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