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