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