configure: bump year
[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 [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     atomics_native
2002     dos_paths
2003     libc_msvcrt
2004     MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
2005     section_data_rel_ro
2006     threads
2007     uwp
2008     winrt
2009 "
2010
2011 SYSTEM_FUNCS="
2012     access
2013     aligned_malloc
2014     arc4random
2015     clock_gettime
2016     closesocket
2017     CommandLineToArgvW
2018     fcntl
2019     getaddrinfo
2020     gethrtime
2021     getopt
2022     GetProcessAffinityMask
2023     GetProcessMemoryInfo
2024     GetProcessTimes
2025     getrusage
2026     GetSystemTimeAsFileTime
2027     gettimeofday
2028     glob
2029     glXGetProcAddress
2030     gmtime_r
2031     inet_aton
2032     isatty
2033     kbhit
2034     localtime_r
2035     lstat
2036     lzo1x_999_compress
2037     mach_absolute_time
2038     MapViewOfFile
2039     memalign
2040     mkstemp
2041     mmap
2042     mprotect
2043     nanosleep
2044     PeekNamedPipe
2045     posix_memalign
2046     pthread_cancel
2047     sched_getaffinity
2048     SecItemImport
2049     SetConsoleTextAttribute
2050     SetConsoleCtrlHandler
2051     setmode
2052     setrlimit
2053     Sleep
2054     strerror_r
2055     sysconf
2056     sysctl
2057     usleep
2058     UTGetOSTypeFromString
2059     VirtualAlloc
2060     wglGetProcAddress
2061 "
2062
2063 SYSTEM_LIBRARIES="
2064     vaapi_drm
2065     vaapi_x11
2066     vdpau_x11
2067     wincrypt
2068 "
2069
2070 TOOLCHAIN_FEATURES="
2071     as_arch_directive
2072     as_fpu_directive
2073     as_func
2074     as_object_arch
2075     asm_mod_q
2076     blocks_extension
2077     ebp_available
2078     ebx_available
2079     gnu_as
2080     gnu_windres
2081     ibm_asm
2082     inline_asm_direct_symbol_refs
2083     inline_asm_labels
2084     inline_asm_nonlocal_labels
2085     pragma_deprecated
2086     rsync_contimeout
2087     symver_asm_label
2088     symver_gnu_asm
2089     vfp_args
2090     xform_asm
2091     xmm_clobbers
2092 "
2093
2094 TYPES_LIST="
2095     kCMVideoCodecType_HEVC
2096     socklen_t
2097     struct_addrinfo
2098     struct_group_source_req
2099     struct_ip_mreq_source
2100     struct_ipv6_mreq
2101     struct_msghdr_msg_flags
2102     struct_pollfd
2103     struct_rusage_ru_maxrss
2104     struct_sctp_event_subscribe
2105     struct_sockaddr_in6
2106     struct_sockaddr_sa_len
2107     struct_sockaddr_storage
2108     struct_stat_st_mtim_tv_nsec
2109     struct_v4l2_frmivalenum_discrete
2110 "
2111
2112 HAVE_LIST="
2113     $ARCH_EXT_LIST
2114     $(add_suffix _external $ARCH_EXT_LIST)
2115     $(add_suffix _inline   $ARCH_EXT_LIST)
2116     $ARCH_FEATURES
2117     $ATOMICS_LIST
2118     $BUILTIN_LIST
2119     $COMPLEX_FUNCS
2120     $HAVE_LIST_CMDLINE
2121     $HAVE_LIST_PUB
2122     $HEADERS_LIST
2123     $INTRINSICS_LIST
2124     $MATH_FUNCS
2125     $SYSTEM_FEATURES
2126     $SYSTEM_FUNCS
2127     $SYSTEM_LIBRARIES
2128     $THREADS_LIST
2129     $TOOLCHAIN_FEATURES
2130     $TYPES_LIST
2131     makeinfo
2132     makeinfo_html
2133     opencl_d3d11
2134     opencl_drm_arm
2135     opencl_dxva2
2136     opencl_vaapi_beignet
2137     opencl_vaapi_intel_media
2138     perl
2139     pod2man
2140     texi2html
2141 "
2142
2143 # options emitted with CONFIG_ prefix but not available on the command line
2144 CONFIG_EXTRA="
2145     aandcttables
2146     ac3dsp
2147     adts_header
2148     audio_frame_queue
2149     audiodsp
2150     blockdsp
2151     bswapdsp
2152     cabac
2153     cbs
2154     cbs_h264
2155     cbs_h265
2156     cbs_mpeg2
2157     dirac_parse
2158     dvprofile
2159     exif
2160     faandct
2161     faanidct
2162     fdctdsp
2163     flacdsp
2164     fmtconvert
2165     frame_thread_encoder
2166     g722dsp
2167     golomb
2168     gplv3
2169     h263dsp
2170     h264chroma
2171     h264dsp
2172     h264parse
2173     h264pred
2174     h264qpel
2175     hevcparse
2176     hpeldsp
2177     huffman
2178     huffyuvdsp
2179     huffyuvencdsp
2180     idctdsp
2181     iirfilter
2182     mdct15
2183     intrax8
2184     iso_media
2185     ividsp
2186     jpegtables
2187     lgplv3
2188     libx262
2189     llauddsp
2190     llviddsp
2191     llvidencdsp
2192     lpc
2193     lzf
2194     me_cmp
2195     mpeg_er
2196     mpegaudio
2197     mpegaudiodsp
2198     mpegaudioheader
2199     mpegvideo
2200     mpegvideoenc
2201     mss34dsp
2202     pixblockdsp
2203     qpeldsp
2204     qsv
2205     qsvdec
2206     qsvenc
2207     qsvvpp
2208     rangecoder
2209     riffdec
2210     riffenc
2211     rtpdec
2212     rtpenc_chain
2213     rv34dsp
2214     sinewin
2215     snappy
2216     srtp
2217     startcode
2218     texturedsp
2219     texturedspenc
2220     tpeldsp
2221     vaapi_1
2222     vaapi_encode
2223     vc1dsp
2224     videodsp
2225     vp3dsp
2226     vp56dsp
2227     vp8dsp
2228     wma_freqs
2229     wmv2dsp
2230 "
2231
2232 CMDLINE_SELECT="
2233     $ARCH_EXT_LIST
2234     $CONFIG_LIST
2235     $HAVE_LIST_CMDLINE
2236     $THREADS_LIST
2237     asm
2238     cross_compile
2239     debug
2240     extra_warnings
2241     logging
2242     lto
2243     optimizations
2244     rpath
2245     stripping
2246 "
2247
2248 PATHS_LIST="
2249     bindir
2250     datadir
2251     docdir
2252     incdir
2253     libdir
2254     mandir
2255     pkgconfigdir
2256     prefix
2257     shlibdir
2258     install_name_dir
2259 "
2260
2261 CMDLINE_SET="
2262     $PATHS_LIST
2263     ar
2264     arch
2265     as
2266     assert_level
2267     build_suffix
2268     cc
2269     objcc
2270     cpu
2271     cross_prefix
2272     custom_allocator
2273     cxx
2274     dep_cc
2275     doxygen
2276     env
2277     extra_version
2278     gas
2279     host_cc
2280     host_cflags
2281     host_extralibs
2282     host_ld
2283     host_ldflags
2284     host_os
2285     ignore_tests
2286     install
2287     ld
2288     ln_s
2289     logfile
2290     malloc_prefix
2291     nm
2292     optflags
2293     nvccflags
2294     pkg_config
2295     pkg_config_flags
2296     progs_suffix
2297     random_seed
2298     ranlib
2299     samples
2300     strip
2301     sws_max_filter_size
2302     sysinclude
2303     sysroot
2304     target_exec
2305     target_os
2306     target_path
2307     target_samples
2308     tempprefix
2309     toolchain
2310     valgrind
2311     x86asmexe
2312 "
2313
2314 CMDLINE_APPEND="
2315     extra_cflags
2316     extra_cxxflags
2317     extra_objcflags
2318     host_cppflags
2319 "
2320
2321 # code dependency declarations
2322
2323 # architecture extensions
2324
2325 armv5te_deps="arm"
2326 armv6_deps="arm"
2327 armv6t2_deps="arm"
2328 armv8_deps="aarch64"
2329 neon_deps_any="aarch64 arm"
2330 intrinsics_neon_deps="neon"
2331 vfp_deps_any="aarch64 arm"
2332 vfpv3_deps="vfp"
2333 setend_deps="arm"
2334
2335 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
2336
2337 altivec_deps="ppc"
2338 dcbzl_deps="ppc"
2339 ldbrx_deps="ppc"
2340 ppc4xx_deps="ppc"
2341 vsx_deps="altivec"
2342 power8_deps="vsx"
2343
2344 loongson2_deps="mips"
2345 loongson3_deps="mips"
2346 mips32r2_deps="mips"
2347 mips32r5_deps="mips"
2348 mips32r6_deps="mips"
2349 mips64r2_deps="mips"
2350 mips64r6_deps="mips"
2351 mipsfpu_deps="mips"
2352 mipsdsp_deps="mips"
2353 mipsdspr2_deps="mips"
2354 mmi_deps="mips"
2355 msa_deps="mipsfpu"
2356
2357 cpunop_deps="i686"
2358 x86_64_select="i686"
2359 x86_64_suggest="fast_cmov"
2360
2361 amd3dnow_deps="mmx"
2362 amd3dnowext_deps="amd3dnow"
2363 i686_deps="x86"
2364 mmx_deps="x86"
2365 mmxext_deps="mmx"
2366 sse_deps="mmxext"
2367 sse2_deps="sse"
2368 sse3_deps="sse2"
2369 ssse3_deps="sse3"
2370 sse4_deps="ssse3"
2371 sse42_deps="sse4"
2372 aesni_deps="sse42"
2373 avx_deps="sse42"
2374 xop_deps="avx"
2375 fma3_deps="avx"
2376 fma4_deps="avx"
2377 avx2_deps="avx"
2378 avx512_deps="avx2"
2379
2380 mmx_external_deps="x86asm"
2381 mmx_inline_deps="inline_asm x86"
2382 mmx_suggest="mmx_external mmx_inline"
2383
2384 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
2385     eval dep=\$${ext}_deps
2386     eval ${ext}_external_deps='"${dep}_external"'
2387     eval ${ext}_inline_deps='"${dep}_inline"'
2388     eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
2389 done
2390
2391 aligned_stack_if_any="aarch64 ppc x86"
2392 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
2393 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
2394 fast_unaligned_if_any="aarch64 ppc x86"
2395 simd_align_16_if_any="altivec neon sse"
2396 simd_align_32_if_any="avx"
2397 simd_align_64_if_any="avx512"
2398
2399 # system capabilities
2400 symver_if_any="symver_asm_label symver_gnu_asm"
2401 valgrind_backtrace_conflict="optimizations"
2402 valgrind_backtrace_deps="valgrind_valgrind_h"
2403
2404 # threading support
2405 atomics_gcc_if="sync_val_compare_and_swap"
2406 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
2407 atomics_win32_if="MemoryBarrier"
2408 atomics_native_if_any="$ATOMICS_LIST"
2409 w32threads_deps="atomics_native"
2410 threads_if_any="$THREADS_LIST"
2411
2412 # subsystems
2413 cbs_h264_select="cbs golomb"
2414 cbs_h265_select="cbs golomb"
2415 cbs_mpeg2_select="cbs"
2416 dct_select="rdft"
2417 dirac_parse_select="golomb"
2418 error_resilience_select="me_cmp"
2419 faandct_deps="faan"
2420 faandct_select="fdctdsp"
2421 faanidct_deps="faan"
2422 faanidct_select="idctdsp"
2423 h264dsp_select="startcode"
2424 hevcparse_select="golomb"
2425 frame_thread_encoder_deps="encoders threads"
2426 intrax8_select="blockdsp idctdsp"
2427 mdct_select="fft"
2428 mdct15_select="fft"
2429 me_cmp_select="fdctdsp idctdsp pixblockdsp"
2430 mpeg_er_select="error_resilience"
2431 mpegaudio_select="mpegaudiodsp mpegaudioheader"
2432 mpegaudiodsp_select="dct"
2433 mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
2434 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
2435 vc1dsp_select="h264chroma qpeldsp startcode"
2436 rdft_select="fft"
2437
2438 # decoders / encoders
2439 aac_decoder_select="adts_header mdct15 mdct sinewin"
2440 aac_fixed_decoder_select="mdct sinewin"
2441 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
2442 aac_latm_decoder_select="aac_decoder aac_latm_parser"
2443 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2444 ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
2445 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
2446 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
2447 adpcm_g722_decoder_select="g722dsp"
2448 adpcm_g722_encoder_select="g722dsp"
2449 aic_decoder_select="golomb idctdsp"
2450 alac_encoder_select="lpc"
2451 als_decoder_select="bswapdsp"
2452 amrnb_decoder_select="lsp"
2453 amrwb_decoder_select="lsp"
2454 amv_decoder_select="sp5x_decoder exif"
2455 amv_encoder_select="aandcttables jpegtables mpegvideoenc"
2456 ape_decoder_select="bswapdsp llauddsp"
2457 apng_decoder_deps="zlib"
2458 apng_encoder_deps="zlib"
2459 apng_encoder_select="llvidencdsp"
2460 aptx_decoder_select="audio_frame_queue"
2461 aptx_encoder_select="audio_frame_queue"
2462 asv1_decoder_select="blockdsp bswapdsp idctdsp"
2463 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
2464 asv2_decoder_select="blockdsp bswapdsp idctdsp"
2465 asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
2466 atrac1_decoder_select="mdct sinewin"
2467 atrac3_decoder_select="mdct"
2468 atrac3p_decoder_select="mdct sinewin"
2469 avrn_decoder_select="exif jpegtables"
2470 bink_decoder_select="blockdsp hpeldsp"
2471 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
2472 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
2473 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
2474 clearvideo_decoder_select="idctdsp"
2475 cllc_decoder_select="bswapdsp"
2476 comfortnoise_encoder_select="lpc"
2477 cook_decoder_select="audiodsp mdct sinewin"
2478 cscd_decoder_select="lzo"
2479 cscd_decoder_suggest="zlib"
2480 dca_decoder_select="mdct"
2481 dds_decoder_select="texturedsp"
2482 dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
2483 dnxhd_decoder_select="blockdsp idctdsp"
2484 dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
2485 dolby_e_decoder_select="mdct"
2486 dvvideo_decoder_select="dvprofile idctdsp"
2487 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
2488 dxa_decoder_deps="zlib"
2489 dxv_decoder_select="lzf texturedsp"
2490 eac3_decoder_select="ac3_decoder"
2491 eac3_encoder_select="ac3_encoder"
2492 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
2493 eatgq_decoder_select="aandcttables"
2494 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
2495 exr_decoder_deps="zlib"
2496 ffv1_decoder_select="rangecoder"
2497 ffv1_encoder_select="rangecoder"
2498 ffvhuff_decoder_select="huffyuv_decoder"
2499 ffvhuff_encoder_select="huffyuv_encoder"
2500 fic_decoder_select="golomb"
2501 flac_decoder_select="flacdsp"
2502 flac_encoder_select="bswapdsp flacdsp lpc"
2503 flashsv2_decoder_deps="zlib"
2504 flashsv2_encoder_deps="zlib"
2505 flashsv_decoder_deps="zlib"
2506 flashsv_encoder_deps="zlib"
2507 flv_decoder_select="h263_decoder"
2508 flv_encoder_select="h263_encoder"
2509 fourxm_decoder_select="blockdsp bswapdsp"
2510 fraps_decoder_select="bswapdsp huffman"
2511 g2m_decoder_deps="zlib"
2512 g2m_decoder_select="blockdsp idctdsp jpegtables"
2513 g729_decoder_select="audiodsp"
2514 h261_decoder_select="mpegvideo"
2515 h261_encoder_select="aandcttables mpegvideoenc"
2516 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
2517 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
2518 h263i_decoder_select="h263_decoder"
2519 h263p_decoder_select="h263_decoder"
2520 h263p_encoder_select="h263_encoder"
2521 h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
2522 h264_decoder_suggest="error_resilience"
2523 hap_decoder_select="snappy texturedsp"
2524 hap_encoder_deps="libsnappy"
2525 hap_encoder_select="texturedspenc"
2526 hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp"
2527 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
2528 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
2529 iac_decoder_select="imc_decoder"
2530 imc_decoder_select="bswapdsp fft mdct sinewin"
2531 indeo3_decoder_select="hpeldsp"
2532 indeo4_decoder_select="ividsp"
2533 indeo5_decoder_select="ividsp"
2534 interplay_video_decoder_select="hpeldsp"
2535 jpegls_decoder_select="mjpeg_decoder"
2536 jv_decoder_select="blockdsp"
2537 lagarith_decoder_select="llviddsp"
2538 ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc"
2539 magicyuv_decoder_select="llviddsp"
2540 magicyuv_encoder_select="llvidencdsp"
2541 mdec_decoder_select="blockdsp idctdsp mpegvideo"
2542 metasound_decoder_select="lsp mdct sinewin"
2543 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
2544 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
2545 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
2546 mjpegb_decoder_select="mjpeg_decoder"
2547 mlp_decoder_select="mlp_parser"
2548 mlp_encoder_select="lpc"
2549 motionpixels_decoder_select="bswapdsp"
2550 mp1_decoder_select="mpegaudio"
2551 mp1float_decoder_select="mpegaudio"
2552 mp2_decoder_select="mpegaudio"
2553 mp2float_decoder_select="mpegaudio"
2554 mp3_decoder_select="mpegaudio"
2555 mp3adu_decoder_select="mpegaudio"
2556 mp3adufloat_decoder_select="mpegaudio"
2557 mp3float_decoder_select="mpegaudio"
2558 mp3on4_decoder_select="mpegaudio"
2559 mp3on4float_decoder_select="mpegaudio"
2560 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2561 mpc8_decoder_select="mpegaudiodsp"
2562 mpegvideo_decoder_select="mpegvideo"
2563 mpeg1video_decoder_select="mpegvideo"
2564 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
2565 mpeg2video_decoder_select="mpegvideo"
2566 mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
2567 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2568 mpeg4_encoder_select="h263_encoder"
2569 msa1_decoder_select="mss34dsp"
2570 mscc_decoder_deps="zlib"
2571 msmpeg4v1_decoder_select="h263_decoder"
2572 msmpeg4v2_decoder_select="h263_decoder"
2573 msmpeg4v2_encoder_select="h263_encoder"
2574 msmpeg4v3_decoder_select="h263_decoder"
2575 msmpeg4v3_encoder_select="h263_encoder"
2576 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
2577 mts2_decoder_select="mss34dsp"
2578 mxpeg_decoder_select="mjpeg_decoder"
2579 nellymoser_decoder_select="mdct sinewin"
2580 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2581 nuv_decoder_select="idctdsp lzo"
2582 on2avc_decoder_select="mdct"
2583 opus_decoder_deps="swresample"
2584 opus_decoder_select="mdct15"
2585 opus_encoder_select="audio_frame_queue mdct15"
2586 png_decoder_deps="zlib"
2587 png_encoder_deps="zlib"
2588 png_encoder_select="llvidencdsp"
2589 prores_decoder_select="blockdsp idctdsp"
2590 prores_encoder_select="fdctdsp"
2591 qcelp_decoder_select="lsp"
2592 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2593 ra_144_decoder_select="audiodsp"
2594 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
2595 ralf_decoder_select="golomb"
2596 rawvideo_decoder_select="bswapdsp"
2597 rscc_decoder_deps="zlib"
2598 rtjpeg_decoder_select="me_cmp"
2599 rv10_decoder_select="h263_decoder"
2600 rv10_encoder_select="h263_encoder"
2601 rv20_decoder_select="h263_decoder"
2602 rv20_encoder_select="h263_encoder"
2603 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2604 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2605 screenpresso_decoder_deps="zlib"
2606 shorten_decoder_select="bswapdsp"
2607 sipr_decoder_select="lsp"
2608 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
2609 snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
2610 sonic_decoder_select="golomb rangecoder"
2611 sonic_encoder_select="golomb rangecoder"
2612 sonic_ls_encoder_select="golomb rangecoder"
2613 sp5x_decoder_select="mjpeg_decoder"
2614 srgc_decoder_deps="zlib"
2615 svq1_decoder_select="hpeldsp"
2616 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
2617 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
2618 svq3_decoder_suggest="zlib"
2619 tak_decoder_select="audiodsp"
2620 tdsc_decoder_deps="zlib"
2621 tdsc_decoder_select="mjpeg_decoder"
2622 theora_decoder_select="vp3_decoder"
2623 thp_decoder_select="mjpeg_decoder"
2624 tiff_decoder_suggest="zlib lzma"
2625 tiff_encoder_suggest="zlib"
2626 truehd_decoder_select="mlp_parser"
2627 truehd_encoder_select="lpc"
2628 truemotion2_decoder_select="bswapdsp"
2629 truespeech_decoder_select="bswapdsp"
2630 tscc_decoder_deps="zlib"
2631 twinvq_decoder_select="mdct lsp sinewin"
2632 txd_decoder_select="texturedsp"
2633 utvideo_decoder_select="bswapdsp llviddsp"
2634 utvideo_encoder_select="bswapdsp huffman llvidencdsp"
2635 vble_decoder_select="llviddsp"
2636 vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
2637 vc1image_decoder_select="vc1_decoder"
2638 vorbis_decoder_select="mdct"
2639 vorbis_encoder_select="mdct"
2640 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2641 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2642 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2643 vp6a_decoder_select="vp6_decoder"
2644 vp6f_decoder_select="vp6_decoder"
2645 vp7_decoder_select="h264pred videodsp vp8dsp"
2646 vp8_decoder_select="h264pred videodsp vp8dsp"
2647 vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
2648 webp_decoder_select="vp8_decoder exif"
2649 wmalossless_decoder_select="llauddsp"
2650 wmapro_decoder_select="mdct sinewin wma_freqs"
2651 wmav1_decoder_select="mdct sinewin wma_freqs"
2652 wmav1_encoder_select="mdct sinewin wma_freqs"
2653 wmav2_decoder_select="mdct sinewin wma_freqs"
2654 wmav2_encoder_select="mdct sinewin wma_freqs"
2655 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2656 wmv1_decoder_select="h263_decoder"
2657 wmv1_encoder_select="h263_encoder"
2658 wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2659 wmv2_encoder_select="h263_encoder wmv2dsp"
2660 wmv3_decoder_select="vc1_decoder"
2661 wmv3image_decoder_select="wmv3_decoder"
2662 xma1_decoder_select="wmapro_decoder"
2663 xma2_decoder_select="wmapro_decoder"
2664 zerocodec_decoder_deps="zlib"
2665 zlib_decoder_deps="zlib"
2666 zlib_encoder_deps="zlib"
2667 zmbv_decoder_deps="zlib"
2668 zmbv_encoder_deps="zlib"
2669
2670 # hardware accelerators
2671 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2672 cuda_deps_any="libdl LoadLibrary"
2673 cuvid_deps="cuda"
2674 d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
2675 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
2676 nvdec_deps="cuda"
2677 videotoolbox_hwaccel_deps="videotoolbox pthreads"
2678 videotoolbox_hwaccel_extralibs="-framework QuartzCore"
2679 xvmc_deps="X11_extensions_XvMClib_h"
2680
2681 h263_vaapi_hwaccel_deps="vaapi"
2682 h263_vaapi_hwaccel_select="h263_decoder"
2683 h263_videotoolbox_hwaccel_deps="videotoolbox"
2684 h263_videotoolbox_hwaccel_select="h263_decoder"
2685 h264_d3d11va_hwaccel_deps="d3d11va"
2686 h264_d3d11va_hwaccel_select="h264_decoder"
2687 h264_d3d11va2_hwaccel_deps="d3d11va"
2688 h264_d3d11va2_hwaccel_select="h264_decoder"
2689 h264_dxva2_hwaccel_deps="dxva2"
2690 h264_dxva2_hwaccel_select="h264_decoder"
2691 h264_nvdec_hwaccel_deps="nvdec"
2692 h264_nvdec_hwaccel_select="h264_decoder"
2693 h264_vaapi_hwaccel_deps="vaapi"
2694 h264_vaapi_hwaccel_select="h264_decoder"
2695 h264_vdpau_hwaccel_deps="vdpau"
2696 h264_vdpau_hwaccel_select="h264_decoder"
2697 h264_videotoolbox_hwaccel_deps="videotoolbox"
2698 h264_videotoolbox_hwaccel_select="h264_decoder"
2699 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2700 hevc_d3d11va_hwaccel_select="hevc_decoder"
2701 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2702 hevc_d3d11va2_hwaccel_select="hevc_decoder"
2703 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2704 hevc_dxva2_hwaccel_select="hevc_decoder"
2705 hevc_nvdec_hwaccel_deps="nvdec"
2706 hevc_nvdec_hwaccel_select="hevc_decoder"
2707 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2708 hevc_vaapi_hwaccel_select="hevc_decoder"
2709 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2710 hevc_vdpau_hwaccel_select="hevc_decoder"
2711 hevc_videotoolbox_hwaccel_deps="videotoolbox"
2712 hevc_videotoolbox_hwaccel_select="hevc_decoder"
2713 mpeg_xvmc_hwaccel_deps="xvmc"
2714 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2715 mpeg1_nvdec_hwaccel_deps="nvdec"
2716 mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
2717 mpeg1_vdpau_hwaccel_deps="vdpau"
2718 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2719 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
2720 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
2721 mpeg1_xvmc_hwaccel_deps="xvmc"
2722 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2723 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2724 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2725 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
2726 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
2727 mpeg2_dxva2_hwaccel_deps="dxva2"
2728 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2729 mpeg2_nvdec_hwaccel_deps="nvdec"
2730 mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
2731 mpeg2_vaapi_hwaccel_deps="vaapi"
2732 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2733 mpeg2_vdpau_hwaccel_deps="vdpau"
2734 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2735 mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
2736 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
2737 mpeg2_xvmc_hwaccel_deps="xvmc"
2738 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2739 mpeg4_nvdec_hwaccel_deps="nvdec"
2740 mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
2741 mpeg4_vaapi_hwaccel_deps="vaapi"
2742 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2743 mpeg4_vdpau_hwaccel_deps="vdpau"
2744 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2745 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
2746 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
2747 vc1_d3d11va_hwaccel_deps="d3d11va"
2748 vc1_d3d11va_hwaccel_select="vc1_decoder"
2749 vc1_d3d11va2_hwaccel_deps="d3d11va"
2750 vc1_d3d11va2_hwaccel_select="vc1_decoder"
2751 vc1_dxva2_hwaccel_deps="dxva2"
2752 vc1_dxva2_hwaccel_select="vc1_decoder"
2753 vc1_nvdec_hwaccel_deps="nvdec"
2754 vc1_nvdec_hwaccel_select="vc1_decoder"
2755 vc1_vaapi_hwaccel_deps="vaapi"
2756 vc1_vaapi_hwaccel_select="vc1_decoder"
2757 vc1_vdpau_hwaccel_deps="vdpau"
2758 vc1_vdpau_hwaccel_select="vc1_decoder"
2759 vp8_nvdec_hwaccel_deps="nvdec"
2760 vp8_nvdec_hwaccel_select="vp8_decoder"
2761 vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
2762 vp8_vaapi_hwaccel_select="vp8_decoder"
2763 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
2764 vp9_d3d11va_hwaccel_select="vp9_decoder"
2765 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
2766 vp9_d3d11va2_hwaccel_select="vp9_decoder"
2767 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
2768 vp9_dxva2_hwaccel_select="vp9_decoder"
2769 vp9_nvdec_hwaccel_deps="nvdec"
2770 vp9_nvdec_hwaccel_select="vp9_decoder"
2771 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
2772 vp9_vaapi_hwaccel_select="vp9_decoder"
2773 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2774 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
2775 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2776 wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
2777 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2778 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2779
2780 # hardware-accelerated codecs
2781 omx_deps="libdl pthreads"
2782 omx_rpi_select="omx"
2783 qsv_deps="libmfx"
2784 qsvdec_select="qsv"
2785 qsvenc_select="qsv"
2786 qsvvpp_select="qsv"
2787 vaapi_encode_deps="vaapi"
2788 v4l2_m2m_deps_any="linux_videodev2_h"
2789
2790 hwupload_cuda_filter_deps="cuda"
2791 scale_npp_filter_deps="cuda libnpp"
2792 scale_cuda_filter_deps="cuda_sdk"
2793 thumbnail_cuda_filter_deps="cuda_sdk"
2794
2795 amf_deps_any="libdl LoadLibrary"
2796 nvenc_deps="cuda"
2797 nvenc_deps_any="libdl LoadLibrary"
2798 nvenc_encoder_deps="nvenc"
2799
2800 h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
2801 h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
2802 h264_amf_encoder_deps="amf"
2803 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
2804 h264_cuvid_decoder_deps="cuvid"
2805 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
2806 h264_mediacodec_decoder_deps="mediacodec"
2807 h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
2808 h264_mmal_decoder_deps="mmal"
2809 h264_nvenc_encoder_deps="nvenc"
2810 h264_omx_encoder_deps="omx"
2811 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec"
2812 h264_qsv_encoder_select="qsvenc"
2813 h264_rkmpp_decoder_deps="rkmpp"
2814 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
2815 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2816 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
2817 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
2818 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
2819 hevc_amf_encoder_deps="amf"
2820 hevc_cuvid_decoder_deps="cuvid"
2821 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
2822 hevc_mediacodec_decoder_deps="mediacodec"
2823 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
2824 hevc_nvenc_encoder_deps="nvenc"
2825 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec"
2826 hevc_qsv_encoder_select="hevcparse qsvenc"
2827 hevc_rkmpp_decoder_deps="rkmpp"
2828 hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
2829 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2830 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
2831 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
2832 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
2833 mjpeg_cuvid_decoder_deps="cuvid"
2834 mjpeg_qsv_encoder_deps="libmfx"
2835 mjpeg_qsv_encoder_select="qsvenc"
2836 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
2837 mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
2838 mpeg1_cuvid_decoder_deps="cuvid"
2839 mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
2840 mpeg2_crystalhd_decoder_select="crystalhd"
2841 mpeg2_cuvid_decoder_deps="cuvid"
2842 mpeg2_mmal_decoder_deps="mmal"
2843 mpeg2_mediacodec_decoder_deps="mediacodec"
2844 mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser"
2845 mpeg2_qsv_encoder_select="qsvenc"
2846 mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2"
2847 mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
2848 mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
2849 mpeg4_crystalhd_decoder_select="crystalhd"
2850 mpeg4_cuvid_decoder_deps="cuvid"
2851 mpeg4_mediacodec_decoder_deps="mediacodec"
2852 mpeg4_mmal_decoder_deps="mmal"
2853 mpeg4_omx_encoder_deps="omx"
2854 mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
2855 mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
2856 msmpeg4_crystalhd_decoder_select="crystalhd"
2857 nvenc_h264_encoder_select="h264_nvenc_encoder"
2858 nvenc_hevc_encoder_select="hevc_nvenc_encoder"
2859 vc1_crystalhd_decoder_select="crystalhd"
2860 vc1_cuvid_decoder_deps="cuvid"
2861 vc1_mmal_decoder_deps="mmal"
2862 vc1_qsv_decoder_select="qsvdec vc1_parser"
2863 vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
2864 vp8_cuvid_decoder_deps="cuvid"
2865 vp8_mediacodec_decoder_deps="mediacodec"
2866 vp8_qsv_decoder_select="qsvdec vp8_parser"
2867 vp8_rkmpp_decoder_deps="rkmpp"
2868 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
2869 vp8_vaapi_encoder_select="vaapi_encode"
2870 vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
2871 vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
2872 vp9_cuvid_decoder_deps="cuvid"
2873 vp9_mediacodec_decoder_deps="mediacodec"
2874 vp9_rkmpp_decoder_deps="rkmpp"
2875 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
2876 vp9_vaapi_encoder_select="vaapi_encode"
2877 vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
2878 wmv3_crystalhd_decoder_select="crystalhd"
2879
2880 # parsers
2881 aac_parser_select="adts_header"
2882 h264_parser_select="golomb h264dsp h264parse"
2883 hevc_parser_select="hevcparse"
2884 mpegaudio_parser_select="mpegaudioheader"
2885 mpegvideo_parser_select="mpegvideo"
2886 mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
2887 vc1_parser_select="vc1dsp"
2888
2889 # bitstream_filters
2890 aac_adtstoasc_bsf_select="adts_header"
2891 h264_metadata_bsf_select="cbs_h264"
2892 h264_redundant_pps_bsf_select="cbs_h264"
2893 hevc_metadata_bsf_select="cbs_h265"
2894 mjpeg2jpeg_bsf_select="jpegtables"
2895 mpeg2_metadata_bsf_select="cbs_mpeg2"
2896 trace_headers_bsf_select="cbs_h264 cbs_h265 cbs_mpeg2"
2897
2898 # external libraries
2899 aac_at_decoder_deps="audiotoolbox"
2900 aac_at_decoder_select="aac_adtstoasc_bsf"
2901 ac3_at_decoder_deps="audiotoolbox"
2902 ac3_at_decoder_select="ac3_parser"
2903 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
2904 alac_at_decoder_deps="audiotoolbox"
2905 amr_nb_at_decoder_deps="audiotoolbox"
2906 avisynth_deps_any="libdl LoadLibrary"
2907 avisynth_demuxer_deps="avisynth"
2908 avisynth_demuxer_select="riffdec"
2909 eac3_at_decoder_deps="audiotoolbox"
2910 eac3_at_decoder_select="ac3_parser"
2911 gsm_ms_at_decoder_deps="audiotoolbox"
2912 ilbc_at_decoder_deps="audiotoolbox"
2913 mp1_at_decoder_deps="audiotoolbox"
2914 mp2_at_decoder_deps="audiotoolbox"
2915 mp3_at_decoder_deps="audiotoolbox"
2916 mp1_at_decoder_select="mpegaudioheader"
2917 mp2_at_decoder_select="mpegaudioheader"
2918 mp3_at_decoder_select="mpegaudioheader"
2919 pcm_alaw_at_decoder_deps="audiotoolbox"
2920 pcm_mulaw_at_decoder_deps="audiotoolbox"
2921 qdmc_at_decoder_deps="audiotoolbox"
2922 qdm2_at_decoder_deps="audiotoolbox"
2923 aac_at_encoder_deps="audiotoolbox"
2924 aac_at_encoder_select="audio_frame_queue"
2925 alac_at_encoder_deps="audiotoolbox"
2926 alac_at_encoder_select="audio_frame_queue"
2927 ilbc_at_encoder_deps="audiotoolbox"
2928 ilbc_at_encoder_select="audio_frame_queue"
2929 pcm_alaw_at_encoder_deps="audiotoolbox"
2930 pcm_alaw_at_encoder_select="audio_frame_queue"
2931 pcm_mulaw_at_encoder_deps="audiotoolbox"
2932 pcm_mulaw_at_encoder_select="audio_frame_queue"
2933 chromaprint_muxer_deps="chromaprint"
2934 h264_videotoolbox_encoder_deps="pthreads"
2935 h264_videotoolbox_encoder_select="videotoolbox_encoder"
2936 hevc_videotoolbox_encoder_deps="pthreads"
2937 hevc_videotoolbox_encoder_select="videotoolbox_encoder"
2938 libcelt_decoder_deps="libcelt"
2939 libfdk_aac_decoder_deps="libfdk_aac"
2940 libfdk_aac_encoder_deps="libfdk_aac"
2941 libfdk_aac_encoder_select="audio_frame_queue"
2942 libgme_demuxer_deps="libgme"
2943 libgsm_decoder_deps="libgsm"
2944 libgsm_encoder_deps="libgsm"
2945 libgsm_ms_decoder_deps="libgsm"
2946 libgsm_ms_encoder_deps="libgsm"
2947 libilbc_decoder_deps="libilbc"
2948 libilbc_encoder_deps="libilbc"
2949 libkvazaar_encoder_deps="libkvazaar"
2950 libmodplug_demuxer_deps="libmodplug"
2951 libmp3lame_encoder_deps="libmp3lame"
2952 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
2953 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2954 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2955 libopencore_amrnb_encoder_select="audio_frame_queue"
2956 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2957 libopenh264_decoder_deps="libopenh264"
2958 libopenh264_decoder_select="h264_mp4toannexb_bsf"
2959 libopenh264_encoder_deps="libopenh264"
2960 libopenjpeg_decoder_deps="libopenjpeg"
2961 libopenjpeg_encoder_deps="libopenjpeg"
2962 libopenmpt_demuxer_deps="libopenmpt"
2963 libopus_decoder_deps="libopus"
2964 libopus_encoder_deps="libopus"
2965 libopus_encoder_select="audio_frame_queue"
2966 librsvg_decoder_deps="librsvg"
2967 libshine_encoder_deps="libshine"
2968 libshine_encoder_select="audio_frame_queue"
2969 libspeex_decoder_deps="libspeex"
2970 libspeex_encoder_deps="libspeex"
2971 libspeex_encoder_select="audio_frame_queue"
2972 libtheora_encoder_deps="libtheora"
2973 libtwolame_encoder_deps="libtwolame"
2974 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2975 libvorbis_decoder_deps="libvorbis"
2976 libvorbis_encoder_deps="libvorbis libvorbisenc"
2977 libvorbis_encoder_select="audio_frame_queue"
2978 libvpx_vp8_decoder_deps="libvpx"
2979 libvpx_vp8_encoder_deps="libvpx"
2980 libvpx_vp9_decoder_deps="libvpx"
2981 libvpx_vp9_encoder_deps="libvpx"
2982 libwavpack_encoder_deps="libwavpack"
2983 libwavpack_encoder_select="audio_frame_queue"
2984 libwebp_encoder_deps="libwebp"
2985 libwebp_anim_encoder_deps="libwebp"
2986 libx262_encoder_deps="libx262"
2987 libx264_encoder_deps="libx264"
2988 libx264rgb_encoder_deps="libx264 x264_csp_bgr"
2989 libx264rgb_encoder_select="libx264_encoder"
2990 libx265_encoder_deps="libx265"
2991 libxavs_encoder_deps="libxavs"
2992 libxvid_encoder_deps="libxvid"
2993 libzvbi_teletext_decoder_deps="libzvbi"
2994 videotoolbox_suggest="coreservices"
2995 videotoolbox_deps="corefoundation coremedia corevideo"
2996 videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
2997
2998 # demuxers / muxers
2999 ac3_demuxer_select="ac3_parser"
3000 aiff_muxer_select="iso_media"
3001 asf_demuxer_select="riffdec"
3002 asf_o_demuxer_select="riffdec"
3003 asf_muxer_select="riffenc"
3004 asf_stream_muxer_select="asf_muxer"
3005 avi_demuxer_select="iso_media riffdec exif"
3006 avi_muxer_select="riffenc"
3007 caf_demuxer_select="iso_media riffdec"
3008 caf_muxer_select="iso_media"
3009 dash_muxer_select="mp4_muxer"
3010 dash_demuxer_deps="libxml2"
3011 dirac_demuxer_select="dirac_parser"
3012 dts_demuxer_select="dca_parser"
3013 dtshd_demuxer_select="dca_parser"
3014 dv_demuxer_select="dvprofile"
3015 dv_muxer_select="dvprofile"
3016 dxa_demuxer_select="riffdec"
3017 eac3_demuxer_select="ac3_parser"
3018 f4v_muxer_select="mov_muxer"
3019 fifo_muxer_deps="threads"
3020 flac_demuxer_select="flac_parser"
3021 hds_muxer_select="flv_muxer"
3022 hls_muxer_select="mpegts_muxer"
3023 hls_muxer_suggest="gcrypt openssl"
3024 image2_alias_pix_demuxer_select="image2_demuxer"
3025 image2_brender_pix_demuxer_select="image2_demuxer"
3026 ipod_muxer_select="mov_muxer"
3027 ismv_muxer_select="mov_muxer"
3028 matroska_audio_muxer_select="matroska_muxer"
3029 matroska_demuxer_select="iso_media riffdec"
3030 matroska_demuxer_suggest="bzlib lzo zlib"
3031 matroska_muxer_select="iso_media riffenc"
3032 mmf_muxer_select="riffenc"
3033 mov_demuxer_select="iso_media riffdec"
3034 mov_demuxer_suggest="zlib"
3035 mov_muxer_select="iso_media riffenc rtpenc_chain"
3036 mp3_demuxer_select="mpegaudio_parser"
3037 mp3_muxer_select="mpegaudioheader"
3038 mp4_muxer_select="mov_muxer"
3039 mpegts_demuxer_select="iso_media"
3040 mpegts_muxer_select="adts_muxer latm_muxer"
3041 mpegtsraw_demuxer_select="mpegts_demuxer"
3042 mxf_d10_muxer_select="mxf_muxer"
3043 mxf_opatom_muxer_select="mxf_muxer"
3044 nut_muxer_select="riffenc"
3045 nuv_demuxer_select="riffdec"
3046 oga_muxer_select="ogg_muxer"
3047 ogg_demuxer_select="dirac_parse"
3048 ogv_muxer_select="ogg_muxer"
3049 opus_muxer_select="ogg_muxer"
3050 psp_muxer_select="mov_muxer"
3051 rtp_demuxer_select="sdp_demuxer"
3052 rtp_muxer_select="golomb"
3053 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
3054 rtsp_demuxer_select="http_protocol rtpdec"
3055 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
3056 sap_demuxer_select="sdp_demuxer"
3057 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
3058 sdp_demuxer_select="rtpdec"
3059 smoothstreaming_muxer_select="ismv_muxer"
3060 spdif_demuxer_select="adts_header"
3061 spdif_muxer_select="adts_header"
3062 spx_muxer_select="ogg_muxer"
3063 swf_demuxer_suggest="zlib"
3064 tak_demuxer_select="tak_parser"
3065 tg2_muxer_select="mov_muxer"
3066 tgp_muxer_select="mov_muxer"
3067 vobsub_demuxer_select="mpegps_demuxer"
3068 w64_demuxer_select="wav_demuxer"
3069 w64_muxer_select="wav_muxer"
3070 wav_demuxer_select="riffdec"
3071 wav_muxer_select="riffenc"
3072 webm_muxer_select="iso_media riffenc"
3073 webm_dash_manifest_demuxer_select="matroska_demuxer"
3074 wtv_demuxer_select="mpegts_demuxer riffdec"
3075 wtv_muxer_select="mpegts_muxer riffenc"
3076 xmv_demuxer_select="riffdec"
3077 xwma_demuxer_select="riffdec"
3078
3079 # indevs / outdevs
3080 alsa_indev_deps="alsa"
3081 alsa_outdev_deps="alsa"
3082 avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
3083 avfoundation_indev_suggest="coregraphics applicationservices"
3084 avfoundation_indev_extralibs="-framework Foundation"
3085 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
3086 caca_outdev_deps="libcaca"
3087 decklink_deps_any="libdl LoadLibrary"
3088 decklink_indev_deps="decklink threads"
3089 decklink_indev_extralibs="-lstdc++"
3090 decklink_outdev_deps="decklink threads"
3091 decklink_outdev_extralibs="-lstdc++"
3092 libndi_newtek_indev_deps="libndi_newtek"
3093 libndi_newtek_indev_extralibs="-lndi"
3094 libndi_newtek_outdev_deps="libndi_newtek"
3095 libndi_newtek_outdev_extralibs="-lndi"
3096 dshow_indev_deps="IBaseFilter"
3097 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
3098 fbdev_indev_deps="linux_fb_h"
3099 fbdev_outdev_deps="linux_fb_h"
3100 gdigrab_indev_deps="CreateDIBSection"
3101 gdigrab_indev_extralibs="-lgdi32"
3102 gdigrab_indev_select="bmp_decoder"
3103 iec61883_indev_deps="libiec61883"
3104 jack_indev_deps="libjack"
3105 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
3106 kmsgrab_indev_deps="libdrm"
3107 lavfi_indev_deps="avfilter"
3108 libcdio_indev_deps="libcdio"
3109 libdc1394_indev_deps="libdc1394"
3110 openal_indev_deps="openal"
3111 opengl_outdev_deps="opengl"
3112 oss_indev_deps_any="sys_soundcard_h"
3113 oss_outdev_deps_any="sys_soundcard_h"
3114 pulse_indev_deps="libpulse"
3115 pulse_outdev_deps="libpulse"
3116 sdl2_outdev_deps="sdl2"
3117 sndio_indev_deps="sndio"
3118 sndio_outdev_deps="sndio"
3119 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
3120 v4l2_indev_suggest="libv4l2"
3121 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
3122 v4l2_outdev_suggest="libv4l2"
3123 vfwcap_indev_deps="vfw32 vfwcap_defines"
3124 xcbgrab_indev_deps="libxcb"
3125 xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
3126 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
3127 xv_outdev_extralibs="-lXv -lX11 -lXext"
3128
3129 # protocols
3130 async_protocol_deps="threads"
3131 bluray_protocol_deps="libbluray"
3132 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
3133 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
3134 ffrtmpcrypt_protocol_select="tcp_protocol"
3135 ffrtmphttp_protocol_conflict="librtmp_protocol"
3136 ffrtmphttp_protocol_select="http_protocol"
3137 ftp_protocol_select="tcp_protocol"
3138 gopher_protocol_select="network"
3139 http_protocol_select="tcp_protocol"
3140 http_protocol_suggest="zlib"
3141 httpproxy_protocol_select="tcp_protocol"
3142 httpproxy_protocol_suggest="zlib"
3143 https_protocol_select="tls_protocol"
3144 https_protocol_suggest="zlib"
3145 icecast_protocol_select="http_protocol"
3146 librtmp_protocol_deps="librtmp"
3147 librtmpe_protocol_deps="librtmp"
3148 librtmps_protocol_deps="librtmp"
3149 librtmpt_protocol_deps="librtmp"
3150 librtmpte_protocol_deps="librtmp"
3151 libsmbclient_protocol_deps="libsmbclient gplv3"
3152 libssh_protocol_deps="libssh"
3153 libtls_conflict="openssl gnutls"
3154 mmsh_protocol_select="http_protocol"
3155 mmst_protocol_select="network"
3156 rtmp_protocol_conflict="librtmp_protocol"
3157 rtmp_protocol_select="tcp_protocol"
3158 rtmp_protocol_suggest="zlib"
3159 rtmpe_protocol_select="ffrtmpcrypt_protocol"
3160 rtmpe_protocol_suggest="zlib"
3161 rtmps_protocol_conflict="librtmp_protocol"
3162 rtmps_protocol_select="tls_protocol"
3163 rtmps_protocol_suggest="zlib"
3164 rtmpt_protocol_select="ffrtmphttp_protocol"
3165 rtmpt_protocol_suggest="zlib"
3166 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
3167 rtmpte_protocol_suggest="zlib"
3168 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
3169 rtmpts_protocol_suggest="zlib"
3170 rtp_protocol_select="udp_protocol"
3171 schannel_conflict="openssl gnutls libtls"
3172 sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
3173 sctp_protocol_select="network"
3174 securetransport_conflict="openssl gnutls libtls"
3175 srtp_protocol_select="rtp_protocol srtp"
3176 tcp_protocol_select="network"
3177 tls_protocol_deps_any="gnutls openssl schannel securetransport libtls"
3178 tls_protocol_select="tcp_protocol"
3179 udp_protocol_select="network"
3180 udplite_protocol_select="network"
3181 unix_protocol_deps="sys_un_h"
3182 unix_protocol_select="network"
3183
3184 # filters
3185 afftfilt_filter_deps="avcodec"
3186 afftfilt_filter_select="fft"
3187 afir_filter_deps="avcodec"
3188 afir_filter_select="fft"
3189 amovie_filter_deps="avcodec avformat"
3190 aresample_filter_deps="swresample"
3191 ass_filter_deps="libass"
3192 atempo_filter_deps="avcodec"
3193 atempo_filter_select="rdft"
3194 azmq_filter_deps="libzmq"
3195 blackframe_filter_deps="gpl"
3196 boxblur_filter_deps="gpl"
3197 bs2b_filter_deps="libbs2b"
3198 colormatrix_filter_deps="gpl"
3199 convolve_filter_deps="avcodec"
3200 convolve_filter_select="fft"
3201 coreimage_filter_deps="coreimage appkit"
3202 coreimage_filter_extralibs="-framework OpenGL"
3203 coreimagesrc_filter_deps="coreimage appkit"
3204 coreimagesrc_filter_extralibs="-framework OpenGL"
3205 cover_rect_filter_deps="avcodec avformat gpl"
3206 cropdetect_filter_deps="gpl"
3207 deconvolve_filter_deps="avcodec"
3208 deconvolve_filter_select="fft"
3209 deinterlace_qsv_filter_deps="libmfx"
3210 deinterlace_vaapi_filter_deps="vaapi"
3211 delogo_filter_deps="gpl"
3212 deshake_filter_select="pixelutils"
3213 drawtext_filter_deps="libfreetype"
3214 drawtext_filter_suggest="libfontconfig libfribidi"
3215 elbg_filter_deps="avcodec"
3216 eq_filter_deps="gpl"
3217 fftfilt_filter_deps="avcodec"
3218 fftfilt_filter_select="rdft"
3219 find_rect_filter_deps="avcodec avformat gpl"
3220 firequalizer_filter_deps="avcodec"
3221 firequalizer_filter_select="rdft"
3222 flite_filter_deps="libflite"
3223 framerate_filter_select="pixelutils"
3224 frei0r_filter_deps="frei0r libdl"
3225 frei0r_src_filter_deps="frei0r libdl"
3226 fspp_filter_deps="gpl"
3227 geq_filter_deps="gpl"
3228 histeq_filter_deps="gpl"
3229 hqdn3d_filter_deps="gpl"
3230 interlace_filter_deps="gpl"
3231 kerndeint_filter_deps="gpl"
3232 ladspa_filter_deps="ladspa libdl"
3233 lv2_filter_deps="lv2"
3234 mcdeint_filter_deps="avcodec gpl"
3235 movie_filter_deps="avcodec avformat"
3236 mpdecimate_filter_deps="gpl"
3237 mpdecimate_filter_select="pixelutils"
3238 mptestsrc_filter_deps="gpl"
3239 negate_filter_deps="lut_filter"
3240 nnedi_filter_deps="gpl"
3241 ocr_filter_deps="libtesseract"
3242 ocv_filter_deps="libopencv"
3243 overlay_opencl_filter_deps="opencl"
3244 overlay_qsv_filter_deps="libmfx"
3245 overlay_qsv_filter_select="qsvvpp"
3246 owdenoise_filter_deps="gpl"
3247 pan_filter_deps="swresample"
3248 perspective_filter_deps="gpl"
3249 phase_filter_deps="gpl"
3250 pp7_filter_deps="gpl"
3251 pp_filter_deps="gpl postproc"
3252 pullup_filter_deps="gpl"
3253 removelogo_filter_deps="avcodec avformat swscale"
3254 repeatfields_filter_deps="gpl"
3255 resample_filter_deps="avresample"
3256 rubberband_filter_deps="librubberband"
3257 sab_filter_deps="gpl swscale"
3258 scale2ref_filter_deps="swscale"
3259 scale_filter_deps="swscale"
3260 scale_qsv_filter_deps="libmfx"
3261 select_filter_select="pixelutils"
3262 showcqt_filter_deps="avcodec avformat swscale"
3263 showcqt_filter_suggest="libfontconfig libfreetype"
3264 showcqt_filter_select="fft"
3265 showfreqs_filter_deps="avcodec"
3266 showfreqs_filter_select="fft"
3267 showspectrum_filter_deps="avcodec"
3268 showspectrum_filter_select="fft"
3269 showspectrumpic_filter_deps="avcodec"
3270 showspectrumpic_filter_select="fft"
3271 signature_filter_deps="gpl avcodec avformat"
3272 smartblur_filter_deps="gpl swscale"
3273 sofalizer_filter_deps="libmysofa avcodec"
3274 sofalizer_filter_select="fft"
3275 spectrumsynth_filter_deps="avcodec"
3276 spectrumsynth_filter_select="fft"
3277 spp_filter_deps="gpl avcodec"
3278 spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
3279 stereo3d_filter_deps="gpl"
3280 subtitles_filter_deps="avformat avcodec libass"
3281 super2xsai_filter_deps="gpl"
3282 pixfmts_super2xsai_test_deps="super2xsai_filter"
3283 tinterlace_filter_deps="gpl"
3284 tinterlace_merge_test_deps="tinterlace_filter"
3285 tinterlace_pad_test_deps="tinterlace_filter"
3286 tonemap_filter_deps="const_nan"
3287 unsharp_opencl_filter_deps="opencl"
3288 uspp_filter_deps="gpl avcodec"
3289 vaguedenoiser_filter_deps="gpl"
3290 vidstabdetect_filter_deps="libvidstab"
3291 vidstabtransform_filter_deps="libvidstab"
3292 libvmaf_filter_deps="libvmaf pthreads"
3293 zmq_filter_deps="libzmq"
3294 zoompan_filter_deps="swscale"
3295 zscale_filter_deps="libzimg const_nan"
3296 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
3297 vpp_qsv_filter_deps="libmfx"
3298 vpp_qsv_filter_select="qsvvpp"
3299
3300 # examples
3301 avio_dir_cmd_deps="avformat avutil"
3302 avio_reading_deps="avformat avcodec avutil"
3303 decode_audio_example_deps="avcodec avutil"
3304 decode_video_example_deps="avcodec avutil"
3305 demuxing_decoding_example_deps="avcodec avformat avutil"
3306 encode_audio_example_deps="avcodec avutil"
3307 encode_video_example_deps="avcodec avutil"
3308 extract_mvs_example_deps="avcodec avformat avutil"
3309 filter_audio_example_deps="avfilter avutil"
3310 filtering_audio_example_deps="avfilter avcodec avformat avutil"
3311 filtering_video_example_deps="avfilter avcodec avformat avutil"
3312 http_multiclient_example_deps="avformat avutil fork"
3313 hw_decode_example_deps="avcodec avformat avutil"
3314 metadata_example_deps="avformat avutil"
3315 muxing_example_deps="avcodec avformat avutil swscale"
3316 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
3317 remuxing_example_deps="avcodec avformat avutil"
3318 resampling_audio_example_deps="avutil swresample"
3319 scaling_video_example_deps="avutil swscale"
3320 transcode_aac_example_deps="avcodec avformat swresample"
3321 transcoding_example_deps="avfilter avcodec avformat avutil"
3322 vaapi_encode_example_deps="avcodec avutil"
3323
3324 # EXTRALIBS_LIST
3325 cpu_init_extralibs="pthreads_extralibs"
3326 cws2fws_extralibs="zlib_extralibs"
3327
3328 # libraries, in linking order
3329 avcodec_deps="avutil"
3330 avcodec_suggest="libm"
3331 avcodec_select="null_bsf"
3332 avdevice_deps="avformat avcodec avutil"
3333 avdevice_suggest="libm"
3334 avfilter_deps="avutil"
3335 avfilter_suggest="libm"
3336 avformat_deps="avcodec avutil"
3337 avformat_suggest="libm network zlib"
3338 avresample_deps="avutil"
3339 avresample_suggest="libm"
3340 avutil_suggest="clock_gettime cuda libm libdrm libmfx opencl user32 vaapi videotoolbox corefoundation corevideo coremedia wincrypt"
3341 postproc_deps="avutil gpl"
3342 postproc_suggest="libm"
3343 swresample_deps="avutil"
3344 swresample_suggest="libm libsoxr"
3345 swscale_deps="avutil"
3346 swscale_suggest="libm"
3347
3348 avcodec_extralibs="pthreads_extralibs iconv_extralibs"
3349 avfilter_extralibs="pthreads_extralibs"
3350 avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
3351
3352 # programs
3353 ffmpeg_deps="avcodec avfilter avformat swresample"
3354 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
3355                null_filter
3356                trim_filter"
3357 ffmpeg_suggest="ole32 psapi shell32"
3358 ffplay_deps="avcodec avformat swscale swresample sdl2"
3359 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
3360 ffplay_suggest="shell32"
3361 ffprobe_deps="avcodec avformat"
3362 ffprobe_suggest="shell32"
3363 ffserver_deps="avformat fork sarestart"
3364 ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
3365
3366 # documentation
3367 podpages_deps="perl"
3368 manpages_deps="perl pod2man"
3369 htmlpages_deps="perl"
3370 htmlpages_deps_any="makeinfo_html texi2html"
3371 txtpages_deps="perl makeinfo"
3372 doc_deps_any="manpages htmlpages podpages txtpages"
3373
3374 # default parameters
3375
3376 logfile="ffbuild/config.log"
3377
3378 # installation paths
3379 prefix_default="/usr/local"
3380 bindir_default='${prefix}/bin'
3381 datadir_default='${prefix}/share/ffmpeg'
3382 docdir_default='${prefix}/share/doc/ffmpeg'
3383 incdir_default='${prefix}/include'
3384 libdir_default='${prefix}/lib'
3385 mandir_default='${prefix}/share/man'
3386
3387 # toolchain
3388 ar_default="ar"
3389 cc_default="gcc"
3390 cxx_default="g++"
3391 host_cc_default="gcc"
3392 doxygen_default="doxygen"
3393 install="install"
3394 ln_s_default="ln -s -f"
3395 nm_default="nm -g"
3396 pkg_config_default=pkg-config
3397 ranlib_default="ranlib"
3398 strip_default="strip"
3399 version_script='--version-script'
3400 objformat="elf32"
3401 x86asmexe_default="nasm"
3402 windres_default="windres"
3403 nvcc_default="nvcc"
3404 nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
3405 striptype="direct"
3406
3407 # OS
3408 target_os_default=$(tolower $(uname -s))
3409 host_os=$target_os_default
3410
3411 # machine
3412 if test "$target_os_default" = aix; then
3413     arch_default=$(uname -p)
3414     strip_default="strip -X32_64"
3415 else
3416     arch_default=$(uname -m)
3417 fi
3418 cpu="generic"
3419 intrinsics="none"
3420
3421 # configurable options
3422 enable $PROGRAM_LIST
3423 enable $DOCUMENT_LIST
3424 enable $EXAMPLE_LIST
3425 enable $(filter_out avresample $LIBRARY_LIST)
3426 enable stripping
3427
3428 enable asm
3429 enable debug
3430 enable doc
3431 enable faan faandct faanidct
3432 enable optimizations
3433 enable runtime_cpudetect
3434 enable safe_bitstream_reader
3435 enable static
3436 enable swscale_alpha
3437 enable valgrind_backtrace
3438
3439 sws_max_filter_size_default=256
3440 set_default sws_max_filter_size
3441
3442 # internal components are enabled by default
3443 enable $EXTRALIBS_LIST
3444
3445 # Avoid external, non-system, libraries getting enabled by dependency resolution
3446 disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
3447
3448 # build settings
3449 SHFLAGS='-shared -Wl,-soname,$$(@F)'
3450 LIBPREF="lib"
3451 LIBSUF=".a"
3452 FULLNAME='$(NAME)$(BUILDSUF)'
3453 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
3454 SLIBPREF="lib"
3455 SLIBSUF=".so"
3456 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
3457 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
3458 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
3459 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
3460 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
3461 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
3462 VERSION_SCRIPT_POSTPROCESS_CMD="cat"
3463
3464 asflags_filter=echo
3465 cflags_filter=echo
3466 ldflags_filter=echo
3467
3468 AS_C='-c'
3469 AS_O='-o $@'
3470 CC_C='-c'
3471 CC_E='-E -o $@'
3472 CC_O='-o $@'
3473 CXX_C='-c'
3474 CXX_O='-o $@'
3475 OBJCC_C='-c'
3476 OBJCC_E='-E -o $@'
3477 OBJCC_O='-o $@'
3478 X86ASM_O='-o $@'
3479 LD_O='-o $@'
3480 LD_LIB='-l%'
3481 LD_PATH='-L'
3482 HOSTCC_C='-c'
3483 HOSTCC_E='-E -o $@'
3484 HOSTCC_O='-o $@'
3485 HOSTLD_O='-o $@'
3486 NVCC_C='-c'
3487 NVCC_O='-o $@'
3488
3489 host_extralibs='-lm'
3490 host_cflags_filter=echo
3491 host_ldflags_filter=echo
3492
3493 target_path='$(CURDIR)'
3494
3495 # since the object filename is not given with the -MM flag, the compiler
3496 # is only able to print the basename, and we must add the path ourselves
3497 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
3498 DEPFLAGS='-MM'
3499
3500 mkdir -p ffbuild
3501
3502 # find source path
3503 if test -f configure; then
3504     source_path=.
3505 else
3506     source_path=$(cd $(dirname "$0"); pwd)
3507     case "$source_path" in
3508         *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
3509     esac
3510     test -e "$source_path/config.h" &&
3511         die "Out of tree builds are impossible with config.h in source dir."
3512 fi
3513
3514 for v in "$@"; do
3515     r=${v#*=}
3516     l=${v%"$r"}
3517     r=$(sh_quote "$r")
3518     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
3519 done
3520
3521 find_things(){
3522     thing=$1
3523     pattern=$2
3524     file=$source_path/$3
3525     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
3526 }
3527
3528 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
3529 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
3530 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
3531 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
3532 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
3533 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
3534 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
3535 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
3536
3537 find_things_extern(){
3538     thing=$1
3539     pattern=$2
3540     file=$source_path/$3
3541     sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
3542 }
3543
3544 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
3545 HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
3546 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
3547
3548 AVCODEC_COMPONENTS_LIST="
3549     $BSF_LIST
3550     $DECODER_LIST
3551     $ENCODER_LIST
3552     $HWACCEL_LIST
3553     $PARSER_LIST
3554 "
3555
3556 AVDEVICE_COMPONENTS_LIST="
3557     $INDEV_LIST
3558     $OUTDEV_LIST
3559 "
3560
3561 AVFILTER_COMPONENTS_LIST="
3562     $FILTER_LIST
3563 "
3564
3565 AVFORMAT_COMPONENTS_LIST="
3566     $DEMUXER_LIST
3567     $MUXER_LIST
3568     $PROTOCOL_LIST
3569 "
3570
3571 ALL_COMPONENTS="
3572     $AVCODEC_COMPONENTS_LIST
3573     $AVDEVICE_COMPONENTS_LIST
3574     $AVFILTER_COMPONENTS_LIST
3575     $AVFORMAT_COMPONENTS_LIST
3576 "
3577
3578 for n in $COMPONENT_LIST; do
3579     v=$(toupper ${n%s})_LIST
3580     eval enable \$$v
3581     eval ${n}_if_any="\$$v"
3582 done
3583
3584 enable $ARCH_EXT_LIST
3585
3586 die_unknown(){
3587     echo "Unknown option \"$1\"."
3588     echo "See $0 --help for available options."
3589     exit 1
3590 }
3591
3592 print_in_columns() {
3593     cols=$(expr $ncols / 24)
3594     cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
3595 }
3596
3597 show_list() {
3598     suffix=_$1
3599     shift
3600     echo $* | sed s/$suffix//g | print_in_columns
3601     exit 0
3602 }
3603
3604 rand_list(){
3605     IFS=', '
3606     set -- $*
3607     unset IFS
3608     for thing; do
3609         comp=${thing%:*}
3610         prob=${thing#$comp}
3611         prob=${prob#:}
3612         is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
3613         echo "prob ${prob:-0.5}"
3614         printf '%s\n' $comp
3615     done
3616 }
3617
3618 do_random(){
3619     action=$1
3620     shift
3621     random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
3622     $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
3623 }
3624
3625 for opt do
3626     optval="${opt#*=}"
3627     case "$opt" in
3628         --extra-ldflags=*)
3629             add_ldflags $optval
3630         ;;
3631         --extra-ldexeflags=*)
3632             add_ldexeflags $optval
3633         ;;
3634         --extra-ldsoflags=*)
3635             add_ldsoflags $optval
3636         ;;
3637         --extra-ldlibflags=*)
3638             warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
3639                  "removed in the future. Use --extra-ldsoflags instead."
3640             add_ldsoflags $optval
3641         ;;
3642         --extra-libs=*)
3643             add_extralibs $optval
3644         ;;
3645         --disable-devices)
3646             disable $INDEV_LIST $OUTDEV_LIST
3647         ;;
3648         --enable-debug=*)
3649             debuglevel="$optval"
3650         ;;
3651         --disable-programs)
3652             disable $PROGRAM_LIST
3653         ;;
3654         --disable-everything)
3655             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3656         ;;
3657         --disable-all)
3658             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3659             disable $LIBRARY_LIST $PROGRAM_LIST doc
3660             enable avutil
3661         ;;
3662         --enable-random|--disable-random)
3663             action=${opt%%-random}
3664             do_random ${action#--} $COMPONENT_LIST
3665         ;;
3666         --enable-random=*|--disable-random=*)
3667             action=${opt%%-random=*}
3668             do_random ${action#--} $optval
3669         ;;
3670         --enable-sdl)
3671             enable sdl2
3672         ;;
3673         --enable-*=*|--disable-*=*)
3674             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
3675             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
3676             eval list=\$$(toupper $thing)_LIST
3677             name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
3678             list=$(filter "$name" $list)
3679             [ "$list" = "" ] && warn "Option $opt did not match anything"
3680             $action $list
3681         ;;
3682         --enable-yasm|--disable-yasm)
3683             warn "The ${opt} option is only provided for compatibility and will be\n"\
3684                  "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
3685             test $opt = --enable-yasm && x86asm=yes || x86asm=no
3686         ;;
3687         --yasmexe=*)
3688             warn "The --yasmexe option is only provided for compatibility and will be\n"\
3689                  "removed in the future. Use --x86asmexe instead."
3690             x86asmexe="$optval"
3691         ;;
3692         --enable-?*|--disable-?*)
3693             eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
3694             if is_in $option $COMPONENT_LIST; then
3695                 test $action = disable && action=unset
3696                 eval $action \$$(toupper ${option%s})_LIST
3697             elif is_in $option $CMDLINE_SELECT; then
3698                 $action $option
3699             else
3700                 die_unknown $opt
3701             fi
3702         ;;
3703         --list-*)
3704             NAME="${opt#--list-}"
3705             is_in $NAME $COMPONENT_LIST || die_unknown $opt
3706             NAME=${NAME%s}
3707             eval show_list $NAME \$$(toupper $NAME)_LIST
3708         ;;
3709         --help|-h) show_help
3710         ;;
3711         --quiet|-q) quiet=yes
3712         ;;
3713         --fatal-warnings) enable fatal_warnings
3714         ;;
3715         --libfuzzer=*)
3716             libfuzzer_path="$optval"
3717         ;;
3718         *)
3719             optname="${opt%%=*}"
3720             optname="${optname#--}"
3721             optname=$(echo "$optname" | sed 's/-/_/g')
3722             if is_in $optname $CMDLINE_SET; then
3723                 eval $optname='$optval'
3724             elif is_in $optname $CMDLINE_APPEND; then
3725                 append $optname "$optval"
3726             else
3727                 die_unknown $opt
3728             fi
3729         ;;
3730     esac
3731 done
3732
3733 for e in $env; do
3734     eval "export $e"
3735 done
3736
3737 if disabled autodetect; then
3738
3739     # Unless iconv is explicitely disabled by the user, we still want to probe
3740     # for the iconv from the libc.
3741     disabled iconv || enable libc_iconv
3742
3743     disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
3744     disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
3745 fi
3746 # Mark specifically enabled, but normally autodetected libraries as requested.
3747 for lib in $AUTODETECT_LIBS; do
3748     enabled $lib && request $lib
3749 done
3750 #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
3751 enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
3752 enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
3753
3754 disabled logging && logfile=/dev/null
3755
3756 # command line configuration sanity checks
3757
3758 # we need to build at least one lib type
3759 if ! enabled_any static shared; then
3760     cat <<EOF
3761 At least one library type must be built.
3762 Specify --enable-static to build the static libraries or --enable-shared to
3763 build the shared libraries as well. To only build the shared libraries specify
3764 --disable-static in addition to --enable-shared.
3765 EOF
3766     exit 1
3767 fi
3768
3769 die_license_disabled() {
3770     enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
3771 }
3772
3773 die_license_disabled_gpl() {
3774     enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
3775 }
3776
3777 map "die_license_disabled gpl"      $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
3778 map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
3779
3780 enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
3781 map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
3782
3783 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
3784
3785 enabled_all gnutls openssl &&
3786     die "GnuTLS and OpenSSL must not be enabled at the same time."
3787
3788 # Disable all the library-specific components if the library itself
3789 # is disabled, see AVCODEC_LIST and following _LIST variables.
3790
3791 disable_components(){
3792     disabled ${1} && disable $(
3793         eval components="\$$(toupper ${1})_COMPONENTS"
3794         map 'eval echo \${$(toupper ${v%s})_LIST}' $components
3795     )
3796 }
3797
3798 map 'disable_components $v' $LIBRARY_LIST
3799
3800 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
3801 set >> $logfile
3802
3803 test -n "$valgrind" && toolchain="valgrind-memcheck"
3804
3805 enabled ossfuzz && {
3806     add_cflags  -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
3807     add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
3808 }
3809
3810 case "$toolchain" in
3811     *-asan)
3812         cc_default="${toolchain%-asan}"
3813         add_cflags  -fsanitize=address
3814         add_ldflags -fsanitize=address
3815     ;;
3816     *-msan)
3817         cc_default="${toolchain%-msan}"
3818         add_cflags  -fsanitize=memory -fsanitize-memory-track-origins
3819         add_ldflags -fsanitize=memory
3820     ;;
3821     *-tsan)
3822         cc_default="${toolchain%-tsan}"
3823         add_cflags  -fsanitize=thread -fPIE
3824         add_ldflags -fsanitize=thread -pie
3825         case "$toolchain" in
3826             gcc-tsan)
3827                 add_cflags  -fPIC
3828                 add_ldflags -fPIC
3829                 ;;
3830         esac
3831     ;;
3832     *-usan)
3833         cc_default="${toolchain%-usan}"
3834         add_cflags  -fsanitize=undefined
3835         add_ldflags -fsanitize=undefined
3836     ;;
3837     valgrind-*)
3838         target_exec_default="valgrind"
3839         case "$toolchain" in
3840             valgrind-massif)
3841                 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"
3842                 ;;
3843             valgrind-memcheck)
3844                 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"
3845                 ;;
3846         esac
3847     ;;
3848     msvc)
3849         # Check whether the current MSVC version needs the C99 converter.
3850         # From MSVC 2013 (compiler major version 18) onwards, it does actually
3851         # support enough of C99 to build ffmpeg. Default to the new
3852         # behaviour if the regexp was unable to match anything, since this
3853         # successfully parses the version number of existing supported
3854         # versions that require the converter (MSVC 2010 and 2012).
3855         cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
3856         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
3857             cc_default="cl"
3858             cxx_default="cl"
3859         else
3860             cc_default="c99wrap cl"
3861             cxx_default="c99wrap cl"
3862         fi
3863         ld_default="$source_path/compat/windows/mslink"
3864         nm_default="dumpbin -symbols"
3865         ar_default="lib"
3866         case "$arch" in
3867         aarch64|arm64)
3868             as_default="armasm64"
3869             ;;
3870         arm*)
3871             as_default="armasm"
3872             ;;
3873         esac
3874         target_os_default="win32"
3875         # Use a relative path for TMPDIR. This makes sure all the
3876         # ffconf temp files are written with a relative path, avoiding
3877         # issues with msys/win32 path conversion for MSVC parameters
3878         # such as -Fo<file> or -out:<file>.
3879         TMPDIR=.
3880     ;;
3881     icl)
3882         cc_default="icl"
3883         ld_default="xilink"
3884         nm_default="dumpbin -symbols"
3885         ar_default="xilib"
3886         target_os_default="win32"
3887         TMPDIR=.
3888     ;;
3889     gcov)
3890         add_cflags  -fprofile-arcs -ftest-coverage
3891         add_ldflags -fprofile-arcs -ftest-coverage
3892     ;;
3893     llvm-cov)
3894         add_cflags -fprofile-arcs -ftest-coverage
3895         add_ldflags --coverage
3896     ;;
3897     hardened)
3898         add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3899         add_cflags   -fno-strict-overflow -fstack-protector-all
3900         add_ldflags  -Wl,-z,relro -Wl,-z,now
3901         add_cflags   -fPIE
3902         add_ldexeflags -fPIE -pie
3903     ;;
3904     ?*)
3905         die "Unknown toolchain $toolchain"
3906     ;;
3907 esac
3908
3909 if test -n "$cross_prefix"; then
3910     test -n "$arch" && test -n "$target_os" ||
3911         die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
3912     enable cross_compile
3913 fi
3914
3915 ar_default="${cross_prefix}${ar_default}"
3916 cc_default="${cross_prefix}${cc_default}"
3917 cxx_default="${cross_prefix}${cxx_default}"
3918 nm_default="${cross_prefix}${nm_default}"
3919 pkg_config_default="${cross_prefix}${pkg_config_default}"
3920 if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
3921     ranlib_default="${cross_prefix}${ranlib_default} -D"
3922 else
3923     ranlib_default="${cross_prefix}${ranlib_default}"
3924 fi
3925 strip_default="${cross_prefix}${strip_default}"
3926 windres_default="${cross_prefix}${windres_default}"
3927
3928 sysinclude_default="${sysroot}/usr/include"
3929
3930 set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
3931     target_exec target_os x86asmexe nvcc
3932 enabled cross_compile || host_cc_default=$cc
3933 set_default host_cc
3934
3935 pkg_config_fail_message=""
3936 if ! $pkg_config --version >/dev/null 2>&1; then
3937     warn "$pkg_config not found, library detection may fail."
3938     pkg_config=false
3939 elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
3940     pkg_config_fail_message="
3941 Note: When building a static binary, add --pkg-config-flags=\"--static\"."
3942 fi
3943
3944 if test $doxygen != $doxygen_default && \
3945   ! $doxygen --version >/dev/null 2>&1; then
3946     warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
3947 fi
3948
3949 exesuf() {
3950     case $1 in
3951         mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
3952     esac
3953 }
3954
3955 EXESUF=$(exesuf $target_os)
3956 HOSTEXESUF=$(exesuf $host_os)
3957
3958 # set temporary file name
3959 : ${TMPDIR:=$TEMPDIR}
3960 : ${TMPDIR:=$TMP}
3961 : ${TMPDIR:=/tmp}
3962
3963 if [ -n "$tempprefix" ] ; then
3964     mktemp(){
3965         tmpname="$tempprefix.${HOSTNAME}.${UID}"
3966         echo "$tmpname"
3967         mkdir "$tmpname"
3968     }
3969 elif ! check_cmd mktemp -u XXXXXX; then
3970     # simple replacement for missing mktemp
3971     # NOT SAFE FOR GENERAL USE
3972     mktemp(){
3973         tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
3974         echo "$tmpname"
3975         mkdir "$tmpname"
3976     }
3977 fi
3978
3979 FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
3980     die "Unable to create temporary directory in $TMPDIR."
3981
3982 tmpfile(){
3983     tmp="${FFTMPDIR}/test"$2
3984     (set -C; exec > $tmp) 2> /dev/null ||
3985         die "Unable to create temporary file in $FFTMPDIR."
3986     eval $1=$tmp
3987 }
3988
3989 trap 'rm -rf -- "$FFTMPDIR"' EXIT
3990 trap 'exit 2' INT
3991
3992 tmpfile TMPASM .asm
3993 tmpfile TMPC   .c
3994 tmpfile TMPCPP .cpp
3995 tmpfile TMPE   $EXESUF
3996 tmpfile TMPH   .h
3997 tmpfile TMPM   .m
3998 tmpfile TMPO   .o
3999 tmpfile TMPS   .S
4000 tmpfile TMPSH  .sh
4001 tmpfile TMPV   .ver
4002
4003 unset -f mktemp
4004
4005 chmod +x $TMPE
4006
4007 # make sure we can execute files in $TMPDIR
4008 cat > $TMPSH 2>> $logfile <<EOF
4009 #! /bin/sh
4010 EOF
4011 chmod +x $TMPSH >> $logfile 2>&1
4012 if ! $TMPSH >> $logfile 2>&1; then
4013     cat <<EOF
4014 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
4015 variable to another directory and make sure that it is not mounted noexec.
4016 EOF
4017     die "Sanity test failed."
4018 fi
4019
4020 armasm_flags(){
4021     for flag; do
4022         case $flag in
4023             # Filter out MSVC cl.exe options from cflags that shouldn't
4024             # be passed to gas-preprocessor
4025             -M[TD]*)                                            ;;
4026             *)                  echo $flag                      ;;
4027         esac
4028    done
4029 }
4030
4031 cparser_flags(){
4032     for flag; do
4033         case $flag in
4034             -Wno-switch)             echo -Wno-switch-enum ;;
4035             -Wno-format-zero-length) ;;
4036             -Wdisabled-optimization) ;;
4037             -Wno-pointer-sign)       echo -Wno-other ;;
4038             *)                       echo $flag ;;
4039         esac
4040     done
4041 }
4042
4043 msvc_common_flags(){
4044     for flag; do
4045         case $flag in
4046             # In addition to specifying certain flags under the compiler
4047             # specific filters, they must be specified here as well or else the
4048             # generic catch all at the bottom will print the original flag.
4049             -Wall)                ;;
4050             -Wextra)              ;;
4051             -std=c99)             ;;
4052             # Common flags
4053             -fomit-frame-pointer) ;;
4054             -g)                   echo -Z7 ;;
4055             -fno-math-errno)      ;;
4056             -fno-common)          ;;
4057             -fno-signed-zeros)    ;;
4058             -fPIC)                ;;
4059             -mthumb)              ;;
4060             -march=*)             ;;
4061             -lz)                  echo zlib.lib ;;
4062             -lx264)               echo libx264.lib ;;
4063             -lstdc++)             ;;
4064             -l*)                  echo ${flag#-l}.lib ;;
4065             -LARGEADDRESSAWARE)   echo $flag ;;
4066             -L*)                  echo -libpath:${flag#-L} ;;
4067             *)                    echo $flag ;;
4068         esac
4069     done
4070 }
4071
4072 msvc_flags(){
4073     msvc_common_flags "$@"
4074     for flag; do
4075         case $flag in
4076             -Wall)                echo -W3 -wd4018 -wd4146 -wd4244 -wd4305     \
4077                                        -wd4554 ;;
4078             -Wextra)              echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
4079                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
4080                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
4081                                        -wd4307 \
4082                                        -wd4273 -wd4554 -wd4701 -wd4703 ;;
4083         esac
4084     done
4085 }
4086
4087 icl_flags(){
4088     msvc_common_flags "$@"
4089     for flag; do
4090         case $flag in
4091             # Despite what Intel's documentation says -Wall, which is supported
4092             # on Windows, does enable remarks so disable them here.
4093             -Wall)                echo $flag -Qdiag-disable:remark ;;
4094             -std=c99)             echo -Qstd=c99 ;;
4095             -flto)                echo -ipo ;;
4096         esac
4097     done
4098 }
4099
4100 icc_flags(){
4101     for flag; do
4102         case $flag in
4103             -flto)                echo -ipo ;;
4104             *)                    echo $flag ;;
4105         esac
4106     done
4107 }
4108
4109 suncc_flags(){
4110     for flag; do
4111         case $flag in
4112             -march=*|-mcpu=*)
4113                 case "${flag#*=}" in
4114                     native)                   echo -xtarget=native       ;;
4115                     v9|niagara)               echo -xarch=sparc          ;;
4116                     ultrasparc)               echo -xarch=sparcvis       ;;
4117                     ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
4118                     i586|pentium)             echo -xchip=pentium        ;;
4119                     i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
4120                     pentium3*|c3-2)           echo -xtarget=pentium3     ;;
4121                     pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
4122                     pentium4*)          echo -xtarget=pentium4           ;;
4123                     prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
4124                     *-sse3)             echo -xarch=sse3                 ;;
4125                     core2)              echo -xarch=ssse3 -xchip=core2   ;;
4126                     bonnell)                   echo -xarch=ssse3         ;;
4127                     corei7|nehalem)            echo -xtarget=nehalem     ;;
4128                     westmere)                  echo -xtarget=westmere    ;;
4129                     silvermont)                echo -xarch=sse4_2        ;;
4130                     corei7-avx|sandybridge)    echo -xtarget=sandybridge ;;
4131                     core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
4132                                                echo -xarch=avx           ;;
4133                     amdfam10|barcelona)        echo -xtarget=barcelona   ;;
4134                     btver1)                    echo -xarch=amdsse4a      ;;
4135                     btver2|bdver*|znver*)      echo -xarch=avx           ;;
4136                     athlon-4|athlon-[mx]p)     echo -xarch=ssea          ;;
4137                     k8|opteron|athlon64|athlon-fx)
4138                                                echo -xarch=sse2a         ;;
4139                     athlon*)                   echo -xarch=pentium_proa  ;;