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