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