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