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