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