]> git.sesse.net Git - ffmpeg/blob - configure
Name the default configure log filename as "config.log" rather than
[ffmpeg] / configure
1 #!/bin/sh
2 #
3 # FFmpeg configure script
4 #
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
8 #
9
10 # Prevent locale nonsense from breaking basic text processing.
11 LC_ALL=C
12 export LC_ALL
13
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
16
17 try_exec(){
18     echo "Trying shell $1"
19     type "$1" > /dev/null 2>&1 && exec "$@"
20 }
21
22 unset foo
23 (: ${foo%%bar}) 2> /dev/null
24 E1="$?"
25
26 (: ${foo?}) 2> /dev/null
27 E2="$?"
28
29 if test "$E1" != 0 || test "$E2" = 0; then
30     echo "Broken shell detected.  Trying alternatives."
31     export FF_CONF_EXEC
32     if test "0$FF_CONF_EXEC" -lt 1; then
33         FF_CONF_EXEC=1
34         try_exec bash "$0" "$@"
35     fi
36     if test "0$FF_CONF_EXEC" -lt 2; then
37         FF_CONF_EXEC=2
38         try_exec ksh "$0" "$@"
39     fi
40     if test "0$FF_CONF_EXEC" -lt 3; then
41         FF_CONF_EXEC=3
42         try_exec /usr/xpg4/bin/sh "$0" "$@"
43     fi
44     echo "No compatible shell script interpreter found."
45     echo "This configure script requires a POSIX-compatible shell"
46     echo "such as bash or ksh."
47     echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
48     echo "Instead, install a working POSIX-compatible shell."
49     echo "Disabling this configure test will create a broken FFmpeg."
50     if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51         echo "This bash version ($BASH_VERSION) is broken on your platform."
52         echo "Upgrade to a later version if available."
53     fi
54     exit 1
55 fi
56
57 show_help(){
58 cat <<EOF
59 Usage: configure [options]
60 Options: [defaults in brackets after descriptions]
61
62 Standard options:
63   --help                   print this message
64   --logfile=FILE           log tests and output to FILE [config.log]
65   --disable-logging        do not log configure debug information
66   --prefix=PREFIX          install in PREFIX [$prefix]
67   --bindir=DIR             install binaries in DIR [PREFIX/bin]
68   --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
69   --libdir=DIR             install libs in DIR [PREFIX/lib]
70   --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]
71   --incdir=DIR             install includes in DIR [PREFIX/include]
72   --mandir=DIR             install man page in DIR [PREFIX/share/man]
73
74 Configuration options:
75   --disable-static         do not build static libraries [no]
76   --enable-shared          build shared libraries [no]
77   --enable-gpl             allow use of GPL code, the resulting libs
78                            and binaries will be under GPL [no]
79   --enable-version3        upgrade (L)GPL to version 3 [no]
80   --enable-nonfree         allow use of nonfree code, the resulting libs
81                            and binaries will be unredistributable [no]
82   --disable-doc            do not build documentation
83   --disable-ffmpeg         disable ffmpeg build
84   --disable-ffplay         disable ffplay build
85   --disable-ffprobe        disable ffprobe build
86   --disable-ffserver       disable ffserver build
87   --disable-avdevice       disable libavdevice build
88   --disable-avcodec        disable libavcodec build
89   --disable-avformat       disable libavformat build
90   --disable-swscale        disable libswscale build
91   --enable-postproc        enable GPLed postprocessing support [no]
92   --disable-avfilter       disable video filter support [no]
93   --enable-avfilter-lavf   video filters dependent on avformat [no]
94   --enable-beosthreads     use BeOS threads [no]
95   --enable-os2threads      use OS/2 threads [no]
96   --enable-pthreads        use pthreads [no]
97   --enable-w32threads      use Win32 threads [no]
98   --enable-x11grab         enable X11 grabbing [no]
99   --disable-network        disable network support [no]
100   --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
101   --enable-gray            enable full grayscale support (slower color)
102   --disable-swscale-alpha  disable alpha channel support in swscale
103   --disable-fastdiv        disable table-based division
104   --enable-small           optimize for size instead of speed
105   --disable-aandct         disable AAN DCT code
106   --disable-dct            disable DCT code
107   --disable-fft            disable FFT code
108   --disable-golomb         disable Golomb code
109   --disable-lpc            disable LPC code
110   --disable-mdct           disable MDCT code
111   --disable-rdft           disable RDFT code
112   --disable-vaapi          disable VAAPI code
113   --disable-vdpau          disable VDPAU code
114   --disable-dxva2          disable DXVA2 code
115   --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
116   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
117   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
118   --disable-everything     disable all components listed below
119   --disable-encoder=NAME   disable encoder NAME
120   --enable-encoder=NAME    enable encoder NAME
121   --disable-encoders       disable all encoders
122   --disable-decoder=NAME   disable decoder NAME
123   --enable-decoder=NAME    enable decoder NAME
124   --disable-decoders       disable all decoders
125   --disable-hwaccel=NAME   disable hwaccel NAME
126   --enable-hwaccel=NAME    enable hwaccel NAME
127   --disable-hwaccels       disable all hwaccels
128   --disable-muxer=NAME     disable muxer NAME
129   --enable-muxer=NAME      enable muxer NAME
130   --disable-muxers         disable all muxers
131   --disable-demuxer=NAME   disable demuxer NAME
132   --enable-demuxer=NAME    enable demuxer NAME
133   --disable-demuxers       disable all demuxers
134   --enable-parser=NAME     enable parser NAME
135   --disable-parser=NAME    disable parser NAME
136   --disable-parsers        disable all parsers
137   --enable-bsf=NAME        enable bitstream filter NAME
138   --disable-bsf=NAME       disable bitstream filter NAME
139   --disable-bsfs           disable all bitstream filters
140   --enable-protocol=NAME   enable protocol NAME
141   --disable-protocol=NAME  disable protocol NAME
142   --disable-protocols      disable all protocols
143   --disable-indev=NAME     disable input device NAME
144   --disable-outdev=NAME    disable output device NAME
145   --disable-indevs         disable input devices
146   --disable-outdevs        disable output devices
147   --disable-devices        disable all devices
148   --enable-filter=NAME     enable filter NAME
149   --disable-filter=NAME    disable filter NAME
150   --disable-filters        disable all filters
151   --list-decoders          show all available decoders
152   --list-encoders          show all available encoders
153   --list-hwaccels          show all available hardware accelerators
154   --list-muxers            show all available muxers
155   --list-demuxers          show all available demuxers
156   --list-parsers           show all available parsers
157   --list-protocols         show all available protocols
158   --list-bsfs              show all available bitstream filters
159   --list-indevs            show all available input devices
160   --list-outdevs           show all available output devices
161   --list-filters           show all available filters
162
163 External library support:
164   --enable-avisynth        enable reading of AVISynth script files [no]
165   --enable-bzlib           enable bzlib [autodetect]
166   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
167   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
168   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
169                            and libraw1394 [no]
170   --enable-libdirac        enable Dirac support via libdirac [no]
171   --enable-libfaac         enable FAAC support via libfaac [no]
172   --enable-libfaad         enable FAAD support via libfaad [no]
173   --enable-libfaadbin      open libfaad.so.0 at runtime [no]
174   --enable-libgsm          enable GSM support via libgsm [no]
175   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
176   --enable-libnut          enable NUT (de)muxing via libnut,
177                            native (de)muxer exists [no]
178   --enable-libopenjpeg     enable JPEG 2000 decoding via OpenJPEG [no]
179   --enable-librtmp         enable RTMP[E] support via librtmp [no]
180   --enable-libschroedinger enable Dirac support via libschroedinger [no]
181   --enable-libspeex        enable Speex decoding via libspeex [no]
182   --enable-libtheora       enable Theora encoding via libtheora [no]
183   --enable-libvorbis       enable Vorbis encoding via libvorbis,
184                            native implementation exists [no]
185   --enable-libvpx          enable VP8 support via libvpx [no]
186   --enable-libx264         enable H.264 encoding via x264 [no]
187   --enable-libxvid         enable Xvid encoding via xvidcore,
188                            native MPEG-4/Xvid encoder exists [no]
189   --enable-mlib            enable Sun medialib [no]
190   --enable-zlib            enable zlib [autodetect]
191
192 Advanced options (experts only):
193   --source-path=PATH       path to source code [$source_path]
194   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
195   --enable-cross-compile   assume a cross-compiler is used
196   --sysroot=PATH           root of cross-build tree
197   --sysinclude=PATH        location of cross-build system headers
198   --target-os=OS           compiler targets OS [$target_os]
199   --target-exec=CMD        command to run executables on target
200   --target-path=DIR        path to view of build directory on target
201   --nm=NM                  use nm tool
202   --ar=AR                  use archive tool AR [$ar_default]
203   --as=AS                  use assembler AS [$as_default]
204   --cc=CC                  use C compiler CC [$cc_default]
205   --ld=LD                  use linker LD
206   --host-cc=HOSTCC         use host C compiler HOSTCC
207   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
208   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
209   --host-libs=HLIBS        use libs HLIBS when linking for host
210   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
211   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
212   --extra-libs=ELIBS       add ELIBS [$ELIBS]
213   --extra-version=STRING   version string suffix []
214   --build-suffix=SUFFIX    library name suffix []
215   --arch=ARCH              select architecture [$arch]
216   --cpu=CPU                select the minimum required CPU (affects
217                            instruction selection, may crash on older CPUs)
218   --enable-powerpc-perf    enable performance report on PPC
219                            (requires enabling PMC)
220   --disable-asm            disable all assembler optimizations
221   --disable-altivec        disable AltiVec optimizations
222   --disable-amd3dnow       disable 3DNow! optimizations
223   --disable-amd3dnowext    disable 3DNow! extended optimizations
224   --disable-mmx            disable MMX optimizations
225   --disable-mmx2           disable MMX2 optimizations
226   --disable-sse            disable SSE optimizations
227   --disable-ssse3          disable SSSE3 optimizations
228   --disable-armv5te        disable armv5te optimizations
229   --disable-armv6          disable armv6 optimizations
230   --disable-armv6t2        disable armv6t2 optimizations
231   --disable-armvfp         disable ARM VFP optimizations
232   --disable-iwmmxt         disable iwmmxt optimizations
233   --disable-mmi            disable MMI optimizations
234   --disable-neon           disable neon optimizations
235   --disable-vis            disable VIS optimizations
236   --disable-yasm           disable use of yasm assembler
237   --enable-pic             build position-independent code
238   --malloc-prefix=PFX      prefix malloc and related names with PFX
239   --enable-sram            allow use of on-chip SRAM
240
241 Developer options (useful when working on FFmpeg itself):
242   --disable-debug          disable debugging symbols
243   --enable-debug=LEVEL     set the debug level [$debuglevel]
244   --enable-gprof           enable profiling with gprof [$gprof]
245   --disable-optimizations  disable compiler optimizations
246   --enable-extra-warnings  enable more compiler warnings
247   --disable-stripping      disable stripping of executables and shared libraries
248   --samples=PATH           location of test samples for FATE
249
250 NOTE: Object files are built at the place where configure is launched.
251 EOF
252   exit 0
253 }
254
255 quotes='""'
256
257 log(){
258     echo "$@" >> $logfile
259 }
260
261 log_file(){
262     log BEGIN $1
263     pr -n -t $1 >> $logfile
264     log END $1
265 }
266
267 echolog(){
268     log "$@"
269     echo "$@"
270 }
271
272 die(){
273     echolog "$@"
274     cat <<EOF
275
276 If you think configure made a mistake, make sure you are using the latest
277 version from SVN.  If the latest version fails, report the problem to the
278 ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
279 EOF
280     if disabled logging; then
281         cat <<EOF
282 Rerun configure with logging enabled (do not use --disable-logging), and
283 include the log this produces with your report.
284 EOF
285     else
286 cat <<EOF
287 Include the log file "$logfile" produced by configure as this will help
288 solving the problem.
289 EOF
290     fi
291     exit 1
292 }
293
294 # Avoid locale weirdness, besides we really just want to translate ASCII.
295 toupper(){
296     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
297 }
298
299 tolower(){
300     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
301 }
302
303 c_escape(){
304     echo "$*" | sed 's/["\\]/\\\0/g'
305 }
306
307 sh_quote(){
308     v=$(echo "$1" | sed "s/'/'\\\\''/g")
309     test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
310     echo "$v"
311 }
312
313 filter(){
314     pat=$1
315     shift
316     for v; do
317         eval "case $v in $pat) echo $v ;; esac"
318     done
319 }
320
321 map(){
322     m=$1
323     shift
324     for v; do eval $m; done
325 }
326
327 set_all(){
328     value=$1
329     shift
330     for var in $*; do
331         eval $var=$value
332     done
333 }
334
335 set_weak(){
336     value=$1
337     shift
338     for var; do
339         eval : \${$var:=$value}
340     done
341 }
342
343 pushvar(){
344     for var in $*; do
345         eval level=\${${var}_level:=0}
346         eval ${var}_${level}="\$$var"
347         eval ${var}_level=$(($level+1))
348     done
349 }
350
351 popvar(){
352     for var in $*; do
353         eval level=\${${var}_level:-0}
354         test $level = 0 && continue
355         eval level=$(($level-1))
356         eval $var="\${${var}_${level}}"
357         eval ${var}_level=$level
358         eval unset ${var}_${level}
359     done
360 }
361
362 enable(){
363     set_all yes $*
364 }
365
366 disable(){
367     set_all no $*
368 }
369
370 enable_weak(){
371     set_weak yes $*
372 }
373
374 disable_weak(){
375     set_weak no $*
376 }
377
378 enable_safe(){
379     for var; do
380         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
381     done
382 }
383
384 disable_safe(){
385     for var; do
386         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
387     done
388 }
389
390 do_enable_deep(){
391     for var; do
392         enabled $var && continue
393         eval sel="\$${var}_select"
394         eval sgs="\$${var}_suggest"
395         pushvar var sgs
396         enable_deep $sel
397         popvar sgs
398         enable_deep_weak $sgs
399         popvar var
400     done
401 }
402
403 enable_deep(){
404     do_enable_deep $*
405     enable $*
406 }
407
408 enable_deep_weak(){
409     do_enable_deep $*
410     enable_weak $*
411 }
412
413 enabled(){
414     test "${1#!}" = "$1" && op== || op=!=
415     eval test "x\$${1#!}" $op "xyes"
416 }
417
418 disabled(){
419     test "${1#!}" = "$1" && op== || op=!=
420     eval test "x\$${1#!}" $op "xno"
421 }
422
423 enabled_all(){
424     for opt; do
425         enabled $opt || return 1
426     done
427 }
428
429 disabled_all(){
430     for opt; do
431         disabled $opt || return 1
432     done
433 }
434
435 enabled_any(){
436     for opt; do
437         enabled $opt && return 0
438     done
439 }
440
441 disabled_any(){
442     for opt; do
443         disabled $opt && return 0
444     done
445     return 1
446 }
447
448 set_default(){
449     for opt; do
450         eval : \${$opt:=\$${opt}_default}
451     done
452 }
453
454 is_in(){
455     value=$1
456     shift
457     for var in $*; do
458         [ $var = $value ] && return 0
459     done
460     return 1
461 }
462
463 check_deps(){
464     for cfg; do
465         cfg="${cfg#!}"
466         enabled ${cfg}_checking && die "Circular dependency for $cfg."
467         disabled ${cfg}_checking && continue
468         enable ${cfg}_checking
469
470         eval dep_all="\$${cfg}_deps"
471         eval dep_any="\$${cfg}_deps_any"
472         eval dep_sel="\$${cfg}_select"
473         eval dep_sgs="\$${cfg}_suggest"
474         eval dep_ifa="\$${cfg}_if"
475         eval dep_ifn="\$${cfg}_if_any"
476
477         pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
478         check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
479         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
480
481         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
482         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
483         enabled_all  $dep_all || disable $cfg
484         enabled_any  $dep_any || disable $cfg
485         disabled_any $dep_sel && disable $cfg
486
487         if enabled $cfg; then
488             eval dep_extralibs="\$${cfg}_extralibs"
489             test -n "$dep_extralibs" && add_extralibs $dep_extralibs
490             enable_deep $dep_sel
491             enable_deep_weak $dep_sgs
492         fi
493
494         disable ${cfg}_checking
495     done
496 }
497
498 print_config(){
499     pfx=$1
500     header=$2
501     makefile=$3
502     shift 3
503     for cfg; do
504         ucname="$(toupper $cfg)"
505         if enabled $cfg; then
506             echo "#define ${pfx}${ucname} 1" >> $header
507             echo "${pfx}${ucname}=yes" >> $makefile
508         else
509             echo "#define ${pfx}${ucname} 0" >> $header
510             echo "!${pfx}${ucname}=yes" >> $makefile
511         fi
512     done
513 }
514
515 flags_saved(){
516     (: ${SAVE_CFLAGS?}) 2> /dev/null
517 }
518
519 save_flags(){
520     flags_saved && return
521     SAVE_CFLAGS="$CFLAGS"
522     SAVE_LDFLAGS="$LDFLAGS"
523     SAVE_extralibs="$extralibs"
524 }
525
526 restore_flags(){
527     flags_saved || return
528     CFLAGS="$SAVE_CFLAGS"
529     LDFLAGS="$SAVE_LDFLAGS"
530     extralibs="$SAVE_extralibs"
531     unset SAVE_CFLAGS
532     unset SAVE_LDFLAGS
533     unset SAVE_extralibs
534 }
535
536 temp_cflags(){
537     save_flags
538     CFLAGS="$CFLAGS $*"
539 }
540
541 temp_ldflags(){
542     save_flags
543     LDFLAGS="$LDFLAGS $*"
544 }
545
546 temp_extralibs(){
547     save_flags
548     extralibs="$extralibs $*"
549 }
550
551 append(){
552     var=$1
553     shift
554     flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
555     eval "$var=\"\$$var $*\""
556 }
557
558 add_cppflags(){
559     append CPPFLAGS $($filter_cppflags "$@")
560 }
561
562 add_cflags(){
563     append CFLAGS $($filter_cflags "$@")
564 }
565
566 add_asflags(){
567     append ASFLAGS $($filter_asflags "$@")
568 }
569
570 add_ldflags(){
571     append LDFLAGS "$@"
572 }
573
574 add_extralibs(){
575     append extralibs "$@"
576 }
577
578 check_cmd(){
579     log "$@"
580     "$@" >> $logfile 2>&1
581 }
582
583 check_cc(){
584     log check_cc "$@"
585     cat > $TMPC
586     log_file $TMPC
587     check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
588 }
589
590 check_cpp(){
591     log check_cpp "$@"
592     cat > $TMPC
593     log_file $TMPC
594     check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
595 }
596
597 check_as(){
598     log check_as "$@"
599     cat > $TMPC
600     log_file $TMPC
601     check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
602 }
603
604 check_asm(){
605     log check_asm "$@"
606     name="$1"
607     code="$2"
608     shift 2
609     disable $name
610     check_as "$@" <<EOF && enable $name
611 void foo(void){ __asm__ volatile($code); }
612 EOF
613 }
614
615 check_yasm(){
616     log check_yasm "$@"
617     echo "$1" > $TMPS
618     log_file $TMPS
619     shift 1
620     check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
621 }
622
623 check_ld(){
624     log check_ld "$@"
625     flags=''
626     libs=''
627     for f; do
628         test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
629     done
630     check_cc $($filter_cflags $flags) || return
631     check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
632 }
633
634 check_cppflags(){
635     log check_cppflags "$@"
636     set -- $($filter_cppflags "$@")
637     check_cc "$@" <<EOF && append CPPFLAGS "$@"
638 int x;
639 EOF
640 }
641
642 check_cflags(){
643     log check_cflags "$@"
644     set -- $($filter_cflags "$@")
645     check_cc "$@" <<EOF && append CFLAGS "$@"
646 int x;
647 EOF
648 }
649
650 test_ldflags(){
651     log test_ldflags "$@"
652     check_ld "$@" <<EOF
653 int main(void){ return 0; }
654 EOF
655 }
656
657 check_ldflags(){
658     log check_ldflags "$@"
659     test_ldflags "$@" && add_ldflags "$@"
660 }
661
662 check_header(){
663     log check_header "$@"
664     header=$1
665     shift
666     disable_safe $header
667     check_cpp "$@" <<EOF && enable_safe $header
668 #include <$header>
669 int x;
670 EOF
671 }
672
673 check_func(){
674     log check_func "$@"
675     func=$1
676     shift
677     disable $func
678     check_ld "$@" <<EOF && enable $func
679 extern int $func();
680 int main(void){ $func(); }
681 EOF
682 }
683
684 check_mathfunc(){
685     log check_mathfunc "$@"
686     func=$1
687     shift
688     disable $func
689     check_ld "$@" <<EOF && enable $func
690 #include <math.h>
691 float foo(float f) { return $func(f); }
692 int main(void){ return 0; }
693 EOF
694 }
695
696 check_func_headers(){
697     log check_func_headers "$@"
698     headers=$1
699     func=$2
700     shift 2
701     disable $func
702     incs=""
703     for hdr in $headers; do
704         incs="$incs
705 #include <$hdr>"
706     done
707     check_ld "$@" <<EOF && enable $func && enable_safe $headers
708 $incs
709 int main(int argc, char **argv){
710     return (long) $func;
711 }
712 EOF
713 }
714
715 check_cpp_condition(){
716     log check_cpp_condition "$@"
717     header=$1
718     condition=$2
719     shift 2
720     check_cpp $($filter_cppflags "$@") <<EOF
721 #include <$header>
722 #if !($condition)
723 #error "unsatisfied condition: $condition"
724 #endif
725 EOF
726 }
727
728 check_lib(){
729     log check_lib "$@"
730     header="$1"
731     func="$2"
732     shift 2
733     temp_extralibs "$@"
734     check_header $header && check_func $func && add_extralibs "$@"
735     err=$?
736     restore_flags
737     return $err
738 }
739
740 check_lib2(){
741     log check_lib2 "$@"
742     headers="$1"
743     func="$2"
744     shift 2
745     check_func_headers "$headers" $func "$@" && add_extralibs "$@"
746 }
747
748 check_exec(){
749     check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
750 }
751
752 check_exec_crash(){
753     code=$(cat)
754
755     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
756     # are safe but may not be available everywhere.  Thus we use
757     # raise(SIGTERM) instead.  The check is run in a subshell so we
758     # can redirect the "Terminated" message from the shell.  SIGBUS
759     # is not defined by standard C so it is used conditionally.
760
761     (check_exec "$@") >> $logfile 2>&1 <<EOF
762 #include <signal.h>
763 static void sighandler(int sig){
764     raise(SIGTERM);
765 }
766 int main(void){
767     signal(SIGILL, sighandler);
768     signal(SIGFPE, sighandler);
769     signal(SIGSEGV, sighandler);
770 #ifdef SIGBUS
771     signal(SIGBUS, sighandler);
772 #endif
773     { $code }
774 }
775 EOF
776 }
777
778 check_type(){
779     log check_type "$@"
780     headers=$1
781     type=$2
782     shift 2
783     disable_safe "$type"
784     incs=""
785     for hdr in $headers; do
786         incs="$incs
787 #include <$hdr>"
788     done
789     check_cc "$@" <<EOF && enable_safe "$type"
790 $incs
791 $type v;
792 EOF
793 }
794
795 check_struct(){
796     log check_type "$@"
797     headers=$1
798     struct=$2
799     member=$3
800     shift 3
801     disable_safe "${struct}_${member}"
802     incs=""
803     for hdr in $headers; do
804         incs="$incs
805 #include <$hdr>"
806     done
807     check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
808 $incs
809 const void *p = &(($struct *)0)->$member;
810 EOF
811 }
812
813 require(){
814     name="$1"
815     header="$2"
816     func="$3"
817     shift 3
818     check_lib $header $func "$@" || die "ERROR: $name not found"
819 }
820
821 require2(){
822     name="$1"
823     headers="$2"
824     func="$3"
825     shift 3
826     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
827 }
828
829 check_foo_config(){
830     cfg=$1
831     pkg=$2
832     header=$3
833     func=$4
834     shift 4
835     disable $cfg
836     check_cmd ${pkg}-config --version
837     err=$?
838     if test "$err" = 0; then
839         temp_cflags $(${pkg}-config --cflags)
840         temp_extralibs $(${pkg}-config --libs)
841         check_lib "$@" $header $func && enable $cfg
842     fi
843     return $err
844 }
845
846 check_host_cc(){
847     log check_host_cc "$@"
848     cat > $TMPC
849     log_file $TMPC
850     check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
851 }
852
853 check_host_cflags(){
854     log check_host_cflags "$@"
855     check_host_cc "$@" <<EOF && append host_cflags "$@"
856 int x;
857 EOF
858 }
859
860 apply(){
861     file=$1
862     shift
863     "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
864 }
865
866 cp_if_changed(){
867     cmp -s "$1" "$2" &&
868         echo "$2 is unchanged" ||
869         cp -f "$1" "$2"
870 }
871
872 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
873 # system-dependent things.
874
875 COMPONENT_LIST="
876     bsfs
877     decoders
878     demuxers
879     encoders
880     filters
881     hwaccels
882     indevs
883     muxers
884     outdevs
885     parsers
886     protocols
887 "
888
889 CONFIG_LIST="
890     $COMPONENT_LIST
891     aandct
892     avcodec
893     avdevice
894     avfilter
895     avfilter_lavf
896     avformat
897     avisynth
898     bzlib
899     dct
900     doc
901     dwt
902     dxva2
903     fastdiv
904     ffmpeg
905     ffplay
906     ffprobe
907     ffserver
908     fft
909     golomb
910     gpl
911     gprof
912     gray
913     h264dsp
914     hardcoded_tables
915     libdc1394
916     libdirac
917     libfaac
918     libfaad
919     libfaadbin
920     libgsm
921     libmp3lame
922     libnut
923     libopencore_amrnb
924     libopencore_amrwb
925     libopenjpeg
926     librtmp
927     libschroedinger
928     libspeex
929     libtheora
930     libvorbis
931     libvpx
932     libx264
933     libxvid
934     lpc
935     lsp
936     mdct
937     memalign_hack
938     mlib
939     mpegaudio_hp
940     network
941     nonfree
942     pic
943     postproc
944     powerpc_perf
945     rdft
946     runtime_cpudetect
947     shared
948     small
949     sram
950     static
951     swscale
952     swscale_alpha
953     vaapi
954     vdpau
955     version3
956     x11grab
957     zlib
958 "
959
960 THREADS_LIST='
961     beosthreads
962     os2threads
963     pthreads
964     w32threads
965 '
966
967 ARCH_LIST='
968     alpha
969     arm
970     avr32
971     avr32_ap
972     avr32_uc
973     bfin
974     ia64
975     m68k
976     mips
977     mips64
978     parisc
979     ppc
980     ppc64
981     s390
982     sh4
983     sparc
984     sparc64
985     tomi
986     x86
987     x86_32
988     x86_64
989 '
990
991 ARCH_EXT_LIST='
992     altivec
993     amd3dnow
994     amd3dnowext
995     armv5te
996     armv6
997     armv6t2
998     armvfp
999     iwmmxt
1000     mmi
1001     mmx
1002     mmx2
1003     neon
1004     ppc4xx
1005     sse
1006     ssse3
1007     vis
1008 '
1009
1010 HAVE_LIST_PUB='
1011     bigendian
1012 '
1013
1014 HAVE_LIST="
1015     $ARCH_EXT_LIST
1016     $HAVE_LIST_PUB
1017     $THREADS_LIST
1018     alsa_asoundlib_h
1019     altivec_h
1020     arpa_inet_h
1021     attribute_may_alias
1022     attribute_packed
1023     bswap
1024     closesocket
1025     cmov
1026     conio_h
1027     dcbzl
1028     dev_bktr_ioctl_bt848_h
1029     dev_bktr_ioctl_meteor_h
1030     dev_ic_bt8xx_h
1031     dev_video_meteor_ioctl_meteor_h
1032     dev_video_bktr_ioctl_bt848_h
1033     dlfcn_h
1034     dlopen
1035     dos_paths
1036     ebp_available
1037     ebx_available
1038     exp2
1039     exp2f
1040     fast_64bit
1041     fast_clz
1042     fast_cmov
1043     fast_unaligned
1044     fork
1045     getaddrinfo
1046     gethrtime
1047     GetProcessMemoryInfo
1048     GetProcessTimes
1049     getrusage
1050     struct_rusage_ru_maxrss
1051     inet_aton
1052     inline_asm
1053     isatty
1054     ldbrx
1055     libdc1394_1
1056     libdc1394_2
1057     llrint
1058     llrintf
1059     local_aligned_16
1060     local_aligned_8
1061     log2
1062     log2f
1063     loongson
1064     lrint
1065     lrintf
1066     lzo1x_999_compress
1067     machine_ioctl_bt848_h
1068     machine_ioctl_meteor_h
1069     malloc_h
1070     memalign
1071     mkstemp
1072     pld
1073     posix_memalign
1074     round
1075     roundf
1076     sdl
1077     sdl_video_size
1078     setmode
1079     socklen_t
1080     soundcard_h
1081     poll_h
1082     setrlimit
1083     strerror_r
1084     struct_addrinfo
1085     struct_ipv6_mreq
1086     struct_sockaddr_in6
1087     struct_sockaddr_sa_len
1088     struct_sockaddr_storage
1089     symver
1090     symver_gnu_asm
1091     symver_asm_label
1092     sys_mman_h
1093     sys_resource_h
1094     sys_select_h
1095     sys_soundcard_h
1096     sys_videoio_h
1097     ten_operands
1098     termios_h
1099     threads
1100     truncf
1101     vfp_args
1102     VirtualAlloc
1103     winsock2_h
1104     xform_asm
1105     yasm
1106 "
1107
1108 # options emitted with CONFIG_ prefix but not available on command line
1109 CONFIG_EXTRA="
1110     avutil
1111     gplv3
1112     lgplv3
1113 "
1114
1115 CMDLINE_SELECT="
1116     $ARCH_EXT_LIST
1117     $CONFIG_LIST
1118     $THREADS_LIST
1119     asm
1120     cross_compile
1121     debug
1122     extra_warnings
1123     logging
1124     optimizations
1125     stripping
1126     yasm
1127 "
1128
1129 PATHS_LIST='
1130     bindir
1131     datadir
1132     incdir
1133     libdir
1134     mandir
1135     prefix
1136     shlibdir
1137 '
1138
1139 CMDLINE_SET="
1140     $PATHS_LIST
1141     ar
1142     arch
1143     as
1144     build_suffix
1145     cc
1146     cpu
1147     cross_prefix
1148     dep_cc
1149     extra_version
1150     host_cc
1151     host_cflags
1152     host_ldflags
1153     host_libs
1154     host_os
1155     ld
1156     logfile
1157     malloc_prefix
1158     nm
1159     samples
1160     source_path
1161     strip
1162     sysinclude
1163     sysroot
1164     target_exec
1165     target_os
1166     target_path
1167 "
1168
1169 CMDLINE_APPEND="
1170     extra_cflags
1171 "
1172
1173 # code dependency declarations
1174
1175 # architecture extensions
1176
1177 armv5te_deps="arm"
1178 armv6_deps="arm"
1179 armv6t2_deps="arm"
1180 armvfp_deps="arm"
1181 iwmmxt_deps="arm"
1182 neon_deps="arm"
1183
1184 mmi_deps="mips"
1185
1186 altivec_deps="ppc"
1187 ppc4xx_deps="ppc"
1188
1189 vis_deps="sparc"
1190
1191 x86_64_suggest="cmov fast_cmov"
1192 amd3dnow_deps="mmx"
1193 amd3dnowext_deps="amd3dnow"
1194 mmx_deps="x86"
1195 mmx2_deps="mmx"
1196 sse_deps="mmx"
1197 ssse3_deps="sse"
1198
1199 fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1200 fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
1201 fast_unaligned_if_any="armv6 ppc x86"
1202
1203 need_memalign="altivec neon sse"
1204 inline_asm_deps="!tms470"
1205
1206 symver_if_any="symver_asm_label symver_gnu_asm"
1207
1208 # subsystems
1209 mdct_select="fft"
1210 rdft_select="fft"
1211
1212 # decoders / encoders / hardware accelerators
1213 aac_decoder_select="mdct rdft aac_parser"
1214 aac_encoder_select="mdct"
1215 ac3_decoder_select="mdct ac3_parser"
1216 alac_encoder_select="lpc"
1217 amrnb_decoder_select="lsp"
1218 atrac1_decoder_select="mdct"
1219 atrac3_decoder_select="mdct"
1220 binkaudio_dct_decoder_select="mdct rdft dct"
1221 binkaudio_rdft_decoder_select="mdct rdft"
1222 cavs_decoder_select="golomb"
1223 cook_decoder_select="mdct"
1224 cscd_decoder_suggest="zlib"
1225 dca_decoder_select="mdct"
1226 dnxhd_encoder_select="aandct"
1227 dxa_decoder_select="zlib"
1228 eac3_decoder_select="ac3_decoder"
1229 eamad_decoder_select="aandct"
1230 eatgq_decoder_select="aandct"
1231 eatqi_decoder_select="aandct"
1232 ffv1_decoder_select="golomb"
1233 flac_decoder_select="golomb"
1234 flac_encoder_select="golomb lpc"
1235 flashsv_decoder_select="zlib"
1236 flashsv_encoder_select="zlib"
1237 flv_decoder_select="h263_decoder"
1238 flv_encoder_select="h263_encoder"
1239 h261_encoder_select="aandct"
1240 h263_decoder_select="h263_parser"
1241 h263_encoder_select="aandct"
1242 h263_vaapi_hwaccel_select="vaapi h263_decoder"
1243 h263i_decoder_select="h263_decoder"
1244 h263p_encoder_select="h263_encoder"
1245 h264_decoder_select="golomb h264dsp"
1246 h264_dxva2_hwaccel_deps="dxva2api_h"
1247 h264_dxva2_hwaccel_select="dxva2 h264_decoder"
1248 h264_vaapi_hwaccel_select="vaapi"
1249 h264_vdpau_decoder_select="vdpau h264_decoder"
1250 imc_decoder_select="fft mdct"
1251 jpegls_decoder_select="golomb"
1252 jpegls_encoder_select="golomb"
1253 ljpeg_encoder_select="aandct"
1254 loco_decoder_select="golomb"
1255 mjpeg_encoder_select="aandct"
1256 mlp_decoder_select="mlp_parser"
1257 mpeg1video_encoder_select="aandct"
1258 mpeg2video_encoder_select="aandct"
1259 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1260 mpeg4_encoder_select="h263_encoder"
1261 mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1262 mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1263 mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1264 mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1265 mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1266 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1267 mpeg_xvmc_decoder_select="mpegvideo_decoder"
1268 msmpeg4v1_decoder_select="h263_decoder"
1269 msmpeg4v1_encoder_select="h263_encoder"
1270 msmpeg4v2_decoder_select="h263_decoder"
1271 msmpeg4v2_encoder_select="h263_encoder"
1272 msmpeg4v3_decoder_select="h263_decoder"
1273 msmpeg4v3_encoder_select="h263_encoder"
1274 nellymoser_decoder_select="mdct"
1275 nellymoser_encoder_select="mdct"
1276 png_decoder_select="zlib"
1277 png_encoder_select="zlib"
1278 qcelp_decoder_select="lsp"
1279 qdm2_decoder_select="mdct rdft"
1280 real_144_encoder_select="lpc"
1281 rv10_decoder_select="h263_decoder"
1282 rv10_encoder_select="h263_encoder"
1283 rv20_decoder_select="h263_decoder"
1284 rv20_encoder_select="h263_encoder"
1285 rv30_decoder_select="golomb h264dsp"
1286 rv40_decoder_select="golomb h264dsp"
1287 shorten_decoder_select="golomb"
1288 sipr_decoder_select="lsp"
1289 snow_decoder_select="dwt"
1290 snow_encoder_select="aandct dwt"
1291 sonic_decoder_select="golomb"
1292 sonic_encoder_select="golomb"
1293 sonic_ls_encoder_select="golomb"
1294 svq1_encoder_select="aandct"
1295 svq3_decoder_select="golomb h264dsp"
1296 svq3_decoder_suggest="zlib"
1297 theora_decoder_select="vp3_decoder"
1298 tiff_decoder_suggest="zlib"
1299 tiff_encoder_suggest="zlib"
1300 truehd_decoder_select="mlp_decoder"
1301 tscc_decoder_select="zlib"
1302 twinvq_decoder_select="mdct lsp"
1303 vc1_decoder_select="h263_decoder"
1304 vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
1305 vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
1306 vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1307 vc1_vdpau_decoder_select="vdpau vc1_decoder"
1308 vorbis_decoder_select="mdct"
1309 vorbis_encoder_select="mdct"
1310 vp6a_decoder_select="vp6_decoder"
1311 vp6f_decoder_select="vp6_decoder"
1312 wmapro_decoder_select="mdct"
1313 wmav1_decoder_select="mdct"
1314 wmav1_encoder_select="mdct"
1315 wmav2_decoder_select="mdct"
1316 wmav2_encoder_select="mdct"
1317 wmavoice_decoder_select="lsp rdft dct"
1318 wmv1_decoder_select="h263_decoder"
1319 wmv1_encoder_select="h263_encoder"
1320 wmv2_decoder_select="h263_decoder"
1321 wmv2_encoder_select="h263_encoder"
1322 wmv3_decoder_select="vc1_decoder"
1323 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
1324 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1325 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1326 zlib_decoder_select="zlib"
1327 zlib_encoder_select="zlib"
1328 zmbv_decoder_select="zlib"
1329 zmbv_encoder_select="zlib"
1330
1331 vaapi_deps="va_va_h"
1332 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1333
1334 # parsers
1335 h264_parser_select="golomb h264dsp"
1336
1337 # bitstream_filters
1338 aac_adtstoasc_bsf_select="aac_parser"
1339
1340 # external libraries
1341 libdirac_decoder_deps="libdirac !libschroedinger"
1342 libdirac_encoder_deps="libdirac"
1343 libfaac_encoder_deps="libfaac"
1344 libfaad_decoder_deps="libfaad"
1345 libfaadbin_extralibs='$ldl'
1346 libgsm_decoder_deps="libgsm"
1347 libgsm_encoder_deps="libgsm"
1348 libgsm_ms_decoder_deps="libgsm"
1349 libgsm_ms_encoder_deps="libgsm"
1350 libmp3lame_encoder_deps="libmp3lame"
1351 libopencore_amrnb_decoder_deps="libopencore_amrnb"
1352 libopencore_amrnb_encoder_deps="libopencore_amrnb"
1353 libopencore_amrwb_decoder_deps="libopencore_amrwb"
1354 libopenjpeg_decoder_deps="libopenjpeg"
1355 libschroedinger_decoder_deps="libschroedinger"
1356 libschroedinger_encoder_deps="libschroedinger"
1357 libspeex_decoder_deps="libspeex"
1358 libtheora_encoder_deps="libtheora"
1359 libvorbis_encoder_deps="libvorbis"
1360 libvpx_decoder_deps="libvpx"
1361 libvpx_encoder_deps="libvpx"
1362 libx264_encoder_deps="libx264"
1363 libxvid_encoder_deps="libxvid"
1364
1365 # demuxers / muxers
1366 ac3_demuxer_deps="ac3_parser"
1367 asf_stream_muxer_select="asf_muxer"
1368 avisynth_demuxer_deps="avisynth"
1369 dirac_demuxer_deps="dirac_parser"
1370 eac3_demuxer_select="ac3_parser"
1371 ipod_muxer_select="mov_muxer"
1372 libnut_demuxer_deps="libnut"
1373 libnut_muxer_deps="libnut"
1374 matroska_audio_muxer_select="matroska_muxer"
1375 matroska_demuxer_suggest="zlib bzlib"
1376 mov_demuxer_suggest="zlib"
1377 mp3_demuxer_deps="mpegaudio_parser"
1378 mp4_muxer_select="mov_muxer"
1379 mpegtsraw_demuxer_select="mpegts_demuxer"
1380 mxf_d10_muxer_select="mxf_muxer"
1381 ogg_demuxer_select="golomb"
1382 psp_muxer_select="mov_muxer"
1383 rtsp_demuxer_deps="sdp_demuxer"
1384 rtsp_muxer_deps="sdp_demuxer"
1385 rtsp_muxer_select="rtp_muxer"
1386 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
1387 sdp_demuxer_select="asf_demuxer rm_demuxer"
1388 spdif_muxer_select="aac_parser"
1389 tg2_muxer_select="mov_muxer"
1390 tgp_muxer_select="mov_muxer"
1391 w64_demuxer_deps="wav_demuxer"
1392
1393 # indevs / outdevs
1394 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
1395 alsa_indev_extralibs="-lasound"
1396 alsa_outdev_deps="alsa_asoundlib_h"
1397 alsa_outdev_extralibs="-lasound"
1398 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1399 dv1394_indev_deps="dv1394 dv_demuxer"
1400 jack_indev_deps="jack_jack_h"
1401 jack_indev_extralibs="-ljack"
1402 libdc1394_indev_deps="libdc1394"
1403 oss_indev_deps_any="soundcard_h sys_soundcard_h"
1404 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
1405 v4l_indev_deps="linux_videodev_h"
1406 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
1407 vfwcap_indev_deps="capCreateCaptureWindow"
1408 vfwcap_indev_extralibs="-lavicap32"
1409 x11_grab_device_indev_deps="x11grab XShmCreateImage"
1410 x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
1411
1412 # protocols
1413 gopher_protocol_deps="network"
1414 http_protocol_deps="network"
1415 http_protocol_select="tcp_protocol"
1416 mmst_protocol_deps="network"
1417 rtmp_protocol_select="tcp_protocol"
1418 rtp_protocol_select="udp_protocol"
1419 tcp_protocol_deps="network"
1420 udp_protocol_deps="network"
1421
1422 # filters
1423 movie_filter_deps="avfilter_lavf"
1424 avfilter_lavf_deps="avformat"
1425
1426 # libraries
1427 avdevice_deps="avcodec avformat"
1428 avformat_deps="avcodec"
1429
1430 # programs
1431 ffmpeg_deps="avcodec avformat swscale"
1432 ffmpeg_select="buffer_filter"
1433 ffplay_deps="avcodec avformat swscale sdl"
1434 ffplay_select="rdft"
1435 ffprobe_deps="avcodec avformat"
1436 ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
1437 ffserver_extralibs='$ldl'
1438
1439 doc_deps="texi2html"
1440
1441 # default parameters
1442
1443 logfile="config.log"
1444
1445 # installation paths
1446 prefix_default="/usr/local"
1447 bindir_default='${prefix}/bin'
1448 datadir_default='${prefix}/share/ffmpeg'
1449 incdir_default='${prefix}/include'
1450 libdir_default='${prefix}/lib'
1451 mandir_default='${prefix}/share/man'
1452 shlibdir_default="$libdir_default"
1453
1454 # toolchain
1455 ar_default="ar"
1456 cc_default="gcc"
1457 cc_version=\"unknown\"
1458 host_cc_default="gcc"
1459 ln_s="ln -sf"
1460 nm_default="nm"
1461 objformat="elf"
1462 ranlib="ranlib"
1463 strip_default="strip"
1464 yasmexe="yasm"
1465
1466 nm_opts='-g'
1467
1468 # machine
1469 arch_default=$(uname -m)
1470 cpu="generic"
1471
1472 # OS
1473 target_os_default=$(tolower $(uname -s))
1474 host_os=$target_os_default
1475
1476 # configurable options
1477 enable avcodec
1478 enable avdevice
1479 enable avfilter
1480 enable avformat
1481 enable avutil
1482 enable asm
1483 enable debug
1484 enable doc
1485 enable fastdiv
1486 enable ffmpeg
1487 enable ffplay
1488 enable ffprobe
1489 enable ffserver
1490 enable mpegaudio_hp
1491 enable network
1492 enable optimizations
1493 enable protocols
1494 enable static
1495 enable stripping
1496 enable swscale
1497 enable swscale_alpha
1498
1499 # build settings
1500 SHFLAGS='-shared -Wl,-soname,$$(@F)'
1501 FFSERVERLDFLAGS=-Wl,-E
1502 LIBPREF="lib"
1503 LIBSUF=".a"
1504 FULLNAME='$(NAME)$(BUILDSUF)'
1505 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1506 SLIBPREF="lib"
1507 SLIBSUF=".so"
1508 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1509 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1510 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1511 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1512
1513 CC_O='-o $@'
1514
1515 host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
1516 host_libs='-lm'
1517
1518 target_path='$(CURDIR)'
1519
1520 # gcc stupidly only outputs the basename of targets with -MM, but we need the
1521 # full relative path for objects in subdirectories for non-recursive Make.
1522 DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
1523 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
1524
1525 # find source path
1526 source_path="$(dirname "$0")"
1527 enable source_path_used
1528 if test -f configure; then
1529     source_path="$(pwd)"
1530     disable source_path_used
1531 else
1532     source_path="$(cd "$source_path"; pwd)"
1533     echo "$source_path" | grep -q '[[:blank:]]' &&
1534         die "Out of tree builds are impossible with whitespace in source path."
1535     test -e "$source_path/config.h" &&
1536         die "Out of tree builds are impossible with config.h in source dir."
1537 fi
1538
1539 for v in "$@"; do
1540     r=${v#*=}
1541     l=${v%"$r"}
1542     r=$(sh_quote "$r")
1543     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
1544 done
1545
1546 find_things(){
1547     thing=$1
1548     pattern=$2
1549     file=$source_path/$3
1550     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1551 }
1552
1553 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
1554 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
1555 HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
1556 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
1557 BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
1558 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
1559 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
1560 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
1561 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
1562 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1563 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
1564
1565 for n in $COMPONENT_LIST; do
1566     v=$(toupper ${n%s})_LIST
1567     eval enable \$$v
1568     eval ${n}_if_any="\$$v"
1569 done
1570
1571 enable $ARCH_EXT_LIST
1572
1573 die_unknown(){
1574     echo "Unknown option \"$1\"."
1575     echo "See $0 --help for available options."
1576     exit 1
1577 }
1578
1579 show_list() {
1580     suffix=_$1
1581     shift
1582     echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
1583     exit 0
1584 }
1585
1586 for opt do
1587     optval="${opt#*=}"
1588     case "$opt" in
1589     --extra-ldflags=*) add_ldflags $optval
1590     ;;
1591     --extra-libs=*) add_extralibs $optval
1592     ;;
1593     --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1594     ;;
1595     --enable-debug=*) debuglevel="$optval"
1596     ;;
1597     --disable-everything)
1598     map 'eval disable \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
1599     ;;
1600     --enable-*=*|--disable-*=*)
1601     eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1602     is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1603     eval list=\$$(toupper $thing)_LIST
1604     name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1605     $action $(filter "$name" $list)
1606     ;;
1607     --enable-?*|--disable-?*)
1608     eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1609     if is_in $option $COMPONENT_LIST; then
1610         test $action = disable && action=unset
1611         eval $action \$$(toupper ${option%s})_LIST
1612     elif is_in $option $CMDLINE_SELECT; then
1613         $action $option
1614     else
1615         die_unknown $opt
1616     fi
1617     ;;
1618     --list-*)
1619         NAME="${opt#--list-}"
1620         is_in $NAME $COMPONENT_LIST || die_unknown $opt
1621         NAME=${NAME%s}
1622         eval show_list $NAME \$$(toupper $NAME)_LIST
1623     ;;
1624     --help|-h) show_help
1625     ;;
1626     *)
1627     optname="${opt%%=*}"
1628     optname="${optname#--}"
1629     optname=$(echo "$optname" | sed 's/-/_/g')
1630     if is_in $optname $CMDLINE_SET; then
1631         eval $optname='$optval'
1632     elif is_in $optname $CMDLINE_APPEND; then
1633         append $optname "$optval"
1634     else
1635          die_unknown $opt
1636     fi
1637     ;;
1638     esac
1639 done
1640
1641 disabled logging && logfile=/dev/null
1642
1643 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
1644 set >> $logfile
1645
1646 test -n "$cross_prefix" && enable cross_compile
1647
1648 if enabled cross_compile; then
1649     test -n "$arch" && test -n "$target_os" ||
1650         die "Must specify target arch and OS when cross-compiling"
1651 fi
1652
1653 set_default arch target_os
1654
1655 ar_default="${cross_prefix}${ar_default}"
1656 cc_default="${cross_prefix}${cc_default}"
1657 nm_default="${cross_prefix}${nm_default}"
1658 ranlib="${cross_prefix}${ranlib}"
1659 strip_default="${cross_prefix}${strip_default}"
1660
1661 sysinclude_default="${sysroot}/usr/include"
1662
1663 set_default cc nm strip sysinclude
1664 enabled cross_compile || host_cc_default=$cc
1665 set_default host_cc
1666
1667 exesuf() {
1668     case $1 in
1669         mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
1670     esac
1671 }
1672
1673 EXESUF=$(exesuf $target_os)
1674 HOSTEXESUF=$(exesuf $host_os)
1675
1676 # set temporary file name
1677 : ${TMPDIR:=$TEMPDIR}
1678 : ${TMPDIR:=$TMP}
1679 : ${TMPDIR:=/tmp}
1680
1681 if ! check_cmd type mktemp; then
1682     # simple replacement for missing mktemp
1683     # NOT SAFE FOR GENERAL USE
1684     mktemp(){
1685         echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
1686     }
1687 fi
1688
1689 tmpfile(){
1690     tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1691         (set -C; exec > $tmp) 2>/dev/null ||
1692         die "Unable to create temporary file in $TMPDIR."
1693     append TMPFILES $tmp
1694     eval $1=$tmp
1695 }
1696
1697 trap 'rm -f -- $TMPFILES' EXIT
1698 trap exit HUP INT TERM
1699
1700 tmpfile TMPC  .c
1701 tmpfile TMPE  $EXESUF
1702 tmpfile TMPH  .h
1703 tmpfile TMPO  .o
1704 tmpfile TMPS  .S
1705 tmpfile TMPV  .ver
1706 tmpfile TMPSH .sh
1707
1708 unset -f mktemp
1709
1710 # make sure we can execute files in $TMPDIR
1711 cat > $TMPSH 2>> $logfile <<EOF
1712 #! /bin/sh
1713 EOF
1714 chmod +x $TMPSH >> $logfile 2>&1
1715 if ! $TMPSH >> $logfile 2>&1; then
1716     cat <<EOF
1717 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
1718 variable to another directory and make sure that it is not mounted noexec.
1719 EOF
1720     die "Sanity test failed."
1721 fi
1722
1723 filter_cflags=echo
1724 filter_cppflags=echo
1725 filter_asflags=echo
1726
1727 if   $cc -v 2>&1 | grep -qi ^gcc; then
1728     cc_type=gcc
1729     cc_version=__VERSION__
1730     if ! $cc -dumpversion | grep -q '^2\.'; then
1731         CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1732         AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1733     fi
1734     speed_cflags='-O3'
1735     size_cflags='-Os'
1736 elif $cc --version 2>/dev/null | grep -q Intel; then
1737     cc_type=icc
1738     cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
1739     CC_DEPFLAGS='-MMD'
1740     AS_DEPFLAGS='-MMD'
1741     speed_cflags='-O3'
1742     size_cflags='-Os'
1743     noopt_cflags='-O1'
1744 elif $cc -v 2>&1 | grep -q xlc; then
1745     cc_type=xlc
1746     cc_version="AV_STRINGIFY(__IBMC__)"
1747     speed_cflags='-O5'
1748     size_cflags='-O5 -qcompact'
1749 elif $cc -V 2>/dev/null | grep -q Compaq; then
1750     cc_type=ccc
1751     cc_version="AV_STRINGIFY(__DECC_VER)"
1752     DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
1753     debuglevel=3
1754     add_ldflags -Wl,-z,now # calls to libots crash without this
1755     speed_cflags='-fast'
1756     size_cflags='-O1'
1757 elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
1758     test -d "$sysroot" || die "No valid sysroot specified."
1759     cc_type=armcc
1760     cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
1761     armcc_conf="$PWD/armcc.conf"
1762     $cc --arm_linux_configure                 \
1763         --arm_linux_config_file="$armcc_conf" \
1764         --configure_sysroot="$sysroot"        \
1765         --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
1766         die "Error creating armcc configuration file."
1767     cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
1768     as_default="${cross_prefix}gcc"
1769     CC_DEPFLAGS='-MMD'
1770     AS_DEPFLAGS='-MMD'
1771     speed_cflags='-O3'
1772     size_cflags='-Os'
1773 elif $cc -version 2>/dev/null | grep -q TMS470; then
1774     cc_type=tms470
1775     cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
1776     cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
1777     CC_O='-fr=$(@D)'
1778     as_default="${cross_prefix}gcc"
1779     ld_default="${cross_prefix}gcc"
1780     TMPO=$(basename $TMPC .c).o
1781     append TMPFILES $TMPO
1782     add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
1783     CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
1784     AS_DEPFLAGS='-MMD'
1785     speed_cflags='-O3 -mf=5'
1786     size_cflags='-O3 -mf=2'
1787     filter_cflags=tms470_flags
1788     tms470_flags(){
1789         for flag; do
1790             case $flag in
1791                 -march=*|-mcpu=*)
1792                     case "${flag#*=}" in
1793                         armv7-a|cortex-a*)      echo -mv=7a8 ;;
1794                         armv7-r|cortex-r*)      echo -mv=7r4 ;;
1795                         armv7-m|cortex-m*)      echo -mv=7m3 ;;
1796                         armv6*|arm11*)          echo -mv=6   ;;
1797                         armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
1798                                                 echo -mv=5e  ;;
1799                         armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
1800                     esac
1801                     ;;
1802                 -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
1803                 -mfpu=vfp)      echo --float_support=vfpv2        ;;
1804                 -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
1805                 -msoft-float)   echo --float_support=vfplib       ;;
1806                 -O[0-3]|-mf=*)  echo $flag                        ;;
1807                 -g)             echo -g -mn                       ;;
1808                 -pds=*)         echo $flag                        ;;
1809             esac
1810         done
1811     }
1812 elif $cc -v 2>&1 | grep -q clang; then
1813     cc_type=clang
1814     cc_version=__VERSION__
1815     CC_DEPFLAGS='-MMD'
1816     AS_DEPFLAGS='-MMD'
1817     speed_cflags='-O3'
1818     size_cflags='-Os'
1819 elif $cc -V 2>&1 | grep -q Sun; then
1820     cc_type=suncc
1821     cc_version="AV_STRINGIFY(__SUNPRO_C)"
1822     DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
1823     DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
1824     speed_cflags='-O5'
1825     size_cflags='-O5 -xspace'
1826     filter_cflags=suncc_flags
1827     suncc_flags(){
1828         for flag; do
1829             case $flag in
1830                 -march=*|-mcpu=*)
1831                     case "${flag#*=}" in
1832                         native)                   echo -xtarget=native       ;;
1833                         v9|niagara)               echo -xarch=sparc          ;;
1834                         ultrasparc)               echo -xarch=sparcvis       ;;
1835                         ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
1836                         i586|pentium)             echo -xchip=pentium        ;;
1837                         i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
1838                         pentium3*|c3-2)           echo -xtarget=pentium3     ;;
1839                         pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
1840                         pentium4*)          echo -xtarget=pentium4           ;;
1841                         prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
1842                         *-sse3)             echo -xarch=sse3                 ;;
1843                         core2)              echo -xarch=ssse3 -xchip=core2   ;;
1844                         amdfam10|barcelona)       echo -xarch=sse4_1         ;;
1845                         athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
1846                         k8|opteron|athlon64|athlon-fx)
1847                                                   echo -xarch=sse2a          ;;
1848                         athlon*)                  echo -xarch=pentium_proa   ;;
1849                     esac
1850                     ;;
1851                 -std=c99)             echo -xc99              ;;
1852                 -fomit-frame-pointer) echo -xregs=frameptr    ;;
1853                 -fPIC)                echo -KPIC -xcode=pic32 ;;
1854                 -W*,*)                echo $flag              ;;
1855                 -f*-*|-W*)                                    ;;
1856                 *)                    echo $flag              ;;
1857             esac
1858         done
1859     }
1860 fi
1861
1862 test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
1863
1864 : ${as_default:=$cc}
1865 : ${dep_cc_default:=$cc}
1866 : ${ld_default:=$cc}
1867 set_default ar as dep_cc ld
1868
1869 test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
1870 test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
1871
1872 add_cflags $extra_cflags
1873 add_asflags $extra_cflags
1874
1875 if test -n "$sysroot"; then
1876     case "$cc_type" in
1877         gcc)
1878             add_cppflags --sysroot="$sysroot"
1879             add_ldflags --sysroot="$sysroot"
1880         ;;
1881         tms470)
1882             add_cppflags -I"$sysinclude"
1883             add_ldflags  --sysroot="$sysroot"
1884         ;;
1885         clang)
1886             add_cppflags -isysroot "$sysroot"
1887             add_ldflags -isysroot "$sysroot"
1888         ;;
1889     esac
1890 fi
1891
1892 if test "$cpu" = host; then
1893     enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
1894
1895     case "$cc_type" in
1896         gcc)
1897             check_native(){
1898                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
1899                 sed -n "/$1=/{
1900                             s/.*$1=\\([^ ]*\\).*/\\1/
1901                             p
1902                             q
1903                         }" $TMPE
1904             }
1905             cpu=$(check_native -march || check_native -mcpu)
1906         ;;
1907     esac
1908
1909     test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
1910 fi
1911
1912 # Deal with common $arch aliases
1913 case "$arch" in
1914     arm*)
1915         arch="arm"
1916     ;;
1917     mips|mipsel|IP*)
1918         arch="mips"
1919     ;;
1920     mips64*)
1921         arch="mips"
1922         subarch="mips64"
1923     ;;
1924     parisc|hppa)
1925         arch="parisc"
1926     ;;
1927     parisc64|hppa64)
1928         arch="parisc"
1929         subarch="parisc64"
1930     ;;
1931     "Power Macintosh"|ppc|powerpc)
1932         arch="ppc"
1933     ;;
1934     ppc64|powerpc64)
1935         arch="ppc"
1936         subarch="ppc64"
1937     ;;
1938     s390|s390x)
1939         arch="s390"
1940     ;;
1941     sh4|sh)
1942         arch="sh4"
1943     ;;
1944     sun4u|sparc64)
1945         arch="sparc"
1946         subarch="sparc64"
1947     ;;
1948     i[3-6]86|i86pc|BePC|x86_64|amd64)
1949         arch="x86"
1950     ;;
1951 esac
1952
1953 is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
1954 enable $arch
1955
1956 # Add processor-specific flags
1957 if test "$cpu" = generic; then
1958     : do nothing
1959 elif enabled ppc; then
1960
1961     case $(tolower $cpu) in
1962         601|ppc601|powerpc601)
1963             cpuflags="-mcpu=601"
1964             disable altivec
1965         ;;
1966         603*|ppc603*|powerpc603*)
1967             cpuflags="-mcpu=603"
1968             disable altivec
1969         ;;
1970         604*|ppc604*|powerpc604*)
1971             cpuflags="-mcpu=604"
1972             disable altivec
1973         ;;
1974         g3|75*|ppc75*|powerpc75*)
1975             cpuflags="-mcpu=750 -mpowerpc-gfxopt"
1976             disable altivec
1977         ;;
1978         g4|745*|ppc745*|powerpc745*)
1979             cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
1980         ;;
1981         74*|ppc74*|powerpc74*)
1982             cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
1983         ;;
1984         g5|970|ppc970|powerpc970|power4*)
1985             cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1986         ;;
1987         cell)
1988             cpuflags="-mcpu=cell"
1989             enable ldbrx
1990         ;;
1991         e500v2)
1992             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
1993             disable altivec
1994         ;;
1995         e500)
1996             cpuflags="-mcpu=8540 -mhard-float"
1997             disable altivec
1998         ;;
1999     esac
2000
2001 elif enabled x86; then
2002
2003     case $cpu in
2004         i[345]86|pentium)
2005             cpuflags="-march=$cpu"
2006             disable mmx
2007         ;;
2008         # targets that do NOT support conditional mov (cmov)
2009         pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
2010             cpuflags="-march=$cpu"
2011             disable cmov
2012         ;;
2013         # targets that do support conditional mov (cmov)
2014         i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
2015             cpuflags="-march=$cpu"
2016             enable cmov
2017             enable fast_cmov
2018         ;;
2019         # targets that do support conditional mov but on which it's slow
2020         pentium4|pentium4m|prescott|nocona)
2021             cpuflags="-march=$cpu"
2022             enable cmov
2023             disable fast_cmov
2024         ;;
2025     esac
2026
2027 elif enabled sparc; then
2028
2029     case $cpu in
2030         niagara)
2031             cpuflags="-mcpu=$cpu"
2032             disable vis
2033         ;;
2034         sparc64)
2035             cpuflags="-mcpu=v9"
2036         ;;
2037     esac
2038
2039 elif enabled arm; then
2040
2041     case $cpu in
2042         armv*)
2043             cpuflags="-march=$cpu"
2044         ;;
2045         *)
2046             cpuflags="-mcpu=$cpu"
2047         ;;
2048     esac
2049
2050 elif enabled alpha; then
2051
2052     enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
2053
2054 elif enabled bfin; then
2055
2056     cpuflags="-mcpu=$cpu"
2057
2058 elif enabled mips; then
2059
2060     cpuflags="-march=$cpu"
2061
2062 elif enabled avr32; then
2063
2064     case $cpu in
2065         ap7[02]0[0-2])
2066             subarch="avr32_ap"
2067             cpuflags="-mpart=$cpu"
2068         ;;
2069         ap)
2070             subarch="avr32_ap"
2071             cpuflags="-march=$cpu"
2072         ;;
2073         uc3[ab]*)
2074             subarch="avr32_uc"
2075             cpuflags="-mcpu=$cpu"
2076         ;;
2077         uc)
2078             subarch="avr32_uc"
2079             cpuflags="-march=$cpu"
2080         ;;
2081     esac
2082
2083 fi
2084
2085 add_cflags $cpuflags
2086 add_asflags $cpuflags
2087
2088 # compiler sanity check
2089 check_exec <<EOF
2090 int main(void){ return 0; }
2091 EOF
2092 if test "$?" != 0; then
2093     echo "$cc is unable to create an executable file."
2094     if test -z "$cross_prefix" && ! enabled cross_compile ; then
2095         echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
2096         echo "Only do this if you know what cross compiling means."
2097     fi
2098     die "C compiler test failed."
2099 fi
2100
2101 add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
2102 check_cflags -std=c99
2103 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
2104 #include <stdlib.h>
2105 EOF
2106 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
2107 #include <stdlib.h>
2108 EOF
2109
2110 check_host_cflags -std=c99
2111
2112 case "$arch" in
2113     alpha|ia64|mips|parisc|sparc)
2114         spic=$shared
2115     ;;
2116     x86)
2117         subarch="x86_32"
2118         check_cc <<EOF && subarch="x86_64"
2119         int test[(int)sizeof(char*) - 7];
2120 EOF
2121         if test "$subarch" = "x86_64"; then
2122             spic=$shared
2123         fi
2124     ;;
2125 esac
2126
2127 enable $subarch
2128 enabled spic && enable pic
2129
2130 # OS specific
2131 case $target_os in
2132     haiku)
2133         prefix_default="/boot/common"
2134         network_extralibs="-lnetwork"
2135         ;;
2136     sunos)
2137         FFSERVERLDFLAGS=""
2138         SHFLAGS='-shared -Wl,-h,$$(@F)'
2139         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
2140         network_extralibs="-lsocket -lnsl"
2141         add_cppflags -D__EXTENSIONS__
2142         nm_opts='-P -g'
2143         ;;
2144     netbsd)
2145         oss_indev_extralibs="-lossaudio"
2146         oss_outdev_extralibs="-lossaudio"
2147         add_cppflags -D_XOPEN_SOURCE=600
2148         ;;
2149     openbsd)
2150         enable malloc_aligned
2151         # On OpenBSD 4.5. the compiler does not use PIC unless
2152         # explicitly using -fPIC. FFmpeg builds fine without PIC,
2153         # however the generated executable will not do anything
2154         # (simply quits with exit-code 1, no crash, no output).
2155         # Thus explicitly enable PIC here.
2156         enable pic
2157         SHFLAGS='-shared'
2158         oss_indev_extralibs="-lossaudio"
2159         oss_outdev_extralibs="-lossaudio"
2160         ;;
2161     freebsd|dragonfly)
2162         enable malloc_aligned
2163         ;;
2164     bsd/os)
2165         osextralibs="-lpoll -lgnugetopt"
2166         strip="strip -d"
2167         ;;
2168     darwin)
2169         enable malloc_aligned
2170         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
2171         strip="strip -x"
2172         FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
2173         SLIBSUF=".dylib"
2174         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2175         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
2176         FFSERVERLDFLAGS=-Wl,-bind_at_load
2177         objformat="macho"
2178         enabled x86_64 && objformat="macho64"
2179         enabled_any pic shared ||
2180             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
2181         ;;
2182     mingw32*)
2183         if test $target_os = "mingw32ce"; then
2184             disable network
2185         else
2186             target_os=mingw32
2187         fi
2188         LIBTARGET=i386
2189         if enabled x86_64; then
2190             enable malloc_aligned
2191             LIBTARGET=x64
2192         elif enabled arm; then
2193             LIBTARGET=arm
2194         fi
2195         shlibdir_default="$bindir_default"
2196         disable ffserver
2197         SLIBPREF=""
2198         SLIBSUF=".dll"
2199         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2200         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2201         SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
2202         SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
2203             install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
2204             install -d "$(LIBDIR)"; \
2205             install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
2206         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
2207         SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
2208         objformat="win32"
2209         enable dos_paths
2210         check_cflags -fno-common
2211         if ! enabled x86_64; then
2212             check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
2213                 die "ERROR: MinGW runtime version must be >= 3.15."
2214             enabled_any avisynth vfwcap_indev &&
2215                 { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
2216                   die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
2217         fi
2218         ;;
2219     cygwin*)
2220         target_os=cygwin
2221         shlibdir_default="$bindir_default"
2222         SLIBPREF="cyg"
2223         SLIBSUF=".dll"
2224         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2225         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2226         SHFLAGS='-shared -Wl,--enable-auto-image-base'
2227         objformat="win32"
2228         enable dos_paths
2229         check_cflags -fno-common
2230         ;;
2231     *-dos|freedos|opendos)
2232         disable ffplay ffserver
2233         disable $INDEV_LIST $OUTDEV_LIST
2234         network_extralibs="-lsocket"
2235         objformat="coff"
2236         enable dos_paths
2237         ;;
2238     linux)
2239         enable dv1394
2240         ;;
2241     irix*)
2242         target_os=irix
2243         ranlib="echo ignoring ranlib"
2244         ;;
2245     os/2*)
2246         strip="lxlite"
2247         ln_s="cp -f"
2248         FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
2249         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
2250         FFSERVERLDFLAGS=""
2251         LIBSUF="_s.a"
2252         SLIBPREF=""
2253         SLIBSUF=".dll"
2254         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2255         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
2256         SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2257           echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2258           echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2259           echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2260           echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2261           emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2262         SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2263           emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2264         SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
2265         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
2266         enable dos_paths
2267         ;;
2268     gnu/kfreebsd)
2269         ;;
2270     gnu)
2271         ;;
2272     none)
2273         ;;
2274     *)
2275         die "Unknown OS '$target_os'."
2276         ;;
2277 esac
2278
2279 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
2280
2281 set_default $PATHS_LIST
2282
2283 add_extralibs $osextralibs
2284
2285 # Combine FFLDFLAGS and the LDFLAGS environment variable.
2286 LDFLAGS="$FFLDFLAGS $LDFLAGS"
2287
2288 # we need to build at least one lib type
2289 if ! enabled_any static shared; then
2290     cat <<EOF
2291 At least one library type must be built.
2292 Specify --enable-static to build the static libraries or --enable-shared to
2293 build the shared libraries as well. To only build the shared libraries specify
2294 --disable-static in addition to --enable-shared.
2295 EOF
2296     exit 1;
2297 fi
2298
2299 disabled static && LIBNAME=""
2300
2301 if enabled_any libfaad libfaadbin ; then
2302     if check_header faad.h; then
2303         check_cc <<EOF
2304 #include <faad.h>
2305 #ifndef FAAD2_VERSION
2306 ok faad1
2307 #endif
2308 int main(void) { return 0; }
2309 EOF
2310         test $? = 0 && enable libfaad2
2311     else
2312         die "FAAD test failed."
2313     fi
2314 fi
2315
2316
2317 die_license_disabled() {
2318     enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2319 }
2320
2321 die_license_disabled gpl libfaad2
2322 die_license_disabled gpl libx264
2323 die_license_disabled gpl libxvid
2324 die_license_disabled gpl postproc
2325 die_license_disabled gpl x11grab
2326
2327 die_license_disabled nonfree libfaac
2328
2329 die_license_disabled version3 libopencore_amrnb
2330 die_license_disabled version3 libopencore_amrwb
2331
2332 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2333
2334 check_deps $ARCH_EXT_LIST
2335
2336 disabled optimizations || check_cflags -fomit-frame-pointer
2337
2338 enable_pic() {
2339     enable pic
2340     add_cppflags -DPIC
2341     add_cflags   -fPIC
2342     add_asflags  -fPIC
2343 }
2344
2345 enabled pic && enable_pic
2346
2347 check_cc <<EOF || die "Symbol mangling check failed."
2348 int ff_extern;
2349 EOF
2350 sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
2351 extern_prefix=${sym%%ff_extern*}
2352
2353 check_cc <<EOF && enable inline_asm
2354 void foo(void) { __asm__ volatile ("" ::); }
2355 EOF
2356
2357 _restrict=
2358 for restrict_keyword in restrict __restrict__ __restrict; do
2359     check_cc <<EOF && _restrict=$restrict_keyword && break
2360 void foo(char * $restrict_keyword p);
2361 EOF
2362 done
2363
2364 check_cc <<EOF && enable attribute_packed
2365 struct { int x; } __attribute__((packed)) x;
2366 EOF
2367
2368 check_cc <<EOF && enable attribute_may_alias
2369 union { int x; } __attribute__((may_alias)) x;
2370 EOF
2371
2372 check_cc <<EOF || die "endian test failed"
2373 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2374 EOF
2375 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
2376
2377 if enabled alpha; then
2378
2379     check_cflags -mieee
2380
2381 elif enabled arm; then
2382
2383     check_cflags -marm
2384
2385     check_ld <<EOF && enable vfp_args
2386 __asm__ (".eabi_attribute 28, 1");
2387 int main(void) { return 0; }
2388 EOF
2389
2390     # We have to check if pld is a nop and disable it.
2391     check_asm pld '"pld [r0]"'
2392
2393     enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2394     enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
2395     enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2396     enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
2397     enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
2398     enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
2399
2400     enabled_all armv6t2 shared !pic && enable_pic
2401
2402 elif enabled mips; then
2403
2404     check_asm loongson '"dmult.g $1, $2, $3"'
2405     enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
2406
2407 elif enabled ppc; then
2408
2409     enable local_aligned_8 local_aligned_16
2410
2411     check_asm dcbzl     '"dcbzl 0, 1"'
2412     check_asm ppc4xx    '"maclhw r10, r11, r12"'
2413     check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2414
2415     # AltiVec flags: The FSF version of GCC differs from the Apple version
2416     if enabled altivec; then
2417         check_cflags -maltivec -mabi=altivec &&
2418         { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2419         check_cflags -faltivec
2420
2421         # check if our compiler supports Motorola AltiVec C API
2422         check_cc <<EOF || disable altivec
2423 $inc_altivec_h
2424 int main(void) {
2425     vector signed int v1, v2, v3;
2426     v1 = vec_add(v2,v3);
2427     return 0;
2428 }
2429 EOF
2430
2431         # check if our compiler supports braces for vector declarations
2432         check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2433 $inc_altivec_h
2434 int main (void) { (vector int) {1}; return 0; }
2435 EOF
2436     fi
2437
2438 elif enabled sparc; then
2439
2440     enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2441         add_cflags -mcpu=ultrasparc -mtune=ultrasparc
2442
2443 elif enabled x86; then
2444
2445     enable local_aligned_8 local_aligned_16
2446
2447     # check whether EBP is available on x86
2448     # As 'i' is stored on the stack, this program will crash
2449     # if the base pointer is used to access it because the
2450     # base pointer is cleared in the inline assembly code.
2451     check_exec_crash <<EOF && enable ebp_available
2452     volatile int i=0;
2453     __asm__ volatile (
2454         "xorl %%ebp, %%ebp"
2455     ::: "%ebp");
2456     return i;
2457 EOF
2458
2459     # check whether EBX is available on x86
2460     check_asm ebx_available '""::"b"(0)' &&
2461         check_asm ebx_available '"":::"%ebx"'
2462
2463     # check whether more than 10 operands are supported
2464     check_cc <<EOF && enable ten_operands
2465 int main(void) {
2466     int x=0;
2467     __asm__ volatile(
2468         ""
2469         :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
2470     );
2471     return 0;
2472 }
2473 EOF
2474
2475     # check whether binutils is new enough to compile SSSE3/MMX2
2476     enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
2477     enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
2478
2479     check_asm bswap '"bswap %%eax" ::: "%eax"'
2480
2481     YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
2482     enabled     x86_64        && append YASMFLAGS "-m amd64"
2483     enabled     pic           && append YASMFLAGS "-DPIC"
2484     test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
2485     case "$objformat" in
2486         elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
2487     esac
2488     disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
2489
2490     case "$cpu" in
2491         athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2492             disable fast_clz
2493         ;;
2494     esac
2495
2496 fi
2497
2498 if check_func dlopen; then
2499     ldl=
2500 elif check_func dlopen -ldl; then
2501     ldl=-ldl
2502 fi
2503
2504 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2505 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2506
2507 check_func  fork
2508 check_func  getaddrinfo $network_extralibs
2509 check_func  gethrtime
2510 check_func  getrusage
2511 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
2512 check_func  inet_aton $network_extralibs
2513 check_func  isatty
2514 check_func  ${malloc_prefix}memalign            && enable memalign
2515 check_func  mkstemp
2516 check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
2517 check_func  setrlimit
2518 check_func  strerror_r
2519 check_func_headers io.h setmode
2520 check_func_headers lzo/lzo1x.h lzo1x_999_compress
2521 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
2522 check_func_headers windows.h GetProcessTimes
2523 check_func_headers windows.h VirtualAlloc
2524
2525 check_header conio.h
2526 check_header dlfcn.h
2527 check_header dxva2api.h
2528 check_header malloc.h
2529 check_header poll.h
2530 check_header sys/mman.h
2531 check_header sys/resource.h
2532 check_header sys/select.h
2533 check_header termios.h
2534 check_header vdpau/vdpau.h
2535 check_header vdpau/vdpau_x11.h
2536 check_header X11/extensions/XvMClib.h
2537
2538 check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
2539
2540 if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
2541      enabled_any $need_memalign ; then
2542     die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
2543 fi
2544
2545 disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
2546 disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
2547
2548 # check for some common methods of building with pthread support
2549 # do this before the optional library checks as some of them require pthreads
2550 if enabled pthreads; then
2551     if check_func pthread_create; then
2552         :
2553     elif check_func pthread_create -pthread; then
2554         add_cflags -pthread
2555         add_extralibs -pthread
2556     elif check_func pthread_create -pthreads; then
2557         add_cflags -pthreads
2558         add_extralibs -pthreads
2559     elif check_func pthread_create -lpthreadGC2; then
2560         add_extralibs -lpthreadGC2
2561     elif ! check_lib pthread.h pthread_create -lpthread; then
2562         die "ERROR: can't find pthreads library"
2563     fi
2564 fi
2565
2566 for thread in $THREADS_LIST; do
2567     if enabled $thread; then
2568         test -n "$thread_type" &&
2569             die "ERROR: Only one thread type must be selected." ||
2570             thread_type="$thread"
2571     fi
2572 done
2573
2574 check_lib math.h sin -lm
2575 disabled vaapi || check_lib va/va.h vaInitialize -lva
2576
2577 check_mathfunc exp2
2578 check_mathfunc exp2f
2579 check_mathfunc llrint
2580 check_mathfunc llrintf
2581 check_mathfunc log2
2582 check_mathfunc log2f
2583 check_mathfunc lrint
2584 check_mathfunc lrintf
2585 check_mathfunc round
2586 check_mathfunc roundf
2587 check_mathfunc truncf
2588
2589 # these are off by default, so fail if requested and not available
2590 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
2591 enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
2592                       require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
2593                       require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
2594 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
2595 enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
2596 enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
2597 enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
2598 enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
2599 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
2600 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
2601 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
2602 enabled librtmp    && require  librtmp librtmp/rtmp.h RTMP_Init $(pkg-config --libs librtmp)
2603 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
2604                            require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
2605 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
2606 enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
2607 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
2608 enabled libvpx     && require2 libvpx "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver" -lvpx &&
2609                       require2 libvpx "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver" -lvpx
2610 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
2611                       { check_cpp_condition x264.h "X264_BUILD >= 98" ||
2612                         die "ERROR: libx264 version must be >= 0.98."; }
2613 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
2614 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
2615
2616 # libdc1394 check
2617 if enabled libdc1394; then
2618     { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2619         enable libdc1394_2; } ||
2620     { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2621         enable libdc1394_1; } ||
2622     die "ERROR: No version of libdc1394 found "
2623 fi
2624
2625 SDL_CONFIG="${cross_prefix}sdl-config"
2626 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
2627     sdl_cflags=$("${SDL_CONFIG}" --cflags)
2628     sdl_libs=$("${SDL_CONFIG}" --libs)
2629     check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
2630     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
2631     enable sdl &&
2632     check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
2633 fi
2634
2635 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
2636
2637 if enabled network; then
2638     check_type "sys/types.h sys/socket.h" socklen_t
2639     check_type netdb.h "struct addrinfo"
2640     check_type netinet/in.h "struct ipv6_mreq"
2641     check_type netinet/in.h "struct sockaddr_in6"
2642     check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2643     check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2644     # Prefer arpa/inet.h over winsock2
2645     if check_header arpa/inet.h ; then
2646         check_func closesocket
2647     elif check_header winsock2.h ; then
2648         check_func_headers winsock2.h closesocket -lws2 && \
2649             network_extralibs="-lws2" || \
2650         { check_func_headers winsock2.h closesocket -lws2_32 && \
2651             network_extralibs="-lws2_32"; }
2652         check_type ws2tcpip.h socklen_t
2653         check_type ws2tcpip.h "struct addrinfo"
2654         check_type ws2tcpip.h "struct ipv6_mreq"
2655         check_type ws2tcpip.h "struct sockaddr_in6"
2656         check_type ws2tcpip.h "struct sockaddr_storage"
2657         check_struct winsock2.h "struct sockaddr" sa_len
2658     else
2659         disable network
2660     fi
2661 fi
2662
2663 check_header linux/videodev.h
2664 check_header linux/videodev2.h
2665 check_header sys/videoio.h
2666
2667 check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
2668
2669 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
2670 { check_header dev/bktr/ioctl_meteor.h &&
2671   check_header dev/bktr/ioctl_bt848.h; } ||
2672 { check_header machine/ioctl_meteor.h &&
2673   check_header machine/ioctl_bt848.h; } ||
2674 { check_header dev/video/meteor/ioctl_meteor.h &&
2675   check_header dev/video/bktr/ioctl_bt848.h; } ||
2676 check_header dev/ic/bt8xx.h
2677
2678 check_header sys/soundcard.h
2679 check_header soundcard.h
2680
2681 enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
2682
2683 enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
2684
2685 enabled x11grab                         &&
2686 check_header X11/Xlib.h                 &&
2687 check_header X11/extensions/XShm.h      &&
2688 check_header X11/extensions/Xfixes.h    &&
2689 check_func XOpenDisplay -lX11           &&
2690 check_func XShmCreateImage -lX11 -lXext &&
2691 check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
2692
2693 if ! disabled vdpau && enabled vdpau_vdpau_h; then
2694 check_cpp_condition \
2695     vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
2696     { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
2697       disable vdpau; }
2698 fi
2699
2700 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
2701
2702 # add some useful compiler flags if supported
2703 check_cflags -Wdeclaration-after-statement
2704 check_cflags -Wall
2705 check_cflags -Wno-switch
2706 check_cflags -Wdisabled-optimization
2707 check_cflags -Wpointer-arith
2708 check_cflags -Wredundant-decls
2709 check_cflags -Wno-pointer-sign
2710 check_cflags -Wcast-qual
2711 check_cflags -Wwrite-strings
2712 check_cflags -Wtype-limits
2713 check_cflags -Wundef
2714 check_cflags -Wmissing-prototypes
2715 enabled extra_warnings && check_cflags -Winline
2716
2717 # add some linker flags
2718 check_ldflags -Wl,--warn-common
2719 check_ldflags -Wl,--as-needed
2720 check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
2721 check_ldflags -Wl,-Bsymbolic
2722
2723 echo "X{};" > $TMPV
2724 if test_ldflags -Wl,--version-script,$TMPV; then
2725     append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
2726     check_cc <<EOF && enable symver_asm_label
2727 void ff_foo(void) __asm__ ("av_foo@VERSION");
2728 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
2729 EOF
2730     check_cc <<EOF && enable symver_gnu_asm
2731 __asm__(".symver ff_foo,av_foo@VERSION");
2732 void ff_foo(void) {}
2733 EOF
2734 fi
2735
2736 if enabled small; then
2737     add_cflags $size_cflags
2738     optimizations="small"
2739 elif enabled optimizations; then
2740     add_cflags $speed_cflags
2741 else
2742     add_cflags $noopt_cflags
2743 fi
2744 check_cflags -fno-math-errno
2745 check_cflags -fno-signed-zeros
2746
2747 if enabled icc; then
2748     # Just warnings, no remarks
2749     check_cflags -w1
2750     # -wd: Disable following warnings
2751     # 144, 167, 556: -Wno-pointer-sign
2752     # 10006: ignoring unknown option -fno-signed-zeros
2753     # 10156: ignoring option '-W'; no argument required
2754     check_cflags -wd144,167,556,10006,10156
2755     # 11030: Warning unknown option --as-needed
2756     # 10156: ignoring option '-export'; no argument required
2757     check_ldflags -wd10156,11030
2758     # Allow to compile with optimizations
2759     check_ldflags -march=$cpu
2760     # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
2761     enable ebp_available
2762 elif enabled ccc; then
2763     # disable some annoying warnings
2764     add_cflags -msg_disable cvtu32to64
2765     add_cflags -msg_disable embedcomment
2766     add_cflags -msg_disable needconstext
2767     add_cflags -msg_disable nomainieee
2768     add_cflags -msg_disable ptrmismatch1
2769     add_cflags -msg_disable unreachcode
2770 elif enabled gcc; then
2771     check_cflags -fno-tree-vectorize
2772     check_cflags -Werror=implicit
2773     check_cflags -Werror=missing-prototypes
2774 elif enabled clang; then
2775     check_cflags -Qunused-arguments
2776 elif enabled armcc; then
2777     # 2523: use of inline assembler is deprecated
2778     add_cflags -Wrvct,--diag_suppress=2523
2779     add_cflags -Wrvct,--diag_suppress=1207
2780 elif enabled tms470; then
2781     add_cflags -pds=824 -pds=837
2782 fi
2783
2784 if enabled gprof; then
2785     add_cflags  -p
2786     add_ldflags -p
2787 fi
2788
2789 enabled_any $THREADS_LIST      && enable threads
2790
2791 check_deps $CONFIG_LIST       \
2792            $CONFIG_EXTRA      \
2793            $HAVE_LIST         \
2794            $DECODER_LIST      \
2795            $ENCODER_LIST      \
2796            $HWACCEL_LIST      \
2797            $PARSER_LIST       \
2798            $BSF_LIST          \
2799            $DEMUXER_LIST      \
2800            $MUXER_LIST        \
2801            $FILTER_LIST       \
2802            $INDEV_LIST        \
2803            $OUTDEV_LIST       \
2804            $PROTOCOL_LIST     \
2805
2806 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
2807
2808 echo "install prefix            $prefix"
2809 echo "source path               $source_path"
2810 echo "C compiler                $cc"
2811 echo "ARCH                      $arch ($cpu)"
2812 if test "$build_suffix" != ""; then
2813     echo "build suffix              $build_suffix"
2814 fi
2815 if test "$extra_version" != ""; then
2816     echo "version string suffix     $extra_version"
2817 fi
2818 echo "big-endian                ${bigendian-no}"
2819 echo "runtime cpu detection     ${runtime_cpudetect-no}"
2820 if enabled x86; then
2821     echo "yasm                      ${yasm-no}"
2822     echo "MMX enabled               ${mmx-no}"
2823     echo "MMX2 enabled              ${mmx2-no}"
2824     echo "3DNow! enabled            ${amd3dnow-no}"
2825     echo "3DNow! extended enabled   ${amd3dnowext-no}"
2826     echo "SSE enabled               ${sse-no}"
2827     echo "SSSE3 enabled             ${ssse3-no}"
2828     echo "CMOV enabled              ${cmov-no}"
2829     echo "CMOV is fast              ${fast_cmov-no}"
2830     echo "EBX available             ${ebx_available-no}"
2831     echo "EBP available             ${ebp_available-no}"
2832     echo "10 operands supported     ${ten_operands-no}"
2833 fi
2834 if enabled arm; then
2835     echo "ARMv5TE enabled           ${armv5te-no}"
2836     echo "ARMv6 enabled             ${armv6-no}"
2837     echo "ARMv6T2 enabled           ${armv6t2-no}"
2838     echo "ARM VFP enabled           ${armvfp-no}"
2839     echo "IWMMXT enabled            ${iwmmxt-no}"
2840     echo "NEON enabled              ${neon-no}"
2841 fi
2842 if enabled mips; then
2843     echo "MMI enabled               ${mmi-no}"
2844 fi
2845 if enabled ppc; then
2846     echo "AltiVec enabled           ${altivec-no}"
2847     echo "PPC 4xx optimizations     ${ppc4xx-no}"
2848     echo "dcbzl available           ${dcbzl-no}"
2849     echo "performance report        ${powerpc_perf-no}"
2850 fi
2851 if enabled sparc; then
2852     echo "VIS enabled               ${vis-no}"
2853 fi
2854 echo "gprof enabled             ${gprof-no}"
2855 echo "debug symbols             ${debug-no}"
2856 echo "strip symbols             ${stripping-no}"
2857 echo "optimizations             ${optimizations-no}"
2858 echo "static                    ${static-no}"
2859 echo "shared                    ${shared-no}"
2860 echo "postprocessing support    ${postproc-no}"
2861 echo "new filter support        ${avfilter-no}"
2862 echo "filters using lavformat   ${avfilter_lavf-no}"
2863 echo "network support           ${network-no}"
2864 echo "threading support         ${thread_type-no}"
2865 echo "SDL support               ${sdl-no}"
2866 echo "Sun medialib support      ${mlib-no}"
2867 echo "AVISynth enabled          ${avisynth-no}"
2868 echo "libdc1394 support         ${libdc1394-no}"
2869 echo "libdirac enabled          ${libdirac-no}"
2870 echo "libfaac enabled           ${libfaac-no}"
2871 echo "libfaad enabled           ${libfaad-no}"
2872 echo "libfaad dlopened          ${libfaadbin-no}"
2873 echo "libgsm enabled            ${libgsm-no}"
2874 echo "libmp3lame enabled        ${libmp3lame-no}"
2875 echo "libnut enabled            ${libnut-no}"
2876 echo "libopencore-amrnb support ${libopencore_amrnb-no}"
2877 echo "libopencore-amrwb support ${libopencore_amrwb-no}"
2878 echo "libopenjpeg enabled       ${libopenjpeg-no}"
2879 echo "librtmp enabled           ${librtmp-no}"
2880 echo "libschroedinger enabled   ${libschroedinger-no}"
2881 echo "libspeex enabled          ${libspeex-no}"
2882 echo "libtheora enabled         ${libtheora-no}"
2883 echo "libvorbis enabled         ${libvorbis-no}"
2884 echo "libvpx enabled            ${libvpx-no}"
2885 echo "libx264 enabled           ${libx264-no}"
2886 echo "libxvid enabled           ${libxvid-no}"
2887 echo "zlib enabled              ${zlib-no}"
2888 echo "bzlib enabled             ${bzlib-no}"
2889 echo
2890
2891 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
2892     echo "Enabled ${type}s:"
2893     eval list=\$$(toupper $type)_LIST
2894     for part in $list; do
2895         enabled $part && echo ${part%_*}
2896     done | sort | pr -3 -t
2897     echo
2898 done
2899
2900 license="LGPL version 2.1 or later"
2901 if enabled nonfree; then
2902     license="nonfree and unredistributable"
2903 elif enabled gplv3; then
2904     license="GPL version 3 or later"
2905 elif enabled lgplv3; then
2906     license="LGPL version 3 or later"
2907 elif enabled gpl; then
2908     license="GPL version 2 or later"
2909 fi
2910
2911 echo "License: $license"
2912
2913 echo "Creating config.mak and config.h..."
2914
2915 # build tree in object directory if source path is different from current one
2916 if enabled source_path_used; then
2917     DIRS="
2918         doc
2919         libavcodec
2920         libavcodec/$arch
2921         libavdevice
2922         libavfilter
2923         libavformat
2924         libavutil
2925         libavutil/$arch
2926         libpostproc
2927         libswscale
2928         libswscale/$arch
2929         tests
2930         tools
2931     "
2932     FILES="
2933         Makefile
2934         common.mak
2935         subdir.mak
2936         doc/texi2pod.pl
2937         libavcodec/Makefile
2938         libavcodec/${arch}/Makefile
2939         libavdevice/Makefile
2940         libavfilter/Makefile
2941         libavformat/Makefile
2942         libavutil/Makefile
2943         libpostproc/Makefile
2944         libswscale/Makefile
2945     "
2946     map 'mkdir -p $v' $DIRS;
2947     map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
2948 fi
2949
2950 enabled stripping || strip="echo skipping strip"
2951
2952 cat > config.mak <<EOF
2953 # Automatically generated by configure - do not modify!
2954 ifndef FFMPEG_CONFIG_MAK
2955 FFMPEG_CONFIG_MAK=1
2956 FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
2957 prefix=$prefix
2958 LIBDIR=\$(DESTDIR)$libdir
2959 SHLIBDIR=\$(DESTDIR)$shlibdir
2960 INCDIR=\$(DESTDIR)$incdir
2961 BINDIR=\$(DESTDIR)$bindir
2962 DATADIR=\$(DESTDIR)$datadir
2963 MANDIR=\$(DESTDIR)$mandir
2964 SRC_PATH="$source_path"
2965 SRC_PATH_BARE=$source_path
2966 BUILD_ROOT="$PWD"
2967 ARCH=$arch
2968 CC=$cc
2969 AS=$as
2970 LD=$ld
2971 DEPCC=$dep_cc
2972 YASM=$yasmexe
2973 YASMDEP=$yasmexe
2974 AR=$ar
2975 RANLIB=$ranlib
2976 CP=cp -p
2977 LN_S=$ln_s
2978 STRIP=$strip
2979 CPPFLAGS=$CPPFLAGS
2980 CFLAGS=$CFLAGS
2981 ASFLAGS=$ASFLAGS
2982 CC_O=$CC_O
2983 LDFLAGS=$LDFLAGS
2984 FFSERVERLDFLAGS=$FFSERVERLDFLAGS
2985 SHFLAGS=$SHFLAGS
2986 YASMFLAGS=$YASMFLAGS
2987 BUILDSUF=$build_suffix
2988 FULLNAME=$FULLNAME
2989 LIBPREF=$LIBPREF
2990 LIBSUF=$LIBSUF
2991 LIBNAME=$LIBNAME
2992 SLIBPREF=$SLIBPREF
2993 SLIBSUF=$SLIBSUF
2994 EXESUF=$EXESUF
2995 EXTRA_VERSION=$extra_version
2996 DEPFLAGS=$DEPFLAGS
2997 CCDEP=$CCDEP
2998 ASDEP=$ASDEP
2999 CC_DEPFLAGS=$CC_DEPFLAGS
3000 AS_DEPFLAGS=$AS_DEPFLAGS
3001 HOSTCC=$host_cc
3002 HOSTCFLAGS=$host_cflags
3003 HOSTEXESUF=$HOSTEXESUF
3004 HOSTLDFLAGS=$host_ldflags
3005 HOSTLIBS=$host_libs
3006 TARGET_EXEC=$target_exec
3007 TARGET_PATH=$target_path
3008 SDL_LIBS=$sdl_libs
3009 SDL_CFLAGS=$sdl_cflags
3010 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
3011 EXTRALIBS=$extralibs
3012 INSTALL=install
3013 LIBTARGET=${LIBTARGET}
3014 SLIBNAME=${SLIBNAME}
3015 SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
3016 SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
3017 SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
3018 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
3019 SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
3020 SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
3021 SAMPLES=$samples
3022 EOF
3023
3024 get_version(){
3025     name=$1
3026     file=$source_path/$2
3027     eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
3028     eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
3029     lcname=$(tolower $name)
3030     eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
3031     eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
3032 }
3033
3034 get_version LIBSWSCALE  libswscale/swscale.h
3035 get_version LIBPOSTPROC libpostproc/postprocess.h
3036 get_version LIBAVCODEC  libavcodec/avcodec.h
3037 get_version LIBAVDEVICE libavdevice/avdevice.h
3038 get_version LIBAVFORMAT libavformat/avformat.h
3039 get_version LIBAVUTIL   libavutil/avutil.h
3040 get_version LIBAVFILTER libavfilter/avfilter.h
3041
3042 cat > $TMPH <<EOF
3043 /* Automatically generated by configure - do not modify! */
3044 #ifndef FFMPEG_CONFIG_H
3045 #define FFMPEG_CONFIG_H
3046 #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
3047 #define FFMPEG_LICENSE "$(c_escape $license)"
3048 #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
3049 #define CC_TYPE "$cc_type"
3050 #define CC_VERSION $cc_version
3051 #define restrict $_restrict
3052 #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\\n\\t"
3053 #define EXTERN_PREFIX "${extern_prefix}"
3054 #define EXTERN_ASM ${extern_prefix}
3055 EOF
3056
3057 test -n "$malloc_prefix" &&
3058     echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
3059
3060 if enabled small || disabled optimizations; then
3061     echo "#undef  av_always_inline"  >> $TMPH
3062     echo "#define av_always_inline"  >> $TMPH
3063 fi
3064
3065 print_config ARCH_   $TMPH config.mak $ARCH_LIST
3066 print_config HAVE_   $TMPH config.mak $HAVE_LIST
3067 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
3068                                       $CONFIG_EXTRA      \
3069                                       $DECODER_LIST      \
3070                                       $ENCODER_LIST      \
3071                                       $HWACCEL_LIST      \
3072                                       $PARSER_LIST       \
3073                                       $BSF_LIST          \
3074                                       $DEMUXER_LIST      \
3075                                       $MUXER_LIST        \
3076                                       $FILTER_LIST       \
3077                                       $PROTOCOL_LIST     \
3078                                       $INDEV_LIST        \
3079                                       $OUTDEV_LIST       \
3080
3081 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
3082 echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
3083
3084 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
3085 cp_if_changed $TMPH config.h
3086
3087 cat > $TMPH <<EOF
3088 /* Generated by ffconf */
3089 #ifndef AVUTIL_AVCONFIG_H
3090 #define AVUTIL_AVCONFIG_H
3091 EOF
3092
3093 print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
3094
3095 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
3096
3097 cp_if_changed $TMPH libavutil/avconfig.h
3098
3099 # build pkg-config files
3100
3101 pkgconfig_generate(){
3102 name=$1
3103 shortname=${name#lib}${build_suffix}
3104 comment=$2
3105 version=$3
3106 libs=$4
3107 requires=$5
3108 cat <<EOF > $name/$name.pc
3109 prefix=$prefix
3110 exec_prefix=\${prefix}
3111 libdir=$libdir
3112 includedir=$incdir
3113
3114 Name: $name
3115 Description: $comment
3116 Version: $version
3117 Requires: $(enabled shared || echo $requires)
3118 Requires.private: $(enabled shared && echo $requires)
3119 Conflicts:
3120 Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
3121 Libs.private: $(enabled shared && echo $libs)
3122 Cflags: -I\${includedir}
3123 EOF
3124 cat <<EOF > $name/$name-uninstalled.pc
3125 prefix=
3126 exec_prefix=
3127 libdir=\${pcfiledir}
3128 includedir=${source_path}
3129
3130 Name: $name
3131 Description: $comment
3132 Version: $version
3133 Requires: $requires
3134 Conflicts:
3135 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
3136 Cflags: -I\${includedir}
3137 EOF
3138 }
3139
3140 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
3141 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
3142 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
3143 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
3144 enabled avfilter &&
3145     pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
3146 enabled postproc &&
3147     pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
3148 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"