avfilter/waveform: use AV_OPT_TYPE_BOOL for mirror option
[ffmpeg.git] / configure
1 #!/bin/sh
2 #
3 # FFmpeg configure script
4 #
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
8 #
9
10 # Prevent locale nonsense from breaking basic text processing.
11 LC_ALL=C
12 export LC_ALL
13
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
16
17 try_exec(){
18     echo "Trying shell $1"
19     type "$1" > /dev/null 2>&1 && exec "$@"
20 }
21
22 unset foo
23 (: ${foo%%bar}) 2> /dev/null
24 E1="$?"
25
26 (: ${foo?}) 2> /dev/null
27 E2="$?"
28
29 if test "$E1" != 0 || test "$E2" = 0; then
30     echo "Broken shell detected.  Trying alternatives."
31     export FF_CONF_EXEC
32     if test "0$FF_CONF_EXEC" -lt 1; then
33         FF_CONF_EXEC=1
34         try_exec bash "$0" "$@"
35     fi
36     if test "0$FF_CONF_EXEC" -lt 2; then
37         FF_CONF_EXEC=2
38         try_exec ksh "$0" "$@"
39     fi
40     if test "0$FF_CONF_EXEC" -lt 3; then
41         FF_CONF_EXEC=3
42         try_exec /usr/xpg4/bin/sh "$0" "$@"
43     fi
44     echo "No compatible shell script interpreter found."
45     echo "This configure script requires a POSIX-compatible shell"
46     echo "such as bash or ksh."
47     echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
48     echo "Instead, install a working POSIX-compatible shell."
49     echo "Disabling this configure test will create a broken FFmpeg."
50     if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51         echo "This bash version ($BASH_VERSION) is broken on your platform."
52         echo "Upgrade to a later version if available."
53     fi
54     exit 1
55 fi
56
57 test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
58
59 show_help(){
60     cat <<EOF
61 Usage: configure [options]
62 Options: [defaults in brackets after descriptions]
63
64 Help options:
65   --help                   print this message
66   --list-decoders          show all available decoders
67   --list-encoders          show all available encoders
68   --list-hwaccels          show all available hardware accelerators
69   --list-demuxers          show all available demuxers
70   --list-muxers            show all available muxers
71   --list-parsers           show all available parsers
72   --list-protocols         show all available protocols
73   --list-bsfs              show all available bitstream filters
74   --list-indevs            show all available input devices
75   --list-outdevs           show all available output devices
76   --list-filters           show all available filters
77
78 Standard options:
79   --logfile=FILE           log tests and output to FILE [config.log]
80   --disable-logging        do not log configure debug information
81   --fatal-warnings         fail if any configure warning is generated
82   --prefix=PREFIX          install in PREFIX [$prefix]
83   --bindir=DIR             install binaries in DIR [PREFIX/bin]
84   --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
85   --docdir=DIR             install documentation in DIR [PREFIX/share/doc/ffmpeg]
86   --libdir=DIR             install libs in DIR [PREFIX/lib]
87   --shlibdir=DIR           install shared libs in DIR [LIBDIR]
88   --incdir=DIR             install includes in DIR [PREFIX/include]
89   --mandir=DIR             install man page in DIR [PREFIX/share/man]
90   --pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]
91   --enable-rpath           use rpath to allow installing libraries in paths
92                            not part of the dynamic linker search path
93                            use rpath when linking programs [USE WITH CARE]
94
95 Licensing options:
96   --enable-gpl             allow use of GPL code, the resulting libs
97                            and binaries will be under GPL [no]
98   --enable-version3        upgrade (L)GPL to version 3 [no]
99   --enable-nonfree         allow use of nonfree code, the resulting libs
100                            and binaries will be unredistributable [no]
101
102 Configuration options:
103   --disable-static         do not build static libraries [no]
104   --enable-shared          build shared libraries [no]
105   --enable-small           optimize for size instead of speed
106   --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
107   --enable-gray            enable full grayscale support (slower color)
108   --disable-swscale-alpha  disable alpha channel support in swscale
109   --disable-all            disable building components, libraries and programs
110   --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no]
111   --enable-raise-major     increase major version numbers in sonames [no]
112
113 Program options:
114   --disable-programs       do not build command line programs
115   --disable-ffmpeg         disable ffmpeg build
116   --disable-ffplay         disable ffplay build
117   --disable-ffprobe        disable ffprobe build
118   --disable-ffserver       disable ffserver build
119
120 Documentation options:
121   --disable-doc            do not build documentation
122   --disable-htmlpages      do not build HTML documentation pages
123   --disable-manpages       do not build man documentation pages
124   --disable-podpages       do not build POD documentation pages
125   --disable-txtpages       do not build text documentation pages
126
127 Component options:
128   --disable-avdevice       disable libavdevice build
129   --disable-avcodec        disable libavcodec build
130   --disable-avformat       disable libavformat build
131   --disable-avutil         disable libavutil build
132   --disable-swresample     disable libswresample build
133   --disable-swscale        disable libswscale build
134   --disable-postproc       disable libpostproc build
135   --disable-avfilter       disable libavfilter build
136   --enable-avresample      enable libavresample build [no]
137   --disable-pthreads       disable pthreads [autodetect]
138   --disable-w32threads     disable Win32 threads [autodetect]
139   --disable-os2threads     disable OS/2 threads [autodetect]
140   --disable-network        disable network support [no]
141   --disable-dct            disable DCT code
142   --disable-dwt            disable DWT code
143   --disable-error-resilience disable error resilience code
144   --disable-lsp            disable LSP code
145   --disable-lzo            disable LZO decoder code
146   --disable-mdct           disable MDCT code
147   --disable-rdft           disable RDFT code
148   --disable-fft            disable FFT code
149   --disable-faan           disable floating point AAN (I)DCT code
150   --disable-pixelutils     disable pixel utils in libavutil
151
152 Hardware accelerators:
153   --disable-d3d11va        disable D3D11VA code [autodetect]
154   --disable-dxva2          disable DXVA2 code [autodetect]
155   --disable-vaapi          disable VAAPI code [autodetect]
156   --disable-vda            disable VDA code [autodetect]
157   --disable-vdpau          disable VDPAU code [autodetect]
158   --enable-videotoolbox    enable VideoToolbox code [autodetect]
159
160 Individual component options:
161   --disable-everything     disable all components listed below
162   --disable-encoder=NAME   disable encoder NAME
163   --enable-encoder=NAME    enable encoder NAME
164   --disable-encoders       disable all encoders
165   --disable-decoder=NAME   disable decoder NAME
166   --enable-decoder=NAME    enable decoder NAME
167   --disable-decoders       disable all decoders
168   --disable-hwaccel=NAME   disable hwaccel NAME
169   --enable-hwaccel=NAME    enable hwaccel NAME
170   --disable-hwaccels       disable all hwaccels
171   --disable-muxer=NAME     disable muxer NAME
172   --enable-muxer=NAME      enable muxer NAME
173   --disable-muxers         disable all muxers
174   --disable-demuxer=NAME   disable demuxer NAME
175   --enable-demuxer=NAME    enable demuxer NAME
176   --disable-demuxers       disable all demuxers
177   --enable-parser=NAME     enable parser NAME
178   --disable-parser=NAME    disable parser NAME
179   --disable-parsers        disable all parsers
180   --enable-bsf=NAME        enable bitstream filter NAME
181   --disable-bsf=NAME       disable bitstream filter NAME
182   --disable-bsfs           disable all bitstream filters
183   --enable-protocol=NAME   enable protocol NAME
184   --disable-protocol=NAME  disable protocol NAME
185   --disable-protocols      disable all protocols
186   --enable-indev=NAME      enable input device NAME
187   --disable-indev=NAME     disable input device NAME
188   --disable-indevs         disable input devices
189   --enable-outdev=NAME     enable output device NAME
190   --disable-outdev=NAME    disable output device NAME
191   --disable-outdevs        disable output devices
192   --disable-devices        disable all devices
193   --enable-filter=NAME     enable filter NAME
194   --disable-filter=NAME    disable filter NAME
195   --disable-filters        disable all filters
196
197 External library support:
198   --enable-avisynth        enable reading of AviSynth script files [no]
199   --disable-bzlib          disable bzlib [autodetect]
200   --enable-fontconfig      enable fontconfig, useful for drawtext filter [no]
201   --enable-frei0r          enable frei0r video filtering [no]
202   --enable-gnutls          enable gnutls, needed for https support
203                            if openssl is not used [no]
204   --disable-iconv          disable iconv [autodetect]
205   --enable-ladspa          enable LADSPA audio filtering [no]
206   --enable-libaacplus      enable AAC+ encoding via libaacplus [no]
207   --enable-libass          enable libass subtitles rendering,
208                            needed for subtitles and ass filter [no]
209   --enable-libbluray       enable BluRay reading using libbluray [no]
210   --enable-libbs2b         enable bs2b DSP library [no]
211   --enable-libcaca         enable textual display using libcaca [no]
212   --enable-libcelt         enable CELT decoding via libcelt [no]
213   --enable-libcdio         enable audio CD grabbing with libcdio [no]
214   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
215                            and libraw1394 [no]
216   --enable-libdcadec       enable DCA decoding via libdcadec [no]
217   --enable-libfaac         enable AAC encoding via libfaac [no]
218   --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
219   --enable-libflite        enable flite (voice synthesis) support via libflite [no]
220   --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
221   --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
222   --enable-libgme          enable Game Music Emu via libgme [no]
223   --enable-libgsm          enable GSM de/encoding via libgsm [no]
224   --enable-libiec61883     enable iec61883 via libiec61883 [no]
225   --enable-libilbc         enable iLBC de/encoding via libilbc [no]
226   --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
227   --enable-libmfx          enable HW acceleration through libmfx
228   --enable-libmodplug      enable ModPlug via libmodplug [no]
229   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
230   --enable-libnut          enable NUT (de)muxing via libnut,
231                            native (de)muxer exists [no]
232   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
233   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
234   --enable-libopencv       enable video filtering via libopencv [no]
235   --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
236   --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
237   --enable-libopus         enable Opus de/encoding via libopus [no]
238   --enable-libpulse        enable Pulseaudio input via libpulse [no]
239   --enable-libquvi         enable quvi input via libquvi [no]
240   --enable-librtmp         enable RTMP[E] support via librtmp [no]
241   --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
242   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
243   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
244   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
245   --enable-libsoxr         enable Include libsoxr resampling [no]
246   --enable-libspeex        enable Speex de/encoding via libspeex [no]
247   --enable-libssh          enable SFTP protocol via libssh [no]
248   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
249   --enable-libtheora       enable Theora encoding via libtheora [no]
250   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
251   --enable-libutvideo      enable Ut Video encoding and decoding via libutvideo [no]
252   --enable-libv4l2         enable libv4l2/v4l-utils [no]
253   --enable-libvidstab      enable video stabilization using vid.stab [no]
254   --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
255   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
256   --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
257                            native implementation exists [no]
258   --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
259   --enable-libwavpack      enable wavpack encoding via libwavpack [no]
260   --enable-libwebp         enable WebP encoding via libwebp [no]
261   --enable-libx264         enable H.264 encoding via x264 [no]
262   --enable-libx265         enable HEVC encoding via x265 [no]
263   --enable-libxavs         enable AVS encoding via xavs [no]
264   --enable-libxcb          enable X11 grabbing using XCB [autodetect]
265   --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
266   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
267   --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
268   --enable-libxvid         enable Xvid encoding via xvidcore,
269                            native MPEG-4/Xvid encoder exists [no]
270   --enable-libzmq          enable message passing via libzmq [no]
271   --enable-libzvbi         enable teletext support via libzvbi [no]
272   --disable-lzma           disable lzma [autodetect]
273   --enable-decklink        enable Blackmagick DeckLink I/O support [no]
274   --enable-mmal            enable decoding via MMAL [no]
275   --enable-nvenc           enable NVIDIA NVENC support [no]
276   --enable-openal          enable OpenAL 1.1 capture support [no]
277   --enable-opencl          enable OpenCL code
278   --enable-opengl          enable OpenGL rendering [no]
279   --enable-openssl         enable openssl, needed for https support
280                            if gnutls is not used [no]
281   --disable-sdl            disable sdl [autodetect]
282   --disable-securetransport disable Secure Transport, needed for TLS support
283                            on OSX if openssl and gnutls are not used [autodetect]
284   --enable-x11grab         enable X11 grabbing (legacy) [no]
285   --disable-xlib           disable xlib [autodetect]
286   --disable-zlib           disable zlib [autodetect]
287
288 Toolchain options:
289   --arch=ARCH              select architecture [$arch]
290   --cpu=CPU                select the minimum required CPU (affects
291                            instruction selection, may crash on older CPUs)
292   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
293   --progs-suffix=SUFFIX    program name suffix []
294   --enable-cross-compile   assume a cross-compiler is used
295   --sysroot=PATH           root of cross-build tree
296   --sysinclude=PATH        location of cross-build system headers
297   --target-os=OS           compiler targets OS [$target_os]
298   --target-exec=CMD        command to run executables on target
299   --target-path=DIR        path to view of build directory on target
300   --target-samples=DIR     path to samples directory on target
301   --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
302   --toolchain=NAME         set tool defaults according to NAME
303   --nm=NM                  use nm tool NM [$nm_default]
304   --ar=AR                  use archive tool AR [$ar_default]
305   --as=AS                  use assembler AS [$as_default]
306   --windres=WINDRES        use windows resource compiler WINDRES [$windres_default]
307   --yasmexe=EXE            use yasm-compatible assembler EXE [$yasmexe_default]
308   --cc=CC                  use C compiler CC [$cc_default]
309   --cxx=CXX                use C compiler CXX [$cxx_default]
310   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
311   --ld=LD                  use linker LD [$ld_default]
312   --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [$pkg_config_default]
313   --pkg-config-flags=FLAGS pass additional flags to pkgconf []
314   --ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]
315   --doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]
316   --host-cc=HOSTCC         use host C compiler HOSTCC
317   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
318   --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
319   --host-ld=HOSTLD         use host linker HOSTLD
320   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
321   --host-libs=HLIBS        use libs HLIBS when linking for host
322   --host-os=OS             compiler host OS [$target_os]
323   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
324   --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
325   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
326   --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
327   --extra-ldlibflags=ELDFLAGS add ELDFLAGS to LDLIBFLAGS [$LDLIBFLAGS]
328   --extra-libs=ELIBS       add ELIBS [$ELIBS]
329   --extra-version=STRING   version string suffix []
330   --optflags=OPTFLAGS      override optimization-related compiler flags
331   --build-suffix=SUFFIX    library name suffix []
332   --enable-pic             build position-independent code
333   --enable-thumb           compile for Thumb instruction set
334   --enable-lto             use link-time optimization
335   --env="ENV=override"     override the environment variables
336
337 Advanced options (experts only):
338   --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
339   --disable-symver         disable symbol versioning
340   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
341   --disable-safe-bitstream-reader
342                            disable buffer boundary checking in bitreaders
343                            (faster, but may crash)
344   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
345   --sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]
346
347 Optimization options (experts only):
348   --disable-asm            disable all assembly optimizations
349   --disable-altivec        disable AltiVec optimizations
350   --disable-vsx            disable VSX optimizations
351   --disable-power8         disable POWER8 optimizations
352   --disable-amd3dnow       disable 3DNow! optimizations
353   --disable-amd3dnowext    disable 3DNow! extended optimizations
354   --disable-mmx            disable MMX optimizations
355   --disable-mmxext         disable MMXEXT optimizations
356   --disable-sse            disable SSE optimizations
357   --disable-sse2           disable SSE2 optimizations
358   --disable-sse3           disable SSE3 optimizations
359   --disable-ssse3          disable SSSE3 optimizations
360   --disable-sse4           disable SSE4 optimizations
361   --disable-sse42          disable SSE4.2 optimizations
362   --disable-avx            disable AVX optimizations
363   --disable-xop            disable XOP optimizations
364   --disable-fma3           disable FMA3 optimizations
365   --disable-fma4           disable FMA4 optimizations
366   --disable-avx2           disable AVX2 optimizations
367   --disable-armv5te        disable armv5te optimizations
368   --disable-armv6          disable armv6 optimizations
369   --disable-armv6t2        disable armv6t2 optimizations
370   --disable-vfp            disable VFP optimizations
371   --disable-neon           disable NEON optimizations
372   --disable-inline-asm     disable use of inline assembly
373   --disable-yasm           disable use of nasm/yasm assembly
374   --disable-mips32r5       disable MIPS32R5 optimizations
375   --disable-mips64r6       disable MIPS64R6 optimizations
376   --disable-mipsdspr1      disable MIPS DSP ASE R1 optimizations
377   --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
378   --disable-msa            disable MSA optimizations
379   --disable-mipsfpu        disable floating point MIPS optimizations
380   --disable-mmi            disable Loongson SIMD optimizations
381   --disable-fast-unaligned consider unaligned accesses slow
382
383 Developer options (useful when working on FFmpeg itself):
384   --disable-debug          disable debugging symbols
385   --enable-debug=LEVEL     set the debug level [$debuglevel]
386   --disable-optimizations  disable compiler optimizations
387   --enable-extra-warnings  enable more compiler warnings
388   --disable-stripping      disable stripping of executables and shared libraries
389   --assert-level=level     0(default), 1 or 2, amount of assertion testing,
390                            2 causes a slowdown at runtime.
391   --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
392   --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
393                            leaks and errors, using the specified valgrind binary.
394                            Cannot be combined with --target-exec
395   --enable-ftrapv          Trap arithmetic overflows
396   --samples=PATH           location of test samples for FATE, if not set use
397                            \$FATE_SAMPLES at make invocation time.
398   --enable-neon-clobber-test check NEON registers for clobbering (should be
399                            used only for debugging purposes)
400   --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
401                            should be used only for debugging purposes)
402   --enable-random          randomly enable/disable components
403   --disable-random
404   --enable-random=LIST     randomly enable/disable specific components or
405   --disable-random=LIST    component groups. LIST is a comma-separated list
406                            of NAME[:PROB] entries where NAME is a component
407                            (group) and PROB the probability associated with
408                            NAME (default 0.5).
409   --random-seed=VALUE      seed value for --enable/disable-random
410   --disable-valgrind-backtrace do not print a backtrace under Valgrind
411                            (only applies to --disable-optimizations builds)
412
413 NOTE: Object files are built at the place where configure is launched.
414 EOF
415   exit 0
416 }
417
418 quotes='""'
419 if test -t 1 && which tput >/dev/null; then
420     ncolors=$(tput colors)
421     if test -n "$ncolors" && test $ncolors -ge 8; then
422         bold_color=$(tput bold)
423         warn_color=$(tput setaf 3)
424         reset_color=$(tput sgr0)
425     fi
426 fi
427
428 log(){
429     echo "$@" >> $logfile
430 }
431
432 log_file(){
433     log BEGIN $1
434     pr -n -t $1 >> $logfile
435     log END $1
436 }
437
438 echolog(){
439     log "$@"
440     echo "$@"
441 }
442
443 warn(){
444     log "WARNING: $*"
445     WARNINGS="${WARNINGS}WARNING: $*\n"
446 }
447
448 die(){
449     echolog "$@"
450     cat <<EOF
451
452 If you think configure made a mistake, make sure you are using the latest
453 version from Git.  If the latest version fails, report the problem to the
454 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
455 EOF
456     if disabled logging; then
457         cat <<EOF
458 Rerun configure with logging enabled (do not use --disable-logging), and
459 include the log this produces with your report.
460 EOF
461     else
462         cat <<EOF
463 Include the log file "$logfile" produced by configure as this will help
464 solve the problem.
465 EOF
466     fi
467     exit 1
468 }
469
470 # Avoid locale weirdness, besides we really just want to translate ASCII.
471 toupper(){
472     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
473 }
474
475 tolower(){
476     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
477 }
478
479 c_escape(){
480     echo "$*" | sed 's/["\\]/\\\0/g'
481 }
482
483 sh_quote(){
484     v=$(echo "$1" | sed "s/'/'\\\\''/g")
485     test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
486     echo "$v"
487 }
488
489 cleanws(){
490     echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
491 }
492
493 filter(){
494     pat=$1
495     shift
496     for v; do
497         eval "case $v in $pat) echo $v ;; esac"
498     done
499 }
500
501 filter_out(){
502     pat=$1
503     shift
504     for v; do
505         eval "case $v in $pat) ;; *) echo $v ;; esac"
506     done
507 }
508
509 map(){
510     m=$1
511     shift
512     for v; do eval $m; done
513 }
514
515 add_suffix(){
516     suffix=$1
517     shift
518     for v; do echo ${v}${suffix}; done
519 }
520
521 set_all(){
522     value=$1
523     shift
524     for var in $*; do
525         eval $var=$value
526     done
527 }
528
529 set_weak(){
530     value=$1
531     shift
532     for var; do
533         eval : \${$var:=$value}
534     done
535 }
536
537 sanitize_var_name(){
538     echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
539 }
540
541 set_safe(){
542     var=$1
543     shift
544     eval $(sanitize_var_name "$var")='$*'
545 }
546
547 get_safe(){
548     eval echo \$$(sanitize_var_name "$1")
549 }
550
551 pushvar(){
552     for pvar in $*; do
553         eval level=\${${pvar}_level:=0}
554         eval ${pvar}_${level}="\$$pvar"
555         eval ${pvar}_level=$(($level+1))
556     done
557 }
558
559 popvar(){
560     for pvar in $*; do
561         eval level=\${${pvar}_level:-0}
562         test $level = 0 && continue
563         eval level=$(($level-1))
564         eval $pvar="\${${pvar}_${level}}"
565         eval ${pvar}_level=$level
566         eval unset ${pvar}_${level}
567     done
568 }
569
570 enable(){
571     set_all yes $*
572 }
573
574 disable(){
575     set_all no $*
576 }
577
578 enable_weak(){
579     set_weak yes $*
580 }
581
582 disable_weak(){
583     set_weak no $*
584 }
585
586 enable_safe(){
587     for var; do
588         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
589     done
590 }
591
592 disable_safe(){
593     for var; do
594         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
595     done
596 }
597
598 do_enable_deep(){
599     for var; do
600         enabled $var && continue
601         eval sel="\$${var}_select"
602         eval sgs="\$${var}_suggest"
603         pushvar var sgs
604         enable_deep $sel
605         popvar sgs
606         enable_deep_weak $sgs
607         popvar var
608     done
609 }
610
611 enable_deep(){
612     do_enable_deep $*
613     enable $*
614 }
615
616 enable_deep_weak(){
617     for var; do
618         disabled $var && continue
619         pushvar var
620         do_enable_deep $var
621         popvar var
622         enable_weak $var
623     done
624 }
625
626 enabled(){
627     test "${1#!}" = "$1" && op== || op=!=
628     eval test "x\$${1#!}" $op "xyes"
629 }
630
631 disabled(){
632     test "${1#!}" = "$1" && op== || op=!=
633     eval test "x\$${1#!}" $op "xno"
634 }
635
636 enabled_all(){
637     for opt; do
638         enabled $opt || return 1
639     done
640 }
641
642 disabled_all(){
643     for opt; do
644         disabled $opt || return 1
645     done
646 }
647
648 enabled_any(){
649     for opt; do
650         enabled $opt && return 0
651     done
652 }
653
654 disabled_any(){
655     for opt; do
656         disabled $opt && return 0
657     done
658     return 1
659 }
660
661 set_default(){
662     for opt; do
663         eval : \${$opt:=\$${opt}_default}
664     done
665 }
666
667 is_in(){
668     value=$1
669     shift
670     for var in $*; do
671         [ $var = $value ] && return 0
672     done
673     return 1
674 }
675
676 do_check_deps(){
677     for cfg; do
678         cfg="${cfg#!}"
679         enabled ${cfg}_checking && die "Circular dependency for $cfg."
680         disabled ${cfg}_checking && continue
681         enable ${cfg}_checking
682         append allopts $cfg
683
684         eval dep_all="\$${cfg}_deps"
685         eval dep_any="\$${cfg}_deps_any"
686         eval dep_sel="\$${cfg}_select"
687         eval dep_sgs="\$${cfg}_suggest"
688         eval dep_ifa="\$${cfg}_if"
689         eval dep_ifn="\$${cfg}_if_any"
690
691         pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
692         do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
693         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
694
695         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
696         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
697         enabled_all  $dep_all || disable $cfg
698         enabled_any  $dep_any || disable $cfg
699         disabled_any $dep_sel && disable $cfg
700
701         if enabled $cfg; then
702             enable_deep $dep_sel
703             enable_deep_weak $dep_sgs
704         fi
705
706         disable ${cfg}_checking
707     done
708 }
709
710 check_deps(){
711     unset allopts
712
713     do_check_deps "$@"
714
715     for cfg in $allopts; do
716         enabled $cfg || continue
717         eval dep_extralibs="\$${cfg}_extralibs"
718         test -n "$dep_extralibs" && add_extralibs $dep_extralibs
719     done
720 }
721
722 print_config(){
723     pfx=$1
724     files=$2
725     shift 2
726     map 'eval echo "$v \${$v:-no}"' "$@" |
727     awk "BEGIN { split(\"$files\", files) }
728         {
729             c = \"$pfx\" toupper(\$1);
730             v = \$2;
731             sub(/yes/, 1, v);
732             sub(/no/,  0, v);
733             for (f in files) {
734                 file = files[f];
735                 if (file ~ /\\.h\$/) {
736                     printf(\"#define %s %d\\n\", c, v) >>file;
737                 } else if (file ~ /\\.asm\$/) {
738                     printf(\"%%define %s %d\\n\", c, v) >>file;
739                 } else if (file ~ /\\.mak\$/) {
740                     n = -v ? \"\" : \"!\";
741                     printf(\"%s%s=yes\\n\", n, c) >>file;
742                 } else if (file ~ /\\.texi\$/) {
743                     pre = -v ? \"\" : \"@c \";
744                     yesno = \$2;
745                     c2 = tolower(c);
746                     gsub(/_/, \"-\", c2);
747                     printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
748                 }
749             }
750         }"
751 }
752
753 print_enabled(){
754     suf=$1
755     shift
756     for v; do
757         enabled $v && printf "%s\n" ${v%$suf};
758     done
759 }
760
761 append(){
762     var=$1
763     shift
764     eval "$var=\"\$$var $*\""
765 }
766
767 prepend(){
768     var=$1
769     shift
770     eval "$var=\"$* \$$var\""
771 }
772
773 unique(){
774     var=$1
775     uniq_list=""
776     for tok in $(eval echo \$$var); do
777         uniq_list="$(filter_out $tok $uniq_list) $tok"
778     done
779     eval "$var=\"${uniq_list}\""
780 }
781
782 add_cppflags(){
783     append CPPFLAGS "$@"
784 }
785
786 add_cflags(){
787     append CFLAGS $($cflags_filter "$@")
788 }
789
790 add_cxxflags(){
791     append CXXFLAGS $($cflags_filter "$@")
792 }
793
794 add_asflags(){
795     append ASFLAGS $($asflags_filter "$@")
796 }
797
798 add_ldflags(){
799     append LDFLAGS $($ldflags_filter "$@")
800 }
801
802 add_ldexeflags(){
803     append LDEXEFLAGS $($ldflags_filter "$@")
804 }
805
806 add_ldlibflags(){
807     append LDLIBFLAGS $($ldflags_filter "$@")
808 }
809
810 add_stripflags(){
811     append ASMSTRIPFLAGS "$@"
812 }
813
814 add_extralibs(){
815     prepend extralibs $($ldflags_filter "$@")
816 }
817
818 add_host_cppflags(){
819     append host_cppflags "$@"
820 }
821
822 add_host_cflags(){
823     append host_cflags $($host_cflags_filter "$@")
824 }
825
826 add_host_ldflags(){
827     append host_ldflags $($host_ldflags_filter "$@")
828 }
829
830 add_compat(){
831     append compat_objs $1
832     shift
833     map 'add_cppflags -D$v' "$@"
834 }
835
836 check_cmd(){
837     log "$@"
838     "$@" >> $logfile 2>&1
839 }
840
841 check_stat(){
842     log check_stat "$@"
843     stat "$1" >> $logfile 2>&1
844 }
845
846 cc_o(){
847     eval printf '%s\\n' $CC_O
848 }
849
850 cc_e(){
851     eval printf '%s\\n' $CC_E
852 }
853
854 check_cc(){
855     log check_cc "$@"
856     cat > $TMPC
857     log_file $TMPC
858     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
859 }
860
861 check_cxx(){
862     log check_cxx "$@"
863     cat > $TMPCPP
864     log_file $TMPCPP
865     check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
866 }
867
868 check_oc(){
869     log check_oc "$@"
870     cat > $TMPM
871     log_file $TMPM
872     check_cmd $cc -Werror=missing-prototypes $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPM
873 }
874
875 check_cpp(){
876     log check_cpp "$@"
877     cat > $TMPC
878     log_file $TMPC
879     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
880 }
881
882 as_o(){
883     eval printf '%s\\n' $AS_O
884 }
885
886 check_as(){
887     log check_as "$@"
888     cat > $TMPS
889     log_file $TMPS
890     check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
891 }
892
893 check_inline_asm(){
894     log check_inline_asm "$@"
895     name="$1"
896     code="$2"
897     shift 2
898     disable $name
899     check_cc "$@" <<EOF && enable $name
900 void foo(void){ __asm__ volatile($code); }
901 EOF
902 }
903
904 check_insn(){
905     log check_insn "$@"
906     check_inline_asm ${1}_inline "\"$2\""
907     echo "$2" | check_as && enable ${1}_external || disable ${1}_external
908 }
909
910 check_yasm(){
911     log check_yasm "$@"
912     echo "$1" > $TMPS
913     log_file $TMPS
914     shift 1
915     check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
916 }
917
918 ld_o(){
919     eval printf '%s\\n' $LD_O
920 }
921
922 check_ld(){
923     log check_ld "$@"
924     type=$1
925     shift 1
926     flags=$(filter_out '-l*|*.so' $@)
927     libs=$(filter '-l*|*.so' $@)
928     check_$type $($cflags_filter $flags) || return
929     flags=$($ldflags_filter $flags)
930     libs=$($ldflags_filter $libs)
931     check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
932 }
933
934 print_include(){
935     hdr=$1
936     test "${hdr%.h}" = "${hdr}" &&
937         echo "#include $hdr"    ||
938         echo "#include <$hdr>"
939 }
940
941 check_code(){
942     log check_code "$@"
943     check=$1
944     headers=$2
945     code=$3
946     shift 3
947     {
948         for hdr in $headers; do
949             print_include $hdr
950         done
951         echo "int main(void) { $code; return 0; }"
952     } | check_$check "$@"
953 }
954
955 check_cppflags(){
956     log check_cppflags "$@"
957     check_cc "$@" <<EOF && append CPPFLAGS "$@"
958 int x;
959 EOF
960 }
961
962 test_cflags(){
963     log test_cflags "$@"
964     set -- $($cflags_filter "$@")
965     check_cc "$@" <<EOF
966 int x;
967 EOF
968 }
969
970 check_cflags(){
971     log check_cflags "$@"
972     test_cflags "$@" && add_cflags "$@"
973 }
974
975 check_cxxflags(){
976     log check_cxxflags "$@"
977     set -- $($cflags_filter "$@")
978     check_cxx "$@" <<EOF && append CXXFLAGS "$@"
979 int x;
980 EOF
981 }
982
983 test_ldflags(){
984     log test_ldflags "$@"
985     check_ld "cc" "$@" <<EOF
986 int main(void){ return 0; }
987 EOF
988 }
989
990 check_ldflags(){
991     log check_ldflags "$@"
992     test_ldflags "$@" && add_ldflags "$@"
993 }
994
995 test_stripflags(){
996     log test_stripflags "$@"
997     # call check_cc to get a fresh TMPO
998     check_cc <<EOF
999 int main(void) { return 0; }
1000 EOF
1001     check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
1002 }
1003
1004 check_stripflags(){
1005     log check_stripflags "$@"
1006     test_stripflags "$@" && add_stripflags "$@"
1007 }
1008
1009 check_header(){
1010     log check_header "$@"
1011     header=$1
1012     shift
1013     disable_safe $header
1014     check_cpp "$@" <<EOF && enable_safe $header
1015 #include <$header>
1016 int x;
1017 EOF
1018 }
1019
1020 check_header_oc(){
1021     log check_header_oc "$@"
1022     rm -f -- "$TMPO"
1023     header=$1
1024     shift
1025     disable_safe $header
1026     {
1027        echo "#include <$header>"
1028        echo "int main(void) { return 0; }"
1029     } | check_oc && check_stat "$TMPO" && enable_safe $headers
1030 }
1031
1032 check_func(){
1033     log check_func "$@"
1034     func=$1
1035     shift
1036     disable $func
1037     check_ld "cc" "$@" <<EOF && enable $func
1038 extern int $func();
1039 int main(void){ $func(); }
1040 EOF
1041 }
1042
1043 check_mathfunc(){
1044     log check_mathfunc "$@"
1045     func=$1
1046     narg=$2
1047     shift 2
1048     test $narg = 2 && args="f, g" || args="f"
1049     disable $func
1050     check_ld "cc" "$@" <<EOF && enable $func
1051 #include <math.h>
1052 float foo(float f, float g) { return $func($args); }
1053 int main(void){ return (int) foo; }
1054 EOF
1055 }
1056
1057 check_func_headers(){
1058     log check_func_headers "$@"
1059     headers=$1
1060     funcs=$2
1061     shift 2
1062     {
1063         for hdr in $headers; do
1064             print_include $hdr
1065         done
1066         for func in $funcs; do
1067             echo "long check_$func(void) { return (long) $func; }"
1068         done
1069         echo "int main(void) { return 0; }"
1070     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
1071 }
1072
1073 check_class_headers_cpp(){
1074     log check_class_headers_cpp "$@"
1075     headers=$1
1076     classes=$2
1077     shift 2
1078     {
1079         for hdr in $headers; do
1080             echo "#include <$hdr>"
1081         done
1082         echo "int main(void) { "
1083         i=1
1084         for class in $classes; do
1085             echo "$class obj$i;"
1086             i=$(expr $i + 1)
1087         done
1088         echo "return 0; }"
1089     } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
1090 }
1091
1092 check_cpp_condition(){
1093     log check_cpp_condition "$@"
1094     header=$1
1095     condition=$2
1096     shift 2
1097     check_cpp "$@" <<EOF
1098 #include <$header>
1099 #if !($condition)
1100 #error "unsatisfied condition: $condition"
1101 #endif
1102 EOF
1103 }
1104
1105 check_lib(){
1106     log check_lib "$@"
1107     header="$1"
1108     func="$2"
1109     shift 2
1110     check_header $header && check_func $func "$@" && add_extralibs "$@"
1111 }
1112
1113 check_lib2(){
1114     log check_lib2 "$@"
1115     headers="$1"
1116     funcs="$2"
1117     shift 2
1118     check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
1119 }
1120
1121 check_lib_cpp(){
1122     log check_lib_cpp "$@"
1123     headers="$1"
1124     classes="$2"
1125     shift 2
1126     check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
1127 }
1128
1129 check_pkg_config(){
1130     log check_pkg_config "$@"
1131     pkgandversion="$1"
1132     pkg="${1%% *}"
1133     headers="$2"
1134     funcs="$3"
1135     shift 3
1136     check_cmd $pkg_config --exists --print-errors $pkgandversion || return
1137     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1138     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1139     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1140         set_safe "${pkg}_cflags" $pkg_cflags   &&
1141         set_safe "${pkg}_libs"   $pkg_libs
1142 }
1143
1144 check_exec(){
1145     check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1146 }
1147
1148 check_exec_crash(){
1149     code=$(cat)
1150
1151     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
1152     # are safe but may not be available everywhere.  Thus we use
1153     # raise(SIGTERM) instead.  The check is run in a subshell so we
1154     # can redirect the "Terminated" message from the shell.  SIGBUS
1155     # is not defined by standard C so it is used conditionally.
1156
1157     (check_exec "$@") >> $logfile 2>&1 <<EOF
1158 #include <signal.h>
1159 static void sighandler(int sig){
1160     raise(SIGTERM);
1161 }
1162 int foo(void){
1163     $code
1164 }
1165 int (*func_ptr)(void) = foo;
1166 int main(void){
1167     signal(SIGILL, sighandler);
1168     signal(SIGFPE, sighandler);
1169     signal(SIGSEGV, sighandler);
1170 #ifdef SIGBUS
1171     signal(SIGBUS, sighandler);
1172 #endif
1173     return func_ptr();
1174 }
1175 EOF
1176 }
1177
1178 check_type(){
1179     log check_type "$@"
1180     headers=$1
1181     type=$2
1182     shift 2
1183     disable_safe "$type"
1184     check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
1185 }
1186
1187 check_struct(){
1188     log check_struct "$@"
1189     headers=$1
1190     struct=$2
1191     member=$3
1192     shift 3
1193     disable_safe "${struct}_${member}"
1194     check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1195         enable_safe "${struct}_${member}"
1196 }
1197
1198 check_builtin(){
1199     log check_builtin "$@"
1200     name=$1
1201     headers=$2
1202     builtin=$3
1203     shift 3
1204     disable "$name"
1205     check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
1206 }
1207
1208 check_compile_assert(){
1209     log check_compile_assert "$@"
1210     name=$1
1211     headers=$2
1212     condition=$3
1213     shift 3
1214     disable "$name"
1215     check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1216 }
1217
1218 require(){
1219     name="$1"
1220     header="$2"
1221     func="$3"
1222     shift 3
1223     check_lib $header $func "$@" || die "ERROR: $name not found"
1224 }
1225
1226 require2(){
1227     name="$1"
1228     headers="$2"
1229     func="$3"
1230     shift 3
1231     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
1232 }
1233
1234 require_cpp(){
1235     name="$1"
1236     headers="$2"
1237     classes="$3"
1238     shift 3
1239     check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
1240 }
1241
1242 use_pkg_config(){
1243     pkg="$1"
1244     check_pkg_config "$@" || return 1
1245     add_cflags    $(get_safe "${pkg}_cflags")
1246     add_extralibs $(get_safe "${pkg}_libs")
1247 }
1248
1249 require_pkg_config(){
1250     use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
1251 }
1252
1253 require_libfreetype(){
1254     log require_libfreetype "$@"
1255     pkg="freetype2"
1256     check_cmd $pkg_config --exists --print-errors $pkg \
1257       || die "ERROR: $pkg not found"
1258     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1259     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1260     {
1261         echo "#include <ft2build.h>"
1262         echo "#include FT_FREETYPE_H"
1263         echo "long check_func(void) { return (long) FT_Init_FreeType; }"
1264         echo "int main(void) { return 0; }"
1265     } | check_ld "cc" $pkg_cflags $pkg_libs \
1266       && set_safe "${pkg}_cflags" $pkg_cflags \
1267       && set_safe "${pkg}_libs"   $pkg_libs \
1268       || die "ERROR: $pkg not found"
1269     add_cflags    $(get_safe "${pkg}_cflags")
1270     add_extralibs $(get_safe "${pkg}_libs")
1271 }
1272
1273 hostcc_e(){
1274     eval printf '%s\\n' $HOSTCC_E
1275 }
1276
1277 hostcc_o(){
1278     eval printf '%s\\n' $HOSTCC_O
1279 }
1280
1281 check_host_cc(){
1282     log check_host_cc "$@"
1283     cat > $TMPC
1284     log_file $TMPC
1285     check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1286 }
1287
1288 check_host_cpp(){
1289     log check_host_cpp "$@"
1290     cat > $TMPC
1291     log_file $TMPC
1292     check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1293 }
1294
1295 check_host_cppflags(){
1296     log check_host_cppflags "$@"
1297     check_host_cc "$@" <<EOF && append host_cppflags "$@"
1298 int x;
1299 EOF
1300 }
1301
1302 check_host_cflags(){
1303     log check_host_cflags "$@"
1304     set -- $($host_cflags_filter "$@")
1305     check_host_cc "$@" <<EOF && append host_cflags "$@"
1306 int x;
1307 EOF
1308 }
1309
1310 check_host_cpp_condition(){
1311     log check_host_cpp_condition "$@"
1312     header=$1
1313     condition=$2
1314     shift 2
1315     check_host_cpp "$@" <<EOF
1316 #include <$header>
1317 #if !($condition)
1318 #error "unsatisfied condition: $condition"
1319 #endif
1320 EOF
1321 }
1322
1323 cp_if_changed(){
1324     cmp -s "$1" "$2" && echo "$2 is unchanged" && return
1325     mkdir -p "$(dirname $2)"
1326     $cp_f "$1" "$2"
1327 }
1328
1329 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1330 # system-dependent things.
1331
1332 COMPONENT_LIST="
1333     bsfs
1334     decoders
1335     demuxers
1336     encoders
1337     filters
1338     hwaccels
1339     indevs
1340     muxers
1341     outdevs
1342     parsers
1343     protocols
1344 "
1345
1346 EXAMPLE_LIST="
1347     avio_reading_example
1348     avio_dir_cmd_example
1349     decoding_encoding_example
1350     demuxing_decoding_example
1351     extract_mvs_example
1352     filter_audio_example
1353     filtering_audio_example
1354     filtering_video_example
1355     metadata_example
1356     muxing_example
1357     qsvdec_example
1358     remuxing_example
1359     resampling_audio_example
1360     scaling_video_example
1361     transcode_aac_example
1362     transcoding_example
1363 "
1364
1365 EXTERNAL_LIBRARY_LIST="
1366     avisynth
1367     bzlib
1368     crystalhd
1369     decklink
1370     frei0r
1371     gnutls
1372     iconv
1373     ladspa
1374     libaacplus
1375     libass
1376     libbluray
1377     libbs2b
1378     libcaca
1379     libcdio
1380     libcelt
1381     libdc1394
1382     libdcadec
1383     libfaac
1384     libfdk_aac
1385     libflite
1386     libfontconfig
1387     libfreetype
1388     libfribidi
1389     libgme
1390     libgsm
1391     libiec61883
1392     libilbc
1393     libkvazaar
1394     libmfx
1395     libmodplug
1396     libmp3lame
1397     libnut
1398     libopencore_amrnb
1399     libopencore_amrwb
1400     libopencv
1401     libopenh264
1402     libopenjpeg
1403     libopus
1404     libpulse
1405     libquvi
1406     librtmp
1407     libschroedinger
1408     libshine
1409     libsmbclient
1410     libsnappy
1411     libsoxr
1412     libspeex
1413     libssh
1414     libstagefright_h264
1415     libtheora
1416     libtwolame
1417     libutvideo
1418     libv4l2
1419     libvidstab
1420     libvo_aacenc
1421     libvo_amrwbenc
1422     libvorbis
1423     libvpx
1424     libwavpack
1425     libwebp
1426     libx264
1427     libx265
1428     libxavs
1429     libxcb
1430     libxcb_shm
1431     libxcb_shape
1432     libxcb_xfixes
1433     libxvid
1434     libzmq
1435     libzvbi
1436     lzma
1437     mmal
1438     nvenc
1439     openal
1440     opencl
1441     opengl
1442     openssl
1443     sdl
1444     securetransport
1445     x11grab
1446     xlib
1447     zlib
1448 "
1449
1450 DOCUMENT_LIST="
1451     doc
1452     htmlpages
1453     manpages
1454     podpages
1455     txtpages
1456 "
1457
1458 FEATURE_LIST="
1459     ftrapv
1460     gray
1461     hardcoded_tables
1462     runtime_cpudetect
1463     safe_bitstream_reader
1464     shared
1465     small
1466     static
1467     swscale_alpha
1468 "
1469
1470 HWACCEL_LIST="
1471     d3d11va
1472     dxva2
1473     vaapi
1474     vda
1475     vdpau
1476     videotoolbox
1477     xvmc
1478 "
1479
1480 LIBRARY_LIST="
1481     avcodec
1482     avdevice
1483     avfilter
1484     avformat
1485     avresample
1486     avutil
1487     postproc
1488     swresample
1489     swscale
1490 "
1491
1492 LICENSE_LIST="
1493     gpl
1494     nonfree
1495     version3
1496 "
1497
1498 PROGRAM_LIST="
1499     ffplay
1500     ffprobe
1501     ffserver
1502     ffmpeg
1503 "
1504
1505 SUBSYSTEM_LIST="
1506     dct
1507     dwt
1508     error_resilience
1509     faan
1510     fast_unaligned
1511     fft
1512     lsp
1513     lzo
1514     mdct
1515     pixelutils
1516     network
1517     rdft
1518 "
1519
1520 CONFIG_LIST="
1521     $COMPONENT_LIST
1522     $DOCUMENT_LIST
1523     $EXAMPLE_LIST
1524     $EXTERNAL_LIBRARY_LIST
1525     $FEATURE_LIST
1526     $HWACCEL_LIST
1527     $LICENSE_LIST
1528     $LIBRARY_LIST
1529     $PROGRAM_LIST
1530     $SUBSYSTEM_LIST
1531     fontconfig
1532     incompatible_libav_abi
1533     memalign_hack
1534     memory_poisoning
1535     neon_clobber_test
1536     pic
1537     pod2man
1538     raise_major
1539     thumb
1540     valgrind_backtrace
1541     xmm_clobber_test
1542 "
1543
1544 THREADS_LIST="
1545     pthreads
1546     os2threads
1547     w32threads
1548 "
1549
1550 ATOMICS_LIST="
1551     atomics_gcc
1552     atomics_suncc
1553     atomics_win32
1554 "
1555
1556 ARCH_LIST="
1557     aarch64
1558     alpha
1559     arm
1560     avr32
1561     avr32_ap
1562     avr32_uc
1563     bfin
1564     ia64
1565     m68k
1566     mips
1567     mips64
1568     parisc
1569     ppc
1570     ppc64
1571     s390
1572     sh4
1573     sparc
1574     sparc64
1575     tilegx
1576     tilepro
1577     tomi
1578     x86
1579     x86_32
1580     x86_64
1581 "
1582
1583 ARCH_EXT_LIST_ARM="
1584     armv5te
1585     armv6
1586     armv6t2
1587     armv8
1588     neon
1589     vfp
1590     vfpv3
1591     setend
1592 "
1593
1594 ARCH_EXT_LIST_MIPS="
1595     mipsfpu
1596     mips32r2
1597     mips32r5
1598     mips64r6
1599     mipsdspr1
1600     mipsdspr2
1601     msa
1602 "
1603
1604 ARCH_EXT_LIST_LOONGSON="
1605     loongson2
1606     loongson3
1607     mmi
1608 "
1609
1610 ARCH_EXT_LIST_X86_SIMD="
1611     amd3dnow
1612     amd3dnowext
1613     avx
1614     avx2
1615     fma3
1616     fma4
1617     mmx
1618     mmxext
1619     sse
1620     sse2
1621     sse3
1622     sse4
1623     sse42
1624     ssse3
1625     xop
1626 "
1627
1628 ARCH_EXT_LIST_PPC="
1629     altivec
1630     dcbzl
1631     ldbrx
1632     power8
1633     ppc4xx
1634     vsx
1635 "
1636
1637 ARCH_EXT_LIST_X86="
1638     $ARCH_EXT_LIST_X86_SIMD
1639     cpunop
1640     i686
1641 "
1642
1643 ARCH_EXT_LIST="
1644     $ARCH_EXT_LIST_ARM
1645     $ARCH_EXT_LIST_PPC
1646     $ARCH_EXT_LIST_X86
1647     $ARCH_EXT_LIST_MIPS
1648     $ARCH_EXT_LIST_LOONGSON
1649 "
1650
1651 ARCH_FEATURES="
1652     aligned_stack
1653     fast_64bit
1654     fast_clz
1655     fast_cmov
1656     local_aligned_8
1657     local_aligned_16
1658     local_aligned_32
1659     simd_align_16
1660 "
1661
1662 BUILTIN_LIST="
1663     atomic_cas_ptr
1664     atomic_compare_exchange
1665     machine_rw_barrier
1666     MemoryBarrier
1667     mm_empty
1668     rdtsc
1669     sarestart
1670     sync_val_compare_and_swap
1671 "
1672 HAVE_LIST_CMDLINE="
1673     inline_asm
1674     symver
1675     yasm
1676 "
1677
1678 HAVE_LIST_PUB="
1679     bigendian
1680     fast_unaligned
1681     incompatible_libav_abi
1682 "
1683
1684 HEADERS_LIST="
1685     alsa_asoundlib_h
1686     altivec_h
1687     arpa_inet_h
1688     asm_types_h
1689     cdio_paranoia_h
1690     cdio_paranoia_paranoia_h
1691     dev_bktr_ioctl_bt848_h
1692     dev_bktr_ioctl_meteor_h
1693     dev_ic_bt8xx_h
1694     dev_video_bktr_ioctl_bt848_h
1695     dev_video_meteor_ioctl_meteor_h
1696     direct_h
1697     dirent_h
1698     dlfcn_h
1699     d3d11_h
1700     dxva_h
1701     ES2_gl_h
1702     gsm_h
1703     io_h
1704     mach_mach_time_h
1705     machine_ioctl_bt848_h
1706     machine_ioctl_meteor_h
1707     malloc_h
1708     openjpeg_1_5_openjpeg_h
1709     OpenGL_gl3_h
1710     poll_h
1711     sndio_h
1712     soundcard_h
1713     sys_mman_h
1714     sys_param_h
1715     sys_resource_h
1716     sys_select_h
1717     sys_soundcard_h
1718     sys_time_h
1719     sys_un_h
1720     sys_videoio_h
1721     termios_h
1722     udplite_h
1723     unistd_h
1724     valgrind_valgrind_h
1725     windows_h
1726     winsock2_h
1727 "
1728
1729 INTRINSICS_LIST="
1730     intrinsics_neon
1731 "
1732
1733 MATH_FUNCS="
1734     atanf
1735     atan2f
1736     cbrt
1737     cbrtf
1738     copysign
1739     cosf
1740     erf
1741     exp2
1742     exp2f
1743     expf
1744     isinf
1745     isnan
1746     ldexpf
1747     llrint
1748     llrintf
1749     log2
1750     log2f
1751     log10f
1752     lrint
1753     lrintf
1754     powf
1755     rint
1756     round
1757     roundf
1758     sinf
1759     trunc
1760     truncf
1761 "
1762
1763 SYSTEM_FUNCS="
1764     access
1765     aligned_malloc
1766     clock_gettime
1767     closesocket
1768     CommandLineToArgvW
1769     CoTaskMemFree
1770     CryptGenRandom
1771     dlopen
1772     fcntl
1773     flt_lim
1774     fork
1775     getaddrinfo
1776     gethrtime
1777     getopt
1778     GetProcessAffinityMask
1779     GetProcessMemoryInfo
1780     GetProcessTimes
1781     getrusage
1782     getservbyport
1783     GetSystemTimeAsFileTime
1784     gettimeofday
1785     glob
1786     glXGetProcAddress
1787     gmtime_r
1788     inet_aton
1789     isatty
1790     jack_port_get_latency_range
1791     kbhit
1792     localtime_r
1793     lstat
1794     lzo1x_999_compress
1795     mach_absolute_time
1796     MapViewOfFile
1797     memalign
1798     mkstemp
1799     mmap
1800     mprotect
1801     nanosleep
1802     PeekNamedPipe
1803     posix_memalign
1804     pthread_cancel
1805     sched_getaffinity
1806     SetConsoleTextAttribute
1807     SetConsoleCtrlHandler
1808     setmode
1809     setrlimit
1810     Sleep
1811     strerror_r
1812     sysconf
1813     sysctl
1814     usleep
1815     VirtualAlloc
1816     wglGetProcAddress
1817 "
1818
1819 TOOLCHAIN_FEATURES="
1820     as_dn_directive
1821     as_func
1822     as_object_arch
1823     asm_mod_q
1824     attribute_may_alias
1825     attribute_packed
1826     ebp_available
1827     ebx_available
1828     gnu_as
1829     gnu_windres
1830     ibm_asm
1831     inline_asm_labels
1832     inline_asm_nonlocal_labels
1833     inline_asm_direct_symbol_refs
1834     pragma_deprecated
1835     rsync_contimeout
1836     symver_asm_label
1837     symver_gnu_asm
1838     vfp_args
1839     xform_asm
1840     xmm_clobbers
1841 "
1842
1843 TYPES_LIST="
1844     CONDITION_VARIABLE_Ptr
1845     socklen_t
1846     struct_addrinfo
1847     struct_dcadec_exss_info_matrix_encoding
1848     struct_group_source_req
1849     struct_ip_mreq_source
1850     struct_ipv6_mreq
1851     struct_pollfd
1852     struct_rusage_ru_maxrss
1853     struct_sctp_event_subscribe
1854     struct_sockaddr_in6
1855     struct_sockaddr_sa_len
1856     struct_sockaddr_storage
1857     struct_stat_st_mtim_tv_nsec
1858     struct_v4l2_frmivalenum_discrete
1859 "
1860
1861 HAVE_LIST="
1862     $ARCH_EXT_LIST
1863     $(add_suffix _external $ARCH_EXT_LIST)
1864     $(add_suffix _inline   $ARCH_EXT_LIST)
1865     $ARCH_FEATURES
1866     $ATOMICS_LIST
1867     $BUILTIN_LIST
1868     $HAVE_LIST_CMDLINE
1869     $HAVE_LIST_PUB
1870     $HEADERS_LIST
1871     $INTRINSICS_LIST
1872     $MATH_FUNCS
1873     $SYSTEM_FUNCS
1874     $THREADS_LIST
1875     $TOOLCHAIN_FEATURES
1876     $TYPES_LIST
1877     atomics_native
1878     dos_paths
1879     dxva2api_cobj
1880     dxva2_lib
1881     libc_msvcrt
1882     libdc1394_1
1883     libdc1394_2
1884     makeinfo
1885     makeinfo_html
1886     perl
1887     pod2man
1888     sdl
1889     section_data_rel_ro
1890     texi2html
1891     threads
1892     vaapi_x11
1893     vdpau_x11
1894     xlib
1895 "
1896
1897 # options emitted with CONFIG_ prefix but not available on the command line
1898 CONFIG_EXTRA="
1899     aandcttables
1900     ac3dsp
1901     audio_frame_queue
1902     audiodsp
1903     blockdsp
1904     bswapdsp
1905     cabac
1906     dvprofile
1907     exif
1908     faandct
1909     faanidct
1910     fdctdsp
1911     flacdsp
1912     fmtconvert
1913     frame_thread_encoder
1914     g722dsp
1915     gcrypt
1916     gmp
1917     golomb
1918     gplv3
1919     h263dsp
1920     h264chroma
1921     h264dsp
1922     h264pred
1923     h264qpel
1924     hpeldsp
1925     huffman
1926     huffyuvdsp
1927     huffyuvencdsp
1928     idctdsp
1929     iirfilter
1930     imdct15
1931     intrax8
1932     ividsp
1933     jpegtables
1934     libx262
1935     lgplv3
1936     llauddsp
1937     llviddsp
1938     lpc
1939     lzf
1940     me_cmp
1941     mpeg_er
1942     mpegaudio
1943     mpegaudiodsp
1944     mpegvideo
1945     mpegvideoenc
1946     mss34dsp
1947     pixblockdsp
1948     qpeldsp
1949     qsv
1950     qsvdec
1951     qsvenc
1952     rangecoder
1953     riffdec
1954     riffenc
1955     rtpdec
1956     rtpenc_chain
1957     rv34dsp
1958     sinewin
1959     snappy
1960     startcode
1961     texturedsp
1962     texturedspenc
1963     tpeldsp
1964     videodsp
1965     vp3dsp
1966     vp56dsp
1967     vp8dsp
1968     wma_freqs
1969     wmv2dsp
1970 "
1971
1972 CMDLINE_SELECT="
1973     $ARCH_EXT_LIST
1974     $CONFIG_LIST
1975     $HAVE_LIST_CMDLINE
1976     $THREADS_LIST
1977     asm
1978     cross_compile
1979     debug
1980     extra_warnings
1981     logging
1982     lto
1983     optimizations
1984     rpath
1985     stripping
1986 "
1987
1988 PATHS_LIST="
1989     bindir
1990     datadir
1991     docdir
1992     incdir
1993     libdir
1994     mandir
1995     pkgconfigdir
1996     prefix
1997     shlibdir
1998 "
1999
2000 CMDLINE_SET="
2001     $PATHS_LIST
2002     ar
2003     arch
2004     as
2005     assert_level
2006     build_suffix
2007     cc
2008     cpu
2009     cross_prefix
2010     cxx
2011     dep_cc
2012     doxygen
2013     env
2014     extra_version
2015     gas
2016     host_cc
2017     host_cflags
2018     host_ld
2019     host_ldflags
2020     host_libs
2021     host_os
2022     install
2023     ld
2024     logfile
2025     malloc_prefix
2026     nm
2027     optflags
2028     pkg_config
2029     pkg_config_flags
2030     progs_suffix
2031     random_seed
2032     ranlib
2033     samples
2034     strip
2035     sws_max_filter_size
2036     sysinclude
2037     sysroot
2038     target_exec
2039     target_os
2040     target_path
2041     target_samples
2042     tempprefix
2043     toolchain
2044     valgrind
2045     yasmexe
2046 "
2047
2048 CMDLINE_APPEND="
2049     extra_cflags
2050     extra_cxxflags
2051     host_cppflags
2052 "
2053
2054 # code dependency declarations
2055
2056 # architecture extensions
2057
2058 armv5te_deps="arm"
2059 armv6_deps="arm"
2060 armv6t2_deps="arm"
2061 armv8_deps="aarch64"
2062 neon_deps_any="aarch64 arm"
2063 intrinsics_neon_deps="neon"
2064 vfp_deps_any="aarch64 arm"
2065 vfpv3_deps="vfp"
2066 setend_deps="arm"
2067
2068 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
2069
2070 mipsfpu_deps="mips"
2071 mipsdspr1_deps="mips"
2072 mipsdspr2_deps="mips"
2073 mips32r2_deps="mips"
2074 mips32r5_deps="mips"
2075 mips64r6_deps="mips"
2076 msa_deps="mips"
2077 mmi_deps="mips"
2078
2079 altivec_deps="ppc"
2080 dcbzl_deps="ppc"
2081 ldbrx_deps="ppc"
2082 ppc4xx_deps="ppc"
2083 vsx_deps="altivec"
2084 power8_deps="vsx"
2085
2086 cpunop_deps="i686"
2087 x86_64_select="i686"
2088 x86_64_suggest="fast_cmov"
2089
2090 amd3dnow_deps="mmx"
2091 amd3dnowext_deps="amd3dnow"
2092 i686_deps="x86"
2093 mmx_deps="x86"
2094 mmxext_deps="mmx"
2095 sse_deps="mmxext"
2096 sse2_deps="sse"
2097 sse3_deps="sse2"
2098 ssse3_deps="sse3"
2099 sse4_deps="ssse3"
2100 sse42_deps="sse4"
2101 avx_deps="sse42"
2102 xop_deps="avx"
2103 fma3_deps="avx"
2104 fma4_deps="avx"
2105 avx2_deps="avx"
2106
2107 mmx_external_deps="yasm"
2108 mmx_inline_deps="inline_asm"
2109 mmx_suggest="mmx_external mmx_inline"
2110
2111 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
2112     eval dep=\$${ext}_deps
2113     eval ${ext}_external_deps='"${dep}_external"'
2114     eval ${ext}_inline_deps='"${dep}_inline"'
2115     eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
2116 done
2117
2118 aligned_stack_if_any="aarch64 ppc x86"
2119 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
2120 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
2121 fast_unaligned_if_any="aarch64 ppc x86"
2122 simd_align_16_if_any="altivec neon sse"
2123
2124 # system capabilities
2125 symver_if_any="symver_asm_label symver_gnu_asm"
2126 valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
2127
2128 # threading support
2129 atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange"
2130 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
2131 atomics_win32_if="MemoryBarrier"
2132 atomics_native_if_any="$ATOMICS_LIST"
2133 w32threads_deps="atomics_native"
2134 threads_if_any="$THREADS_LIST"
2135
2136 # subsystems
2137 dct_select="rdft"
2138 error_resilience_select="me_cmp"
2139 faandct_deps="faan fdctdsp"
2140 faanidct_deps="faan idctdsp"
2141 frame_thread_encoder_deps="encoders threads"
2142 intrax8_select="error_resilience"
2143 mdct_select="fft"
2144 rdft_select="fft"
2145 me_cmp_select="fdctdsp idctdsp pixblockdsp"
2146 mpeg_er_select="error_resilience"
2147 mpegaudio_select="mpegaudiodsp"
2148 mpegaudiodsp_select="dct"
2149 mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
2150 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
2151 qsvdec_select="qsv"
2152 qsvenc_select="qsv"
2153
2154 # decoders / encoders
2155 aac_decoder_select="imdct15 mdct sinewin"
2156 aac_fixed_decoder_select="mdct sinewin"
2157 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
2158 aac_latm_decoder_select="aac_decoder aac_latm_parser"
2159 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2160 ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
2161 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
2162 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
2163 adpcm_g722_decoder_select="g722dsp"
2164 adpcm_g722_encoder_select="g722dsp"
2165 aic_decoder_select="golomb idctdsp"
2166 alac_encoder_select="lpc"
2167 als_decoder_select="bswapdsp"
2168 amrnb_decoder_select="lsp"
2169 amrwb_decoder_select="lsp"
2170 amv_decoder_select="sp5x_decoder exif"
2171 amv_encoder_select="aandcttables jpegtables mpegvideoenc"
2172 ape_decoder_select="bswapdsp llauddsp"
2173 apng_decoder_select="zlib"
2174 apng_encoder_select="huffyuvencdsp zlib"
2175 asv1_decoder_select="blockdsp bswapdsp idctdsp"
2176 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
2177 asv2_decoder_select="blockdsp bswapdsp idctdsp"
2178 asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
2179 atrac1_decoder_select="mdct sinewin"
2180 atrac3_decoder_select="mdct"
2181 atrac3p_decoder_select="mdct sinewin"
2182 avrn_decoder_select="exif jpegtables"
2183 bink_decoder_select="blockdsp hpeldsp"
2184 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
2185 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
2186 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
2187 cllc_decoder_select="bswapdsp"
2188 comfortnoise_encoder_select="lpc"
2189 cook_decoder_select="audiodsp mdct sinewin"
2190 cscd_decoder_select="lzo"
2191 cscd_decoder_suggest="zlib"
2192 dca_decoder_select="fmtconvert mdct"
2193 dds_decoder_select="texturedsp"
2194 dirac_decoder_select="dwt golomb videodsp mpegvideoenc"
2195 dnxhd_decoder_select="blockdsp idctdsp"
2196 dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
2197 dvvideo_decoder_select="dvprofile idctdsp"
2198 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
2199 dxa_decoder_select="zlib"
2200 dxv_decoder_select="lzf texturedsp"
2201 eac3_decoder_select="ac3_decoder"
2202 eac3_encoder_select="ac3_encoder"
2203 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
2204 eatgq_decoder_select="aandcttables"
2205 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder"
2206 exr_decoder_select="zlib"
2207 ffv1_decoder_select="golomb rangecoder"
2208 ffv1_encoder_select="rangecoder"
2209 ffvhuff_decoder_select="huffyuv_decoder"
2210 ffvhuff_encoder_select="huffyuv_encoder"
2211 fic_decoder_select="golomb"
2212 flac_decoder_select="flacdsp golomb"
2213 flac_encoder_select="bswapdsp flacdsp golomb lpc"
2214 flashsv_decoder_select="zlib"
2215 flashsv_encoder_select="zlib"
2216 flashsv2_encoder_select="zlib"
2217 flashsv2_decoder_select="zlib"
2218 flv_decoder_select="h263_decoder"
2219 flv_encoder_select="h263_encoder"
2220 fourxm_decoder_select="blockdsp bswapdsp"
2221 fraps_decoder_select="bswapdsp huffman"
2222 g2m_decoder_select="blockdsp idctdsp jpegtables zlib"
2223 g729_decoder_select="audiodsp"
2224 h261_decoder_select="mpegvideo"
2225 h261_encoder_select="aandcttables mpegvideoenc"
2226 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
2227 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
2228 h263i_decoder_select="h263_decoder"
2229 h263p_decoder_select="h263_decoder"
2230 h263p_encoder_select="h263_encoder"
2231 h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
2232 h264_decoder_suggest="error_resilience"
2233 h264_qsv_decoder_deps="libmfx"
2234 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2235 h264_qsv_encoder_deps="libmfx"
2236 h264_qsv_encoder_select="qsvenc"
2237 hap_decoder_select="snappy texturedsp"
2238 hap_encoder_deps="libsnappy"
2239 hap_encoder_select="texturedspenc"
2240 hevc_decoder_select="bswapdsp cabac golomb videodsp"
2241 hevc_qsv_encoder_deps="libmfx"
2242 hevc_qsv_decoder_deps="libmfx"
2243 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
2244 hevc_qsv_encoder_select="qsvenc"
2245 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
2246 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp"
2247 iac_decoder_select="imc_decoder"
2248 imc_decoder_select="bswapdsp fft mdct sinewin"
2249 indeo3_decoder_select="hpeldsp"
2250 indeo4_decoder_select="ividsp"
2251 indeo5_decoder_select="ividsp"
2252 interplay_video_decoder_select="hpeldsp"
2253 jpegls_decoder_select="golomb mjpeg_decoder"
2254 jpegls_encoder_select="golomb"
2255 jv_decoder_select="blockdsp"
2256 lagarith_decoder_select="huffyuvdsp"
2257 ljpeg_encoder_select="aandcttables idctdsp jpegtables"
2258 loco_decoder_select="golomb"
2259 mdec_decoder_select="blockdsp idctdsp mpegvideo"
2260 metasound_decoder_select="lsp mdct sinewin"
2261 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
2262 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
2263 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
2264 mjpegb_decoder_select="mjpeg_decoder"
2265 mlp_decoder_select="mlp_parser"
2266 motionpixels_decoder_select="bswapdsp"
2267 mp1_decoder_select="mpegaudio"
2268 mp1float_decoder_select="mpegaudio"
2269 mp2_decoder_select="mpegaudio"
2270 mp2float_decoder_select="mpegaudio"
2271 mp3_decoder_select="mpegaudio"
2272 mp3adu_decoder_select="mpegaudio"
2273 mp3adufloat_decoder_select="mpegaudio"
2274 mp3float_decoder_select="mpegaudio"
2275 mp3on4_decoder_select="mpegaudio"
2276 mp3on4float_decoder_select="mpegaudio"
2277 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2278 mpc8_decoder_select="mpegaudiodsp"
2279 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
2280 mpeg_xvmc_decoder_select="mpeg2video_decoder"
2281 mpegvideo_decoder_select="mpegvideo"
2282 mpeg1video_decoder_select="mpegvideo"
2283 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
2284 mpeg2video_decoder_select="mpegvideo"
2285 mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
2286 mpeg2_qsv_decoder_deps="libmfx"
2287 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel"
2288 mpeg2_qsv_encoder_deps="libmfx"
2289 mpeg2_qsv_encoder_select="qsvenc"
2290 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2291 mpeg4_encoder_select="h263_encoder"
2292 msa1_decoder_select="mss34dsp"
2293 msmpeg4v1_decoder_select="h263_decoder"
2294 msmpeg4v2_decoder_select="h263_decoder"
2295 msmpeg4v2_encoder_select="h263_encoder"
2296 msmpeg4v3_decoder_select="h263_decoder"
2297 msmpeg4v3_encoder_select="h263_encoder"
2298 mss2_decoder_select="vc1_decoder"
2299 mts2_decoder_select="mss34dsp"
2300 mxpeg_decoder_select="mjpeg_decoder"
2301 nellymoser_decoder_select="mdct sinewin"
2302 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2303 nuv_decoder_select="idctdsp lzo"
2304 on2avc_decoder_select="mdct"
2305 opus_decoder_deps="swresample"
2306 opus_decoder_select="imdct15"
2307 png_decoder_select="zlib"
2308 png_encoder_select="huffyuvencdsp zlib"
2309 prores_decoder_select="blockdsp idctdsp"
2310 prores_encoder_select="fdctdsp"
2311 qcelp_decoder_select="lsp"
2312 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2313 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
2314 ra_144_decoder_select="audiodsp"
2315 ralf_decoder_select="golomb"
2316 rawvideo_decoder_select="bswapdsp"
2317 rtjpeg_decoder_select="me_cmp"
2318 rv10_decoder_select="h263_decoder"
2319 rv10_encoder_select="h263_encoder"
2320 rv20_decoder_select="h263_decoder"
2321 rv20_encoder_select="h263_encoder"
2322 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2323 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2324 shorten_decoder_select="golomb"
2325 sipr_decoder_select="lsp"
2326 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
2327 snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
2328 sonic_decoder_select="golomb rangecoder"
2329 sonic_encoder_select="golomb rangecoder"
2330 sonic_ls_encoder_select="golomb rangecoder"
2331 sp5x_decoder_select="mjpeg_decoder"
2332 svq1_decoder_select="hpeldsp"
2333 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
2334 svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
2335 svq3_decoder_suggest="zlib"
2336 tak_decoder_select="audiodsp"
2337 tdsc_decoder_select="zlib mjpeg_decoder"
2338 theora_decoder_select="vp3_decoder"
2339 thp_decoder_select="mjpeg_decoder"
2340 tiff_decoder_suggest="zlib lzma"
2341 tiff_encoder_suggest="zlib"
2342 truehd_decoder_select="mlp_parser"
2343 truemotion2_decoder_select="bswapdsp"
2344 truespeech_decoder_select="bswapdsp"
2345 tscc_decoder_select="zlib"
2346 twinvq_decoder_select="mdct lsp sinewin"
2347 txd_decoder_select="texturedsp"
2348 utvideo_decoder_select="bswapdsp"
2349 utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
2350 vble_decoder_select="huffyuvdsp"
2351 vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 qpeldsp startcode"
2352 vc1image_decoder_select="vc1_decoder"
2353 vc1_qsv_decoder_deps="libmfx"
2354 vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel"
2355 vorbis_decoder_select="mdct"
2356 vorbis_encoder_select="mdct"
2357 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2358 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2359 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2360 vp6a_decoder_select="vp6_decoder"
2361 vp6f_decoder_select="vp6_decoder"
2362 vp7_decoder_select="h264pred videodsp vp8dsp"
2363 vp8_decoder_select="h264pred videodsp vp8dsp"
2364 vp9_decoder_select="videodsp vp9_parser"
2365 webp_decoder_select="vp8_decoder"
2366 wmalossless_decoder_select="llauddsp"
2367 wmapro_decoder_select="mdct sinewin wma_freqs"
2368 wmav1_decoder_select="mdct sinewin wma_freqs"
2369 wmav1_encoder_select="mdct sinewin wma_freqs"
2370 wmav2_decoder_select="mdct sinewin wma_freqs"
2371 wmav2_encoder_select="mdct sinewin wma_freqs"
2372 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2373 wmv1_decoder_select="h263_decoder"
2374 wmv1_encoder_select="h263_encoder"
2375 wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2376 wmv2_encoder_select="h263_encoder wmv2dsp"
2377 wmv3_decoder_select="vc1_decoder"
2378 wmv3image_decoder_select="wmv3_decoder"
2379 zerocodec_decoder_select="zlib"
2380 zlib_decoder_select="zlib"
2381 zlib_encoder_select="zlib"
2382 zmbv_decoder_select="zlib"
2383 zmbv_encoder_select="zlib"
2384
2385 # hardware accelerators
2386 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2387 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
2388 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
2389 vaapi_deps="va_va_h"
2390 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads CoreServices_CoreServices_h"
2391 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -framework CoreServices"
2392 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2393 videotoolbox_deps="VideoToolbox_VideoToolbox_h pthreads CoreServices_CoreServices_h"
2394 videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreServices"
2395 xvmc_deps="X11_extensions_XvMClib_h"
2396
2397 h263_vaapi_hwaccel_deps="vaapi"
2398 h263_vaapi_hwaccel_select="h263_decoder"
2399 h263_vdpau_hwaccel_deps="vdpau"
2400 h263_vdpau_hwaccel_select="h263_decoder"
2401 h263_videotoolbox_hwaccel_deps="videotoolbox"
2402 h263_videotoolbox_hwaccel_select="h263_decoder"
2403 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
2404 h264_d3d11va_hwaccel_deps="d3d11va"
2405 h264_d3d11va_hwaccel_select="h264_decoder"
2406 h264_dxva2_hwaccel_deps="dxva2"
2407 h264_dxva2_hwaccel_select="h264_decoder"
2408 h264_mmal_decoder_deps="mmal"
2409 h264_mmal_hwaccel_deps="mmal"
2410 h264_mmal_decoder_select="h264_decoder"
2411 h264_mmal_encoder_deps="mmal"
2412 h264_qsv_hwaccel_deps="libmfx"
2413 h264_vaapi_hwaccel_deps="vaapi"
2414 h264_vaapi_hwaccel_select="h264_decoder"
2415 h264_vda_decoder_deps="vda"
2416 h264_vda_decoder_select="h264_decoder"
2417 h264_vda_hwaccel_deps="vda"
2418 h264_vda_hwaccel_select="h264_decoder"
2419 h264_vda_old_hwaccel_deps="vda"
2420 h264_vda_old_hwaccel_select="h264_decoder"
2421 h264_vdpau_decoder_deps="vdpau"
2422 h264_vdpau_decoder_select="h264_decoder"
2423 h264_vdpau_hwaccel_deps="vdpau"
2424 h264_vdpau_hwaccel_select="h264_decoder"
2425 h264_videotoolbox_hwaccel_deps="videotoolbox"
2426 h264_videotoolbox_hwaccel_select="h264_decoder"
2427 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2428 hevc_d3d11va_hwaccel_select="hevc_decoder"
2429 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2430 hevc_dxva2_hwaccel_select="hevc_decoder"
2431 hevc_qsv_hwaccel_deps="libmfx"
2432 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2433 hevc_vaapi_hwaccel_select="hevc_decoder"
2434 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2435 hevc_vdpau_hwaccel_select="hevc_decoder"
2436 mpeg_vdpau_decoder_deps="vdpau"
2437 mpeg_vdpau_decoder_select="mpeg2video_decoder"
2438 mpeg_xvmc_hwaccel_deps="xvmc"
2439 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2440 mpeg1_vdpau_decoder_deps="vdpau"
2441 mpeg1_vdpau_decoder_select="mpeg1video_decoder"
2442 mpeg1_vdpau_hwaccel_deps="vdpau"
2443 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2444 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
2445 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
2446 mpeg1_xvmc_hwaccel_deps="xvmc"
2447 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2448 mpeg2_crystalhd_decoder_select="crystalhd"
2449 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2450 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2451 mpeg2_dxva2_hwaccel_deps="dxva2"
2452 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2453 mpeg2_qsv_hwaccel_deps="libmfx"
2454 mpeg2_qsv_hwaccel_select="qsvdec_mpeg2"
2455 mpeg2_vaapi_hwaccel_deps="vaapi"
2456 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2457 mpeg2_vdpau_hwaccel_deps="vdpau"
2458 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2459 mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
2460 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
2461 mpeg2_xvmc_hwaccel_deps="xvmc"
2462 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2463 mpeg4_crystalhd_decoder_select="crystalhd"
2464 mpeg4_vaapi_hwaccel_deps="vaapi"
2465 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2466 mpeg4_vdpau_decoder_deps="vdpau"
2467 mpeg4_vdpau_decoder_select="mpeg4_decoder"
2468 mpeg4_vdpau_hwaccel_deps="vdpau"
2469 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2470 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
2471 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
2472 msmpeg4_crystalhd_decoder_select="crystalhd"
2473 vc1_crystalhd_decoder_select="crystalhd"
2474 vc1_d3d11va_hwaccel_deps="d3d11va"
2475 vc1_d3d11va_hwaccel_select="vc1_decoder"
2476 vc1_dxva2_hwaccel_deps="dxva2"
2477 vc1_dxva2_hwaccel_select="vc1_decoder"
2478 vc1_vaapi_hwaccel_deps="vaapi"
2479 vc1_vaapi_hwaccel_select="vc1_decoder"
2480 vc1_vdpau_decoder_deps="vdpau"
2481 vc1_vdpau_decoder_select="vc1_decoder"
2482 vc1_vdpau_hwaccel_deps="vdpau"
2483 vc1_vdpau_hwaccel_select="vc1_decoder"
2484 vc1_qsv_hwaccel_deps="libmfx"
2485 vc1_qsv_hwaccel_select="qsvdec_vc1"
2486 wmv3_crystalhd_decoder_select="crystalhd"
2487 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2488 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2489 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2490 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
2491 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2492
2493 # parsers
2494 h264_parser_select="h264_decoder"
2495 hevc_parser_select="golomb"
2496 mpegvideo_parser_select="mpegvideo"
2497 mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
2498 vc1_parser_select="mpegvideo startcode vc1_decoder"
2499
2500 # bitstream_filters
2501 mjpeg2jpeg_bsf_select="jpegtables"
2502
2503 # external libraries
2504 libaacplus_encoder_deps="libaacplus"
2505 libcelt_decoder_deps="libcelt"
2506 libdcadec_decoder_deps="libdcadec"
2507 libfaac_encoder_deps="libfaac"
2508 libfaac_encoder_select="audio_frame_queue"
2509 libfdk_aac_decoder_deps="libfdk_aac"
2510 libfdk_aac_encoder_deps="libfdk_aac"
2511 libfdk_aac_encoder_select="audio_frame_queue"
2512 libgme_demuxer_deps="libgme"
2513 libgsm_decoder_deps="libgsm"
2514 libgsm_encoder_deps="libgsm"
2515 libgsm_ms_decoder_deps="libgsm"
2516 libgsm_ms_encoder_deps="libgsm"
2517 libilbc_decoder_deps="libilbc"
2518 libilbc_encoder_deps="libilbc"
2519 libkvazaar_encoder_deps="libkvazaar"
2520 libmodplug_demuxer_deps="libmodplug"
2521 libmp3lame_encoder_deps="libmp3lame"
2522 libmp3lame_encoder_select="audio_frame_queue"
2523 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2524 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2525 libopencore_amrnb_encoder_select="audio_frame_queue"
2526 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2527 libopenh264_encoder_deps="libopenh264"
2528 libopenjpeg_decoder_deps="libopenjpeg"
2529 libopenjpeg_encoder_deps="libopenjpeg"
2530 libopus_decoder_deps="libopus"
2531 libopus_encoder_deps="libopus"
2532 libopus_encoder_select="audio_frame_queue"
2533 libquvi_demuxer_deps="libquvi"
2534 libschroedinger_decoder_deps="libschroedinger"
2535 libschroedinger_encoder_deps="libschroedinger"
2536 libshine_encoder_deps="libshine"
2537 libshine_encoder_select="audio_frame_queue"
2538 libspeex_decoder_deps="libspeex"
2539 libspeex_encoder_deps="libspeex"
2540 libspeex_encoder_select="audio_frame_queue"
2541 libstagefright_h264_decoder_deps="libstagefright_h264"
2542 libtheora_encoder_deps="libtheora"
2543 libtwolame_encoder_deps="libtwolame"
2544 libvo_aacenc_encoder_deps="libvo_aacenc"
2545 libvo_aacenc_encoder_select="audio_frame_queue"
2546 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2547 libvorbis_decoder_deps="libvorbis"
2548 libvorbis_encoder_deps="libvorbis"
2549 libvorbis_encoder_select="audio_frame_queue"
2550 libvpx_vp8_decoder_deps="libvpx"
2551 libvpx_vp8_encoder_deps="libvpx"
2552 libvpx_vp9_decoder_deps="libvpx"
2553 libvpx_vp9_encoder_deps="libvpx"
2554 libwavpack_encoder_deps="libwavpack"
2555 libwebp_encoder_deps="libwebp"
2556 libwebp_anim_encoder_deps="libwebp"
2557 libx262_encoder_deps="libx262"
2558 libx264_encoder_deps="libx264"
2559 libx264rgb_encoder_deps="libx264"
2560 libx264rgb_encoder_select="libx264_encoder"
2561 libx265_encoder_deps="libx265"
2562 libxavs_encoder_deps="libxavs"
2563 libxvid_encoder_deps="libxvid"
2564 libutvideo_decoder_deps="libutvideo"
2565 libutvideo_encoder_deps="libutvideo"
2566 libzvbi_teletext_decoder_deps="libzvbi"
2567 nvenc_encoder_deps="nvenc"
2568 nvenc_h264_encoder_deps="nvenc"
2569 nvenc_hevc_encoder_deps="nvenc"
2570
2571 # demuxers / muxers
2572 ac3_demuxer_select="ac3_parser"
2573 asf_demuxer_select="riffdec"
2574 asf_o_demuxer_select="riffdec"
2575 asf_muxer_select="riffenc"
2576 asf_stream_muxer_select="asf_muxer"
2577 avi_demuxer_select="riffdec exif"
2578 avi_muxer_select="riffenc"
2579 avisynth_demuxer_deps="avisynth"
2580 avisynth_demuxer_select="riffdec"
2581 caf_demuxer_select="riffdec"
2582 dash_muxer_select="mp4_muxer"
2583 dirac_demuxer_select="dirac_parser"
2584 dts_demuxer_select="dca_parser"
2585 dtshd_demuxer_select="dca_parser"
2586 dv_demuxer_select="dvprofile"
2587 dv_muxer_select="dvprofile"
2588 dxa_demuxer_select="riffdec"
2589 eac3_demuxer_select="ac3_parser"
2590 f4v_muxer_select="mov_muxer"
2591 flac_demuxer_select="flac_parser"
2592 hds_muxer_select="flv_muxer"
2593 hls_muxer_select="mpegts_muxer"
2594 image2_alias_pix_demuxer_select="image2_demuxer"
2595 image2_brender_pix_demuxer_select="image2_demuxer"
2596 ipod_muxer_select="mov_muxer"
2597 ismv_muxer_select="mov_muxer"
2598 libnut_demuxer_deps="libnut"
2599 libnut_muxer_deps="libnut"
2600 matroska_audio_muxer_select="matroska_muxer"
2601 matroska_demuxer_select="riffdec"
2602 matroska_demuxer_suggest="bzlib lzo zlib"
2603 matroska_muxer_select="riffenc"
2604 mmf_muxer_select="riffenc"
2605 mov_demuxer_select="riffdec"
2606 mov_demuxer_suggest="zlib"
2607 mov_muxer_select="riffenc rtpenc_chain"
2608 mp3_demuxer_select="mpegaudio_parser"
2609 mp4_muxer_select="mov_muxer"
2610 mpegts_muxer_select="adts_muxer latm_muxer"
2611 mpegtsraw_demuxer_select="mpegts_demuxer"
2612 mxf_d10_muxer_select="mxf_muxer"
2613 mxf_opatom_muxer_select="mxf_muxer"
2614 nut_muxer_select="riffenc"
2615 nuv_demuxer_select="riffdec"
2616 oga_muxer_select="ogg_muxer"
2617 ogg_demuxer_select="golomb"
2618 opus_muxer_select="ogg_muxer"
2619 psp_muxer_select="mov_muxer"
2620 rtp_demuxer_select="sdp_demuxer"
2621 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol"
2622 rtsp_demuxer_select="http_protocol rtpdec"
2623 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2624 sap_demuxer_select="sdp_demuxer"
2625 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2626 sdp_demuxer_select="rtpdec"
2627 smoothstreaming_muxer_select="ismv_muxer"
2628 spdif_muxer_select="aac_parser"
2629 spx_muxer_select="ogg_muxer"
2630 tak_demuxer_select="tak_parser"
2631 tg2_muxer_select="mov_muxer"
2632 tgp_muxer_select="mov_muxer"
2633 vobsub_demuxer_select="mpegps_demuxer"
2634 w64_demuxer_select="wav_demuxer"
2635 w64_muxer_select="wav_muxer"
2636 wav_demuxer_select="riffdec"
2637 wav_muxer_select="riffenc"
2638 webm_muxer_select="riffenc"
2639 wtv_demuxer_select="riffdec"
2640 wtv_muxer_select="riffenc"
2641 xmv_demuxer_select="riffdec"
2642 xwma_demuxer_select="riffdec"
2643
2644 # indevs / outdevs
2645 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
2646 alsa_outdev_deps="alsa_asoundlib_h"
2647 avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
2648 avfoundation_indev_select="avfoundation"
2649 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2650 caca_outdev_deps="libcaca"
2651 decklink_outdev_deps="decklink pthreads"
2652 decklink_outdev_extralibs="-lstdc++"
2653 decklink_indev_deps="decklink pthreads"
2654 decklink_indev_extralibs="-lstdc++"
2655 dshow_indev_deps="IBaseFilter"
2656 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
2657 dv1394_indev_deps="dv1394"
2658 dv1394_indev_select="dv_demuxer"
2659 fbdev_indev_deps="linux_fb_h"
2660 fbdev_outdev_deps="linux_fb_h"
2661 gdigrab_indev_deps="CreateDIBSection"
2662 gdigrab_indev_extralibs="-lgdi32"
2663 gdigrab_indev_select="bmp_decoder"
2664 iec61883_indev_deps="libiec61883"
2665 jack_indev_deps="jack_jack_h sem_timedwait"
2666 lavfi_indev_deps="avfilter"
2667 libcdio_indev_deps="libcdio"
2668 libdc1394_indev_deps="libdc1394"
2669 libv4l2_indev_deps="libv4l2"
2670 openal_indev_deps="openal"
2671 opengl_outdev_deps="opengl"
2672 oss_indev_deps_any="soundcard_h sys_soundcard_h"
2673 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
2674 pulse_indev_deps="libpulse"
2675 pulse_outdev_deps="libpulse"
2676 qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
2677 qtkit_indev_select="qtkit"
2678 sdl_outdev_deps="sdl"
2679 sndio_indev_deps="sndio_h"
2680 sndio_outdev_deps="sndio_h"
2681 v4l_indev_deps="linux_videodev_h"
2682 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2683 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
2684 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
2685 vfwcap_indev_extralibs="-lavicap32"
2686 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
2687 xv_outdev_extralibs="-lXv -lX11 -lXext"
2688 x11grab_indev_deps="x11grab"
2689 x11grab_xcb_indev_deps="libxcb"
2690
2691 # protocols
2692 async_protocol_deps="pthreads"
2693 bluray_protocol_deps="libbluray"
2694 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2695 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
2696 ffrtmpcrypt_protocol_select="tcp_protocol"
2697 ffrtmphttp_protocol_deps="!librtmp_protocol"
2698 ffrtmphttp_protocol_select="http_protocol"
2699 ftp_protocol_select="tcp_protocol"
2700 gopher_protocol_select="network"
2701 http_protocol_select="tcp_protocol"
2702 httpproxy_protocol_select="tcp_protocol"
2703 https_protocol_select="tls_protocol"
2704 icecast_protocol_select="http_protocol"
2705 librtmp_protocol_deps="librtmp"
2706 librtmpe_protocol_deps="librtmp"
2707 librtmps_protocol_deps="librtmp"
2708 librtmpt_protocol_deps="librtmp"
2709 librtmpte_protocol_deps="librtmp"
2710 libsmbclient_protocol_deps="libsmbclient gplv3"
2711 libssh_protocol_deps="libssh"
2712 mmsh_protocol_select="http_protocol"
2713 mmst_protocol_select="network"
2714 rtmp_protocol_deps="!librtmp_protocol"
2715 rtmp_protocol_select="tcp_protocol"
2716 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2717 rtmps_protocol_deps="!librtmp_protocol"
2718 rtmps_protocol_select="tls_protocol"
2719 rtmpt_protocol_select="ffrtmphttp_protocol"
2720 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2721 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2722 rtp_protocol_select="udp_protocol"
2723 sctp_protocol_deps="struct_sctp_event_subscribe"
2724 sctp_protocol_select="network"
2725 srtp_protocol_select="rtp_protocol"
2726 tcp_protocol_select="network"
2727 tls_gnutls_protocol_deps="gnutls !tls_securetransport_protocol"
2728 tls_gnutls_protocol_select="tcp_protocol"
2729 tls_openssl_protocol_deps="openssl !tls_securetransport_protocol !tls_gnutls_protocol"
2730 tls_openssl_protocol_select="tcp_protocol"
2731 tls_securetransport_protocol_deps="securetransport"
2732 tls_securetransport_protocol_select="tcp_protocol"
2733 tls_protocol_deps_any="tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
2734 udp_protocol_select="network"
2735 udplite_protocol_select="network"
2736 unix_protocol_deps="sys_un_h"
2737 unix_protocol_select="network"
2738
2739 # filters
2740 amovie_filter_deps="avcodec avformat"
2741 aresample_filter_deps="swresample"
2742 ass_filter_deps="libass"
2743 asyncts_filter_deps="avresample"
2744 atempo_filter_deps="avcodec"
2745 atempo_filter_select="rdft"
2746 azmq_filter_deps="libzmq"
2747 blackframe_filter_deps="gpl"
2748 boxblur_filter_deps="gpl"
2749 bs2b_filter_deps="libbs2b"
2750 colormatrix_filter_deps="gpl"
2751 cover_rect_filter_deps="avcodec avformat gpl"
2752 cropdetect_filter_deps="gpl"
2753 delogo_filter_deps="gpl"
2754 deshake_filter_select="pixelutils"
2755 drawtext_filter_deps="libfreetype"
2756 dynaudnorm_filter_deps="copysign erf"
2757 ebur128_filter_deps="gpl"
2758 eq_filter_deps="gpl"
2759 fftfilt_filter_deps="avcodec"
2760 fftfilt_filter_select="rdft"
2761 flite_filter_deps="libflite"
2762 find_rect_filter_deps="avcodec avformat gpl"
2763 frei0r_filter_deps="frei0r dlopen"
2764 frei0r_src_filter_deps="frei0r dlopen"
2765 fspp_filter_deps="gpl"
2766 geq_filter_deps="gpl"
2767 histeq_filter_deps="gpl"
2768 hqdn3d_filter_deps="gpl"
2769 interlace_filter_deps="gpl"
2770 kerndeint_filter_deps="gpl"
2771 ladspa_filter_deps="ladspa dlopen"
2772 mcdeint_filter_deps="avcodec gpl"
2773 movie_filter_deps="avcodec avformat"
2774 mpdecimate_filter_deps="gpl"
2775 mpdecimate_filter_select="pixelutils"
2776 mptestsrc_filter_deps="gpl"
2777 negate_filter_deps="lut_filter"
2778 perspective_filter_deps="gpl"
2779 pp7_filter_deps="gpl"
2780 ocv_filter_deps="libopencv"
2781 owdenoise_filter_deps="gpl"
2782 pan_filter_deps="swresample"
2783 phase_filter_deps="gpl"
2784 pp_filter_deps="gpl postproc"
2785 pullup_filter_deps="gpl"
2786 removelogo_filter_deps="avcodec avformat swscale"
2787 repeatfields_filter_deps="gpl"
2788 resample_filter_deps="avresample"
2789 sab_filter_deps="gpl swscale"
2790 scale_filter_deps="swscale"
2791 scale2ref_filter_deps="swscale"
2792 select_filter_select="pixelutils"
2793 smartblur_filter_deps="gpl swscale"
2794 showcqt_filter_deps="avcodec"
2795 showcqt_filter_select="fft"
2796 showfreqs_filter_deps="avcodec"
2797 showfreqs_filter_select="fft"
2798 showspectrum_filter_deps="avcodec"
2799 showspectrum_filter_select="rdft"
2800 spp_filter_deps="gpl avcodec"
2801 spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
2802 stereo3d_filter_deps="gpl"
2803 subtitles_filter_deps="avformat avcodec libass"
2804 super2xsai_filter_deps="gpl"
2805 tinterlace_filter_deps="gpl"
2806 vidstabdetect_filter_deps="libvidstab"
2807 vidstabtransform_filter_deps="libvidstab"
2808 pixfmts_super2xsai_test_deps="super2xsai_filter"
2809 tinterlace_merge_test_deps="tinterlace_filter"
2810 tinterlace_pad_test_deps="tinterlace_filter"
2811 uspp_filter_deps="gpl avcodec"
2812 zmq_filter_deps="libzmq"
2813 zoompan_filter_deps="swscale"
2814
2815 # examples
2816 avio_reading="avformat avcodec avutil"
2817 avio_dir_cmd="avformat avutil"
2818 avcodec_example_deps="avcodec avutil"
2819 decoding_encoding_example_deps="avcodec avformat avutil"
2820 demuxing_decoding_example_deps="avcodec avformat avutil"
2821 extract_mvs_example_deps="avcodec avformat avutil"
2822 filter_audio_example_deps="avfilter avutil"
2823 filtering_audio_example_deps="avfilter avcodec avformat avutil"
2824 filtering_video_example_deps="avfilter avcodec avformat avutil"
2825 metadata_example_deps="avformat avutil"
2826 muxing_example_deps="avcodec avformat avutil swscale"
2827 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
2828 remuxing_example_deps="avcodec avformat avutil"
2829 resampling_audio_example_deps="avutil swresample"
2830 scaling_video_example_deps="avutil swscale"
2831 transcode_aac_example_deps="avcodec avformat swresample"
2832 transcoding_example_deps="avfilter avcodec avformat avutil"
2833
2834 # libraries, in linking order
2835 avcodec_deps="avutil"
2836 avdevice_deps="avformat avcodec avutil"
2837 avfilter_deps="avutil"
2838 avformat_deps="avcodec avutil"
2839 avresample_deps="avutil"
2840 postproc_deps="avutil gpl"
2841 swresample_deps="avutil"
2842 swscale_deps="avutil"
2843
2844 # programs
2845 ffmpeg_deps="avcodec avfilter avformat swresample"
2846 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
2847                null_filter
2848                setpts_filter trim_filter"
2849 ffplay_deps="avcodec avformat swscale swresample sdl"
2850 ffplay_libs='$sdl_libs'
2851 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
2852 ffprobe_deps="avcodec avformat"
2853 ffserver_deps="avformat fork sarestart"
2854 ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
2855
2856 # documentation
2857 podpages_deps="perl"
2858 manpages_deps="perl pod2man"
2859 htmlpages_deps="perl"
2860 htmlpages_deps_any="makeinfo_html texi2html"
2861 txtpages_deps="perl makeinfo"
2862 doc_deps_any="manpages htmlpages podpages txtpages"
2863
2864 # default parameters
2865
2866 logfile="config.log"
2867
2868 # installation paths
2869 prefix_default="/usr/local"
2870 bindir_default='${prefix}/bin'
2871 datadir_default='${prefix}/share/ffmpeg'
2872 docdir_default='${prefix}/share/doc/ffmpeg'
2873 incdir_default='${prefix}/include'
2874 libdir_default='${prefix}/lib'
2875 mandir_default='${prefix}/share/man'
2876
2877 # toolchain
2878 ar_default="ar"
2879 cc_default="gcc"
2880 cxx_default="g++"
2881 host_cc_default="gcc"
2882 cp_f="cp -f"
2883 doxygen_default="doxygen"
2884 install="install"
2885 ln_s="ln -s -f"
2886 nm_default="nm -g"
2887 objformat="elf"
2888 pkg_config_default=pkg-config
2889 ranlib_default="ranlib"
2890 strip_default="strip"
2891 yasmexe_default="yasm"
2892 windres_default="windres"
2893
2894 # OS
2895 target_os_default=$(tolower $(uname -s))
2896 host_os=$target_os_default
2897
2898 # machine
2899 if test "$target_os_default" = aix; then
2900     arch_default=$(uname -p)
2901     strip_default="strip -X32_64"
2902 else
2903     arch_default=$(uname -m)
2904 fi
2905 cpu="generic"
2906 intrinsics="none"
2907
2908 # configurable options
2909 enable $PROGRAM_LIST
2910 enable $DOCUMENT_LIST
2911 enable $EXAMPLE_LIST
2912 enable $(filter_out avresample $LIBRARY_LIST)
2913 enable stripping
2914
2915 enable asm
2916 enable debug
2917 enable doc
2918 enable faan faandct faanidct
2919 enable optimizations
2920 enable runtime_cpudetect
2921 enable safe_bitstream_reader
2922 enable static
2923 enable swscale_alpha
2924 enable valgrind_backtrace
2925
2926 sws_max_filter_size_default=256
2927 set_default sws_max_filter_size
2928
2929 # Enable hwaccels by default.
2930 enable d3d11va dxva2 vaapi vda vdpau videotoolbox xvmc
2931 enable xlib
2932
2933 # build settings
2934 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2935 LIBPREF="lib"
2936 LIBSUF=".a"
2937 FULLNAME='$(NAME)$(BUILDSUF)'
2938 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
2939 SLIBPREF="lib"
2940 SLIBSUF=".so"
2941 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
2942 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2943 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2944 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2945 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2946 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2947
2948 asflags_filter=echo
2949 cflags_filter=echo
2950 ldflags_filter=echo
2951
2952 AS_C='-c'
2953 AS_O='-o $@'
2954 CC_C='-c'
2955 CC_E='-E -o $@'
2956 CC_O='-o $@'
2957 CXX_C='-c'
2958 CXX_O='-o $@'
2959 LD_O='-o $@'
2960 LD_LIB='-l%'
2961 LD_PATH='-L'
2962 HOSTCC_C='-c'
2963 HOSTCC_E='-E -o $@'
2964 HOSTCC_O='-o $@'
2965 HOSTLD_O='-o $@'
2966
2967 host_libs='-lm'
2968 host_cflags_filter=echo
2969 host_ldflags_filter=echo
2970
2971 target_path='$(CURDIR)'
2972
2973 # since the object filename is not given with the -MM flag, the compiler
2974 # is only able to print the basename, and we must add the path ourselves
2975 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2976 DEPFLAGS='-MM'
2977
2978 # find source path
2979 if test -f configure; then
2980     source_path=.
2981 else
2982     source_path=$(cd $(dirname "$0"); pwd)
2983     case "$source_path" in
2984         *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
2985     esac
2986     test -e "$source_path/config.h" &&
2987         die "Out of tree builds are impossible with config.h in source dir."
2988 fi
2989
2990 for v in "$@"; do
2991     r=${v#*=}
2992     l=${v%"$r"}
2993     r=$(sh_quote "$r")
2994     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
2995 done
2996
2997 find_things(){
2998     thing=$1
2999     pattern=$2
3000     file=$source_path/$3
3001     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
3002 }
3003
3004 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
3005 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
3006 HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
3007 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
3008 BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
3009 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
3010 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
3011 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
3012 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
3013 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
3014 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
3015
3016 ALL_COMPONENTS="
3017     $BSF_LIST
3018     $DECODER_LIST
3019     $DEMUXER_LIST
3020     $ENCODER_LIST
3021     $FILTER_LIST
3022     $HWACCEL_LIST
3023     $INDEV_LIST
3024     $MUXER_LIST
3025     $OUTDEV_LIST
3026     $PARSER_LIST
3027     $PROTOCOL_LIST
3028 "
3029
3030 for n in $COMPONENT_LIST; do
3031     v=$(toupper ${n%s})_LIST
3032     eval enable \$$v
3033     eval ${n}_if_any="\$$v"
3034 done
3035
3036 enable $ARCH_EXT_LIST
3037
3038 die_unknown(){
3039     echo "Unknown option \"$1\"."
3040     echo "See $0 --help for available options."
3041     exit 1
3042 }
3043
3044 print_3_columns() {
3045     cat | tr ' ' '\n' | sort | pr -r -3 -t
3046 }
3047
3048 show_list() {
3049     suffix=_$1
3050     shift
3051     echo $* | sed s/$suffix//g | print_3_columns
3052     exit 0
3053 }
3054
3055 rand_list(){
3056     IFS=', '
3057     set -- $*
3058     unset IFS
3059     for thing; do
3060         comp=${thing%:*}
3061         prob=${thing#$comp}
3062         prob=${prob#:}
3063         is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
3064         echo "prob ${prob:-0.5}"
3065         printf '%s\n' $comp
3066     done
3067 }
3068
3069 do_random(){
3070     action=$1
3071     shift
3072     random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
3073     $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
3074 }
3075
3076 for opt do
3077     optval="${opt#*=}"
3078     case "$opt" in
3079         --extra-ldflags=*)
3080             add_ldflags $optval
3081         ;;
3082         --extra-ldexeflags=*)
3083             add_ldexeflags $optval
3084         ;;
3085         --extra-ldlibflags=*)
3086             add_ldlibflags $optval
3087         ;;
3088         --extra-libs=*)
3089             add_extralibs $optval
3090         ;;
3091         --disable-devices)
3092             disable $INDEV_LIST $OUTDEV_LIST
3093         ;;
3094         --enable-debug=*)
3095             debuglevel="$optval"
3096         ;;
3097         --disable-programs)
3098             disable $PROGRAM_LIST
3099         ;;
3100         --disable-everything)
3101             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3102         ;;
3103         --disable-all)
3104             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3105             disable $LIBRARY_LIST $PROGRAM_LIST doc
3106         ;;
3107         --enable-random|--disable-random)
3108             action=${opt%%-random}
3109             do_random ${action#--} $COMPONENT_LIST
3110         ;;
3111         --enable-random=*|--disable-random=*)
3112             action=${opt%%-random=*}
3113             do_random ${action#--} $optval
3114         ;;
3115         --enable-*=*|--disable-*=*)
3116             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
3117             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
3118             eval list=\$$(toupper $thing)_LIST
3119             name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
3120             list=$(filter "$name" $list)
3121             [ "$list" = "" ] && warn "Option $opt did not match anything"
3122             $action $list
3123         ;;
3124         --enable-?*|--disable-?*)
3125             eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
3126             if is_in $option $COMPONENT_LIST; then
3127                 test $action = disable && action=unset
3128                 eval $action \$$(toupper ${option%s})_LIST
3129             elif is_in $option $CMDLINE_SELECT; then
3130                 $action $option
3131             else
3132                 die_unknown $opt
3133             fi
3134         ;;
3135         --list-*)
3136             NAME="${opt#--list-}"
3137             is_in $NAME $COMPONENT_LIST || die_unknown $opt
3138             NAME=${NAME%s}
3139             eval show_list $NAME \$$(toupper $NAME)_LIST
3140         ;;
3141         --help|-h) show_help
3142         ;;
3143         --fatal-warnings) enable fatal_warnings
3144         ;;
3145         *)
3146             optname="${opt%%=*}"
3147             optname="${optname#--}"
3148             optname=$(echo "$optname" | sed 's/-/_/g')
3149             if is_in $optname $CMDLINE_SET; then
3150                 eval $optname='$optval'
3151             elif is_in $optname $CMDLINE_APPEND; then
3152                 append $optname "$optval"
3153             else
3154                 die_unknown $opt
3155             fi
3156         ;;
3157     esac
3158 done
3159
3160 for e in $env; do
3161     eval "export $e"
3162 done
3163
3164 disabled logging && logfile=/dev/null
3165
3166 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
3167 set >> $logfile
3168
3169 test -n "$valgrind" && toolchain="valgrind-memcheck"
3170
3171 case "$toolchain" in
3172     clang-asan)
3173         cc_default="clang"
3174         add_cflags  -fsanitize=address
3175         add_ldflags -fsanitize=address
3176     ;;
3177     clang-tsan)
3178         cc_default="clang"
3179         add_cflags  -fsanitize=thread -pie
3180         add_ldflags -fsanitize=thread -pie
3181     ;;
3182     clang-usan)
3183         cc_default="clang"
3184         add_cflags  -fsanitize=undefined
3185         add_ldflags -fsanitize=undefined
3186     ;;
3187     gcc-asan)
3188         cc_default="gcc"
3189         add_cflags  -fsanitize=address
3190         add_ldflags -fsanitize=address
3191     ;;
3192     gcc-tsan)
3193         cc_default="gcc"
3194         add_cflags  -fsanitize=thread -pie -fPIC
3195         add_ldflags -fsanitize=thread -pie -fPIC
3196     ;;
3197     gcc-usan)
3198         cc_default="gcc"
3199         add_cflags  -fsanitize=undefined
3200         add_ldflags -fsanitize=undefined
3201     ;;
3202     valgrind-massif)
3203         target_exec_default=${valgrind:-"valgrind"}
3204         target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc"
3205     ;;
3206     valgrind-memcheck)
3207         target_exec_default=${valgrind:-"valgrind"}
3208         target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp"
3209     ;;
3210     msvc)
3211         # Check whether the current MSVC version needs the C99 converter.
3212         # From MSVC 2013 (compiler major version 18) onwards, it does actually
3213         # support enough of C99 to build ffmpeg. Default to the new
3214         # behaviour if the regexp was unable to match anything, since this
3215         # successfully parses the version number of existing supported
3216         # versions that require the converter (MSVC 2010 and 2012).
3217         cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
3218         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
3219             cc_default="cl"
3220         else
3221             cc_default="c99wrap cl"
3222         fi
3223         ld_default="$source_path/compat/windows/mslink"
3224         nm_default="dumpbin -symbols"
3225         ar_default="lib"
3226         case "$arch" in
3227         arm*)
3228             as_default="armasm"
3229             ;;
3230         esac
3231         target_os_default="win32"
3232         # Use a relative path for TMPDIR. This makes sure all the
3233         # ffconf temp files are written with a relative path, avoiding
3234         # issues with msys/win32 path conversion for MSVC parameters
3235         # such as -Fo<file> or -out:<file>.
3236         TMPDIR=.
3237     ;;
3238     icl)
3239         cc_default="icl"
3240         ld_default="xilink"
3241         nm_default="dumpbin -symbols"
3242         ar_default="xilib"
3243         target_os_default="win32"
3244         TMPDIR=.
3245     ;;
3246     gcov)
3247         add_cflags  -fprofile-arcs -ftest-coverage
3248         add_ldflags -fprofile-arcs -ftest-coverage
3249     ;;
3250     hardened)
3251         add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3252         add_cflags   -fno-strict-overflow -fstack-protector-all
3253         add_ldflags  -Wl,-z,relro -Wl,-z,now
3254     ;;
3255     ?*)
3256         die "Unknown toolchain $toolchain"
3257     ;;
3258 esac
3259
3260 test -n "$cross_prefix" && enable cross_compile
3261
3262 if enabled cross_compile; then
3263     test -n "$arch" && test -n "$target_os" ||
3264         die "Must specify target arch and OS when cross-compiling"
3265 fi
3266
3267 ar_default="${cross_prefix}${ar_default}"
3268 cc_default="${cross_prefix}${cc_default}"
3269 cxx_default="${cross_prefix}${cxx_default}"
3270 nm_default="${cross_prefix}${nm_default}"
3271 pkg_config_default="${cross_prefix}${pkg_config_default}"
3272 if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
3273     ranlib_default="${cross_prefix}${ranlib_default} -D"
3274 else
3275     ranlib_default="${cross_prefix}${ranlib_default}"
3276 fi
3277 strip_default="${cross_prefix}${strip_default}"
3278 windres_default="${cross_prefix}${windres_default}"
3279
3280 sysinclude_default="${sysroot}/usr/include"
3281
3282 set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
3283     target_exec target_os yasmexe
3284 enabled cross_compile || host_cc_default=$cc
3285 set_default host_cc
3286
3287 pkg_config_fail_message=""
3288 if ! $pkg_config --version >/dev/null 2>&1; then
3289     warn "$pkg_config not found, library detection may fail."
3290     pkg_config=false
3291 elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
3292     pkg_config_fail_message="
3293 Note: When building a static binary, add --pkg-config-flags=\"--static\"."
3294 fi
3295
3296 if test $doxygen != $doxygen_default && \
3297   ! $doxygen --version >/dev/null 2>&1; then
3298     warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
3299 fi
3300
3301 exesuf() {
3302     case $1 in
3303         mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
3304     esac
3305 }
3306
3307 EXESUF=$(exesuf $target_os)
3308 HOSTEXESUF=$(exesuf $host_os)
3309
3310 # set temporary file name
3311 : ${TMPDIR:=$TEMPDIR}
3312 : ${TMPDIR:=$TMP}
3313 : ${TMPDIR:=/tmp}
3314
3315 if [ -n "$tempprefix" ] ; then
3316     mktemp(){
3317         echo $tempprefix.${HOSTNAME}.${UID}
3318     }
3319 elif ! check_cmd mktemp -u XXXXXX; then
3320     # simple replacement for missing mktemp
3321     # NOT SAFE FOR GENERAL USE
3322     mktemp(){
3323         echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
3324     }
3325 fi
3326
3327 tmpfile(){
3328     tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
3329         (set -C; exec > $tmp) 2>/dev/null ||
3330         die "Unable to create temporary file in $TMPDIR."
3331     append TMPFILES $tmp
3332     eval $1=$tmp
3333 }
3334
3335 trap 'rm -f -- $TMPFILES' EXIT
3336
3337 tmpfile TMPASM .asm
3338 tmpfile TMPC   .c
3339 tmpfile TMPCPP .cpp
3340 tmpfile TMPE   $EXESUF
3341 tmpfile TMPH   .h
3342 tmpfile TMPM   .m
3343 tmpfile TMPO   .o
3344 tmpfile TMPS   .S
3345 tmpfile TMPSH  .sh
3346 tmpfile TMPV   .ver
3347
3348 unset -f mktemp
3349
3350 chmod +x $TMPE
3351
3352 # make sure we can execute files in $TMPDIR
3353 cat > $TMPSH 2>> $logfile <<EOF
3354 #! /bin/sh
3355 EOF
3356 chmod +x $TMPSH >> $logfile 2>&1
3357 if ! $TMPSH >> $logfile 2>&1; then
3358     cat <<EOF
3359 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
3360 variable to another directory and make sure that it is not mounted noexec.
3361 EOF
3362     die "Sanity test failed."
3363 fi
3364
3365 armasm_flags(){
3366     for flag; do
3367         case $flag in
3368             # Filter out MSVC cl.exe options from cflags that shouldn't
3369             # be passed to gas-preprocessor
3370             -M[TD]*)                                            ;;
3371             *)                  echo $flag                      ;;
3372         esac
3373    done
3374 }
3375
3376 ccc_flags(){
3377     for flag; do
3378         case $flag in
3379             -std=c99)           echo -c99                       ;;
3380             -mcpu=*)            echo -arch ${flag#*=}           ;;
3381             -mieee)             echo -ieee                      ;;
3382             -O*|-fast)          echo $flag                      ;;
3383             -fno-math-errno)    echo -assume nomath_errno       ;;
3384             -g)                 echo -g3                        ;;
3385             -Wall)              echo -msg_enable level2         ;;
3386             -Wno-pointer-sign)  echo -msg_disable ptrmismatch1  ;;
3387             -Wl,*)              echo $flag                      ;;
3388             -f*|-W*)                                            ;;
3389             *)                  echo $flag                      ;;
3390         esac
3391    done
3392 }
3393
3394 cparser_flags(){
3395     for flag; do
3396         case $flag in
3397             -Wno-switch)             echo -Wno-switch-enum ;;
3398             -Wno-format-zero-length) ;;
3399             -Wdisabled-optimization) ;;
3400             -Wno-pointer-sign)       echo -Wno-other ;;
3401             *)                       echo $flag ;;
3402         esac
3403     done
3404 }
3405
3406 msvc_common_flags(){
3407     for flag; do
3408         case $flag in
3409             # In addition to specifying certain flags under the compiler
3410             # specific filters, they must be specified here as well or else the
3411             # generic catch all at the bottom will print the original flag.
3412             -Wall)                ;;
3413             -std=c99)             ;;
3414             # Common flags
3415             -fomit-frame-pointer) ;;
3416             -g)                   echo -Z7 ;;
3417             -fno-math-errno)      ;;
3418             -fno-common)          ;;
3419             -fno-signed-zeros)    ;;
3420             -fPIC)                ;;
3421             -mthumb)              ;;
3422             -march=*)             ;;
3423             -lz)                  echo zlib.lib ;;
3424             -lavifil32)           echo vfw32.lib ;;
3425             -lavicap32)           echo vfw32.lib user32.lib ;;
3426             -l*)                  echo ${flag#-l}.lib ;;
3427             -LARGEADDRESSAWARE)   echo $flag ;;
3428             -L*)                  echo -libpath:${flag#-L} ;;
3429             *)                    echo $flag ;;
3430         esac
3431     done
3432 }
3433
3434 msvc_flags(){
3435     msvc_common_flags "$@"
3436     for flag; do
3437         case $flag in
3438             -Wall)                echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
3439                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
3440                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
3441                                        -wd4307 \
3442                                        -wd4273 -wd4554 -wd4701 ;;
3443         esac
3444     done
3445 }
3446
3447 icl_flags(){
3448     msvc_common_flags "$@"
3449     for flag; do
3450         case $flag in
3451             # Despite what Intel's documentation says -Wall, which is supported
3452             # on Windows, does enable remarks so disable them here.
3453             -Wall)                echo $flag -Qdiag-disable:remark ;;
3454             -std=c99)             echo -Qstd=c99 ;;
3455             -flto)                echo -ipo ;;
3456         esac
3457     done
3458 }
3459
3460 icc_flags(){
3461     for flag; do
3462         case $flag in
3463             -flto)                echo -ipo ;;
3464             *)                    echo $flag ;;
3465         esac
3466     done
3467 }
3468
3469 pgi_flags(){
3470     for flag; do
3471         case $flag in
3472             -flto)                echo -Mipa=fast,libopt,libinline,vestigial ;;
3473             -fomit-frame-pointer) echo -Mnoframe ;;
3474             -g)                   echo -gopt ;;
3475             *)                    echo $flag ;;
3476         esac
3477     done
3478 }
3479
3480 suncc_flags(){
3481     for flag; do
3482         case $flag in
3483             -march=*|-mcpu=*)
3484                 case "${flag#*=}" in
3485                     native)                   echo -xtarget=native       ;;
3486                     v9|niagara)               echo -xarch=sparc          ;;
3487                     ultrasparc)               echo -xarch=sparcvis       ;;
3488                     ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
3489                     i586|pentium)             echo -xchip=pentium        ;;
3490                     i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
3491                     pentium3*|c3-2)           echo -xtarget=pentium3     ;;
3492                     pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
3493                     pentium4*)          echo -xtarget=pentium4           ;;
3494                     prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
3495                     *-sse3)             echo -xarch=sse3                 ;;
3496                     core2)              echo -xarch=ssse3 -xchip=core2   ;;
3497                     bonnell)                   echo -xarch=ssse3         ;;
3498                     corei7|nehalem)            echo -xtarget=nehalem     ;;
3499                     westmere)                  echo -xtarget=westmere    ;;
3500                     silvermont)                echo -xarch=sse4_2        ;;
3501                     corei7-avx|sandybridge)    echo -xtarget=sandybridge ;;
3502                     core-avx*|ivybridge|haswell|broadwell)
3503                                                echo -xarch=avx           ;;
3504                     amdfam10|barcelona)        echo -xtarget=barcelona   ;;
3505                     btver1)                    echo -xarch=amdsse4a      ;;
3506                     btver2|bdver*)             echo -xarch=avx           ;;
3507                     athlon-4|athlon-[mx]p)     echo -xarch=ssea          ;;
3508                     k8|opteron|athlon64|athlon-fx)
3509                                                echo -xarch=sse2a         ;;
3510                     athlon*)                   echo -xarch=pentium_proa  ;;
3511                 esac
3512                 ;;
3513             -std=c99)             echo -xc99              ;;
3514             -fomit-frame-pointer) echo -xregs=frameptr    ;;
3515             -fPIC)                echo -KPIC -xcode=pic32 ;;
3516             -W*,*)                echo $flag              ;;
3517             -f*-*|-W*|-mimpure-text)                      ;;
3518             -shared)              echo -G                 ;;
3519             *)                    echo $flag              ;;
3520         esac
3521     done
3522 }
3523
3524 tms470_flags(){
3525     for flag; do
3526         case $flag in
3527             -march=*|-mcpu=*)
3528                 case "${flag#*=}" in
3529                     armv7-a|cortex-a*)      echo -mv=7a8 ;;
3530                     armv7-r|cortex-r*)      echo -mv=7r4 ;;
3531                     armv7-m|cortex-m*)      echo -mv=7m3 ;;
3532                     armv6*|arm11*)          echo -mv=6   ;;
3533                     armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3534                                             echo -mv=5e  ;;
3535                     armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
3536                 esac
3537                 ;;
3538             -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
3539             -mfpu=vfp)      echo --float_support=vfpv2        ;;
3540             -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
3541             -mfpu=vfpv3-d16) echo --float_support=vfpv3d16    ;;
3542             -msoft-float)   echo --float_support=vfplib       ;;
3543             -O[0-3]|-mf=*)  echo $flag                        ;;
3544             -g)             echo -g -mn                       ;;
3545             -pds=*)         echo $flag                        ;;
3546             -D*|-I*)        echo $flag                        ;;
3547             --gcc|--abi=*)  echo $flag                        ;;
3548             -me)            echo $flag                        ;;
3549         esac
3550     done
3551 }
3552
3553 probe_cc(){
3554     pfx=$1
3555     _cc=$2
3556     first=$3
3557
3558     unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3559     unset _ld_o _ldflags _ld_lib _ld_path
3560     unset _depflags _DEPCMD _DEPFLAGS
3561     _flags_filter=echo
3562
3563     if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
3564         true # no-op to avoid reading stdin in following checks
3565     elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3566         _type=llvm_gcc
3567         gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3568         _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
3569         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3570         _cflags_speed='-O3'
3571         _cflags_size='-Os'
3572     elif $_cc -v 2>&1 | grep -qi ^gcc; then
3573         _type=gcc
3574         gcc_version=$($_cc --version | head -n1)
3575         gcc_basever=$($_cc -dumpversion)
3576         gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3577         gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3578         _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3579         case $gcc_basever in
3580             2*) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
3581         esac
3582         if [ "$first" = true ]; then
3583             case $gcc_basever in
3584                 4.2*)
3585                 warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
3586             esac
3587         fi
3588         _cflags_speed='-O3'
3589         _cflags_size='-Os'
3590     elif $_cc --version 2>/dev/null | grep -q ^icc; then
3591         _type=icc
3592         _ident=$($_cc --version | head -n1)
3593         _depflags='-MMD'
3594         _cflags_speed='-O3'
3595         _cflags_size='-Os'
3596         _cflags_noopt='-O1'
3597         _flags_filter=icc_flags
3598     elif $_cc -v 2>&1 | grep -q xlc; then
3599         _type=xlc
3600         _ident=$($_cc -qversion 2>/dev/null | head -n1)
3601         _cflags_speed='-O5'
3602         _cflags_size='-O5 -qcompact'
3603     elif $_cc -V 2>/dev/null | grep -q Compaq; then
3604         _type=ccc
3605         _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3606         _DEPFLAGS='-M'
3607         _cflags_speed='-fast'
3608         _cflags_size='-O1'
3609         _flags_filter=ccc_flags
3610     elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
3611         test -d "$sysroot" || die "No valid sysroot specified."
3612         _type=armcc
3613         _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
3614         armcc_conf="$PWD/armcc.conf"
3615         $_cc --arm_linux_configure                 \
3616              --arm_linux_config_file="$armcc_conf" \
3617              --configure_sysroot="$sysroot"        \
3618              --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3619              die "Error creating armcc configuration file."
3620         $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3621         _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3622         as_default="${cross_prefix}gcc"
3623         _depflags='-MMD'
3624         _cflags_speed='-O3'
3625         _cflags_size='-Os'
3626     elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
3627         _type=tms470
3628         _ident=$($_cc -version | head -n1 | tr -s ' ')
3629         _flags='--gcc --abi=eabi -me'
3630         _cc_e='-ppl -fe=$@'
3631         _cc_o='-fe=$@'
3632         _depflags='-ppa -ppd=$(@:.o=.d)'
3633         _cflags_speed='-O3 -mf=5'
3634         _cflags_size='-O3 -mf=2'
3635         _flags_filter=tms470_flags
3636     elif $_cc -v 2>&1 | grep -q clang; then
3637         _type=clang
3638         _ident=$($_cc --version 2>/dev/null | head -n1)
3639         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3640         _cflags_speed='-O3'
3641         _cflags_size='-Os'
3642     elif $_cc -V 2>&1 | grep -q Sun; then
3643         _type=suncc
3644         _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3645         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3646         _DEPFLAGS='-xM1 -xc99'
3647         _ldflags='-std=c99'
3648         _cflags_speed='-O5'
3649         _cflags_size='-O5 -xspace'
3650         _flags_filter=suncc_flags
3651     elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3652         _type=pathscale
3653         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3654         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3655         _cflags_speed='-O2'
3656         _cflags_size='-Os'
3657         _flags_filter='filter_out -Wdisabled-optimization'
3658     elif $_cc -v 2>&1 | grep -q Open64; then
3659         _type=open64
3660         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3661         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3662         _cflags_speed='-O2'
3663         _cflags_size='-Os'
3664         _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3665     elif $_cc -V 2>&1 | grep -q Portland; then
3666         _type=pgi
3667         _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
3668         opt_common='-alias=ansi -Mdse -Mlre -Mpre'
3669         _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3670         _cflags_size="-O2 -Munroll=c:1 $opt_common"
3671         _cflags_noopt="-O"
3672         _flags_filter=pgi_flags
3673     elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3674         _type=armasm
3675         _ident=$($_cc | head -n1)
3676         # 4509: "This form of conditional instruction is deprecated"
3677         _flags="-nologo -ignore 4509"
3678         _flags_filter=armasm_flags
3679     elif $_cc 2>&1 | grep -q Intel; then
3680         _type=icl
3681         _ident=$($_cc 2>&1 | head -n1)
3682         _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3683         # Not only is O3 broken on 13.x+ but it is slower on all previous
3684         # versions (tested) as well.
3685         _cflags_speed="-O2"
3686         _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3687         if $_cc 2>&1 | grep -q Linker; then
3688             _ld_o='-out:$@'
3689         else
3690             _ld_o='-Fe$@'
3691         fi
3692         _cc_o='-Fo$@'
3693         _cc_e='-P'
3694         _flags_filter=icl_flags
3695         _ld_lib='lib%.a'
3696         _ld_path='-libpath:'
3697         # -Qdiag-error to make icl error when seeing certain unknown arguments
3698         _flags='-nologo -Qdiag-error:4044,10157'
3699         # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
3700         # with MSVC which enables it by default.
3701         _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS -fp:precise'
3702         disable stripping
3703     elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
3704         _type=msvc
3705         _ident=$($_cc 2>&1 | head -n1)
3706         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3707         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3708         _cflags_speed="-O2"
3709         _cflags_size="-O1"
3710         if $_cc -nologo- 2>&1 | grep -q Linker; then
3711             _ld_o='-out:$@'
3712         else
3713             _ld_o='-Fe$@'
3714         fi
3715         _cc_o='-Fo$@'
3716         _cc_e='-P -Fi$@'
3717         _flags_filter=msvc_flags
3718         _ld_lib='lib%.a'
3719         _ld_path='-libpath:'
3720         _flags='-nologo'
3721         _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS'
3722         disable stripping
3723     elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3724         _type=cparser
3725         _ident=$($_cc --version | head -n1)
3726         _depflags='-MMD'
3727         _cflags_speed='-O4'
3728         _cflags_size='-O2'
3729         _flags_filter=cparser_flags
3730     fi
3731
3732     eval ${pfx}_type=\$_type
3733     eval ${pfx}_ident=\$_ident
3734 }
3735
3736 set_ccvars(){
3737     eval ${1}_C=\${_cc_c-\${${1}_C}}
3738     eval ${1}_E=\${_cc_e-\${${1}_E}}
3739     eval ${1}_O=\${_cc_o-\${${1}_O}}
3740
3741     if [ -n "$_depflags" ]; then
3742         eval ${1}_DEPFLAGS=\$_depflags
3743     else
3744         eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3745         eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3746         eval DEP${1}FLAGS=\$_flags
3747     fi
3748 }
3749
3750 probe_cc cc "$cc" "true"
3751 cflags_filter=$_flags_filter
3752 cflags_speed=$_cflags_speed
3753 cflags_size=$_cflags_size
3754 cflags_noopt=$_cflags_noopt
3755 add_cflags $_flags $_cflags
3756 cc_ldflags=$_ldflags
3757 set_ccvars CC
3758
3759 probe_cc hostcc "$host_cc"
3760 host_cflags_filter=$_flags_filter
3761 add_host_cflags  $_flags $_cflags
3762 set_ccvars HOSTCC
3763
3764 test -n "$cc_type" && enable $cc_type ||
3765     warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3766
3767 : ${as_default:=$cc}
3768 : ${dep_cc_default:=$cc}
3769 : ${ld_default:=$cc}
3770 : ${host_ld_default:=$host_cc}
3771 set_default ar as dep_cc ld host_ld windres
3772
3773 probe_cc as "$as"
3774 asflags_filter=$_flags_filter
3775 add_asflags $_flags $_cflags
3776 set_ccvars AS
3777
3778 probe_cc ld "$ld"
3779 ldflags_filter=$_flags_filter
3780 add_ldflags $_flags $_ldflags
3781 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3782 LD_O=${_ld_o-$LD_O}
3783 LD_LIB=${_ld_lib-$LD_LIB}
3784 LD_PATH=${_ld_path-$LD_PATH}
3785
3786 probe_cc hostld "$host_ld"
3787 host_ldflags_filter=$_flags_filter
3788 add_host_ldflags $_flags $_ldflags
3789 HOSTLD_O=${_ld_o-$HOSTLD_O}
3790
3791 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3792     probe_cc depcc "$dep_cc"
3793     CCDEP=${_DEPCMD:-$DEPCMD}
3794     CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3795     DEPCCFLAGS=$_flags
3796 fi
3797
3798 if $ar 2>&1 | grep -q Microsoft; then
3799     arflags="-nologo"
3800     ar_o='-out:$@'
3801 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3802     arflags="rq"
3803     ar_o='$@'
3804 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3805     arflags='-Xany -r -c'
3806     ar_o='$@'
3807 elif $ar 2>&1 | grep -q "\[D\] "; then
3808     arflags="rcD"
3809     ar_o='$@'
3810 else
3811     arflags="rc"
3812     ar_o='$@'
3813 fi
3814
3815 add_cflags $extra_cflags
3816 add_cxxflags $extra_cxxflags
3817 add_asflags $extra_cflags
3818
3819 if test -n "$sysroot"; then
3820     case "$cc_type" in
3821         gcc|llvm_gcc|clang)
3822             add_cppflags --sysroot="$sysroot"
3823             add_ldflags --sysroot="$sysroot"
3824 # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
3825             add_cppflags -isysroot "$sysroot"
3826             add_ldflags -isysroot "$sysroot"
3827         ;;
3828         tms470)
3829             add_cppflags -I"$sysinclude"
3830             add_ldflags  --sysroot="$sysroot"
3831         ;;
3832     esac
3833 fi
3834
3835 if test "$cpu" = host; then
3836     enabled cross_compile &&
3837         die "--cpu=host makes no sense when cross-compiling."
3838
3839     case "$cc_type" in
3840         gcc|llvm_gcc)
3841             check_native(){
3842                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3843                 sed -n "/cc1.*$1=/{
3844                             s/.*$1=\\([^ ]*\\).*/\\1/
3845                             p
3846                             q
3847                         }" $TMPE
3848             }
3849             cpu=$(check_native -march || check_native -mcpu)
3850         ;;
3851     esac
3852
3853     test "${cpu:-host}" = host &&
3854         die "--cpu=host not supported with compiler $cc"
3855 fi
3856
3857 # Deal with common $arch aliases
3858 case "$arch" in
3859     aarch64|arm64)
3860         arch="aarch64"
3861     ;;
3862     arm*|iPad*|iPhone*)
3863         arch="arm"
3864     ;;
3865     mips*|IP*)
3866         arch="mips"
3867     ;;
3868     parisc*|hppa*)
3869         arch="parisc"
3870     ;;
3871     "Power Macintosh"|ppc*|powerpc*)
3872         arch="ppc"
3873     ;;
3874     s390|s390x)
3875         arch="s390"
3876     ;;
3877     sh4|sh)
3878         arch="sh4"
3879     ;;
3880     sun4u|sparc*)
3881         arch="sparc"
3882     ;;
3883     tilegx|tile-gx)
3884         arch="tilegx"
3885     ;;
3886     i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
3887         arch="x86"
3888     ;;
3889 esac
3890
3891 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3892 enable $arch
3893
3894 # Add processor-specific flags
3895 if enabled aarch64; then
3896
3897     case $cpu in
3898         armv*)
3899             cpuflags="-march=$cpu"
3900         ;;
3901         *)
3902             cpuflags="-mcpu=$cpu"
3903         ;;
3904     esac
3905
3906 elif enabled alpha; then
3907
3908     cpuflags="-mcpu=$cpu"
3909
3910 elif enabled arm; then
3911
3912     check_arm_arch() {
3913         check_cpp_condition stddef.h \
3914             "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3915             $cpuflags
3916     }
3917
3918     probe_arm_arch() {
3919         if   check_arm_arch 4;        then echo armv4;
3920         elif check_arm_arch 4T;       then echo armv4t;
3921         elif check_arm_arch 5;        then echo armv5;
3922         elif check_arm_arch 5E;       then echo armv5e;
3923         elif check_arm_arch 5T;       then echo armv5t;
3924         elif check_arm_arch 5TE;      then echo armv5te;
3925         elif check_arm_arch 5TEJ;     then echo armv5te;
3926         elif check_arm_arch 6;        then echo armv6;
3927         elif check_arm_arch 6J;       then echo armv6j;
3928         elif check_arm_arch 6K;       then echo armv6k;
3929         elif check_arm_arch 6Z;       then echo armv6z;
3930         elif check_arm_arch 6ZK;      then echo armv6zk;
3931         elif check_arm_arch 6T2;      then echo armv6t2;
3932         elif check_arm_arch 7;        then echo armv7;
3933         elif check_arm_arch 7A  7_A;  then echo armv7-a;
3934         elif check_arm_arch 7S;       then echo armv7-a;
3935         elif check_arm_arch 7R  7_R;  then echo armv7-r;
3936         elif check_arm_arch 7M  7_M;  then echo armv7-m;
3937         elif check_arm_arch 7EM 7E_M; then echo armv7-m;
3938         elif check_arm_arch 8A  8_A;  then echo armv8-a;
3939         fi
3940     }
3941
3942     [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3943
3944     case $cpu in
3945         armv*)
3946             cpuflags="-march=$cpu"
3947             subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3948         ;;
3949         *)
3950             cpuflags="-mcpu=$cpu"
3951             case $cpu in
3952                 cortex-a*)                               subarch=armv7a  ;;
3953                 cortex-r*)                               subarch=armv7r  ;;
3954                 cortex-m*)                 enable thumb; subarch=armv7m  ;;
3955                 arm11*)                                  subarch=armv6   ;;
3956                 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3957                 armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
3958                 *)                             subarch=$(probe_arm_arch) ;;
3959             esac
3960         ;;
3961     esac
3962
3963     case "$subarch" in
3964         armv5t*)    enable fast_clz                ;;
3965         armv[6-8]*)
3966             enable fast_clz
3967             disabled fast_unaligned || enable fast_unaligned
3968             ;;
3969     esac
3970
3971 elif enabled avr32; then
3972
3973     case $cpu in
3974         ap7[02]0[0-2])
3975             subarch="avr32_ap"
3976             cpuflags="-mpart=$cpu"
3977         ;;
3978         ap)
3979             subarch="avr32_ap"
3980             cpuflags="-march=$cpu"
3981         ;;
3982         uc3[ab]*)
3983             subarch="avr32_uc"
3984             cpuflags="-mcpu=$cpu"
3985         ;;
3986         uc)
3987             subarch="avr32_uc"
3988             cpuflags="-march=$cpu"
3989         ;;
3990     esac
3991
3992 elif enabled bfin; then
3993
3994     cpuflags="-mcpu=$cpu"
3995
3996 elif enabled mips; then
3997
3998     cpuflags="-march=$cpu"
3999
4000     case $cpu in
4001         24kc)
4002             disable mips32r5
4003             disable mips64r6
4004             disable mipsfpu
4005             disable mipsdspr1
4006             disable mipsdspr2
4007             disable msa
4008         ;;
4009         24kf*)
4010             disable mips32r5
4011             disable mips64r6
4012             disable mipsdspr1
4013             disable mipsdspr2
4014             disable msa
4015         ;;
4016         24kec|34kc|1004kc)
4017             disable mips32r5
4018             disable mips64r6
4019             disable mipsfpu
4020             disable mipsdspr2
4021             disable msa
4022         ;;
4023         24kef*|34kf*|1004kf*)
4024             disable mips32r5
4025             disable mips64r6
4026             disable mipsdspr2
4027             disable msa
4028         ;;
4029         74kc)
4030             disable mips32r5
4031             disable mips64r6
4032             disable mipsfpu
4033             disable msa
4034         ;;
4035         74kf)
4036             disable mips32r5
4037             disable mips64r6
4038             disable msa
4039         ;;
4040         p5600)
4041             disable mips64r6
4042             disable mipsdspr1
4043             disable mipsdspr2
4044
4045             check_cflags "-mtune=p5600"
4046         ;;
4047         i6400)
4048             disable mips32r5
4049             disable mipsdspr1
4050             disable mipsdspr2
4051             disable mipsfpu
4052
4053             check_cflags "-mtune=i6400 -mabi=64"
4054             check_ldflags "-mabi=64"
4055         ;;
4056         loongson*)
4057             disable mipsfpu
4058             disable mips32r2
4059             disable mips32r5
4060             disable mips64r6
4061             disable mipsdspr1
4062             disable mipsdspr2
4063             disable msa
4064             enable local_aligned_8 local_aligned_16 local_aligned_32
4065             enable simd_align_16
4066             enable fast_64bit
4067             enable fast_clz
4068             enable fast_cmov
4069             enable fast_unaligned
4070             disable aligned_stack
4071             case $cpu in
4072                 loongson3*)