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