]> git.sesse.net Git - ffmpeg/blob - configure
prores: fixes a few prores 4444 samples
[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-version2        force GPL version 2 [no]
80   --enable-version3        upgrade (L)GPL to version 3 [no]
81   --enable-nonfree         allow use of nonfree code, the resulting libs
82                            and binaries will be unredistributable [no]
83   --disable-doc            do not build documentation
84   --disable-ffmpeg         disable ffmpeg build
85   --disable-avconv         disable avconv build
86   --disable-ffplay         disable ffplay build
87   --disable-ffprobe        disable ffprobe build
88   --disable-ffserver       disable ffserver build
89   --disable-avdevice       disable libavdevice build
90   --disable-avcodec        disable libavcodec build
91   --disable-avformat       disable libavformat build
92   --disable-swresample     disable libswresample build
93   --disable-swscale        disable libswscale build
94   --disable-postproc       disable libpostproc build
95   --disable-avfilter       disable video filter support [no]
96   --disable-pthreads       disable pthreads [auto]
97   --enable-w32threads      use Win32 threads [no]
98   --enable-x11grab         enable X11 grabbing [no]
99   --disable-network        disable network support [no]
100   --enable-gray            enable full grayscale support (slower color)
101   --disable-swscale-alpha  disable alpha channel support in swscale
102   --disable-fastdiv        disable table-based division
103   --enable-small           optimize for size instead of speed
104   --disable-aandct         disable AAN DCT code
105   --disable-dct            disable DCT code
106   --disable-fft            disable FFT code
107   --disable-golomb         disable Golomb code
108   --disable-huffman        disable Huffman code
109   --disable-lpc            disable LPC code
110   --disable-mdct           disable MDCT code
111   --disable-rdft           disable RDFT code
112   --enable-vaapi           enable VAAPI code [autodetect]
113   --enable-vdpau           enable VDPAU code [autodetect]
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-libcelt         enable CELT/Opus decoding via libcelt [no]
167   --enable-frei0r          enable frei0r video filtering
168   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
169   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
170   --enable-libopencv       enable video filtering via libopencv [no]
171   --enable-libcdio         enable audio CD grabbing with libcdio
172   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
173                            and libraw1394 [no]
174   --enable-libdirac        enable Dirac support via libdirac [no]
175   --enable-libfaac         enable FAAC support via libfaac [no]
176   --enable-libfreetype     enable libfreetype [no]
177   --enable-libgsm          enable GSM support via libgsm [no]
178   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
179   --enable-libnut          enable NUT (de)muxing via libnut,
180                            native (de)muxer exists [no]
181   --enable-libopenjpeg     enable JPEG 2000 decoding via OpenJPEG [no]
182   --enable-librtmp         enable RTMP[E] support via librtmp [no]
183   --enable-libschroedinger enable Dirac support via libschroedinger [no]
184   --enable-libspeex        enable Speex encoding and decoding via libspeex [no]
185   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
186   --enable-libtheora       enable Theora encoding via libtheora [no]
187   --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
188   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
189   --enable-libvorbis       enable Vorbis encoding via libvorbis,
190                            native implementation exists [no]
191   --enable-libvpx          enable VP8 support via libvpx [no]
192   --enable-libx264         enable H.264 encoding via x264 [no]
193   --enable-libxavs         enable AVS encoding via xavs [no]
194   --enable-libxvid         enable Xvid encoding via xvidcore,
195                            native MPEG-4/Xvid encoder exists [no]
196   --enable-openal          enable OpenAL 1.1 capture support [no]
197   --enable-mlib            enable Sun medialib [no]
198   --enable-zlib            enable zlib [autodetect]
199
200 Advanced options (experts only):
201   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
202   --enable-cross-compile   assume a cross-compiler is used
203   --sysroot=PATH           root of cross-build tree
204   --sysinclude=PATH        location of cross-build system headers
205   --target-os=OS           compiler targets OS [$target_os]
206   --target-exec=CMD        command to run executables on target
207   --target-path=DIR        path to view of build directory on target
208   --nm=NM                  use nm tool
209   --ar=AR                  use archive tool AR [$ar_default]
210   --as=AS                  use assembler AS [$as_default]
211   --cc=CC                  use C compiler CC [$cc_default]
212   --cxx=CXX                use C compiler CXX [$cxx_default]
213   --ld=LD                  use linker LD
214   --host-cc=HOSTCC         use host C compiler HOSTCC
215   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
216   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
217   --host-libs=HLIBS        use libs HLIBS when linking for host
218   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
219   --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
220   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
221   --extra-libs=ELIBS       add ELIBS [$ELIBS]
222   --extra-version=STRING   version string suffix []
223   --build-suffix=SUFFIX    library name suffix []
224   --progs-suffix=SUFFIX    program name suffix []
225   --arch=ARCH              select architecture [$arch]
226   --cpu=CPU                select the minimum required CPU (affects
227                            instruction selection, may crash on older CPUs)
228   --disable-asm            disable all assembler optimizations
229   --disable-altivec        disable AltiVec optimizations
230   --disable-amd3dnow       disable 3DNow! optimizations
231   --disable-amd3dnowext    disable 3DNow! extended optimizations
232   --disable-mmx            disable MMX optimizations
233   --disable-mmx2           disable MMX2 optimizations
234   --disable-sse            disable SSE optimizations
235   --disable-ssse3          disable SSSE3 optimizations
236   --disable-avx            disable AVX optimizations
237   --disable-armv5te        disable armv5te optimizations
238   --disable-armv6          disable armv6 optimizations
239   --disable-armv6t2        disable armv6t2 optimizations
240   --disable-armvfp         disable ARM VFP optimizations
241   --disable-iwmmxt         disable iwmmxt optimizations
242   --disable-mmi            disable MMI optimizations
243   --disable-neon           disable neon optimizations
244   --disable-vis            disable VIS optimizations
245   --disable-yasm           disable use of yasm assembler
246   --enable-pic             build position-independent code
247   --malloc-prefix=PFX      prefix malloc and related names with PFX
248   --enable-sram            allow use of on-chip SRAM
249   --disable-symver         disable symbol versioning
250   --optflags               override optimization-related compiler flags
251
252 Developer options (useful when working on FFmpeg itself):
253   --disable-debug          disable debugging symbols
254   --enable-debug=LEVEL     set the debug level [$debuglevel]
255   --disable-optimizations  disable compiler optimizations
256   --enable-extra-warnings  enable more compiler warnings
257   --disable-stripping      disable stripping of executables and shared libraries
258   --samples=PATH           location of test samples for FATE, if not set use
259                            \$FATE_SAMPLES at make invocation time.
260
261 NOTE: Object files are built at the place where configure is launched.
262 EOF
263   exit 0
264 }
265
266 quotes='""'
267
268 log(){
269     echo "$@" >> $logfile
270 }
271
272 log_file(){
273     log BEGIN $1
274     pr -n -t $1 >> $logfile
275     log END $1
276 }
277
278 echolog(){
279     log "$@"
280     echo "$@"
281 }
282
283 warn(){
284     log "WARNING: $*"
285     WARNINGS="${WARNINGS}WARNING: $*\n"
286 }
287
288 die(){
289     echolog "$@"
290     cat <<EOF
291
292 If you think configure made a mistake, make sure you are using the latest
293 version from Git.  If the latest version fails, report the problem to the
294 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
295 EOF
296     if disabled logging; then
297         cat <<EOF
298 Rerun configure with logging enabled (do not use --disable-logging), and
299 include the log this produces with your report.
300 EOF
301     else
302 cat <<EOF
303 Include the log file "$logfile" produced by configure as this will help
304 solving the problem.
305 EOF
306     fi
307     exit 1
308 }
309
310 # Avoid locale weirdness, besides we really just want to translate ASCII.
311 toupper(){
312     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
313 }
314
315 tolower(){
316     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
317 }
318
319 c_escape(){
320     echo "$*" | sed 's/["\\]/\\\0/g'
321 }
322
323 sh_quote(){
324     v=$(echo "$1" | sed "s/'/'\\\\''/g")
325     test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
326     echo "$v"
327 }
328
329 cleanws(){
330     echo "$@" | sed 's/^ *//;s/  */ /g;s/ *$//'
331 }
332
333 filter(){
334     pat=$1
335     shift
336     for v; do
337         eval "case $v in $pat) echo $v ;; esac"
338     done
339 }
340
341 filter_out(){
342     pat=$1
343     shift
344     for v; do
345         eval "case $v in $pat) ;; *) echo $v ;; esac"
346     done
347 }
348
349 map(){
350     m=$1
351     shift
352     for v; do eval $m; done
353 }
354
355 set_all(){
356     value=$1
357     shift
358     for var in $*; do
359         eval $var=$value
360     done
361 }
362
363 set_weak(){
364     value=$1
365     shift
366     for var; do
367         eval : \${$var:=$value}
368     done
369 }
370
371 set_safe(){
372     var=$1
373     shift
374     eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
375 }
376
377 get_safe(){
378     eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
379 }
380
381 pushvar(){
382     for var in $*; do
383         eval level=\${${var}_level:=0}
384         eval ${var}_${level}="\$$var"
385         eval ${var}_level=$(($level+1))
386     done
387 }
388
389 popvar(){
390     for var in $*; do
391         eval level=\${${var}_level:-0}
392         test $level = 0 && continue
393         eval level=$(($level-1))
394         eval $var="\${${var}_${level}}"
395         eval ${var}_level=$level
396         eval unset ${var}_${level}
397     done
398 }
399
400 enable(){
401     set_all yes $*
402 }
403
404 disable(){
405     set_all no $*
406 }
407
408 enable_weak(){
409     set_weak yes $*
410 }
411
412 disable_weak(){
413     set_weak no $*
414 }
415
416 enable_safe(){
417     for var; do
418         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
419     done
420 }
421
422 disable_safe(){
423     for var; do
424         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
425     done
426 }
427
428 do_enable_deep(){
429     for var; do
430         enabled $var && continue
431         eval sel="\$${var}_select"
432         eval sgs="\$${var}_suggest"
433         pushvar var sgs
434         enable_deep $sel
435         popvar sgs
436         enable_deep_weak $sgs
437         popvar var
438     done
439 }
440
441 enable_deep(){
442     do_enable_deep $*
443     enable $*
444 }
445
446 enable_deep_weak(){
447     do_enable_deep $*
448     enable_weak $*
449 }
450
451 enabled(){
452     test "${1#!}" = "$1" && op== || op=!=
453     eval test "x\$${1#!}" $op "xyes"
454 }
455
456 disabled(){
457     test "${1#!}" = "$1" && op== || op=!=
458     eval test "x\$${1#!}" $op "xno"
459 }
460
461 enabled_all(){
462     for opt; do
463         enabled $opt || return 1
464     done
465 }
466
467 disabled_all(){
468     for opt; do
469         disabled $opt || return 1
470     done
471 }
472
473 enabled_any(){
474     for opt; do
475         enabled $opt && return 0
476     done
477 }
478
479 disabled_any(){
480     for opt; do
481         disabled $opt && return 0
482     done
483     return 1
484 }
485
486 set_default(){
487     for opt; do
488         eval : \${$opt:=\$${opt}_default}
489     done
490 }
491
492 is_in(){
493     value=$1
494     shift
495     for var in $*; do
496         [ $var = $value ] && return 0
497     done
498     return 1
499 }
500
501 check_deps(){
502     for cfg; do
503         cfg="${cfg#!}"
504         enabled ${cfg}_checking && die "Circular dependency for $cfg."
505         disabled ${cfg}_checking && continue
506         enable ${cfg}_checking
507
508         eval dep_all="\$${cfg}_deps"
509         eval dep_any="\$${cfg}_deps_any"
510         eval dep_sel="\$${cfg}_select"
511         eval dep_sgs="\$${cfg}_suggest"
512         eval dep_ifa="\$${cfg}_if"
513         eval dep_ifn="\$${cfg}_if_any"
514
515         pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
516         check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
517         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
518
519         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
520         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
521         enabled_all  $dep_all || disable $cfg
522         enabled_any  $dep_any || disable $cfg
523         disabled_any $dep_sel && disable $cfg
524
525         if enabled $cfg; then
526             eval dep_extralibs="\$${cfg}_extralibs"
527             test -n "$dep_extralibs" && add_extralibs $dep_extralibs
528             enable_deep $dep_sel
529             enable_deep_weak $dep_sgs
530         fi
531
532         disable ${cfg}_checking
533     done
534 }
535
536 print_config_h(){
537     enabled $1 && v=1 || v=0
538     echo "#define $2 $v"
539 }
540
541 print_config_mak(){
542     enabled $1 && v= || v=!
543     echo "$v$2=yes"
544 }
545
546 print_config_asm(){
547     enabled $1 && echo "%define $2"
548 }
549
550 print_config(){
551     pfx=$1
552     files=$2
553     shift 2
554     for cfg; do
555         ucname="$(toupper $cfg)"
556         for f in $files; do
557             "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
558         done
559     done
560 }
561
562 print_enabled(){
563     test "$1" = -n && end=" " && shift || end="\n"
564     suf=$1
565     shift
566     for v; do
567         enabled $v && printf "%s$end" ${v%$suf};
568     done
569 }
570
571 append(){
572     var=$1
573     shift
574     eval "$var=\"\$$var $*\""
575 }
576
577 prepend(){
578     var=$1
579     shift
580     eval "$var=\"$* \$$var\""
581 }
582
583 add_cppflags(){
584     append CPPFLAGS $($filter_cppflags "$@")
585 }
586
587 add_cflags(){
588     append CFLAGS $($filter_cflags "$@")
589 }
590
591 add_cxxflags(){
592     append CXXFLAGS $($filter_cflags "$@")
593 }
594
595 add_asflags(){
596     append ASFLAGS $($filter_asflags "$@")
597 }
598
599 add_ldflags(){
600     append LDFLAGS "$@"
601 }
602
603 add_extralibs(){
604     prepend extralibs "$@"
605 }
606
607 check_cmd(){
608     log "$@"
609     "$@" >> $logfile 2>&1
610 }
611
612 check_cc(){
613     log check_cc "$@"
614     cat > $TMPC
615     log_file $TMPC
616     check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
617 }
618
619 check_cxx(){
620     log check_cxx "$@"
621     cat > $TMPCPP
622     log_file $TMPCPP
623     check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" -c -o $TMPO $TMPCPP
624 }
625
626 check_cpp(){
627     log check_cpp "$@"
628     cat > $TMPC
629     log_file $TMPC
630     check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
631 }
632
633 check_as(){
634     log check_as "$@"
635     cat > $TMPC
636     log_file $TMPC
637     check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
638 }
639
640 check_asm(){
641     log check_asm "$@"
642     name="$1"
643     code="$2"
644     shift 2
645     disable $name
646     check_as "$@" <<EOF && enable $name
647 void foo(void){ __asm__ volatile($code); }
648 EOF
649 }
650
651 check_yasm(){
652     log check_yasm "$@"
653     echo "$1" > $TMPS
654     log_file $TMPS
655     shift 1
656     check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
657 }
658
659 check_ld(){
660     log check_ld "$@"
661     type=$1
662     shift 1
663     flags=''
664     libs=''
665     for f; do
666         test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
667     done
668     check_$type $($filter_cflags $flags) || return
669     check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
670 }
671
672 check_cppflags(){
673     log check_cppflags "$@"
674     set -- $($filter_cppflags "$@")
675     check_cc "$@" <<EOF && append CPPFLAGS "$@"
676 int x;
677 EOF
678 }
679
680 check_cflags(){
681     log check_cflags "$@"
682     set -- $($filter_cflags "$@")
683     check_cc "$@" <<EOF && append CFLAGS "$@"
684 int x;
685 EOF
686 }
687
688 check_cxxflags(){
689     log check_cxxflags "$@"
690     set -- $($filter_cflags "$@")
691     check_cxx "$@" <<EOF && append CXXFLAGS "$@"
692 int x;
693 EOF
694 }
695
696 test_ldflags(){
697     log test_ldflags "$@"
698     check_ld "cc" "$@" <<EOF
699 int main(void){ return 0; }
700 EOF
701 }
702
703 check_ldflags(){
704     log check_ldflags "$@"
705     test_ldflags "$@" && add_ldflags "$@"
706 }
707
708 check_header(){
709     log check_header "$@"
710     header=$1
711     shift
712     disable_safe $header
713     check_cpp "$@" <<EOF && enable_safe $header
714 #include <$header>
715 int x;
716 EOF
717 }
718
719 check_func(){
720     log check_func "$@"
721     func=$1
722     shift
723     disable $func
724     check_ld "cc" "$@" <<EOF && enable $func
725 extern int $func();
726 int main(void){ $func(); }
727 EOF
728 }
729
730 check_mathfunc(){
731     log check_mathfunc "$@"
732     func=$1
733     shift
734     disable $func
735     check_ld "cc" "$@" <<EOF && enable $func
736 #include <math.h>
737 float foo(float f) { return $func(f); }
738 int main(void){ return (int) foo; }
739 EOF
740 }
741
742 check_func_headers(){
743     log check_func_headers "$@"
744     headers=$1
745     funcs=$2
746     shift 2
747     {
748         for hdr in $headers; do
749             echo "#include <$hdr>"
750         done
751         for func in $funcs; do
752             echo "long check_$func(void) { return (long) $func; }"
753         done
754         echo "int main(void) { return 0; }"
755     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
756 }
757
758 check_class_headers_cpp(){
759     log check_class_headers_cpp "$@"
760     headers=$1
761     classes=$2
762     shift 2
763     {
764         for hdr in $headers; do
765             echo "#include <$hdr>"
766         done
767         echo "int main(void) { "
768         i=1
769         for class in $classes; do
770             echo "$class obj$i;"
771             i=$(expr $i + 1)
772         done
773         echo "return 0; }"
774     } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
775 }
776
777 check_cpp_condition(){
778     log check_cpp_condition "$@"
779     header=$1
780     condition=$2
781     shift 2
782     check_cpp $($filter_cppflags "$@") <<EOF
783 #include <$header>
784 #if !($condition)
785 #error "unsatisfied condition: $condition"
786 #endif
787 EOF
788 }
789
790 check_lib(){
791     log check_lib "$@"
792     header="$1"
793     func="$2"
794     shift 2
795     check_header $header && check_func $func "$@" && add_extralibs "$@"
796 }
797
798 check_lib2(){
799     log check_lib2 "$@"
800     headers="$1"
801     funcs="$2"
802     shift 2
803     check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
804 }
805
806 check_lib_cpp(){
807     log check_lib_cpp "$@"
808     headers="$1"
809     classes="$2"
810     shift 2
811     check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
812 }
813
814 check_pkg_config(){
815     log check_pkg_config "$@"
816     pkg="$1"
817     headers="$2"
818     funcs="$3"
819     shift 3
820     $pkg_config --exists $pkg 2>/dev/null || return
821     pkg_cflags=$($pkg_config --cflags $pkg)
822     pkg_libs=$($pkg_config --libs $pkg)
823     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
824         set_safe ${pkg}_cflags $pkg_cflags   &&
825         set_safe ${pkg}_libs   $pkg_libs
826 }
827
828 check_exec(){
829     check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
830 }
831
832 check_exec_crash(){
833     code=$(cat)
834
835     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
836     # are safe but may not be available everywhere.  Thus we use
837     # raise(SIGTERM) instead.  The check is run in a subshell so we
838     # can redirect the "Terminated" message from the shell.  SIGBUS
839     # is not defined by standard C so it is used conditionally.
840
841     (check_exec "$@") >> $logfile 2>&1 <<EOF
842 #include <signal.h>
843 static void sighandler(int sig){
844     raise(SIGTERM);
845 }
846 int main(void){
847     signal(SIGILL, sighandler);
848     signal(SIGFPE, sighandler);
849     signal(SIGSEGV, sighandler);
850 #ifdef SIGBUS
851     signal(SIGBUS, sighandler);
852 #endif
853     { $code }
854 }
855 EOF
856 }
857
858 check_type(){
859     log check_type "$@"
860     headers=$1
861     type=$2
862     shift 2
863     disable_safe "$type"
864     incs=""
865     for hdr in $headers; do
866         incs="$incs
867 #include <$hdr>"
868     done
869     check_cc "$@" <<EOF && enable_safe "$type"
870 $incs
871 $type v;
872 EOF
873 }
874
875 check_struct(){
876     log check_type "$@"
877     headers=$1
878     struct=$2
879     member=$3
880     shift 3
881     disable_safe "${struct}_${member}"
882     incs=""
883     for hdr in $headers; do
884         incs="$incs
885 #include <$hdr>"
886     done
887     check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
888 $incs
889 const void *p = &(($struct *)0)->$member;
890 EOF
891 }
892
893 require(){
894     name="$1"
895     header="$2"
896     func="$3"
897     shift 3
898     check_lib $header $func "$@" || die "ERROR: $name not found"
899 }
900
901 require2(){
902     name="$1"
903     headers="$2"
904     func="$3"
905     shift 3
906     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
907 }
908
909 require_cpp(){
910     name="$1"
911     headers="$2"
912     classes="$3"
913     shift 3
914     check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
915 }
916
917 require_pkg_config(){
918     pkg="$1"
919     check_pkg_config "$@" || die "ERROR: $pkg not found"
920     add_cflags    $(get_safe ${pkg}_cflags)
921     add_extralibs $(get_safe ${pkg}_libs)
922 }
923
924 check_host_cc(){
925     log check_host_cc "$@"
926     cat > $TMPC
927     log_file $TMPC
928     check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
929 }
930
931 check_host_cflags(){
932     log check_host_cflags "$@"
933     check_host_cc "$@" <<EOF && append host_cflags "$@"
934 int x;
935 EOF
936 }
937
938 apply(){
939     file=$1
940     shift
941     "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
942 }
943
944 cp_if_changed(){
945     cmp -s "$1" "$2" && echo "$2 is unchanged" && return
946     mkdir -p "$(dirname $2)"
947     cp -f "$1" "$2"
948 }
949
950 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
951 # system-dependent things.
952
953 COMPONENT_LIST="
954     bsfs
955     decoders
956     demuxers
957     encoders
958     filters
959     hwaccels
960     indevs
961     muxers
962     outdevs
963     parsers
964     protocols
965 "
966
967 CONFIG_LIST="
968     $COMPONENT_LIST
969     aandct
970     ac3dsp
971     avcodec
972     avdevice
973     avfilter
974     avformat
975     avisynth
976     bzlib
977     crystalhd
978     dct
979     doc
980     dwt
981     dxva2
982     fastdiv
983     ffmpeg
984     avconv
985     ffplay
986     ffprobe
987     ffserver
988     fft
989     frei0r
990     golomb
991     gpl
992     gray
993     h264dsp
994     h264pred
995     hardcoded_tables
996     huffman
997     libcdio
998     libcelt
999     libdc1394
1000     libdirac
1001     libfaac
1002     libfreetype
1003     libgsm
1004     libmp3lame
1005     libnut
1006     libopencore_amrnb
1007     libopencore_amrwb
1008     libopencv
1009     libopenjpeg
1010     librtmp
1011     libschroedinger
1012     libspeex
1013     libstagefright_h264
1014     libtheora
1015     libvo_aacenc
1016     libvo_amrwbenc
1017     libvorbis
1018     libvpx
1019     libx264
1020     libxavs
1021     libxvid
1022     lpc
1023     lsp
1024     mdct
1025     memalign_hack
1026     mlib
1027     mpegaudiodsp
1028     network
1029     nonfree
1030     openal
1031     pic
1032     postproc
1033     rdft
1034     rtpdec
1035     runtime_cpudetect
1036     shared
1037     sinewin
1038     small
1039     sram
1040     static
1041     swresample
1042     swscale
1043     swscale_alpha
1044     thumb
1045     vaapi
1046     vdpau
1047     version2
1048     version3
1049     x11grab
1050     zlib
1051 "
1052
1053 THREADS_LIST='
1054     pthreads
1055     w32threads
1056 '
1057
1058 ARCH_LIST='
1059     alpha
1060     arm
1061     avr32
1062     avr32_ap
1063     avr32_uc
1064     bfin
1065     ia64
1066     m68k
1067     mips
1068     mips64
1069     parisc
1070     ppc
1071     ppc64
1072     s390
1073     sh4
1074     sparc
1075     sparc64
1076     tomi
1077     x86
1078     x86_32
1079     x86_64
1080 '
1081
1082 ARCH_EXT_LIST='
1083     altivec
1084     amd3dnow
1085     amd3dnowext
1086     armv5te
1087     armv6
1088     armv6t2
1089     armvfp
1090     avx
1091     iwmmxt
1092     mmi
1093     mmx
1094     mmx2
1095     neon
1096     ppc4xx
1097     sse
1098     ssse3
1099     vfpv3
1100     vis
1101 '
1102
1103 HAVE_LIST_PUB='
1104     bigendian
1105     fast_unaligned
1106 '
1107
1108 HAVE_LIST="
1109     $ARCH_EXT_LIST
1110     $HAVE_LIST_PUB
1111     $THREADS_LIST
1112     aligned_stack
1113     alsa_asoundlib_h
1114     altivec_h
1115     arpa_inet_h
1116     attribute_may_alias
1117     attribute_packed
1118     bswap
1119     closesocket
1120     cmov
1121     dcbzl
1122     dev_bktr_ioctl_bt848_h
1123     dev_bktr_ioctl_meteor_h
1124     dev_ic_bt8xx_h
1125     dev_video_meteor_ioctl_meteor_h
1126     dev_video_bktr_ioctl_bt848_h
1127     dlfcn_h
1128     dlopen
1129     dos_paths
1130     ebp_available
1131     ebx_available
1132     exp2
1133     exp2f
1134     fast_64bit
1135     fast_clz
1136     fast_cmov
1137     fcntl
1138     fork
1139     getaddrinfo
1140     gethrtime
1141     GetProcessMemoryInfo
1142     GetProcessTimes
1143     getrusage
1144     gnu_as
1145     struct_rusage_ru_maxrss
1146     ibm_asm
1147     inet_aton
1148     inline_asm
1149     isatty
1150     kbhit
1151     ldbrx
1152     llrint
1153     llrintf
1154     local_aligned_16
1155     local_aligned_8
1156     localtime_r
1157     log2
1158     log2f
1159     loongson
1160     lrint
1161     lrintf
1162     lzo1x_999_compress
1163     machine_ioctl_bt848_h
1164     machine_ioctl_meteor_h
1165     malloc_h
1166     MapViewOfFile
1167     memalign
1168     mkstemp
1169     mmap
1170     PeekNamedPipe
1171     posix_memalign
1172     round
1173     roundf
1174     sdl
1175     sdl_video_size
1176     setmode
1177     sndio_h
1178     socklen_t
1179     soundcard_h
1180     poll_h
1181     setrlimit
1182     strerror_r
1183     strptime
1184     strtok_r
1185     struct_addrinfo
1186     struct_ipv6_mreq
1187     struct_sockaddr_in6
1188     struct_sockaddr_sa_len
1189     struct_sockaddr_storage
1190     symver
1191     symver_gnu_asm
1192     symver_asm_label
1193     sys_mman_h
1194     sys_resource_h
1195     sys_select_h
1196     sys_soundcard_h
1197     sys_videoio_h
1198     termios_h
1199     threads
1200     trunc
1201     truncf
1202     vfp_args
1203     VirtualAlloc
1204     winsock2_h
1205     xform_asm
1206     xmm_clobbers
1207     yasm
1208 "
1209
1210 # options emitted with CONFIG_ prefix but not available on command line
1211 CONFIG_EXTRA="
1212     avutil
1213     gplv3
1214     gplv2
1215     lgplv3
1216 "
1217
1218 CMDLINE_SELECT="
1219     $ARCH_EXT_LIST
1220     $CONFIG_LIST
1221     $THREADS_LIST
1222     asm
1223     cross_compile
1224     debug
1225     extra_warnings
1226     logging
1227     optimizations
1228     stripping
1229     symver
1230     yasm
1231 "
1232
1233 PATHS_LIST='
1234     bindir
1235     datadir
1236     incdir
1237     libdir
1238     mandir
1239     prefix
1240     shlibdir
1241 '
1242
1243 CMDLINE_SET="
1244     $PATHS_LIST
1245     ar
1246     arch
1247     as
1248     build_suffix
1249     progs_suffix
1250     cc
1251     cpu
1252     cross_prefix
1253     cxx
1254     dep_cc
1255     extra_version
1256     host_cc
1257     host_cflags
1258     host_ldflags
1259     host_libs
1260     host_os
1261     install
1262     ld
1263     logfile
1264     malloc_prefix
1265     nm
1266     optflags
1267     pkg_config
1268     samples
1269     strip
1270     sysinclude
1271     sysroot
1272     target_exec
1273     target_os
1274     target_path
1275 "
1276
1277 CMDLINE_APPEND="
1278     extra_cflags
1279     extra_cxxflags
1280 "
1281
1282 # code dependency declarations
1283
1284 # architecture extensions
1285
1286 armv5te_deps="arm"
1287 armv6_deps="arm"
1288 armv6t2_deps="arm"
1289 armvfp_deps="arm"
1290 iwmmxt_deps="arm"
1291 neon_deps="arm"
1292 vfpv3_deps="armvfp"
1293
1294 mmi_deps="mips"
1295
1296 altivec_deps="ppc"
1297 ppc4xx_deps="ppc"
1298
1299 vis_deps="sparc"
1300
1301 x86_64_suggest="cmov fast_cmov"
1302 amd3dnow_deps="mmx"
1303 amd3dnowext_deps="amd3dnow"
1304 mmx_deps="x86"
1305 mmx2_deps="mmx"
1306 sse_deps="mmx"
1307 ssse3_deps="sse"
1308 avx_deps="ssse3"
1309
1310 aligned_stack_if_any="ppc x86"
1311 fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1312 fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
1313 fast_unaligned_if_any="armv6 ppc x86"
1314
1315 need_memalign="altivec neon sse"
1316 inline_asm_deps="!tms470"
1317
1318 symver_if_any="symver_asm_label symver_gnu_asm"
1319
1320 # subsystems
1321 dct_select="rdft"
1322 mdct_select="fft"
1323 rdft_select="fft"
1324 mpegaudiodsp_select="dct"
1325
1326 # decoders / encoders / hardware accelerators
1327 aac_decoder_select="mdct sinewin"
1328 aac_encoder_select="mdct sinewin"
1329 aac_latm_decoder_select="aac_decoder aac_latm_parser"
1330 ac3_decoder_select="mdct ac3dsp ac3_parser"
1331 ac3_encoder_select="mdct ac3dsp"
1332 ac3_fixed_encoder_select="mdct ac3dsp"
1333 alac_encoder_select="lpc"
1334 amrnb_decoder_select="lsp"
1335 amrwb_decoder_select="lsp"
1336 atrac1_decoder_select="mdct sinewin"
1337 atrac3_decoder_select="mdct"
1338 binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1339 binkaudio_rdft_decoder_select="mdct rdft sinewin"
1340 cavs_decoder_select="golomb"
1341 cook_decoder_select="mdct sinewin"
1342 cscd_decoder_suggest="zlib"
1343 dca_decoder_select="mdct"
1344 dnxhd_encoder_select="aandct"
1345 dxa_decoder_select="zlib"
1346 eac3_decoder_select="ac3_decoder"
1347 eac3_encoder_select="mdct ac3dsp"
1348 eamad_decoder_select="aandct"
1349 eatgq_decoder_select="aandct"
1350 eatqi_decoder_select="aandct"
1351 ffv1_decoder_select="golomb"
1352 flac_decoder_select="golomb"
1353 flac_encoder_select="golomb lpc"
1354 flashsv_decoder_select="zlib"
1355 flashsv_encoder_select="zlib"
1356 flashsv2_encoder_select="zlib"
1357 flashsv2_decoder_select="zlib"
1358 flv_decoder_select="h263_decoder"
1359 flv_encoder_select="h263_encoder"
1360 fraps_decoder_select="huffman"
1361 h261_encoder_select="aandct"
1362 h263_decoder_select="h263_parser"
1363 h263_encoder_select="aandct"
1364 h263_vaapi_hwaccel_select="vaapi h263_decoder"
1365 h263i_decoder_select="h263_decoder"
1366 h263p_encoder_select="h263_encoder"
1367 h264_decoder_select="golomb h264dsp h264pred"
1368 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
1369 h264_dxva2_hwaccel_deps="dxva2api_h"
1370 h264_dxva2_hwaccel_select="dxva2 h264_decoder"
1371 h264_vaapi_hwaccel_select="vaapi"
1372 h264_vdpau_decoder_select="vdpau h264_decoder"
1373 imc_decoder_select="fft mdct sinewin"
1374 jpegls_decoder_select="golomb"
1375 jpegls_encoder_select="golomb"
1376 ljpeg_encoder_select="aandct"
1377 loco_decoder_select="golomb"
1378 mjpeg_encoder_select="aandct"
1379 mlp_decoder_select="mlp_parser"
1380 mp1_decoder_select="mpegaudiodsp"
1381 mp2_decoder_select="mpegaudiodsp"
1382 mp3adu_decoder_select="mpegaudiodsp"
1383 mp3_decoder_select="mpegaudiodsp"
1384 mp3on4_decoder_select="mpegaudiodsp"
1385 mp1float_decoder_select="mpegaudiodsp"
1386 mp2float_decoder_select="mpegaudiodsp"
1387 mp3adufloat_decoder_select="mpegaudiodsp"
1388 mp3float_decoder_select="mpegaudiodsp"
1389 mp3on4float_decoder_select="mpegaudiodsp"
1390 mpeg1video_encoder_select="aandct"
1391 mpeg2video_encoder_select="aandct"
1392 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1393 mpeg4_encoder_select="h263_encoder"
1394 mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1395 mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1396 mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
1397 mpeg2_crystalhd_decoder_select="crystalhd"
1398 mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1399 mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
1400 mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
1401 mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1402 mpeg4_crystalhd_decoder_select="crystalhd"
1403 mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1404 mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1405 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1406 mpeg_xvmc_decoder_select="mpegvideo_decoder"
1407 msmpeg4_crystalhd_decoder_select="crystalhd"
1408 msmpeg4v1_decoder_select="h263_decoder"
1409 msmpeg4v1_encoder_select="h263_encoder"
1410 msmpeg4v2_decoder_select="h263_decoder"
1411 msmpeg4v2_encoder_select="h263_encoder"
1412 msmpeg4v3_decoder_select="h263_decoder"
1413 msmpeg4v3_encoder_select="h263_encoder"
1414 nellymoser_decoder_select="mdct sinewin"
1415 nellymoser_encoder_select="mdct sinewin"
1416 png_decoder_select="zlib"
1417 png_encoder_select="zlib"
1418 prores_decoder_deps="version2 gpl"
1419 qcelp_decoder_select="lsp"
1420 qdm2_decoder_select="mdct rdft mpegaudiodsp"
1421 ra_144_encoder_select="lpc"
1422 rv10_decoder_select="h263_decoder"
1423 rv10_encoder_select="h263_encoder"
1424 rv20_decoder_select="h263_decoder"
1425 rv20_encoder_select="h263_encoder"
1426 rv30_decoder_select="golomb h264pred"
1427 rv40_decoder_select="golomb h264pred"
1428 shorten_decoder_select="golomb"
1429 sipr_decoder_select="lsp"
1430 snow_decoder_select="dwt"
1431 snow_encoder_select="aandct dwt"
1432 sonic_decoder_select="golomb"
1433 sonic_encoder_select="golomb"
1434 sonic_ls_encoder_select="golomb"
1435 svq1_encoder_select="aandct"
1436 svq3_decoder_select="golomb h264dsp h264pred"
1437 svq3_decoder_suggest="zlib"
1438 theora_decoder_select="vp3_decoder"
1439 tiff_decoder_suggest="zlib"
1440 tiff_encoder_suggest="zlib"
1441 truehd_decoder_select="mlp_decoder"
1442 tscc_decoder_select="zlib"
1443 twinvq_decoder_select="mdct lsp sinewin"
1444 vc1_decoder_select="h263_decoder"
1445 vc1_crystalhd_decoder_select="crystalhd"
1446 vc1_dxva2_hwaccel_deps="dxva2api_h"
1447 vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
1448 vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1449 vc1_vdpau_decoder_select="vdpau vc1_decoder"
1450 vc1image_decoder_select="vc1_decoder"
1451 vorbis_decoder_select="mdct"
1452 vorbis_encoder_select="mdct"
1453 vp6_decoder_select="huffman"
1454 vp6a_decoder_select="vp6_decoder"
1455 vp6f_decoder_select="vp6_decoder"
1456 vp8_decoder_select="h264pred"
1457 wmapro_decoder_select="mdct sinewin"
1458 wmav1_decoder_select="mdct sinewin"
1459 wmav1_encoder_select="mdct sinewin"
1460 wmav2_decoder_select="mdct sinewin"
1461 wmav2_encoder_select="mdct sinewin"
1462 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
1463 wmv1_decoder_select="h263_decoder"
1464 wmv1_encoder_select="h263_encoder"
1465 wmv2_decoder_select="h263_decoder"
1466 wmv2_encoder_select="h263_encoder"
1467 wmv3_decoder_select="vc1_decoder"
1468 wmv3_crystalhd_decoder_select="crystalhd"
1469 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
1470 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1471 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1472 wmv3image_decoder_select="wmv3_decoder"
1473 zlib_decoder_select="zlib"
1474 zlib_encoder_select="zlib"
1475 zmbv_decoder_select="zlib"
1476 zmbv_encoder_select="zlib"
1477
1478 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
1479 vaapi_deps="va_va_h"
1480 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1481
1482 # parsers
1483 h264_parser_select="golomb h264dsp h264pred"
1484
1485 # external libraries
1486 libcelt_decoder_deps="libcelt"
1487 libdirac_decoder_deps="libdirac !libschroedinger"
1488 libdirac_encoder_deps="libdirac"
1489 libfaac_encoder_deps="libfaac"
1490 libgsm_decoder_deps="libgsm"
1491 libgsm_encoder_deps="libgsm"
1492 libgsm_ms_decoder_deps="libgsm"
1493 libgsm_ms_encoder_deps="libgsm"
1494 libmp3lame_encoder_deps="libmp3lame"
1495 libopencore_amrnb_decoder_deps="libopencore_amrnb"
1496 libopencore_amrnb_encoder_deps="libopencore_amrnb"
1497 libopencore_amrwb_decoder_deps="libopencore_amrwb"
1498 libopenjpeg_decoder_deps="libopenjpeg"
1499 libschroedinger_decoder_deps="libschroedinger"
1500 libschroedinger_encoder_deps="libschroedinger"
1501 libspeex_decoder_deps="libspeex"
1502 libspeex_encoder_deps="libspeex"
1503 libstagefright_h264_decoder_deps="libstagefright_h264"
1504 libtheora_encoder_deps="libtheora"
1505 libvo_aacenc_encoder_deps="libvo_aacenc"
1506 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
1507 libvorbis_encoder_deps="libvorbis"
1508 libvpx_decoder_deps="libvpx"
1509 libvpx_encoder_deps="libvpx"
1510 libx264_encoder_deps="libx264"
1511 libxavs_encoder_deps="libxavs"
1512 libxvid_encoder_deps="libxvid"
1513
1514 # demuxers / muxers
1515 ac3_demuxer_select="ac3_parser"
1516 asf_stream_muxer_select="asf_muxer"
1517 avisynth_demuxer_deps="avisynth"
1518 dirac_demuxer_select="dirac_parser"
1519 eac3_demuxer_select="ac3_parser"
1520 flac_demuxer_select="flac_parser"
1521 ipod_muxer_select="mov_muxer"
1522 libnut_demuxer_deps="libnut"
1523 libnut_muxer_deps="libnut"
1524 matroska_audio_muxer_select="matroska_muxer"
1525 matroska_demuxer_suggest="zlib bzlib"
1526 mov_demuxer_suggest="zlib"
1527 mp3_demuxer_select="mpegaudio_parser"
1528 mp4_muxer_select="mov_muxer"
1529 mpegtsraw_demuxer_select="mpegts_demuxer"
1530 mxf_d10_muxer_select="mxf_muxer"
1531 ogg_demuxer_select="golomb"
1532 psp_muxer_select="mov_muxer"
1533 rtp_demuxer_select="sdp_demuxer"
1534 rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
1535 rtsp_demuxer_select="http_protocol rtpdec"
1536 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
1537 sap_demuxer_select="sdp_demuxer"
1538 sap_muxer_select="rtp_muxer rtp_protocol"
1539 sdp_demuxer_select="rtpdec"
1540 spdif_muxer_select="aac_parser"
1541 tg2_muxer_select="mov_muxer"
1542 tgp_muxer_select="mov_muxer"
1543 w64_demuxer_deps="wav_demuxer"
1544
1545 # indevs / outdevs
1546 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
1547 alsa_outdev_deps="alsa_asoundlib_h"
1548 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1549 dshow_indev_deps="IBaseFilter"
1550 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
1551 dv1394_indev_deps="dv1394 dv_demuxer"
1552 fbdev_indev_deps="linux_fb_h"
1553 jack_indev_deps="jack_jack_h sem_timedwait"
1554 lavfi_indev_deps="avfilter"
1555 libcdio_indev_deps="libcdio"
1556 libdc1394_indev_deps="libdc1394"
1557 openal_indev_deps="openal"
1558 oss_indev_deps_any="soundcard_h sys_soundcard_h"
1559 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
1560 sdl_outdev_deps="sdl"
1561 sndio_indev_deps="sndio_h"
1562 sndio_outdev_deps="sndio_h"
1563 v4l_indev_deps="linux_videodev_h"
1564 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
1565 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
1566 vfwcap_indev_extralibs="-lavicap32"
1567 x11_grab_device_indev_deps="x11grab XShmCreateImage"
1568 x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
1569
1570 # protocols
1571 gopher_protocol_deps="network"
1572 http_protocol_deps="network"
1573 http_protocol_select="tcp_protocol"
1574 mmsh_protocol_select="http_protocol"
1575 mmst_protocol_deps="network"
1576 rtmp_protocol_select="tcp_protocol"
1577 rtp_protocol_select="udp_protocol"
1578 tcp_protocol_deps="network"
1579 udp_protocol_deps="network"
1580
1581 # filters
1582 abuffer_filter_deps="strtok_r"
1583 aconvert_filter_deps="strtok_r"
1584 aformat_filter_deps="strtok_r"
1585 amovie_filter_deps="avcodec avformat"
1586 blackframe_filter_deps="gpl"
1587 boxblur_filter_deps="gpl"
1588 cropdetect_filter_deps="gpl"
1589 delogo_filter_deps="gpl"
1590 drawtext_filter_deps="libfreetype"
1591 frei0r_filter_deps="frei0r dlopen strtok_r"
1592 frei0r_src_filter_deps="frei0r dlopen strtok_r"
1593 hqdn3d_filter_deps="gpl"
1594 movie_filter_deps="avcodec avformat"
1595 mp_filter_deps="gpl avcodec"
1596 mptestsrc_filter_deps="gpl"
1597 negate_filter_deps="lut_filter"
1598 ocv_filter_deps="libopencv"
1599 scale_filter_deps="swscale"
1600 yadif_filter_deps="gpl"
1601
1602 # libraries
1603 avdevice_deps="avcodec avformat"
1604 avformat_deps="avcodec"
1605 postproc_deps="gpl"
1606
1607 # programs
1608 ffmpeg_deps="avcodec avformat swscale swresample"
1609 ffmpeg_select="buffer_filter buffersink_filter"
1610 avconv_deps="avcodec avformat swscale"
1611 avconv_select="buffer_filter"
1612 ffplay_deps="avcodec avformat swscale sdl"
1613 ffplay_select="buffersink_filter rdft"
1614 ffprobe_deps="avcodec avformat"
1615 ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
1616 ffserver_extralibs='$ldl'
1617
1618 doc_deps="texi2html"
1619
1620 # tests
1621
1622 test_deps(){
1623     suf1=$1
1624     suf2=$2
1625     shift 2
1626     for v; do
1627         dep=${v%=*}
1628         tests=${v#*=}
1629         for name in ${tests}; do
1630             eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'"
1631         done
1632     done
1633 }
1634
1635 test_deps _encoder _decoder                                             \
1636     adpcm_g726=g726                                                     \
1637     adpcm_ima_qt                                                        \
1638     adpcm_ima_wav                                                       \
1639     adpcm_ms                                                            \
1640     adpcm_swf                                                           \
1641     adpcm_yamaha=adpcm_yam                                              \
1642     alac                                                                \
1643     asv1                                                                \
1644     asv2                                                                \
1645     bmp                                                                 \
1646     dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd"                        \
1647     dvvideo="dv dv50"                                                   \
1648     ffv1                                                                \
1649     flac                                                                \
1650     flashsv                                                             \
1651     flv                                                                 \
1652     gif                                                                 \
1653     h261                                                                \
1654     h263="h263 h263p"                                                   \
1655     huffyuv                                                             \
1656     jpegls                                                              \
1657     mjpeg="jpg mjpeg ljpeg"                                             \
1658     mp2                                                                 \
1659     mpeg1video="mpeg mpeg1b"                                            \
1660     mpeg2video="mpeg2 mpeg2thread"                                      \
1661     mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc"                 \
1662     msmpeg4v3=msmpeg4                                                   \
1663     msmpeg4v2                                                           \
1664     pbm=pbmpipe                                                         \
1665     pcx                                                                 \
1666     pgm="pgm pgmpipe"                                                   \
1667     png                                                                 \
1668     ppm="ppm ppmpipe"                                                   \
1669     rawvideo="rgb yuv"                                                  \
1670     roq                                                                 \
1671     rv10                                                                \
1672     rv20                                                                \
1673     sgi                                                                 \
1674     snow="snow snowll"                                                  \
1675     svq1                                                                \
1676     targa=tga                                                           \
1677     tiff                                                                \
1678     wmav1                                                               \
1679     wmav2                                                               \
1680     wmv1                                                                \
1681     wmv2                                                                \
1682
1683 test_deps _muxer _demuxer                                               \
1684     aiff                                                                \
1685     pcm_alaw=alaw                                                       \
1686     asf                                                                 \
1687     au                                                                  \
1688     avi                                                                 \
1689     dv=dv_fmt                                                           \
1690     ffm                                                                 \
1691     flv=flv_fmt                                                         \
1692     gxf                                                                 \
1693     matroska=mkv                                                        \
1694     mmf                                                                 \
1695     mov                                                                 \
1696     pcm_mulaw=mulaw                                                     \
1697     mxf="mxf mxf_d10"                                                   \
1698     nut                                                                 \
1699     ogg                                                                 \
1700     rawvideo=pixfmt                                                     \
1701     rm                                                                  \
1702     swf                                                                 \
1703     mpegts=ts                                                           \
1704     voc                                                                 \
1705     wav                                                                 \
1706     yuv4mpegpipe=yuv4mpeg                                               \
1707
1708 ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
1709 mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
1710
1711 # default parameters
1712
1713 logfile="config.log"
1714
1715 # installation paths
1716 prefix_default="/usr/local"
1717 bindir_default='${prefix}/bin'
1718 datadir_default='${prefix}/share/ffmpeg'
1719 incdir_default='${prefix}/include'
1720 libdir_default='${prefix}/lib'
1721 mandir_default='${prefix}/share/man'
1722 shlibdir_default="$libdir_default"
1723
1724 # toolchain
1725 ar_default="ar"
1726 cc_default="gcc"
1727 cxx_default="g++"
1728 cc_version=\"unknown\"
1729 host_cc_default="gcc"
1730 install="install"
1731 ln_s="ln -sf"
1732 nm_default="nm"
1733 objformat="elf"
1734 pkg_config_default=pkg-config
1735 ranlib="ranlib"
1736 strip_default="strip"
1737 yasmexe="yasm"
1738 nogas=":"
1739
1740 nm_opts='-g'
1741
1742 # machine
1743 arch_default=$(uname -m)
1744 cpu="generic"
1745
1746 # OS
1747 target_os_default=$(tolower $(uname -s))
1748 host_os=$target_os_default
1749
1750 # configurable options
1751 enable avcodec
1752 enable avdevice
1753 enable avfilter
1754 enable avformat
1755 enable avutil
1756 enable asm
1757 enable debug
1758 enable doc
1759 enable fastdiv
1760 enable ffmpeg
1761 enable avconv
1762 enable ffplay
1763 enable ffprobe
1764 enable ffserver
1765 enable network
1766 enable optimizations
1767 enable postproc
1768 enable protocols
1769 enable static
1770 enable stripping
1771 enable swresample
1772 enable swscale
1773 enable swscale_alpha
1774
1775 # build settings
1776 SHFLAGS='-shared -Wl,-soname,$$(@F)'
1777 FFSERVERLDFLAGS=-Wl,-E
1778 LIBPREF="lib"
1779 LIBSUF=".a"
1780 FULLNAME='$(NAME)$(BUILDSUF)'
1781 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1782 SLIBPREF="lib"
1783 SLIBSUF=".so"
1784 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1785 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1786 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1787 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1788 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
1789 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
1790
1791 AS_O='-o $@'
1792 CC_O='-o $@'
1793 CXX_O='-o $@'
1794
1795 host_cflags='-D_ISOC99_SOURCE -O3 -g'
1796 host_libs='-lm'
1797
1798 target_path='$(CURDIR)'
1799
1800 # since the object filename is not given with the -MM flag, the compiler
1801 # is only able to print the basename, and we must add the path ourselves
1802 DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
1803 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
1804
1805 # find source path
1806 if test -f configure; then
1807     source_path=.
1808 else
1809     source_path=$(cd $(dirname "$0"); pwd)
1810     echo "$source_path" | grep -q '[[:blank:]]' &&
1811         die "Out of tree builds are impossible with whitespace in source path."
1812     test -e "$source_path/config.h" &&
1813         die "Out of tree builds are impossible with config.h in source dir."
1814 fi
1815
1816 for v in "$@"; do
1817     r=${v#*=}
1818     l=${v%"$r"}
1819     r=$(sh_quote "$r")
1820     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
1821 done
1822
1823 find_things(){
1824     thing=$1
1825     pattern=$2
1826     file=$source_path/$3
1827     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1828 }
1829
1830 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
1831 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
1832 HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
1833 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
1834 BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
1835 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
1836 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
1837 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
1838 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
1839 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1840 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
1841
1842 find_tests(){
1843     map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
1844 }
1845
1846 ACODEC_TESTS=$(find_tests acodec)
1847 VCODEC_TESTS=$(find_tests vsynth1)
1848 LAVF_TESTS=$(find_tests lavf)
1849 LAVFI_TESTS=$(find_tests lavfi)
1850 SEEK_TESTS=$(find_tests seek seek_)
1851
1852 pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
1853
1854 for n in $COMPONENT_LIST; do
1855     v=$(toupper ${n%s})_LIST
1856     eval enable \$$v
1857     eval ${n}_if_any="\$$v"
1858 done
1859
1860 enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
1861
1862 die_unknown(){
1863     echo "Unknown option \"$1\"."
1864     echo "See $0 --help for available options."
1865     exit 1
1866 }
1867
1868 show_list() {
1869     suffix=_$1
1870     shift
1871     echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
1872     exit 0
1873 }
1874
1875 for opt do
1876     optval="${opt#*=}"
1877     case "$opt" in
1878     --extra-ldflags=*) add_ldflags $optval
1879     ;;
1880     --extra-libs=*) add_extralibs $optval
1881     ;;
1882     --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1883     ;;
1884     --enable-debug=*) debuglevel="$optval"
1885     ;;
1886     --disable-everything)
1887     map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
1888     ;;
1889     --enable-*=*|--disable-*=*)
1890     eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1891     is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1892     eval list=\$$(toupper $thing)_LIST
1893     name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1894     $action $(filter "$name" $list)
1895     ;;
1896     --enable-?*|--disable-?*)
1897     eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1898     if is_in $option $COMPONENT_LIST; then
1899         test $action = disable && action=unset
1900         eval $action \$$(toupper ${option%s})_LIST
1901     elif is_in $option $CMDLINE_SELECT; then
1902         $action $option
1903     else
1904         die_unknown $opt
1905     fi
1906     ;;
1907     --list-*)
1908         NAME="${opt#--list-}"
1909         is_in $NAME $COMPONENT_LIST || die_unknown $opt
1910         NAME=${NAME%s}
1911         eval show_list $NAME \$$(toupper $NAME)_LIST
1912     ;;
1913     --help|-h) show_help
1914     ;;
1915     *)
1916     optname="${opt%%=*}"
1917     optname="${optname#--}"
1918     optname=$(echo "$optname" | sed 's/-/_/g')
1919     if is_in $optname $CMDLINE_SET; then
1920         eval $optname='$optval'
1921     elif is_in $optname $CMDLINE_APPEND; then
1922         append $optname "$optval"
1923     else
1924          die_unknown $opt
1925     fi
1926     ;;
1927     esac
1928 done
1929
1930 disabled logging && logfile=/dev/null
1931
1932 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
1933 set >> $logfile
1934
1935 test -n "$cross_prefix" && enable cross_compile
1936
1937 if enabled cross_compile; then
1938     test -n "$arch" && test -n "$target_os" ||
1939         die "Must specify target arch and OS when cross-compiling"
1940 fi
1941
1942 set_default arch target_os
1943
1944 ar_default="${cross_prefix}${ar_default}"
1945 cc_default="${cross_prefix}${cc_default}"
1946 cxx_default="${cross_prefix}${cxx_default}"
1947 nm_default="${cross_prefix}${nm_default}"
1948 pkg_config_default="${cross_prefix}${pkg_config_default}"
1949 ranlib="${cross_prefix}${ranlib}"
1950 strip_default="${cross_prefix}${strip_default}"
1951
1952 sysinclude_default="${sysroot}/usr/include"
1953
1954 set_default cc cxx nm pkg_config strip sysinclude
1955 enabled cross_compile || host_cc_default=$cc
1956 set_default host_cc
1957
1958 if ! $pkg_config --version >/dev/null 2>&1; then
1959     warn "$pkg_config not found, library detection may fail."
1960     pkg_config=false
1961 fi
1962
1963 exesuf() {
1964     case $1 in
1965         mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
1966     esac
1967 }
1968
1969 EXESUF=$(exesuf $target_os)
1970 HOSTEXESUF=$(exesuf $host_os)
1971
1972 # set temporary file name
1973 : ${TMPDIR:=$TEMPDIR}
1974 : ${TMPDIR:=$TMP}
1975 : ${TMPDIR:=/tmp}
1976
1977 if ! check_cmd mktemp -u XXXXXX; then
1978     # simple replacement for missing mktemp
1979     # NOT SAFE FOR GENERAL USE
1980     mktemp(){
1981         echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
1982     }
1983 fi
1984
1985 tmpfile(){
1986     tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1987         (set -C; exec > $tmp) 2>/dev/null ||
1988         die "Unable to create temporary file in $TMPDIR."
1989     append TMPFILES $tmp
1990     eval $1=$tmp
1991 }
1992
1993 trap 'rm -f -- $TMPFILES' EXIT
1994
1995 tmpfile TMPC  .c
1996 tmpfile TMPCPP .cpp
1997 tmpfile TMPE  $EXESUF
1998 tmpfile TMPH  .h
1999 tmpfile TMPO  .o
2000 tmpfile TMPS  .S
2001 tmpfile TMPV  .ver
2002 tmpfile TMPSH .sh
2003 tmpfile TMPASM .asm
2004
2005 unset -f mktemp
2006
2007 chmod +x $TMPE
2008
2009 # make sure we can execute files in $TMPDIR
2010 cat > $TMPSH 2>> $logfile <<EOF
2011 #! /bin/sh
2012 EOF
2013 chmod +x $TMPSH >> $logfile 2>&1
2014 if ! $TMPSH >> $logfile 2>&1; then
2015     cat <<EOF
2016 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
2017 variable to another directory and make sure that it is not mounted noexec.
2018 EOF
2019     die "Sanity test failed."
2020 fi
2021
2022 filter_cflags=echo
2023 filter_cppflags=echo
2024 filter_asflags=echo
2025
2026 if   $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
2027     cc_type=llvm_gcc
2028     cc_version=__VERSION__
2029     gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
2030     cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
2031     CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2032     AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2033     speed_cflags='-O3'
2034     size_cflags='-Os'
2035 elif $cc -v 2>&1 | grep -qi ^gcc; then
2036     cc_type=gcc
2037     cc_version=__VERSION__
2038     gcc_version=$($cc --version | head -n1)
2039     gcc_basever=$($cc -dumpversion)
2040     gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
2041     gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
2042     cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
2043     if ! $cc -dumpversion | grep -q '^2\.'; then
2044         CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2045         AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2046     fi
2047     speed_cflags='-O3'
2048     size_cflags='-Os'
2049 elif $cc --version 2>/dev/null | grep -q Intel; then
2050     cc_type=icc
2051     cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
2052     cc_ident=$($cc --version | head -n1)
2053     icc_version=$($cc -dumpversion)
2054     CC_DEPFLAGS='-MMD'
2055     AS_DEPFLAGS='-MMD'
2056     speed_cflags='-O3'
2057     size_cflags='-Os'
2058     noopt_cflags='-O1'
2059 elif $cc -v 2>&1 | grep -q xlc; then
2060     cc_type=xlc
2061     cc_version="AV_STRINGIFY(__IBMC__)"
2062     cc_ident=$($cc -qversion 2>/dev/null | head -n1)
2063     speed_cflags='-O5'
2064     size_cflags='-O5 -qcompact'
2065 elif $cc -V 2>/dev/null | grep -q Compaq; then
2066     cc_type=ccc
2067     cc_version="AV_STRINGIFY(__DECC_VER)"
2068     cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
2069     DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
2070     debuglevel=3
2071     add_ldflags -Wl,-z,now # calls to libots crash without this
2072     speed_cflags='-fast'
2073     size_cflags='-O1'
2074 elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
2075     test -d "$sysroot" || die "No valid sysroot specified."
2076     cc_type=armcc
2077     cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
2078     cc_ident=$($cc --vsn | head -n1)
2079     armcc_conf="$PWD/armcc.conf"
2080     $cc --arm_linux_configure                 \
2081         --arm_linux_config_file="$armcc_conf" \
2082         --configure_sysroot="$sysroot"        \
2083         --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
2084         die "Error creating armcc configuration file."
2085     $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
2086     cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
2087     as_default="${cross_prefix}gcc"
2088     CC_DEPFLAGS='-MMD'
2089     AS_DEPFLAGS='-MMD'
2090     speed_cflags='-O3'
2091     size_cflags='-Os'
2092     filter_asflags="filter_out -W${armcc_opt}*"
2093 elif $cc -version 2>/dev/null | grep -q TMS470; then
2094     cc_type=tms470
2095     cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
2096     cc_ident=$($cc -version | head -n1 | tr -s ' ')
2097     cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
2098     CC_O='-fr=$(@D)'
2099     as_default="${cross_prefix}gcc"
2100     ld_default="${cross_prefix}gcc"
2101     TMPO=$(basename $TMPC .c).o
2102     append TMPFILES $TMPO
2103     add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
2104     CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
2105     AS_DEPFLAGS='-MMD'
2106     speed_cflags='-O3 -mf=5'
2107     size_cflags='-O3 -mf=2'
2108     filter_cflags=tms470_flags
2109     tms470_flags(){
2110         for flag; do
2111             case $flag in
2112                 -march=*|-mcpu=*)
2113                     case "${flag#*=}" in
2114                         armv7-a|cortex-a*)      echo -mv=7a8 ;;
2115                         armv7-r|cortex-r*)      echo -mv=7r4 ;;
2116                         armv7-m|cortex-m*)      echo -mv=7m3 ;;
2117                         armv6*|arm11*)          echo -mv=6   ;;
2118                         armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
2119                                                 echo -mv=5e  ;;
2120                         armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
2121                     esac
2122                     ;;
2123                 -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
2124                 -mfpu=vfp)      echo --float_support=vfpv2        ;;
2125                 -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
2126                 -msoft-float)   echo --float_support=vfplib       ;;
2127                 -O[0-3]|-mf=*)  echo $flag                        ;;
2128                 -g)             echo -g -mn                       ;;
2129                 -pds=*)         echo $flag                        ;;
2130             esac
2131         done
2132     }
2133 elif $cc -v 2>&1 | grep -q clang; then
2134     cc_type=clang
2135     $cc -dM -E $TMPC | grep -q __clang_version__ &&
2136         cc_version=__clang_version__ || cc_version=__VERSION__
2137     cc_ident=$($cc --version | head -n1)
2138     CC_DEPFLAGS='-MMD'
2139     AS_DEPFLAGS='-MMD'
2140     speed_cflags='-O3'
2141     size_cflags='-Os'
2142 elif $cc -V 2>&1 | grep -q Sun; then
2143     cc_type=suncc
2144     cc_version="AV_STRINGIFY(__SUNPRO_C)"
2145     cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
2146     DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
2147     DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
2148     add_ldflags -xc99
2149     speed_cflags='-O5'
2150     size_cflags='-O5 -xspace'
2151     filter_cflags=suncc_flags
2152     suncc_flags(){
2153         for flag; do
2154             case $flag in
2155                 -march=*|-mcpu=*)
2156                     case "${flag#*=}" in
2157                         native)                   echo -xtarget=native       ;;
2158                         v9|niagara)               echo -xarch=sparc          ;;
2159                         ultrasparc)               echo -xarch=sparcvis       ;;
2160                         ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
2161                         i586|pentium)             echo -xchip=pentium        ;;
2162                         i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
2163                         pentium3*|c3-2)           echo -xtarget=pentium3     ;;
2164                         pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
2165                         pentium4*)          echo -xtarget=pentium4           ;;
2166                         prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
2167                         *-sse3)             echo -xarch=sse3                 ;;
2168                         core2)              echo -xarch=ssse3 -xchip=core2   ;;
2169                         amdfam10|barcelona)       echo -xarch=sse4_1         ;;
2170                         athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
2171                         k8|opteron|athlon64|athlon-fx)
2172                                                   echo -xarch=sse2a          ;;
2173                         athlon*)                  echo -xarch=pentium_proa   ;;
2174                     esac
2175                     ;;
2176                 -std=c99)             echo -xc99              ;;
2177                 -fomit-frame-pointer) echo -xregs=frameptr    ;;
2178                 -fPIC)                echo -KPIC -xcode=pic32 ;;
2179                 -W*,*)                echo $flag              ;;
2180                 -f*-*|-W*)                                    ;;
2181                 *)                    echo $flag              ;;
2182             esac
2183         done
2184     }
2185 elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
2186     cc_type=pathscale
2187     cc_version=__PATHSCALE__
2188     cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2189     CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2190     AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2191     speed_cflags='-O2'
2192     size_cflags='-Os'
2193     filter_cflags='filter_out -Wdisabled-optimization'
2194 elif $cc -v 2>&1 | grep -q Open64; then
2195     cc_type=open64
2196     cc_version=__OPEN64__
2197     cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2198     CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2199     AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2200     speed_cflags='-O2'
2201     size_cflags='-Os'
2202     filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
2203 fi
2204
2205 test -n "$cc_type" && enable $cc_type ||
2206     warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
2207
2208 : ${as_default:=$cc}
2209 : ${dep_cc_default:=$cc}
2210 : ${ld_default:=$cc}
2211 set_default ar as dep_cc ld
2212
2213 test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
2214 test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD
2215 test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
2216
2217 add_cflags $extra_cflags
2218 add_cxxflags $extra_cxxflags
2219 add_asflags $extra_cflags
2220
2221 if test -n "$sysroot"; then
2222     case "$cc_type" in
2223         gcc|llvm_gcc|clang)
2224             add_cppflags --sysroot="$sysroot"
2225             add_ldflags --sysroot="$sysroot"
2226         ;;
2227         tms470)
2228             add_cppflags -I"$sysinclude"
2229             add_ldflags  --sysroot="$sysroot"
2230         ;;
2231     esac
2232 fi
2233
2234 if test "$cpu" = host; then
2235     enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
2236
2237     case "$cc_type" in
2238         gcc|llvm_gcc)
2239             check_native(){
2240                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
2241                 sed -n "/cc1.*$1=/{
2242                             s/.*$1=\\([^ ]*\\).*/\\1/
2243                             p
2244                             q
2245                         }" $TMPE
2246             }
2247             cpu=$(check_native -march || check_native -mcpu)
2248         ;;
2249     esac
2250
2251     test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
2252 fi
2253
2254 # Deal with common $arch aliases
2255 case "$arch" in
2256     arm*)
2257         arch="arm"
2258     ;;
2259     mips|mipsel|IP*)
2260         arch="mips"
2261     ;;
2262     mips64*)
2263         arch="mips"
2264         subarch="mips64"
2265     ;;
2266     parisc|hppa)
2267         arch="parisc"
2268     ;;
2269     parisc64|hppa64)
2270         arch="parisc"
2271         subarch="parisc64"
2272     ;;
2273     "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
2274         arch="ppc"
2275     ;;
2276     s390|s390x)
2277         arch="s390"
2278     ;;
2279     sh4|sh)
2280         arch="sh4"
2281     ;;
2282     sun4u|sparc64)
2283         arch="sparc"
2284         subarch="sparc64"
2285     ;;
2286     i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
2287         arch="x86"
2288     ;;
2289 esac
2290
2291 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
2292 enable $arch
2293
2294 # Add processor-specific flags
2295 if test "$cpu" = generic; then
2296     : do nothing
2297 elif enabled ppc; then
2298
2299     case $(tolower $cpu) in
2300         601|ppc601|powerpc601)
2301             cpuflags="-mcpu=601"
2302             disable altivec
2303         ;;
2304         603*|ppc603*|powerpc603*)
2305             cpuflags="-mcpu=603"
2306             disable altivec
2307         ;;
2308         604*|ppc604*|powerpc604*)
2309             cpuflags="-mcpu=604"
2310             disable altivec
2311         ;;
2312         g3|75*|ppc75*|powerpc75*)
2313             cpuflags="-mcpu=750 -mpowerpc-gfxopt"
2314             disable altivec
2315         ;;
2316         g4|745*|ppc745*|powerpc745*)
2317             cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
2318         ;;
2319         74*|ppc74*|powerpc74*)
2320             cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
2321         ;;
2322         g5|970|ppc970|powerpc970|power4*)
2323             cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
2324         ;;
2325         cell)
2326             cpuflags="-mcpu=cell"
2327             enable ldbrx
2328         ;;
2329         e500v2)
2330             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
2331             disable altivec
2332         ;;
2333         e500)
2334             cpuflags="-mcpu=8540 -mhard-float"
2335             disable altivec
2336         ;;
2337     esac
2338
2339 elif enabled x86; then
2340
2341     case $cpu in
2342         i[345]86|pentium)
2343             cpuflags="-march=$cpu"
2344             disable mmx
2345         ;;
2346         # targets that do NOT support conditional mov (cmov)
2347         pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
2348             cpuflags="-march=$cpu"
2349             disable cmov
2350         ;;
2351         # targets that do support conditional mov (cmov)
2352         i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
2353             cpuflags="-march=$cpu"
2354             enable cmov
2355             enable fast_cmov
2356         ;;
2357         # targets that do support conditional mov but on which it's slow
2358         pentium4|pentium4m|prescott|nocona)
2359             cpuflags="-march=$cpu"
2360             enable cmov
2361             disable fast_cmov
2362         ;;
2363     esac
2364
2365 elif enabled sparc; then
2366
2367     case $cpu in
2368         niagara)
2369             cpuflags="-mcpu=$cpu"
2370             disable vis
2371         ;;
2372         sparc64)
2373             cpuflags="-mcpu=v9"
2374         ;;
2375     esac
2376
2377 elif enabled arm; then
2378
2379     case $cpu in
2380         armv*)
2381             cpuflags="-march=$cpu"
2382             subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
2383         ;;
2384         *)
2385             cpuflags="-mcpu=$cpu"
2386             case $cpu in
2387                 cortex-a*)                               subarch=armv7a  ;;
2388                 cortex-r*)                               subarch=armv7r  ;;
2389                 cortex-m*)                 enable thumb; subarch=armv7m  ;;
2390                 arm11*)                                  subarch=armv6   ;;
2391                 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
2392                 armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
2393             esac
2394         ;;
2395     esac
2396
2397 elif enabled alpha; then
2398
2399     enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
2400
2401 elif enabled bfin; then
2402
2403     cpuflags="-mcpu=$cpu"
2404
2405 elif enabled mips; then
2406
2407     cpuflags="-march=$cpu"
2408
2409 elif enabled avr32; then
2410
2411     case $cpu in
2412         ap7[02]0[0-2])
2413             subarch="avr32_ap"
2414             cpuflags="-mpart=$cpu"
2415         ;;
2416         ap)
2417             subarch="avr32_ap"
2418             cpuflags="-march=$cpu"
2419         ;;
2420         uc3[ab]*)
2421             subarch="avr32_uc"
2422             cpuflags="-mcpu=$cpu"
2423         ;;
2424         uc)
2425             subarch="avr32_uc"
2426             cpuflags="-march=$cpu"
2427         ;;
2428     esac
2429
2430 fi
2431
2432 add_cflags $cpuflags
2433 add_asflags $cpuflags
2434
2435 # compiler sanity check
2436 check_exec <<EOF
2437 int main(void){ return 0; }
2438 EOF
2439 if test "$?" != 0; then
2440     echo "$cc is unable to create an executable file."
2441     if test -z "$cross_prefix" && ! enabled cross_compile ; then
2442         echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
2443         echo "Only do this if you know what cross compiling means."
2444     fi
2445     die "C compiler test failed."
2446 fi
2447
2448 add_cppflags -D_ISOC99_SOURCE
2449 add_cxxflags -D__STDC_CONSTANT_MACROS
2450 check_cflags -std=c99
2451 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
2452 #include <stdlib.h>
2453 EOF
2454 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
2455 #include <stdlib.h>
2456 EOF
2457
2458 check_host_cflags -std=c99
2459 check_host_cflags -Wall
2460
2461 case "$arch" in
2462     alpha|ia64|mips|parisc|sparc)
2463         spic=$shared
2464     ;;
2465     x86)
2466         subarch="x86_32"
2467         check_cc <<EOF && subarch="x86_64"
2468         int test[(int)sizeof(char*) - 7];
2469 EOF
2470         if test "$subarch" = "x86_64"; then
2471             spic=$shared
2472         fi
2473     ;;
2474     ppc)
2475         check_cc <<EOF && subarch="ppc64"
2476         int test[(int)sizeof(char*) - 7];
2477 EOF
2478     ;;
2479 esac
2480
2481 enable $subarch
2482 enabled spic && enable pic
2483
2484 # OS specific
2485 case $target_os in
2486     haiku)
2487         prefix_default="/boot/common"
2488         network_extralibs="-lnetwork"
2489         host_libs=
2490         ;;
2491     sunos)
2492         FFSERVERLDFLAGS=""
2493         SHFLAGS='-shared -Wl,-h,$$(@F)'
2494         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
2495         network_extralibs="-lsocket -lnsl"
2496         add_cppflags -D__EXTENSIONS__
2497         nm_opts='-P -g'
2498         ;;
2499     netbsd)
2500         disable symver
2501         oss_indev_extralibs="-lossaudio"
2502         oss_outdev_extralibs="-lossaudio"
2503         ;;
2504     openbsd)
2505         enable malloc_aligned
2506         # On OpenBSD 4.5. the compiler does not use PIC unless
2507         # explicitly using -fPIC. FFmpeg builds fine without PIC,
2508         # however the generated executable will not do anything
2509         # (simply quits with exit-code 1, no crash, no output).
2510         # Thus explicitly enable PIC here.
2511         enable pic
2512         disable symver
2513         SHFLAGS='-shared'
2514         oss_indev_extralibs="-lossaudio"
2515         oss_outdev_extralibs="-lossaudio"
2516         ;;
2517     dragonfly)
2518         enable malloc_aligned
2519         disable symver
2520         ;;
2521     freebsd)
2522         enable malloc_aligned
2523         ;;
2524     bsd/os)
2525         add_extralibs -lpoll -lgnugetopt
2526         strip="strip -d"
2527         ;;
2528     darwin)
2529         enable malloc_aligned
2530         gas="gas-preprocessor.pl $cc"
2531         enabled ppc && add_asflags -force_cpusubtype_ALL
2532         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
2533         enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
2534         strip="${strip} -x"
2535         add_ldflags -Wl,-dynamic,-search_paths_first
2536         SLIBSUF=".dylib"
2537         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2538         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
2539         FFSERVERLDFLAGS=-Wl,-bind_at_load
2540         objformat="macho"
2541         enabled x86_64 && objformat="macho64"
2542         enabled_any pic shared ||
2543             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
2544         ;;
2545     mingw32*)
2546         if test $target_os = "mingw32ce"; then
2547             disable network
2548         else
2549             target_os=mingw32
2550         fi
2551         LIBTARGET=i386
2552         if enabled x86_64; then
2553             enable malloc_aligned
2554             LIBTARGET=x64
2555         elif enabled arm; then
2556             LIBTARGET=arm-wince
2557         fi
2558         shlibdir_default="$bindir_default"
2559         SLIBPREF=""
2560         SLIBSUF=".dll"
2561         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2562         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2563         SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
2564         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2565         SLIB_INSTALL_LINKS=
2566         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
2567         SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
2568         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'
2569         objformat="win32"
2570         enable dos_paths
2571         check_cflags -fno-common
2572         check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
2573                                       || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
2574                 die "ERROR: MinGW runtime version must be >= 3.15."
2575         add_cppflags -U__STRICT_ANSI__
2576         ;;
2577     cygwin*)
2578         target_os=cygwin
2579         shlibdir_default="$bindir_default"
2580         SLIBPREF="cyg"
2581         SLIBSUF=".dll"
2582         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2583         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2584         SHFLAGS='-shared -Wl,--enable-auto-image-base'
2585         objformat="win32"
2586         enable dos_paths
2587         check_cflags -fno-common
2588         add_cppflags -U__STRICT_ANSI__
2589         ;;
2590     *-dos|freedos|opendos)
2591         network_extralibs="-lsocket"
2592         objformat="coff"
2593         enable dos_paths
2594         add_cppflags -U__STRICT_ANSI__
2595         ;;
2596     linux)
2597         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2598         enable dv1394
2599         ;;
2600     irix*)
2601         target_os=irix
2602         ranlib="echo ignoring ranlib"
2603         ;;
2604     os/2*)
2605         strip="lxlite -CS"
2606         ln_s="cp -f"
2607         objformat="aout"
2608         add_cppflags -D_GNU_SOURCE
2609         add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
2610         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
2611         FFSERVERLDFLAGS=""
2612         LIBSUF="_s.a"
2613         SLIBPREF=""
2614         SLIBSUF=".dll"
2615         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2616         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
2617         SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2618           echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2619           echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2620           echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2621           echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2622           emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2623         SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2624           emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2625         SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
2626         enable dos_paths
2627         ;;
2628     gnu/kfreebsd)
2629         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
2630         ;;
2631     gnu)
2632         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2633         ;;
2634     qnx)
2635         add_cppflags -D_QNX_SOURCE
2636         network_extralibs="-lsocket"
2637         ;;
2638     symbian)
2639         SLIBSUF=".dll"
2640         enable dos_paths
2641         add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
2642         add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
2643         add_ldflags -Wl,--target1-abs,--no-undefined \
2644                     -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
2645                     -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
2646         add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
2647                       -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
2648                       -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
2649         ;;
2650     none)
2651         ;;
2652     *)
2653         die "Unknown OS '$target_os'."
2654         ;;
2655 esac
2656
2657 echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
2658
2659 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
2660
2661 set_default $PATHS_LIST
2662
2663 # we need to build at least one lib type
2664 if ! enabled_any static shared; then
2665     cat <<EOF
2666 At least one library type must be built.
2667 Specify --enable-static to build the static libraries or --enable-shared to
2668 build the shared libraries as well. To only build the shared libraries specify
2669 --disable-static in addition to --enable-shared.
2670 EOF
2671     exit 1;
2672 fi
2673
2674 die_license_disabled() {
2675     enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2676 }
2677
2678 die_license_disabled gpl libcdio
2679 die_license_disabled gpl libx264
2680 die_license_disabled gpl libxavs
2681 die_license_disabled gpl libxvid
2682 die_license_disabled gpl x11grab
2683
2684 die_license_disabled nonfree libfaac
2685
2686 die_license_disabled version3 libopencore_amrnb
2687 die_license_disabled version3 libopencore_amrwb
2688 die_license_disabled version3 libvo_aacenc
2689 die_license_disabled version3 libvo_amrwbenc
2690
2691 ! enabled gpl && enabled version2 && die "LGPLv2 mode is unsupported"
2692 enabled version3 && enabled version2 && ! enabled nonfree && die "GPLv2 (not v2+) and GPLv3 without --enable-nonfree"
2693
2694 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2695 enabled version2 && enabled gpl && enable gplv2
2696
2697 disabled optimizations || check_cflags -fomit-frame-pointer
2698
2699 enable_pic() {
2700     enable pic
2701     add_cppflags -DPIC
2702     add_cflags   -fPIC
2703     add_asflags  -fPIC
2704 }
2705
2706 enabled pic && enable_pic
2707
2708 check_cc <<EOF || die "Symbol mangling check failed."
2709 int ff_extern;
2710 EOF
2711 sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
2712 extern_prefix=${sym%%ff_extern*}
2713
2714 check_cc <<EOF && enable inline_asm
2715 void foo(void) { __asm__ volatile ("" ::); }
2716 EOF
2717
2718 _restrict=
2719 for restrict_keyword in restrict __restrict__ __restrict; do
2720     check_cc <<EOF && _restrict=$restrict_keyword && break
2721 void foo(char * $restrict_keyword p);
2722 EOF
2723 done
2724
2725 check_cc <<EOF && enable attribute_packed
2726 struct { int x; } __attribute__((packed)) x;
2727 EOF
2728
2729 check_cc <<EOF && enable attribute_may_alias
2730 union { int x; } __attribute__((may_alias)) x;
2731 EOF
2732
2733 check_cc <<EOF || die "endian test failed"
2734 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2735 EOF
2736 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
2737
2738 if enabled alpha; then
2739
2740     check_cflags -mieee
2741
2742 elif enabled arm; then
2743
2744     enabled thumb && check_cflags -mthumb || check_cflags -marm
2745     nogas=die
2746
2747     if     check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
2748         enable vfp_args
2749     elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
2750         case "${cross_prefix:-$cc}" in
2751             *hardfloat*)         enable vfp_args;   fpabi=vfp ;;
2752             *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
2753 __asm__ (".eabi_attribute 28, 1");
2754 int main(void) { return 0; }
2755 EOF
2756         esac
2757         warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
2758     fi
2759
2760     enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2761     enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
2762     enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2763     enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
2764     enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
2765     enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
2766     enabled vfpv3   && check_asm vfpv3   '"vmov.f32 s0, #1.0"'
2767
2768     enabled_all armv6t2 shared !pic && enable_pic
2769
2770 elif enabled mips; then
2771
2772     check_asm loongson '"dmult.g $1, $2, $3"'
2773     enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
2774
2775 elif enabled ppc; then
2776
2777     enable local_aligned_8 local_aligned_16
2778
2779     check_asm dcbzl     '"dcbzl 0, %0" :: "r"(0)'
2780     check_asm ibm_asm   '"add 0, 0, 0"'
2781     check_asm ppc4xx    '"maclhw r10, r11, r12"'
2782     check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2783
2784     # AltiVec flags: The FSF version of GCC differs from the Apple version
2785     if enabled altivec; then
2786         nogas=warn
2787         check_cflags -maltivec -mabi=altivec &&
2788         { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2789         check_cflags -faltivec
2790
2791         # check if our compiler supports Motorola AltiVec C API
2792         check_cc <<EOF || disable altivec
2793 $inc_altivec_h
2794 int main(void) {
2795     vector signed int v1, v2, v3;
2796     v1 = vec_add(v2,v3);
2797     return 0;
2798 }
2799 EOF
2800
2801         # check if our compiler supports braces for vector declarations
2802         check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2803 $inc_altivec_h
2804 int main (void) { (vector int) {1}; return 0; }
2805 EOF
2806     fi
2807
2808 elif enabled sparc; then
2809
2810     enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2811         add_cflags -mcpu=ultrasparc -mtune=ultrasparc
2812
2813 elif enabled x86; then
2814
2815     enable local_aligned_8 local_aligned_16
2816
2817     # check whether EBP is available on x86
2818     # As 'i' is stored on the stack, this program will crash
2819     # if the base pointer is used to access it because the
2820     # base pointer is cleared in the inline assembly code.
2821     check_exec_crash <<EOF && enable ebp_available
2822     volatile int i=0;
2823     __asm__ volatile (
2824         "xorl %%ebp, %%ebp"
2825     ::: "%ebp");
2826     return i;
2827 EOF
2828
2829     # check whether EBX is available on x86
2830     check_asm ebx_available '""::"b"(0)' &&
2831         check_asm ebx_available '"":::"%ebx"'
2832
2833     # check whether xmm clobbers are supported
2834     check_asm xmm_clobbers '"":::"%xmm0"'
2835
2836     # check whether binutils is new enough to compile SSSE3/MMX2
2837     enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
2838     enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
2839
2840     check_asm bswap '"bswap %%eax" ::: "%eax"'
2841
2842     if ! disabled_any asm mmx yasm; then
2843         if check_cmd $yasmexe --version; then
2844             enabled x86_64 && yasm_extra="-m amd64"
2845             yasm_debug="-g dwarf2"
2846         elif check_cmd nasm -v; then
2847             yasmexe=nasm
2848             yasm_debug="-g -F dwarf"
2849             enabled x86_64 && test "$objformat" = elf && objformat=elf64
2850         fi
2851
2852         YASMFLAGS="-f $objformat $yasm_extra"
2853         enabled pic               && append YASMFLAGS "-DPIC"
2854         test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
2855         case "$objformat" in
2856             elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
2857         esac
2858
2859         check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
2860             die "yasm not found, use --disable-yasm for a crippled build"
2861         check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
2862     fi
2863
2864     case "$cpu" in
2865         athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2866             disable fast_clz
2867         ;;
2868     esac
2869
2870 fi
2871
2872 if enabled asm; then
2873     as=${gas:=$as}
2874     check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
2875         $nogas "GNU assembler not found, install gas-preprocessor"
2876 fi
2877
2878 check_ldflags -Wl,--as-needed
2879
2880 if check_func dlopen; then
2881     ldl=
2882 elif check_func dlopen -ldl; then
2883     ldl=-ldl
2884 fi
2885
2886 if enabled network; then
2887     check_type "sys/types.h sys/socket.h" socklen_t
2888     check_type netdb.h "struct addrinfo"
2889     check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
2890     check_type netinet/in.h "struct sockaddr_in6"
2891     check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2892     check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2893     # Prefer arpa/inet.h over winsock2
2894     if check_header arpa/inet.h ; then
2895         check_func closesocket
2896     elif check_header winsock2.h ; then
2897         check_func_headers winsock2.h closesocket -lws2 && \
2898             network_extralibs="-lws2" || \
2899         { check_func_headers winsock2.h closesocket -lws2_32 && \
2900             network_extralibs="-lws2_32"; }
2901         check_type ws2tcpip.h socklen_t
2902         check_type ws2tcpip.h "struct addrinfo"
2903         check_type ws2tcpip.h "struct ipv6_mreq"
2904         check_type ws2tcpip.h "struct sockaddr_in6"
2905         check_type ws2tcpip.h "struct sockaddr_storage"
2906         check_struct winsock2.h "struct sockaddr" sa_len
2907     else
2908         disable network
2909     fi
2910 fi
2911
2912 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2913 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2914
2915 check_func  fcntl
2916 check_func  fork
2917 check_func  getaddrinfo $network_extralibs
2918 check_func  gethrtime
2919 check_func  getrusage
2920 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
2921 check_func  inet_aton $network_extralibs
2922 check_func  isatty
2923 check_func  localtime_r
2924 check_func  ${malloc_prefix}memalign            && enable memalign
2925 check_func  mkstemp
2926 check_func  mmap
2927 check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
2928 check_func  setrlimit
2929 check_func  strerror_r
2930 check_func  strptime
2931 check_func  strtok_r
2932 check_func_headers conio.h kbhit
2933 check_func_headers windows.h PeekNamedPipe
2934 check_func_headers io.h setmode
2935 check_func_headers lzo/lzo1x.h lzo1x_999_compress
2936 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
2937 check_func_headers windows.h GetProcessTimes
2938 check_func_headers windows.h MapViewOfFile
2939 check_func_headers windows.h VirtualAlloc
2940
2941 check_header dlfcn.h
2942 check_header dxva2api.h -D_WIN32_WINNT=0x0600
2943 check_header libcrystalhd/libcrystalhd_if.h
2944 check_header malloc.h
2945 check_header poll.h
2946 check_header sys/mman.h
2947 check_header sys/resource.h
2948 check_header sys/select.h
2949 check_header termios.h
2950 check_header vdpau/vdpau.h
2951 check_header vdpau/vdpau_x11.h
2952 check_header X11/extensions/XvMClib.h
2953
2954 disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
2955 disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
2956
2957 # check for some common methods of building with pthread support
2958 # do this before the optional library checks as some of them require pthreads
2959 if ! disabled pthreads && ! enabled w32threads; then
2960     enable pthreads
2961     if check_func pthread_create; then
2962         :
2963     elif check_func pthread_create -pthread; then
2964         add_cflags -pthread
2965         add_extralibs -pthread
2966     elif check_func pthread_create -pthreads; then
2967         add_cflags -pthreads
2968         add_extralibs -pthreads
2969     elif check_func pthread_create -lpthreadGC2; then
2970         add_extralibs -lpthreadGC2
2971     elif ! check_lib pthread.h pthread_create -lpthread; then
2972         disable pthreads
2973     fi
2974 fi
2975
2976 for thread in $THREADS_LIST; do
2977     if enabled $thread; then
2978         test -n "$thread_type" &&
2979             die "ERROR: Only one thread type must be selected." ||
2980             thread_type="$thread"
2981     fi
2982 done
2983
2984 check_lib math.h sin -lm && LIBM="-lm"
2985 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
2986 enabled vaapi && require vaapi va/va.h vaInitialize -lva
2987
2988 check_mathfunc exp2
2989 check_mathfunc exp2f
2990 check_mathfunc llrint
2991 check_mathfunc llrintf
2992 check_mathfunc log2
2993 check_mathfunc log2f
2994 check_mathfunc lrint
2995 check_mathfunc lrintf
2996 check_mathfunc round
2997 check_mathfunc roundf
2998 check_mathfunc trunc
2999 check_mathfunc truncf
3000
3001 # these are off by default, so fail if requested and not available
3002 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
3003 enabled libcelt    && require libcelt celt/celt.h celt_decode -lcelt0
3004 enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
3005 enabled libdc1394  && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
3006 enabled libdirac   && require_pkg_config dirac                          \
3007     "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h"  \
3008     "dirac_decoder_init dirac_encoder_init"
3009 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
3010 enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
3011 enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
3012 enabled libmp3lame && require  "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
3013 enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
3014 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
3015 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
3016 enabled libopencv  && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
3017 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
3018 enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
3019 enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
3020 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
3021 enabled libstagefright_h264  && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
3022     media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
3023     media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder
3024 enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
3025 enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
3026 enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
3027 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
3028 enabled libvpx     && {
3029     enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
3030                                 die "ERROR: libvpx decoder version must be >=0.9.1"; }
3031     enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
3032                                 die "ERROR: libvpx encoder version must be >=0.9.6"; } }
3033 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
3034                       { check_cpp_condition x264.h "X264_BUILD >= 115" ||
3035                         die "ERROR: libx264 version must be >= 0.115."; }
3036 enabled libxavs    && require  libxavs xavs.h xavs_encoder_encode -lxavs
3037 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
3038 enabled openal     && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
3039                         check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
3040                         die "ERROR: openal not found"; } &&
3041                       { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
3042                         die "ERROR: openal version must be 1.1 or compatible"; }
3043 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
3044
3045 SDL_CONFIG="${cross_prefix}sdl-config"
3046 if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
3047     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
3048     enable sdl &&
3049     check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
3050 else
3051   if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
3052     sdl_cflags=$("${SDL_CONFIG}" --cflags)
3053     sdl_libs=$("${SDL_CONFIG}" --libs)
3054     check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
3055     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
3056     enable sdl &&
3057     check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
3058   fi
3059 fi
3060 enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
3061
3062 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
3063
3064 check_header linux/fb.h
3065 check_header linux/videodev.h
3066 check_header linux/videodev2.h
3067 check_header sys/videoio.h
3068
3069 check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
3070 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
3071 # w32api 3.12 had it defined wrong
3072 check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
3073
3074 check_type "dshow.h" IBaseFilter
3075
3076 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
3077 { check_header dev/bktr/ioctl_meteor.h &&
3078   check_header dev/bktr/ioctl_bt848.h; } ||
3079 { check_header machine/ioctl_meteor.h &&
3080   check_header machine/ioctl_bt848.h; } ||
3081 { check_header dev/video/meteor/ioctl_meteor.h &&
3082   check_header dev/video/bktr/ioctl_bt848.h; } ||
3083 check_header dev/ic/bt8xx.h
3084
3085 check_header sndio.h
3086 if check_struct sys/soundcard.h audio_buf_info bytes; then
3087     enable_safe sys/soundcard.h
3088 else
3089     check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
3090     #include <sys/soundcard.h>
3091     audio_buf_info abc;
3092 EOF
3093 fi
3094 check_header soundcard.h
3095
3096 enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
3097
3098 enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
3099
3100 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
3101
3102 enabled libcdio &&
3103     check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
3104
3105 enabled x11grab                         &&
3106 check_header X11/Xlib.h                 &&
3107 check_header X11/extensions/XShm.h      &&
3108 check_header X11/extensions/Xfixes.h    &&
3109 check_func XOpenDisplay -lX11           &&
3110 check_func XShmCreateImage -lX11 -lXext &&
3111 check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
3112
3113 if ! disabled vaapi; then
3114     check_lib va/va.h vaInitialize -lva && {
3115         check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
3116         warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
3117     } || disable vaapi
3118 fi
3119
3120 if ! disabled vdpau && enabled vdpau_vdpau_h; then
3121 check_cpp_condition \
3122     vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
3123     { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
3124       disable vdpau; }
3125 fi
3126
3127 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
3128
3129 # add some useful compiler flags if supported
3130 check_cflags -Wdeclaration-after-statement
3131 check_cflags -Wall
3132 check_cflags -Wno-parentheses
3133 check_cflags -Wno-switch
3134 check_cflags -Wno-format-zero-length
3135 check_cflags -Wdisabled-optimization
3136 check_cflags -Wpointer-arith
3137 check_cflags -Wredundant-decls
3138 check_cflags -Wno-pointer-sign
3139 check_cflags -Wcast-qual
3140 check_cflags -Wwrite-strings
3141 check_cflags -Wtype-limits
3142 check_cflags -Wundef
3143 check_cflags -Wmissing-prototypes
3144 check_cflags -Wno-pointer-to-int-cast
3145 enabled extra_warnings && check_cflags -Winline
3146
3147 # add some linker flags
3148 check_ldflags -Wl,--warn-common
3149 check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
3150 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
3151
3152 echo "X{};" > $TMPV
3153 if test_ldflags -Wl,--version-script,$TMPV; then
3154     append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
3155     check_cc <<EOF && enable symver_asm_label
3156 void ff_foo(void) __asm__ ("av_foo@VERSION");
3157 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
3158 EOF
3159     check_cc <<EOF && enable symver_gnu_asm
3160 __asm__(".symver ff_foo,av_foo@VERSION");
3161 void ff_foo(void) {}
3162 EOF
3163 fi
3164
3165 if [ -n "$optflags" ]; then
3166     add_cflags $optflags
3167 elif enabled small; then
3168     add_cflags $size_cflags
3169 elif enabled optimizations; then
3170     add_cflags $speed_cflags
3171 else
3172     add_cflags $noopt_cflags
3173 fi
3174 check_cflags -fno-math-errno
3175 check_cflags -fno-signed-zeros
3176
3177 if enabled icc; then
3178     # Just warnings, no remarks
3179     check_cflags -w1
3180     # -wd: Disable following warnings
3181     # 144, 167, 556: -Wno-pointer-sign
3182     # 1292: attribute "foo" ignored
3183     # 10006: ignoring unknown option -fno-signed-zeros
3184     # 10148: ignoring unknown option -Wno-parentheses
3185     # 10156: ignoring option '-W'; no argument required
3186     check_cflags -wd144,167,556,1292,10006,10148,10156
3187     # 11030: Warning unknown option --as-needed
3188     # 10156: ignoring option '-export'; no argument required
3189     check_ldflags -wd10156,11030
3190     # Allow to compile with optimizations
3191     check_ldflags -march=$cpu
3192     # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
3193     enable ebp_available
3194     if enabled x86_32; then
3195         test ${icc_version%%.*} -ge 11 && \
3196             check_cflags -falign-stack=maintain-16-byte || \
3197             disable aligned_stack
3198     fi
3199 elif enabled ccc; then
3200     # disable some annoying warnings
3201     add_cflags -msg_disable cvtu32to64
3202     add_cflags -msg_disable embedcomment
3203     add_cflags -msg_disable needconstext
3204     add_cflags -msg_disable nomainieee
3205     add_cflags -msg_disable ptrmismatch1
3206     add_cflags -msg_disable unreachcode
3207 elif enabled gcc; then
3208     check_cflags -fno-tree-vectorize
3209     check_cflags -Werror=implicit-function-declaration
3210     check_cflags -Werror=missing-prototypes
3211 elif enabled llvm_gcc; then
3212     check_cflags -mllvm -stack-alignment=16
3213 elif enabled clang; then
3214     check_cflags -mllvm -stack-alignment=16
3215     check_cflags -Qunused-arguments
3216 elif enabled armcc; then
3217     # 2523: use of inline assembler is deprecated
3218     add_cflags -W${armcc_opt},--diag_suppress=2523
3219     add_cflags -W${armcc_opt},--diag_suppress=1207
3220     add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
3221     add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
3222     add_cflags -W${armcc_opt},--diag_suppress=167  # pointer sign
3223     add_cflags -W${armcc_opt},--diag_suppress=513  # pointer sign
3224 elif enabled tms470; then
3225     add_cflags -pds=824 -pds=837
3226 elif enabled pathscale; then
3227     add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
3228 fi
3229
3230 enabled_any $THREADS_LIST      && enable threads
3231
3232 check_deps $CONFIG_LIST       \
3233            $CONFIG_EXTRA      \
3234            $HAVE_LIST         \
3235            $DECODER_LIST      \
3236            $ENCODER_LIST      \
3237            $HWACCEL_LIST      \
3238            $PARSER_LIST       \
3239            $BSF_LIST          \
3240            $DEMUXER_LIST      \
3241            $MUXER_LIST        \
3242            $FILTER_LIST       \
3243            $INDEV_LIST        \
3244            $OUTDEV_LIST       \
3245            $PROTOCOL_LIST     \
3246            $ACODEC_TESTS      \
3247            $VCODEC_TESTS      \
3248            $LAVF_TESTS        \
3249            $LAVFI_TESTS       \
3250            $SEEK_TESTS        \
3251
3252 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
3253
3254 if test $target_os == "haiku"; then
3255     disable memalign
3256     disable posix_memalign
3257 fi
3258
3259 ! enabled_any memalign posix_memalign malloc_aligned &&
3260     enabled_any $need_memalign && enable memalign_hack
3261
3262 echo "install prefix            $prefix"
3263 echo "source path               $source_path"
3264 echo "C compiler                $cc"
3265 echo "ARCH                      $arch ($cpu)"
3266 if test "$build_suffix" != ""; then
3267     echo "build suffix              $build_suffix"
3268 fi
3269 if test "$progs_suffix" != ""; then
3270     echo "progs suffix              $progs_suffix"
3271 fi
3272 if test "$extra_version" != ""; then
3273     echo "version string suffix     $extra_version"
3274 fi
3275 echo "big-endian                ${bigendian-no}"
3276 echo "runtime cpu detection     ${runtime_cpudetect-no}"
3277 if enabled x86; then
3278     echo "${yasmexe}                      ${yasm-no}"
3279     echo "MMX enabled               ${mmx-no}"
3280     echo "MMX2 enabled              ${mmx2-no}"
3281     echo "3DNow! enabled            ${amd3dnow-no}"
3282     echo "3DNow! extended enabled   ${amd3dnowext-no}"
3283     echo "SSE enabled               ${sse-no}"
3284     echo "SSSE3 enabled             ${ssse3-no}"
3285     echo "AVX enabled               ${avx-no}"
3286     echo "CMOV enabled              ${cmov-no}"
3287     echo "CMOV is fast              ${fast_cmov-no}"
3288     echo "EBX available             ${ebx_available-no}"
3289     echo "EBP available             ${ebp_available-no}"
3290 fi
3291 if enabled arm; then
3292     echo "ARMv5TE enabled           ${armv5te-no}"
3293     echo "ARMv6 enabled             ${armv6-no}"
3294     echo "ARMv6T2 enabled           ${armv6t2-no}"
3295     echo "ARM VFP enabled           ${armvfp-no}"
3296     echo "IWMMXT enabled            ${iwmmxt-no}"
3297     echo "NEON enabled              ${neon-no}"
3298 fi
3299 if enabled mips; then
3300     echo "MMI enabled               ${mmi-no}"
3301 fi
3302 if enabled ppc; then
3303     echo "AltiVec enabled           ${altivec-no}"
3304     echo "PPC 4xx optimizations     ${ppc4xx-no}"
3305     echo "dcbzl available           ${dcbzl-no}"
3306 fi
3307 if enabled sparc; then
3308     echo "VIS enabled               ${vis-no}"
3309 fi
3310 echo "debug symbols             ${debug-no}"
3311 echo "strip symbols             ${stripping-no}"
3312 echo "optimize for size         ${small-no}"
3313 echo "optimizations             ${optimizations-no}"
3314 echo "static                    ${static-no}"
3315 echo "shared                    ${shared-no}"
3316 echo "postprocessing support    ${postproc-no}"
3317 echo "new filter support        ${avfilter-no}"
3318 echo "network support           ${network-no}"
3319 echo "threading support         ${thread_type-no}"
3320 echo "SDL support               ${sdl-no}"
3321 echo "Sun medialib support      ${mlib-no}"
3322 echo "libdxva2 enabled          ${dxva2-no}"
3323 echo "libva enabled             ${vaapi-no}"
3324 echo "libvdpau enabled          ${vdpau-no}"
3325 echo "AVISynth enabled          ${avisynth-no}"
3326 echo "libcelt enabled           ${libcelt-no}"
3327 echo "frei0r enabled            ${frei0r-no}"
3328 echo "libcdio support           ${libcdio-no}"
3329 echo "libdc1394 support         ${libdc1394-no}"
3330 echo "libdirac enabled          ${libdirac-no}"
3331 echo "libfaac enabled           ${libfaac-no}"
3332 echo "libgsm enabled            ${libgsm-no}"
3333 echo "libmp3lame enabled        ${libmp3lame-no}"
3334 echo "libnut enabled            ${libnut-no}"
3335 echo "libopencore-amrnb support ${libopencore_amrnb-no}"
3336 echo "libopencore-amrwb support ${libopencore_amrwb-no}"
3337 echo "libopencv support         ${libopencv-no}"
3338 echo "libopenjpeg enabled       ${libopenjpeg-no}"
3339 echo "librtmp enabled           ${librtmp-no}"
3340 echo "libschroedinger enabled   ${libschroedinger-no}"
3341 echo "libspeex enabled          ${libspeex-no}"
3342 echo "libstagefright-h264 enabled    ${libstagefright_h264-no}"
3343 echo "libtheora enabled         ${libtheora-no}"
3344 echo "libvo-aacenc support      ${libvo_aacenc-no}"
3345 echo "libvo-amrwbenc support    ${libvo_amrwbenc-no}"
3346 echo "libvorbis enabled         ${libvorbis-no}"
3347 echo "libvpx enabled            ${libvpx-no}"
3348 echo "libx264 enabled           ${libx264-no}"
3349 echo "libxavs enabled           ${libxavs-no}"
3350 echo "libxvid enabled           ${libxvid-no}"
3351 echo "openal enabled            ${openal-no}"
3352 echo "zlib enabled              ${zlib-no}"
3353 echo "bzlib enabled             ${bzlib-no}"
3354 echo
3355
3356 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
3357     echo "Enabled ${type}s:"
3358     eval list=\$$(toupper $type)_LIST
3359     print_enabled '_*' $list | sort | pr -r -3 -t
3360     echo
3361 done
3362
3363 license="LGPL version 2.1 or later"
3364 if enabled nonfree; then
3365     license="nonfree and unredistributable"
3366 elif enabled gplv3; then
3367     license="GPL version 3 or later"
3368 elif enabled gplv2; then
3369     license="GPL version 2"
3370 elif enabled lgplv3; then
3371     license="LGPL version 3 or later"
3372 elif enabled gpl; then
3373     license="GPL version 2 or later"
3374 fi
3375
3376 echo "License: $license"
3377
3378 echo "Creating config.mak and config.h..."
3379
3380 test -e Makefile || $ln_s "$source_path/Makefile" .
3381
3382 enabled stripping || strip="echo skipping strip"
3383
3384 config_files="$TMPH config.mak"
3385
3386 cat > config.mak <<EOF
3387 # Automatically generated by configure - do not modify!
3388 ifndef FFMPEG_CONFIG_MAK
3389 FFMPEG_CONFIG_MAK=1
3390 FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
3391 prefix=$prefix
3392 LIBDIR=\$(DESTDIR)$libdir
3393 SHLIBDIR=\$(DESTDIR)$shlibdir
3394 INCDIR=\$(DESTDIR)$incdir
3395 BINDIR=\$(DESTDIR)$bindir
3396 DATADIR=\$(DESTDIR)$datadir
3397 MANDIR=\$(DESTDIR)$mandir
3398 SRC_PATH=$source_path
3399 ifndef MAIN_MAKEFILE
3400 SRC_PATH:=\$(SRC_PATH:.%=..%)
3401 endif
3402 CC_IDENT=$cc_ident
3403 ARCH=$arch
3404 CC=$cc
3405 CXX=$cxx
3406 AS=$as
3407 LD=$ld
3408 DEPCC=$dep_cc
3409 YASM=$yasmexe
3410 YASMDEP=$yasmexe
3411 AR=$ar
3412 RANLIB=$ranlib
3413 CP=cp -p
3414 LN_S=$ln_s
3415 STRIP=$strip
3416 CPPFLAGS=$CPPFLAGS
3417 CFLAGS=$CFLAGS
3418 CXXFLAGS=$CXXFLAGS
3419 ASFLAGS=$ASFLAGS
3420 AS_O=$CC_O
3421 CC_O=$CC_O
3422 CXX_O=$CXX_O
3423 LDFLAGS=$LDFLAGS
3424 FFSERVERLDFLAGS=$FFSERVERLDFLAGS
3425 SHFLAGS=$SHFLAGS
3426 YASMFLAGS=$YASMFLAGS
3427 BUILDSUF=$build_suffix
3428 PROGSSUF=$progs_suffix
3429 FULLNAME=$FULLNAME
3430 LIBPREF=$LIBPREF
3431 LIBSUF=$LIBSUF
3432 LIBNAME=$LIBNAME
3433 SLIBPREF=$SLIBPREF
3434 SLIBSUF=$SLIBSUF
3435 EXESUF=$EXESUF
3436 EXTRA_VERSION=$extra_version
3437 DEPFLAGS=$DEPFLAGS
3438 CCDEP=$CCDEP
3439 CXXDEP=$CXXDEP
3440 ASDEP=$ASDEP
3441 CC_DEPFLAGS=$CC_DEPFLAGS
3442 AS_DEPFLAGS=$AS_DEPFLAGS
3443 HOSTCC=$host_cc
3444 HOSTCFLAGS=$host_cflags
3445 HOSTEXESUF=$HOSTEXESUF
3446 HOSTLDFLAGS=$host_ldflags
3447 HOSTLIBS=$host_libs
3448 TARGET_EXEC=$target_exec
3449 TARGET_PATH=$target_path
3450 SDL_LIBS=$sdl_libs
3451 SDL_CFLAGS=$sdl_cflags
3452 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
3453 EXTRALIBS=$extralibs
3454 INSTALL=$install
3455 LIBTARGET=${LIBTARGET}
3456 SLIBNAME=${SLIBNAME}
3457 SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
3458 SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
3459 SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
3460 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
3461 SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
3462 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
3463 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
3464 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
3465 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
3466 EOF
3467
3468 get_version(){
3469     name=$1
3470     file=$source_path/$2
3471     eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
3472     eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
3473     lcname=$(tolower $name)
3474     eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
3475     eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
3476 }
3477
3478 get_version LIBSWSCALE  libswscale/swscale.h
3479 get_version LIBSWRESAMPLE libswresample/swresample.h
3480 get_version LIBPOSTPROC libpostproc/postprocess.h
3481 get_version LIBAVCODEC  libavcodec/version.h
3482 get_version LIBAVDEVICE libavdevice/avdevice.h
3483 get_version LIBAVFORMAT libavformat/version.h
3484 get_version LIBAVUTIL   libavutil/avutil.h
3485 get_version LIBAVFILTER libavfilter/avfilter.h
3486
3487 cat > $TMPH <<EOF
3488 /* Automatically generated by configure - do not modify! */
3489 #ifndef FFMPEG_CONFIG_H
3490 #define FFMPEG_CONFIG_H
3491 #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
3492 #define FFMPEG_LICENSE "$(c_escape $license)"
3493 #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
3494 #define AVCONV_DATADIR "$(eval c_escape $datadir)"
3495 #define CC_TYPE "$cc_type"
3496 #define CC_VERSION $cc_version
3497 #define restrict $_restrict
3498 #define EXTERN_PREFIX "${extern_prefix}"
3499 #define EXTERN_ASM ${extern_prefix}
3500 #define SLIBSUF "$SLIBSUF"
3501 EOF
3502
3503 test -n "$malloc_prefix" &&
3504     echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
3505
3506 if enabled small || disabled optimizations; then
3507     echo "#undef  av_always_inline"  >> $TMPH
3508     if enabled small; then
3509         echo "#define av_always_inline inline"  >> $TMPH
3510     else
3511         echo "#define av_always_inline av_unused"  >> $TMPH
3512     fi
3513 fi
3514
3515 if enabled yasm; then
3516     append config_files $TMPASM
3517     printf '' >$TMPASM
3518 fi
3519
3520 print_config ARCH_   "$config_files" $ARCH_LIST
3521 print_config HAVE_   "$config_files" $HAVE_LIST
3522 print_config CONFIG_ "$config_files" $CONFIG_LIST       \
3523                                      $CONFIG_EXTRA      \
3524                                      $DECODER_LIST      \
3525                                      $ENCODER_LIST      \
3526                                      $HWACCEL_LIST      \
3527                                      $PARSER_LIST       \
3528                                      $BSF_LIST          \
3529                                      $DEMUXER_LIST      \
3530                                      $MUXER_LIST        \
3531                                      $FILTER_LIST       \
3532                                      $PROTOCOL_LIST     \
3533                                      $INDEV_LIST        \
3534                                      $OUTDEV_LIST       \
3535
3536 cat >>config.mak <<EOF
3537 ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
3538 VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
3539 LAVF_TESTS=$(print_enabled   -n _test $LAVF_TESTS)
3540 LAVFI_TESTS=$(print_enabled  -n _test $LAVFI_TESTS)
3541 SEEK_TESTS=$(print_enabled   -n _test $SEEK_TESTS)
3542 EOF
3543
3544 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
3545 echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
3546
3547 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
3548 cp_if_changed $TMPH config.h
3549 touch .config
3550
3551 enabled yasm && cp_if_changed $TMPASM config.asm
3552
3553 cat > $TMPH <<EOF
3554 /* Generated by ffconf */
3555 #ifndef AVUTIL_AVCONFIG_H
3556 #define AVUTIL_AVCONFIG_H
3557 EOF
3558
3559 print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
3560
3561 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
3562
3563 cp_if_changed $TMPH libavutil/avconfig.h
3564
3565 test -n "$WARNINGS" && printf "\n$WARNINGS"
3566
3567 # build pkg-config files
3568
3569 pkgconfig_generate(){
3570 name=$1
3571 shortname=${name#lib}${build_suffix}
3572 comment=$2
3573 version=$3
3574 libs=$4
3575 requires=$5
3576 enabled ${name#lib} || return 0
3577 mkdir -p $name
3578 cat <<EOF > $name/$name.pc
3579 prefix=$prefix
3580 exec_prefix=\${prefix}
3581 libdir=$libdir
3582 includedir=$incdir
3583
3584 Name: $name
3585 Description: $comment
3586 Version: $version
3587 Requires: $(enabled shared || echo $requires)
3588 Requires.private: $(enabled shared && echo $requires)
3589 Conflicts:
3590 Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
3591 Libs.private: $(enabled shared && echo $libs)
3592 Cflags: -I\${includedir}
3593 EOF
3594 cat <<EOF > $name/$name-uninstalled.pc
3595 prefix=
3596 exec_prefix=
3597 libdir=\${pcfiledir}
3598 includedir=${source_path}
3599
3600 Name: $name
3601 Description: $comment
3602 Version: $version
3603 Requires: $requires
3604 Conflicts:
3605 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
3606 Cflags: -I\${includedir}
3607 EOF
3608 }
3609
3610 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
3611 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
3612 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
3613 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
3614 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
3615 pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
3616 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
3617 pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"