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