avcodec/alsdec: Fix decoding error with mono audio files
[ffmpeg.git] / configure
1 #!/bin/sh
2 #
3 # FFmpeg configure script
4 #
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
8 #
9
10 # Prevent locale nonsense from breaking basic text processing.
11 LC_ALL=C
12 export LC_ALL
13
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
16
17 try_exec(){
18     echo "Trying shell $1"
19     type "$1" > /dev/null 2>&1 && exec "$@"
20 }
21
22 unset foo
23 (: ${foo%%bar}) 2> /dev/null
24 E1="$?"
25
26 (: ${foo?}) 2> /dev/null
27 E2="$?"
28
29 if test "$E1" != 0 || test "$E2" = 0; then
30     echo "Broken shell detected.  Trying alternatives."
31     export FF_CONF_EXEC
32     if test "0$FF_CONF_EXEC" -lt 1; then
33         FF_CONF_EXEC=1
34         try_exec bash "$0" "$@"
35     fi
36     if test "0$FF_CONF_EXEC" -lt 2; then
37         FF_CONF_EXEC=2
38         try_exec ksh "$0" "$@"
39     fi
40     if test "0$FF_CONF_EXEC" -lt 3; then
41         FF_CONF_EXEC=3
42         try_exec /usr/xpg4/bin/sh "$0" "$@"
43     fi
44     echo "No compatible shell script interpreter found."
45     echo "This configure script requires a POSIX-compatible shell"
46     echo "such as bash or ksh."
47     echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
48     echo "Instead, install a working POSIX-compatible shell."
49     echo "Disabling this configure test will create a broken FFmpeg."
50     if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51         echo "This bash version ($BASH_VERSION) is broken on your platform."
52         echo "Upgrade to a later version if available."
53     fi
54     exit 1
55 fi
56
57 test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
58
59 show_help(){
60     cat <<EOF
61 Usage: configure [options]
62 Options: [defaults in brackets after descriptions]
63
64 Help options:
65   --help                   print this message
66   --quiet                  Suppress showing informative output
67   --list-decoders          show all available decoders
68   --list-encoders          show all available encoders
69   --list-hwaccels          show all available hardware accelerators
70   --list-demuxers          show all available demuxers
71   --list-muxers            show all available muxers
72   --list-parsers           show all available parsers
73   --list-protocols         show all available protocols
74   --list-bsfs              show all available bitstream filters
75   --list-indevs            show all available input devices
76   --list-outdevs           show all available output devices
77   --list-filters           show all available filters
78
79 Standard options:
80   --logfile=FILE           log tests and output to FILE [ffbuild/config.log]
81   --disable-logging        do not log configure debug information
82   --fatal-warnings         fail if any configure warning is generated
83   --prefix=PREFIX          install in PREFIX [$prefix_default]
84   --bindir=DIR             install binaries in DIR [PREFIX/bin]
85   --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
86   --docdir=DIR             install documentation in DIR [PREFIX/share/doc/ffmpeg]
87   --libdir=DIR             install libs in DIR [PREFIX/lib]
88   --shlibdir=DIR           install shared libs in DIR [LIBDIR]
89   --incdir=DIR             install includes in DIR [PREFIX/include]
90   --mandir=DIR             install man page in DIR [PREFIX/share/man]
91   --pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]
92   --enable-rpath           use rpath to allow installing libraries in paths
93                            not part of the dynamic linker search path
94                            use rpath when linking programs (USE WITH CARE)
95   --install-name-dir=DIR   Darwin directory name for installed targets
96
97 Licensing options:
98   --enable-gpl             allow use of GPL code, the resulting libs
99                            and binaries will be under GPL [no]
100   --enable-version3        upgrade (L)GPL to version 3 [no]
101   --enable-nonfree         allow use of nonfree code, the resulting libs
102                            and binaries will be unredistributable [no]
103
104 Configuration options:
105   --disable-static         do not build static libraries [no]
106   --enable-shared          build shared libraries [no]
107   --enable-small           optimize for size instead of speed
108   --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
109   --enable-gray            enable full grayscale support (slower color)
110   --disable-swscale-alpha  disable alpha channel support in swscale
111   --disable-all            disable building components, libraries and programs
112   --disable-autodetect     disable automatically detected external libraries [no]
113
114 Program options:
115   --disable-programs       do not build command line programs
116   --disable-ffmpeg         disable ffmpeg build
117   --disable-ffplay         disable ffplay build
118   --disable-ffprobe        disable ffprobe build
119
120 Documentation options:
121   --disable-doc            do not build documentation
122   --disable-htmlpages      do not build HTML documentation pages
123   --disable-manpages       do not build man documentation pages
124   --disable-podpages       do not build POD documentation pages
125   --disable-txtpages       do not build text documentation pages
126
127 Component options:
128   --disable-avdevice       disable libavdevice build
129   --disable-avcodec        disable libavcodec build
130   --disable-avformat       disable libavformat build
131   --disable-swresample     disable libswresample build
132   --disable-swscale        disable libswscale build
133   --disable-postproc       disable libpostproc build
134   --disable-avfilter       disable libavfilter build
135   --disable-pthreads       disable pthreads [autodetect]
136   --disable-w32threads     disable Win32 threads [autodetect]
137   --disable-os2threads     disable OS/2 threads [autodetect]
138   --disable-network        disable network support [no]
139   --disable-dct            disable DCT code
140   --disable-dwt            disable DWT code
141   --disable-error-resilience disable error resilience code
142   --disable-lsp            disable LSP code
143   --disable-lzo            disable LZO decoder code
144   --disable-mdct           disable MDCT code
145   --disable-rdft           disable RDFT code
146   --disable-fft            disable FFT code
147   --disable-faan           disable floating point AAN (I)DCT code
148   --disable-pixelutils     disable pixel utils in libavutil
149
150 Individual component options:
151   --disable-everything     disable all components listed below
152   --disable-encoder=NAME   disable encoder NAME
153   --enable-encoder=NAME    enable encoder NAME
154   --disable-encoders       disable all encoders
155   --disable-decoder=NAME   disable decoder NAME
156   --enable-decoder=NAME    enable decoder NAME
157   --disable-decoders       disable all decoders
158   --disable-hwaccel=NAME   disable hwaccel NAME
159   --enable-hwaccel=NAME    enable hwaccel NAME
160   --disable-hwaccels       disable all hwaccels
161   --disable-muxer=NAME     disable muxer NAME
162   --enable-muxer=NAME      enable muxer NAME
163   --disable-muxers         disable all muxers
164   --disable-demuxer=NAME   disable demuxer NAME
165   --enable-demuxer=NAME    enable demuxer NAME
166   --disable-demuxers       disable all demuxers
167   --enable-parser=NAME     enable parser NAME
168   --disable-parser=NAME    disable parser NAME
169   --disable-parsers        disable all parsers
170   --enable-bsf=NAME        enable bitstream filter NAME
171   --disable-bsf=NAME       disable bitstream filter NAME
172   --disable-bsfs           disable all bitstream filters
173   --enable-protocol=NAME   enable protocol NAME
174   --disable-protocol=NAME  disable protocol NAME
175   --disable-protocols      disable all protocols
176   --enable-indev=NAME      enable input device NAME
177   --disable-indev=NAME     disable input device NAME
178   --disable-indevs         disable input devices
179   --enable-outdev=NAME     enable output device NAME
180   --disable-outdev=NAME    disable output device NAME
181   --disable-outdevs        disable output devices
182   --disable-devices        disable all devices
183   --enable-filter=NAME     enable filter NAME
184   --disable-filter=NAME    disable filter NAME
185   --disable-filters        disable all filters
186
187 External library support:
188
189   Using any of the following switches will allow FFmpeg to link to the
190   corresponding external library. All the components depending on that library
191   will become enabled, if all their other dependencies are met and they are not
192   explicitly disabled. E.g. --enable-libopus will enable linking to
193   libopus and allow the libopus encoder to be built, unless it is
194   specifically disabled with --disable-encoder=libopus.
195
196   Note that only the system libraries are auto-detected. All the other external
197   libraries must be explicitly enabled.
198
199   Also note that the following help text describes the purpose of the libraries
200   themselves, not all their features will necessarily be usable by FFmpeg.
201
202   --disable-alsa           disable ALSA support [autodetect]
203   --disable-appkit         disable Apple AppKit framework [autodetect]
204   --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
205   --enable-avisynth        enable reading of AviSynth script files [no]
206   --disable-bzlib          disable bzlib [autodetect]
207   --disable-coreimage      disable Apple CoreImage framework [autodetect]
208   --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
209   --enable-frei0r          enable frei0r video filtering [no]
210   --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support
211                            if openssl, librtmp or gmp is not used [no]
212   --enable-gmp             enable gmp, needed for rtmp(t)e support
213                            if openssl or librtmp is not used [no]
214   --enable-gnutls          enable gnutls, needed for https support
215                            if openssl, libtls or mbedtls is not used [no]
216   --disable-iconv          disable iconv [autodetect]
217   --enable-jni             enable JNI support [no]
218   --enable-ladspa          enable LADSPA audio filtering [no]
219   --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
220   --enable-libaribb24      enable ARIB text and caption decoding via libaribb24 [no]
221   --enable-libass          enable libass subtitles rendering,
222                            needed for subtitles and ass filter [no]
223   --enable-libbluray       enable BluRay reading using libbluray [no]
224   --enable-libbs2b         enable bs2b DSP library [no]
225   --enable-libcaca         enable textual display using libcaca [no]
226   --enable-libcelt         enable CELT decoding via libcelt [no]
227   --enable-libcdio         enable audio CD grabbing with libcdio [no]
228   --enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]
229   --enable-libdav1d        enable AV1 decoding via libdav1d [no]
230   --enable-libdavs2        enable AVS2 decoding via libdavs2 [no]
231   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
232                            and libraw1394 [no]
233   --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
234   --enable-libflite        enable flite (voice synthesis) support via libflite [no]
235   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
236   --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
237   --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
238   --enable-libglslang      enable GLSL->SPIRV compilation via libglslang [no]
239   --enable-libgme          enable Game Music Emu via libgme [no]
240   --enable-libgsm          enable GSM de/encoding via libgsm [no]
241   --enable-libiec61883     enable iec61883 via libiec61883 [no]
242   --enable-libilbc         enable iLBC de/encoding via libilbc [no]
243   --enable-libjack         enable JACK audio sound server [no]
244   --enable-libklvanc       enable Kernel Labs VANC processing [no]
245   --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
246   --enable-liblensfun      enable lensfun lens correction [no]
247   --enable-libmodplug      enable ModPlug via libmodplug [no]
248   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
249   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
250   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
251   --enable-libopencv       enable video filtering via libopencv [no]
252   --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
253   --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
254   --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
255   --enable-libopenvino     enable OpenVINO as a DNN module backend
256                            for DNN based filters like dnn_processing [no]
257   --enable-libopus         enable Opus de/encoding via libopus [no]
258   --enable-libpulse        enable Pulseaudio input via libpulse [no]
259   --enable-librabbitmq     enable RabbitMQ library [no]
260   --enable-librav1e        enable AV1 encoding via rav1e [no]
261   --enable-librist         enable RIST via librist [no]
262   --enable-librsvg         enable SVG rasterization via librsvg [no]
263   --enable-librubberband   enable rubberband needed for rubberband filter [no]
264   --enable-librtmp         enable RTMP[E] support via librtmp [no]
265   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
266   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
267   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
268   --enable-libsoxr         enable Include libsoxr resampling [no]
269   --enable-libspeex        enable Speex de/encoding via libspeex [no]
270   --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
271   --enable-libssh          enable SFTP protocol via libssh [no]
272   --enable-libsvtav1       enable AV1 encoding via SVT [no]
273   --enable-libtensorflow   enable TensorFlow as a DNN module backend
274                            for DNN based filters like sr [no]
275   --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
276   --enable-libtheora       enable Theora encoding via libtheora [no]
277   --enable-libtls          enable LibreSSL (via libtls), needed for https support
278                            if openssl, gnutls or mbedtls is not used [no]
279   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
280   --enable-libuavs3d       enable AVS3 decoding via libuavs3d [no]
281   --enable-libv4l2         enable libv4l2/v4l-utils [no]
282   --enable-libvidstab      enable video stabilization using vid.stab [no]
283   --enable-libvmaf         enable vmaf filter via libvmaf [no]
284   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
285   --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
286                            native implementation exists [no]
287   --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
288   --enable-libwebp         enable WebP encoding via libwebp [no]
289   --enable-libx264         enable H.264 encoding via x264 [no]
290   --enable-libx265         enable HEVC encoding via x265 [no]
291   --enable-libxavs         enable AVS encoding via xavs [no]
292   --enable-libxavs2        enable AVS2 encoding via xavs2 [no]
293   --enable-libxcb          enable X11 grabbing using XCB [autodetect]
294   --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
295   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
296   --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
297   --enable-libxvid         enable Xvid encoding via xvidcore,
298                            native MPEG-4/Xvid encoder exists [no]
299   --enable-libxml2         enable XML parsing using the C library libxml2, needed
300                            for dash demuxing support [no]
301   --enable-libzimg         enable z.lib, needed for zscale filter [no]
302   --enable-libzmq          enable message passing via libzmq [no]
303   --enable-libzvbi         enable teletext support via libzvbi [no]
304   --enable-lv2             enable LV2 audio filtering [no]
305   --disable-lzma           disable lzma [autodetect]
306   --enable-decklink        enable Blackmagic DeckLink I/O support [no]
307   --enable-mbedtls         enable mbedTLS, needed for https support
308                            if openssl, gnutls or libtls is not used [no]
309   --enable-mediacodec      enable Android MediaCodec support [no]
310   --enable-mediafoundation enable encoding via MediaFoundation [auto]
311   --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
312   --enable-openal          enable OpenAL 1.1 capture support [no]
313   --enable-opencl          enable OpenCL processing [no]
314   --enable-opengl          enable OpenGL rendering [no]
315   --enable-openssl         enable openssl, needed for https support
316                            if gnutls, libtls or mbedtls is not used [no]
317   --enable-pocketsphinx    enable PocketSphinx, needed for asr filter [no]
318   --disable-sndio          disable sndio support [autodetect]
319   --disable-schannel       disable SChannel SSP, needed for TLS support on
320                            Windows if openssl and gnutls are not used [autodetect]
321   --disable-sdl2           disable sdl2 [autodetect]
322   --disable-securetransport disable Secure Transport, needed for TLS support
323                            on OSX if openssl and gnutls are not used [autodetect]
324   --enable-vapoursynth     enable VapourSynth demuxer [no]
325   --enable-vulkan          enable Vulkan code [no]
326   --disable-xlib           disable xlib [autodetect]
327   --disable-zlib           disable zlib [autodetect]
328
329   The following libraries provide various hardware acceleration features:
330   --disable-amf            disable AMF video encoding code [autodetect]
331   --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
332   --enable-cuda-nvcc       enable Nvidia CUDA compiler [no]
333   --disable-cuda-llvm      disable CUDA compilation using clang [autodetect]
334   --disable-cuvid          disable Nvidia CUVID support [autodetect]
335   --disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]
336   --disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]
337   --disable-ffnvcodec      disable dynamically linked Nvidia code [autodetect]
338   --enable-libdrm          enable DRM code (Linux) [no]
339   --enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
340   --enable-libnpp          enable Nvidia Performance Primitives-based code [no]
341   --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
342   --disable-nvdec          disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
343   --disable-nvenc          disable Nvidia video encoding code [autodetect]
344   --enable-omx             enable OpenMAX IL code [no]
345   --enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]
346   --enable-rkmpp           enable Rockchip Media Process Platform code [no]
347   --disable-v4l2-m2m       disable V4L2 mem2mem code [autodetect]
348   --disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
349   --disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
350   --disable-videotoolbox   disable VideoToolbox code [autodetect]
351
352 Toolchain options:
353   --arch=ARCH              select architecture [$arch]
354   --cpu=CPU                select the minimum required CPU (affects
355                            instruction selection, may crash on older CPUs)
356   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
357   --progs-suffix=SUFFIX    program name suffix []
358   --enable-cross-compile   assume a cross-compiler is used
359   --sysroot=PATH           root of cross-build tree
360   --sysinclude=PATH        location of cross-build system headers
361   --target-os=OS           compiler targets OS [$target_os]
362   --target-exec=CMD        command to run executables on target
363   --target-path=DIR        path to view of build directory on target
364   --target-samples=DIR     path to samples directory on target
365   --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
366   --toolchain=NAME         set tool defaults according to NAME
367                            (gcc-asan, clang-asan, gcc-msan, clang-msan,
368                            gcc-tsan, clang-tsan, gcc-usan, clang-usan,
369                            valgrind-massif, valgrind-memcheck,
370                            msvc, icl, gcov, llvm-cov, hardened)
371   --nm=NM                  use nm tool NM [$nm_default]
372   --ar=AR                  use archive tool AR [$ar_default]
373   --as=AS                  use assembler AS [$as_default]
374   --ln_s=LN_S              use symbolic link tool LN_S [$ln_s_default]
375   --strip=STRIP            use strip tool STRIP [$strip_default]
376   --windres=WINDRES        use windows resource compiler WINDRES [$windres_default]
377   --x86asmexe=EXE          use nasm-compatible assembler EXE [$x86asmexe_default]
378   --cc=CC                  use C compiler CC [$cc_default]
379   --cxx=CXX                use C compiler CXX [$cxx_default]
380   --objcc=OCC              use ObjC compiler OCC [$cc_default]
381   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
382   --nvcc=NVCC              use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
383   --ld=LD                  use linker LD [$ld_default]
384   --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [$pkg_config_default]
385   --pkg-config-flags=FLAGS pass additional flags to pkgconf []
386   --ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]
387   --doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]
388   --host-cc=HOSTCC         use host C compiler HOSTCC
389   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
390   --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
391   --host-ld=HOSTLD         use host linker HOSTLD
392   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
393   --host-extralibs=HLIBS   use libs HLIBS when linking for host
394   --host-os=OS             compiler host OS [$target_os]
395   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
396   --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
397   --extra-objcflags=FLAGS  add FLAGS to OBJCFLAGS [$CFLAGS]
398   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
399   --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
400   --extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [$LDSOFLAGS]
401   --extra-libs=ELIBS       add ELIBS [$ELIBS]
402   --extra-version=STRING   version string suffix []
403   --optflags=OPTFLAGS      override optimization-related compiler flags
404   --nvccflags=NVCCFLAGS    override nvcc flags [$nvccflags_default]
405   --build-suffix=SUFFIX    library name suffix []
406   --enable-pic             build position-independent code
407   --enable-thumb           compile for Thumb instruction set
408   --enable-lto             use link-time optimization
409   --env="ENV=override"     override the environment variables
410
411 Advanced options (experts only):
412   --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
413   --custom-allocator=NAME  use a supported custom allocator
414   --disable-symver         disable symbol versioning
415   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
416   --disable-safe-bitstream-reader
417                            disable buffer boundary checking in bitreaders
418                            (faster, but may crash)
419   --sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]
420
421 Optimization options (experts only):
422   --disable-asm            disable all assembly optimizations
423   --disable-altivec        disable AltiVec optimizations
424   --disable-vsx            disable VSX optimizations
425   --disable-power8         disable POWER8 optimizations
426   --disable-amd3dnow       disable 3DNow! optimizations
427   --disable-amd3dnowext    disable 3DNow! extended optimizations
428   --disable-mmx            disable MMX optimizations
429   --disable-mmxext         disable MMXEXT optimizations
430   --disable-sse            disable SSE optimizations
431   --disable-sse2           disable SSE2 optimizations
432   --disable-sse3           disable SSE3 optimizations
433   --disable-ssse3          disable SSSE3 optimizations
434   --disable-sse4           disable SSE4 optimizations
435   --disable-sse42          disable SSE4.2 optimizations
436   --disable-avx            disable AVX optimizations
437   --disable-xop            disable XOP optimizations
438   --disable-fma3           disable FMA3 optimizations
439   --disable-fma4           disable FMA4 optimizations
440   --disable-avx2           disable AVX2 optimizations
441   --disable-avx512         disable AVX-512 optimizations
442   --disable-aesni          disable AESNI optimizations
443   --disable-armv5te        disable armv5te optimizations
444   --disable-armv6          disable armv6 optimizations
445   --disable-armv6t2        disable armv6t2 optimizations
446   --disable-vfp            disable VFP optimizations
447   --disable-neon           disable NEON optimizations
448   --disable-inline-asm     disable use of inline assembly
449   --disable-x86asm         disable use of standalone x86 assembly
450   --disable-mipsdsp        disable MIPS DSP ASE R1 optimizations
451   --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
452   --disable-msa            disable MSA optimizations
453   --disable-mipsfpu        disable floating point MIPS optimizations
454   --disable-mmi            disable Loongson SIMD optimizations
455   --disable-fast-unaligned consider unaligned accesses slow
456
457 Developer options (useful when working on FFmpeg itself):
458   --disable-debug          disable debugging symbols
459   --enable-debug=LEVEL     set the debug level [$debuglevel]
460   --disable-optimizations  disable compiler optimizations
461   --enable-extra-warnings  enable more compiler warnings
462   --disable-stripping      disable stripping of executables and shared libraries
463   --assert-level=level     0(default), 1 or 2, amount of assertion testing,
464                            2 causes a slowdown at runtime.
465   --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
466   --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
467                            leaks and errors, using the specified valgrind binary.
468                            Cannot be combined with --target-exec
469   --enable-ftrapv          Trap arithmetic overflows
470   --samples=PATH           location of test samples for FATE, if not set use
471                            \$FATE_SAMPLES at make invocation time.
472   --enable-neon-clobber-test check NEON registers for clobbering (should be
473                            used only for debugging purposes)
474   --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
475                            should be used only for debugging purposes)
476   --enable-random          randomly enable/disable components
477   --disable-random
478   --enable-random=LIST     randomly enable/disable specific components or
479   --disable-random=LIST    component groups. LIST is a comma-separated list
480                            of NAME[:PROB] entries where NAME is a component
481                            (group) and PROB the probability associated with
482                            NAME (default 0.5).
483   --random-seed=VALUE      seed value for --enable/disable-random
484   --disable-valgrind-backtrace do not print a backtrace under Valgrind
485                            (only applies to --disable-optimizations builds)
486   --enable-ossfuzz         Enable building fuzzer tool
487   --libfuzzer=PATH         path to libfuzzer
488   --ignore-tests=TESTS     comma-separated list (without "fate-" prefix
489                            in the name) of tests whose result is ignored
490   --enable-linux-perf      enable Linux Performance Monitor API
491   --disable-large-tests    disable tests that use a large amount of memory
492
493 NOTE: Object files are built at the place where configure is launched.
494 EOF
495   exit 0
496 }
497
498 if test -t 1 && which tput >/dev/null 2>&1; then
499     ncolors=$(tput colors)
500     if test -n "$ncolors" && test $ncolors -ge 8; then
501         bold_color=$(tput bold)
502         warn_color=$(tput setaf 3)
503         error_color=$(tput setaf 1)
504         reset_color=$(tput sgr0)
505     fi
506     # 72 used instead of 80 since that's the default of pr
507     ncols=$(tput cols)
508 fi
509 : ${ncols:=72}
510
511 log(){
512     echo "$@" >> $logfile
513 }
514
515 log_file(){
516     log BEGIN "$1"
517     log_file_i=1
518     while IFS= read -r log_file_line; do
519         printf '%5d\t%s\n' "$log_file_i" "$log_file_line"
520         log_file_i=$(($log_file_i+1))
521     done < "$1" >> "$logfile"
522     log END "$1"
523 }
524
525 warn(){
526     log "WARNING: $*"
527     WARNINGS="${WARNINGS}WARNING: $*\n"
528 }
529
530 die(){
531     log "$@"
532     echo "$error_color$bold_color$@$reset_color"
533     cat <<EOF
534
535 If you think configure made a mistake, make sure you are using the latest
536 version from Git.  If the latest version fails, report the problem to the
537 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
538 EOF
539     if disabled logging; then
540         cat <<EOF
541 Rerun configure with logging enabled (do not use --disable-logging), and
542 include the log this produces with your report.
543 EOF
544     else
545         cat <<EOF
546 Include the log file "$logfile" produced by configure as this will help
547 solve the problem.
548 EOF
549     fi
550     exit 1
551 }
552
553 # Avoid locale weirdness, besides we really just want to translate ASCII.
554 toupper(){
555     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
556 }
557
558 tolower(){
559     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
560 }
561
562 c_escape(){
563     echo "$*" | sed 's/["\\]/\\\0/g'
564 }
565
566 sh_quote(){
567     v=$(echo "$1" | sed "s/'/'\\\\''/g")
568     test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
569     echo "$v"
570 }
571
572 cleanws(){
573     echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
574 }
575
576 filter(){
577     pat=$1
578     shift
579     for v; do
580         eval "case '$v' in $pat) printf '%s ' '$v' ;; esac"
581     done
582 }
583
584 filter_out(){
585     pat=$1
586     shift
587     for v; do
588         eval "case '$v' in $pat) ;; *) printf '%s ' '$v' ;; esac"
589     done
590 }
591
592 map(){
593     m=$1
594     shift
595     for v; do eval $m; done
596 }
597
598 add_suffix(){
599     suffix=$1
600     shift
601     for v; do echo ${v}${suffix}; done
602 }
603
604 remove_suffix(){
605     suffix=$1
606     shift
607     for v; do echo ${v%$suffix}; done
608 }
609
610 set_all(){
611     value=$1
612     shift
613     for var in $*; do
614         eval $var=$value
615     done
616 }
617
618 set_weak(){
619     value=$1
620     shift
621     for var; do
622         eval : \${$var:=$value}
623     done
624 }
625
626 sanitize_var_name(){
627     echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
628 }
629
630 set_sanitized(){
631     var=$1
632     shift
633     eval $(sanitize_var_name "$var")='$*'
634 }
635
636 get_sanitized(){
637     eval echo \$$(sanitize_var_name "$1")
638 }
639
640 pushvar(){
641     for pvar in $*; do
642         eval level=\${${pvar}_level:=0}
643         eval ${pvar}_${level}="\$$pvar"
644         eval ${pvar}_level=$(($level+1))
645     done
646 }
647
648 popvar(){
649     for pvar in $*; do
650         eval level=\${${pvar}_level:-0}
651         test $level = 0 && continue
652         eval level=$(($level-1))
653         eval $pvar="\${${pvar}_${level}}"
654         eval ${pvar}_level=$level
655         eval unset ${pvar}_${level}
656     done
657 }
658
659 request(){
660     for var in $*; do
661         eval ${var}_requested=yes
662         eval $var=
663     done
664 }
665
666 warn_if_gets_disabled(){
667     for var in $*; do
668         WARN_IF_GETS_DISABLED_LIST="$WARN_IF_GETS_DISABLED_LIST $var"
669     done
670 }
671
672 enable(){
673     set_all yes $*
674 }
675
676 disable(){
677     set_all no $*
678 }
679
680 disable_with_reason(){
681     disable $1
682     eval "${1}_disable_reason=\"$2\""
683     if requested $1; then
684         die "ERROR: $1 requested, but $2"
685     fi
686 }
687
688 enable_weak(){
689     set_weak yes $*
690 }
691
692 disable_weak(){
693     set_weak no $*
694 }
695
696 enable_sanitized(){
697     for var; do
698         enable $(sanitize_var_name $var)
699     done
700 }
701
702 disable_sanitized(){
703     for var; do
704         disable $(sanitize_var_name $var)
705     done
706 }
707
708 do_enable_deep(){
709     for var; do
710         enabled $var && continue
711         set -- $var
712         eval enable_deep \$${var}_select
713         var=$1
714         eval enable_deep_weak \$${var}_suggest
715     done
716 }
717
718 enable_deep(){
719     do_enable_deep $*
720     enable $*
721 }
722
723 enable_deep_weak(){
724     for var; do
725         disabled $var && continue
726         set -- $var
727         do_enable_deep $var
728         var=$1
729         enable_weak $var
730     done
731 }
732
733 requested(){
734     test "${1#!}" = "$1" && op="=" || op="!="
735     eval test "x\$${1#!}_requested" $op "xyes"
736 }
737
738 enabled(){
739     test "${1#!}" = "$1" && op="=" || op="!="
740     eval test "x\$${1#!}" $op "xyes"
741 }
742
743 disabled(){
744     test "${1#!}" = "$1" && op="=" || op="!="
745     eval test "x\$${1#!}" $op "xno"
746 }
747
748 enabled_all(){
749     for opt; do
750         enabled $opt || return 1
751     done
752 }
753
754 disabled_all(){
755     for opt; do
756         disabled $opt || return 1
757     done
758 }
759
760 enabled_any(){
761     for opt; do
762         enabled $opt && return 0
763     done
764 }
765
766 disabled_any(){
767     for opt; do
768         disabled $opt && return 0
769     done
770     return 1
771 }
772
773 set_default(){
774     for opt; do
775         eval : \${$opt:=\$${opt}_default}
776     done
777 }
778
779 is_in(){
780     value=$1
781     shift
782     for var in $*; do
783         [ $var = $value ] && return 0
784     done
785     return 1
786 }
787
788 # The cfg loop is very hot (several thousands iterations), and in bash also
789 # potentialy quite slow. Try to abort the iterations early, preferably without
790 # calling functions. 70%+ of the time cfg is already done or without deps.
791 check_deps(){
792     for cfg; do
793         eval [ x\$${cfg}_checking = xdone ] && continue
794         eval [ x\$${cfg}_checking = xinprogress ] && die "Circular dependency for $cfg."
795
796         eval "
797         dep_all=\$${cfg}_deps
798         dep_any=\$${cfg}_deps_any
799         dep_con=\$${cfg}_conflict
800         dep_sel=\$${cfg}_select
801         dep_sgs=\$${cfg}_suggest
802         dep_ifa=\$${cfg}_if
803         dep_ifn=\$${cfg}_if_any
804         "
805
806         # most of the time here $cfg has no deps - avoid costly no-op work
807         if [ "$dep_all$dep_any$dep_con$dep_sel$dep_sgs$dep_ifa$dep_ifn" ]; then
808             eval ${cfg}_checking=inprogress
809
810             set -- $cfg "$dep_all" "$dep_any" "$dep_con" "$dep_sel" "$dep_sgs" "$dep_ifa" "$dep_ifn"
811             check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
812             cfg=$1; dep_all=$2; dep_any=$3; dep_con=$4; dep_sel=$5 dep_sgs=$6; dep_ifa=$7; dep_ifn=$8
813
814             [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
815             [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
816             enabled_all  $dep_all || { disable_with_reason $cfg "not all dependencies are satisfied: $dep_all"; }
817             enabled_any  $dep_any || { disable_with_reason $cfg "not any dependency is satisfied: $dep_any"; }
818             disabled_all $dep_con || { disable_with_reason $cfg "some conflicting dependencies are unsatisfied: $dep_con"; }
819             disabled_any $dep_sel && { disable_with_reason $cfg "some selected dependency is unsatisfied: $dep_sel"; }
820
821             enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
822
823             for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
824                 # filter out library deps, these do not belong in extralibs
825                 is_in $dep $LIBRARY_LIST && continue
826                 enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs
827             done
828         fi
829
830         eval ${cfg}_checking=done
831     done
832 }
833
834 print_config(){
835     pfx=$1
836     files=$2
837     shift 2
838     map 'eval echo "$v \${$v:-no}"' "$@" |
839     awk "BEGIN { split(\"$files\", files) }
840         {
841             c = \"$pfx\" toupper(\$1);
842             v = \$2;
843             sub(/yes/, 1, v);
844             sub(/no/,  0, v);
845             for (f in files) {
846                 file = files[f];
847                 if (file ~ /\\.h\$/) {
848                     printf(\"#define %s %d\\n\", c, v) >>file;
849                 } else if (file ~ /\\.asm\$/) {
850                     printf(\"%%define %s %d\\n\", c, v) >>file;
851                 } else if (file ~ /\\.mak\$/) {
852                     n = -v ? \"\" : \"!\";
853                     printf(\"%s%s=yes\\n\", n, c) >>file;
854                 } else if (file ~ /\\.texi\$/) {
855                     pre = -v ? \"\" : \"@c \";
856                     yesno = \$2;
857                     c2 = tolower(c);
858                     gsub(/_/, \"-\", c2);
859                     printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
860                 }
861             }
862         }"
863 }
864
865 print_enabled(){
866     suf=$1
867     shift
868     for v; do
869         enabled $v && printf "%s\n" ${v%$suf}
870     done
871 }
872
873 append(){
874     var=$1
875     shift
876     eval "$var=\"\$$var $*\""
877 }
878
879 prepend(){
880     var=$1
881     shift
882     eval "$var=\"$* \$$var\""
883 }
884
885 reverse () {
886     eval '
887         reverse_out=
888         for v in $'$1'; do
889             reverse_out="$v $reverse_out"
890         done
891         '$1'=$reverse_out
892     '
893 }
894
895 # keeps the last occurence of each non-unique item
896 unique(){
897     unique_out=
898     eval unique_in=\$$1
899     reverse unique_in
900     for v in $unique_in; do
901         # " $unique_out" +space such that every item is surrounded with spaces
902         case " $unique_out" in *" $v "*) continue; esac  # already in list
903         unique_out="$unique_out$v "
904     done
905     reverse unique_out
906     eval $1=\$unique_out
907 }
908
909 resolve(){
910     resolve_out=
911     eval resolve_in=\$$1
912     for v in $resolve_in; do
913         eval 'resolve_out="$resolve_out$'$v' "'
914     done
915     eval $1=\$resolve_out
916 }
917
918 add_cppflags(){
919     append CPPFLAGS "$@"
920 }
921
922 add_cflags(){
923     append CFLAGS $($cflags_filter "$@")
924 }
925
926 add_cflags_headers(){
927     append CFLAGS_HEADERS $($cflags_filter "$@")
928 }
929
930 add_cxxflags(){
931     append CXXFLAGS $($cflags_filter "$@")
932 }
933
934 add_objcflags(){
935     append OBJCFLAGS $($objcflags_filter "$@")
936 }
937
938 add_asflags(){
939     append ASFLAGS $($asflags_filter "$@")
940 }
941
942 add_ldflags(){
943     append LDFLAGS $($ldflags_filter "$@")
944 }
945
946 add_ldexeflags(){
947     append LDEXEFLAGS $($ldflags_filter "$@")
948 }
949
950 add_ldsoflags(){
951     append LDSOFLAGS $($ldflags_filter "$@")
952 }
953
954 add_extralibs(){
955     prepend extralibs $($ldflags_filter "$@")
956 }
957
958 add_stripflags(){
959     append ASMSTRIPFLAGS "$@"
960 }
961
962 add_host_cppflags(){
963     append host_cppflags "$@"
964 }
965
966 add_host_cflags(){
967     append host_cflags $($host_cflags_filter "$@")
968 }
969
970 add_host_ldflags(){
971     append host_ldflags $($host_ldflags_filter "$@")
972 }
973
974 add_compat(){
975     append compat_objs $1
976     shift
977     map 'add_cppflags -D$v' "$@"
978 }
979
980 test_cmd(){
981     log "$@"
982     "$@" >> $logfile 2>&1
983 }
984
985 test_stat(){
986     log test_stat "$@"
987     stat "$1" >> $logfile 2>&1
988 }
989
990 cc_e(){
991     eval printf '%s\\n' $CC_E
992 }
993
994 cc_o(){
995     eval printf '%s\\n' $CC_O
996 }
997
998 as_o(){
999     eval printf '%s\\n' $AS_O
1000 }
1001
1002 x86asm_o(){
1003     eval printf '%s\\n' $X86ASM_O
1004 }
1005
1006 ld_o(){
1007     eval printf '%s\\n' $LD_O
1008 }
1009
1010 hostcc_e(){
1011     eval printf '%s\\n' $HOSTCC_E
1012 }
1013
1014 hostcc_o(){
1015     eval printf '%s\\n' $HOSTCC_O
1016 }
1017
1018 nvcc_o(){
1019     eval printf '%s\\n' $NVCC_O
1020 }
1021
1022 test_cc(){
1023     log test_cc "$@"
1024     cat > $TMPC
1025     log_file $TMPC
1026     test_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
1027 }
1028
1029 test_cxx(){
1030     log test_cxx "$@"
1031     cat > $TMPCPP
1032     log_file $TMPCPP
1033     test_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
1034 }
1035
1036 test_objcc(){
1037     log test_objcc "$@"
1038     cat > $TMPM
1039     log_file $TMPM
1040     test_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM
1041 }
1042
1043 test_nvcc(){
1044     log test_nvcc "$@"
1045     cat > $TMPCU
1046     log_file $TMPCU
1047     tmpcu_=$TMPCU
1048     tmpo_=$TMPO
1049     [ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_)
1050     test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
1051 }
1052
1053 check_nvcc() {
1054     log check_nvcc "$@"
1055     name=$1
1056     shift 1
1057     disabled $name && return
1058     disable $name
1059     test_nvcc "$@" <<EOF && enable $name
1060 extern "C" {
1061     __global__ void hello(unsigned char *data) {}
1062 }
1063 EOF
1064 }
1065
1066 test_cpp(){
1067     log test_cpp "$@"
1068     cat > $TMPC
1069     log_file $TMPC
1070     test_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
1071 }
1072
1073 test_as(){
1074     log test_as "$@"
1075     cat > $TMPS
1076     log_file $TMPS
1077     test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
1078 }
1079
1080 test_x86asm(){
1081     log test_x86asm "$@"
1082     echo "$1" > $TMPASM
1083     log_file $TMPASM
1084     shift
1085     test_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" $(x86asm_o $TMPO) $TMPASM
1086 }
1087
1088 check_cmd(){
1089     log check_cmd "$@"
1090     cmd=$1
1091     disabled $cmd && return
1092     disable $cmd
1093     test_cmd $@ && enable $cmd
1094 }
1095
1096 check_as(){
1097     log check_as "$@"
1098     name=$1
1099     code=$2
1100     shift 2
1101     disable $name
1102     test_as $@ <<EOF && enable $name
1103 $code
1104 EOF
1105 }
1106
1107 check_inline_asm(){
1108     log check_inline_asm "$@"
1109     name="$1"
1110     code="$2"
1111     shift 2
1112     disable $name
1113     test_cc "$@" <<EOF && enable $name
1114 void foo(void){ __asm__ volatile($code); }
1115 EOF
1116 }
1117
1118 check_inline_asm_flags(){
1119     log check_inline_asm_flags "$@"
1120     name="$1"
1121     code="$2"
1122     flags=''
1123     shift 2
1124     while [ "$1" != "" ]; do
1125       append flags $1
1126       shift
1127     done;
1128     disable $name
1129     cat > $TMPC <<EOF
1130 void foo(void){ __asm__ volatile($code); }
1131 EOF
1132     log_file $TMPC
1133     test_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
1134     enable $name && add_cflags $flags && add_asflags $flags && add_ldflags $flags
1135 }
1136
1137 check_insn(){
1138     log check_insn "$@"
1139     check_inline_asm ${1}_inline "\"$2\""
1140     check_as ${1}_external "$2"
1141 }
1142
1143 check_x86asm(){
1144     log check_x86asm "$@"
1145     name=$1
1146     shift
1147     disable $name
1148     test_x86asm "$@" && enable $name
1149 }
1150
1151 test_ld(){
1152     log test_ld "$@"
1153     type=$1
1154     shift 1
1155     flags=$(filter_out '-l*|*.so' $@)
1156     libs=$(filter '-l*|*.so' $@)
1157     test_$type $($cflags_filter $flags) || return
1158     flags=$($ldflags_filter $flags)
1159     libs=$($ldflags_filter $libs)
1160     test_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
1161 }
1162
1163 check_ld(){
1164     log check_ld "$@"
1165     type=$1
1166     name=$2
1167     shift 2
1168     disable $name
1169     test_ld $type $@ && enable $name
1170 }
1171
1172 print_include(){
1173     hdr=$1
1174     test "${hdr%.h}" = "${hdr}" &&
1175         echo "#include $hdr"    ||
1176         echo "#include <$hdr>"
1177 }
1178
1179 test_code(){
1180     log test_code "$@"
1181     check=$1
1182     headers=$2
1183     code=$3
1184     shift 3
1185     {
1186         for hdr in $headers; do
1187             print_include $hdr
1188         done
1189         echo "int main(void) { $code; return 0; }"
1190     } | test_$check "$@"
1191 }
1192
1193 check_cppflags(){
1194     log check_cppflags "$@"
1195     test_cpp "$@" <<EOF && append CPPFLAGS "$@"
1196 #include <stdlib.h>
1197 EOF
1198 }
1199
1200 test_cflags(){
1201     log test_cflags "$@"
1202     set -- $($cflags_filter "$@")
1203     test_cc "$@" <<EOF
1204 int x;
1205 EOF
1206 }
1207
1208 check_cflags(){
1209     log check_cflags "$@"
1210     test_cflags "$@" && add_cflags "$@"
1211 }
1212
1213 check_cxxflags(){
1214     log check_cxxflags "$@"
1215     set -- $($cflags_filter "$@")
1216     test_cxx "$@" <<EOF && append CXXFLAGS "$@"
1217 int x;
1218 EOF
1219 }
1220
1221 test_objcflags(){
1222     log test_objcflags "$@"
1223     set -- $($objcflags_filter "$@")
1224     test_objcc "$@" <<EOF
1225 int x;
1226 EOF
1227 }
1228
1229 check_objcflags(){
1230     log check_objcflags "$@"
1231     test_objcflags "$@" && add_objcflags "$@"
1232 }
1233
1234 test_ldflags(){
1235     log test_ldflags "$@"
1236     set -- $($ldflags_filter "$@")
1237     test_ld "cc" "$@" <<EOF
1238 int main(void){ return 0; }
1239 EOF
1240 }
1241
1242 check_ldflags(){
1243     log check_ldflags "$@"
1244     test_ldflags "$@" && add_ldflags "$@"
1245 }
1246
1247 test_stripflags(){
1248     log test_stripflags "$@"
1249     # call test_cc to get a fresh TMPO
1250     test_cc <<EOF
1251 int main(void) { return 0; }
1252 EOF
1253     test_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
1254 }
1255
1256 check_stripflags(){
1257     log check_stripflags "$@"
1258     test_stripflags "$@" && add_stripflags "$@"
1259 }
1260
1261 check_headers(){
1262     log check_headers "$@"
1263     headers=$1
1264     shift
1265     disable_sanitized $headers
1266     {
1267         for hdr in $headers; do
1268             print_include $hdr
1269         done
1270         echo "int x;"
1271     } | test_cpp "$@" && enable_sanitized $headers
1272 }
1273
1274 check_header_objcc(){
1275     log check_header_objcc "$@"
1276     rm -f -- "$TMPO"
1277     header=$1
1278     shift
1279     disable_sanitized $header
1280     {
1281        echo "#include <$header>"
1282        echo "int main(void) { return 0; }"
1283     } | test_objcc && test_stat "$TMPO" && enable_sanitized $header
1284 }
1285
1286 check_apple_framework(){
1287     log check_apple_framework "$@"
1288     framework="$1"
1289     name="$(tolower $framework)"
1290     header="${framework}/${framework}.h"
1291     disable $name
1292     check_header_objcc $header &&
1293         enable $name && eval ${name}_extralibs='"-framework $framework"'
1294 }
1295
1296 check_func(){
1297     log check_func "$@"
1298     func=$1
1299     shift
1300     disable $func
1301     test_ld "cc" "$@" <<EOF && enable $func
1302 extern int $func();
1303 int main(void){ $func(); }
1304 EOF
1305 }
1306
1307 check_complexfunc(){
1308     log check_complexfunc "$@"
1309     func=$1
1310     narg=$2
1311     shift 2
1312     test $narg = 2 && args="f, g" || args="f * I"
1313     disable $func
1314     test_ld "cc" "$@" <<EOF && enable $func
1315 #include <complex.h>
1316 #include <math.h>
1317 float foo(complex float f, complex float g) { return $func($args); }
1318 int main(void){ return (int) foo; }
1319 EOF
1320 }
1321
1322 check_mathfunc(){
1323     log check_mathfunc "$@"
1324     func=$1
1325     narg=$2
1326     shift 2
1327     test $narg = 2 && args="f, g" || args="f"
1328     disable $func
1329     test_ld "cc" "$@" <<EOF && enable $func
1330 #include <math.h>
1331 float foo(float f, float g) { return $func($args); }
1332 int main(void){ return (int) foo; }
1333 EOF
1334 }
1335
1336 check_func_headers(){
1337     log check_func_headers "$@"
1338     headers=$1
1339     funcs=$2
1340     shift 2
1341     {
1342         for hdr in $headers; do
1343             print_include $hdr
1344         done
1345         echo "#include <stdint.h>"
1346         for func in $funcs; do
1347             echo "long check_$func(void) { return (long) $func; }"
1348         done
1349         echo "int main(void) { int ret = 0;"
1350         # LTO could optimize out the test functions without this
1351         for func in $funcs; do
1352             echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
1353         done
1354         echo "return ret; }"
1355     } | test_ld "cc" "$@" && enable $funcs && enable_sanitized $headers
1356 }
1357
1358 check_class_headers_cpp(){
1359     log check_class_headers_cpp "$@"
1360     headers=$1
1361     classes=$2
1362     shift 2
1363     {
1364         for hdr in $headers; do
1365             echo "#include <$hdr>"
1366         done
1367         echo "int main(void) { "
1368         i=1
1369         for class in $classes; do
1370             echo "$class obj$i;"
1371             i=$(expr $i + 1)
1372         done
1373         echo "return 0; }"
1374     } | test_ld "cxx" "$@" && enable $funcs && enable_sanitized $headers
1375 }
1376
1377 test_cpp_condition(){
1378     log test_cpp_condition "$@"
1379     header=$1
1380     condition=$2
1381     shift 2
1382     test_cpp "$@" <<EOF
1383 #include <$header>
1384 #if !($condition)
1385 #error "unsatisfied condition: $condition"
1386 #endif
1387 EOF
1388 }
1389
1390 check_cpp_condition(){
1391     log check_cpp_condition "$@"
1392     name=$1
1393     shift 1
1394     disable $name
1395     test_cpp_condition "$@" && enable $name
1396 }
1397
1398 test_cflags_cc(){
1399     log test_cflags_cc "$@"
1400     flags=$1
1401     header=$2
1402     condition=$3
1403     shift 3
1404     set -- $($cflags_filter "$flags")
1405     test_cc "$@" <<EOF
1406 #include <$header>
1407 #if !($condition)
1408 #error "unsatisfied condition: $condition"
1409 #endif
1410 EOF
1411 }
1412
1413 check_lib(){
1414     log check_lib "$@"
1415     name="$1"
1416     headers="$2"
1417     funcs="$3"
1418     shift 3
1419     disable $name
1420     check_func_headers "$headers" "$funcs" "$@" &&
1421         enable $name && eval ${name}_extralibs="\$@"
1422 }
1423
1424 check_lib_cpp(){
1425     log check_lib_cpp "$@"
1426     name="$1"
1427     headers="$2"
1428     classes="$3"
1429     shift 3
1430     disable $name
1431     check_class_headers_cpp "$headers" "$classes" "$@" &&
1432         enable $name && eval ${name}_extralibs="\$@"
1433 }
1434
1435 test_pkg_config(){
1436     log test_pkg_config "$@"
1437     name="$1"
1438     pkg_version="$2"
1439     pkg="${2%% *}"
1440     headers="$3"
1441     funcs="$4"
1442     shift 4
1443     disable $name
1444     test_cmd $pkg_config --exists --print-errors $pkg_version || return
1445     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1446     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1447     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1448         enable $name &&
1449         set_sanitized "${name}_cflags"    $pkg_cflags &&
1450         set_sanitized "${name}_extralibs" $pkg_libs
1451 }
1452
1453 test_pkg_config_cpp(){
1454     log test_pkg_config_cpp "$@"
1455     name="$1"
1456     pkg_version="$2"
1457     pkg="${2%% *}"
1458     headers="$3"
1459     cond="$4"
1460     shift 4
1461     disable $name
1462     test_cmd $pkg_config --exists --print-errors $pkg_version || return
1463     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1464     pkg_incdir=$($pkg_config --variable=includedir $pkg_config_flags $pkg)
1465     test_cpp_condition "$pkg_incdir/$headers" "$cond" "$@" &&
1466         enable $name &&
1467         set_sanitized "${name}_cflags" $pkg_cflags
1468 }
1469
1470 check_pkg_config(){
1471     log check_pkg_config "$@"
1472     name="$1"
1473     test_pkg_config "$@" &&
1474         eval add_cflags \$${name}_cflags
1475 }
1476
1477 check_pkg_config_cpp(){
1478     log check_pkg_config_cpp "$@"
1479     name="$1"
1480     test_pkg_config_cpp "$@" &&
1481         eval add_cflags \$${name}_cflags
1482 }
1483
1484 test_exec(){
1485     test_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1486 }
1487
1488 check_exec_crash(){
1489     log check_exec_crash "$@"
1490     code=$(cat)
1491
1492     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
1493     # are safe but may not be available everywhere.  Thus we use
1494     # raise(SIGTERM) instead.  The check is run in a subshell so we
1495     # can redirect the "Terminated" message from the shell.  SIGBUS
1496     # is not defined by standard C so it is used conditionally.
1497
1498     (test_exec "$@") >> $logfile 2>&1 <<EOF
1499 #include <signal.h>
1500 static void sighandler(int sig){
1501     raise(SIGTERM);
1502 }
1503 int foo(void){
1504     $code
1505 }
1506 int (*func_ptr)(void) = foo;
1507 int main(void){
1508     signal(SIGILL, sighandler);
1509     signal(SIGFPE, sighandler);
1510     signal(SIGSEGV, sighandler);
1511 #ifdef SIGBUS
1512     signal(SIGBUS, sighandler);
1513 #endif
1514     return func_ptr();
1515 }
1516 EOF
1517 }
1518
1519 check_type(){
1520     log check_type "$@"
1521     headers=$1
1522     type=$2
1523     shift 2
1524     disable_sanitized "$type"
1525     test_code cc "$headers" "$type v" "$@" && enable_sanitized "$type"
1526 }
1527
1528 check_struct(){
1529     log check_struct "$@"
1530     headers=$1
1531     struct=$2
1532     member=$3
1533     shift 3
1534     disable_sanitized "${struct}_${member}"
1535     test_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1536         enable_sanitized "${struct}_${member}"
1537 }
1538
1539 check_builtin(){
1540     log check_builtin "$@"
1541     name=$1
1542     headers=$2
1543     builtin=$3
1544     shift 3
1545     disable "$name"
1546     test_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
1547 }
1548
1549 check_compile_assert(){
1550     log check_compile_assert "$@"
1551     name=$1
1552     headers=$2
1553     condition=$3
1554     shift 3
1555     disable "$name"
1556     test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1557 }
1558
1559 check_cc(){
1560     log check_cc "$@"
1561     name=$1
1562     shift
1563     disable "$name"
1564     test_code cc "$@" && enable "$name"
1565 }
1566
1567 require(){
1568     log require "$@"
1569     name_version="$1"
1570     name="${1%% *}"
1571     shift
1572     check_lib $name "$@" || die "ERROR: $name_version not found"
1573 }
1574
1575 require_cc(){
1576     log require_cc "$@"
1577     name="$1"
1578     check_cc "$@" || die "ERROR: $name failed"
1579 }
1580
1581 require_cpp(){
1582     log require_cpp "$@"
1583     name_version="$1"
1584     name="${1%% *}"
1585     shift
1586     check_lib_cpp "$name" "$@" || die "ERROR: $name_version not found"
1587 }
1588
1589 require_headers(){
1590     log require_headers "$@"
1591     headers="$1"
1592     check_headers "$@" || die "ERROR: $headers not found"
1593 }
1594
1595 require_cpp_condition(){
1596     log require_cpp_condition "$@"
1597     condition="$3"
1598     check_cpp_condition "$@" || die "ERROR: $condition not satisfied"
1599 }
1600
1601 require_pkg_config(){
1602     log require_pkg_config "$@"
1603     pkg_version="$2"
1604     check_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
1605 }
1606
1607 require_pkg_config_cpp(){
1608     log require_pkg_config_cpp "$@"
1609     pkg_version="$2"
1610     check_pkg_config_cpp "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
1611 }
1612
1613 test_host_cc(){
1614     log test_host_cc "$@"
1615     cat > $TMPC
1616     log_file $TMPC
1617     test_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1618 }
1619
1620 test_host_cpp(){
1621     log test_host_cpp "$@"
1622     cat > $TMPC
1623     log_file $TMPC
1624     test_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1625 }
1626
1627 check_host_cppflags(){
1628     log check_host_cppflags "$@"
1629     test_host_cpp "$@" <<EOF && append host_cppflags "$@"
1630 #include <stdlib.h>
1631 EOF
1632 }
1633
1634 check_host_cflags(){
1635     log check_host_cflags "$@"
1636     set -- $($host_cflags_filter "$@")
1637     test_host_cc "$@" <<EOF && append host_cflags "$@"
1638 int x;
1639 EOF
1640 }
1641
1642 test_host_cpp_condition(){
1643     log test_host_cpp_condition "$@"
1644     header=$1
1645     condition=$2
1646     shift 2
1647     test_host_cpp "$@" <<EOF
1648 #include <$header>
1649 #if !($condition)
1650 #error "unsatisfied condition: $condition"
1651 #endif
1652 EOF
1653 }
1654
1655 check_host_cpp_condition(){
1656     log check_host_cpp_condition "$@"
1657     name=$1
1658     shift 1
1659     disable $name
1660     test_host_cpp_condition "$@" && enable $name
1661 }
1662
1663 cp_if_changed(){
1664     cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
1665     mkdir -p "$(dirname $2)"
1666     cp -f "$1" "$2"
1667 }
1668
1669 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1670 # system-dependent things.
1671
1672 AVCODEC_COMPONENTS="
1673     bsfs
1674     decoders
1675     encoders
1676     hwaccels
1677     parsers
1678 "
1679
1680 AVDEVICE_COMPONENTS="
1681     indevs
1682     outdevs
1683 "
1684
1685 AVFILTER_COMPONENTS="
1686     filters
1687 "
1688
1689 AVFORMAT_COMPONENTS="
1690     demuxers
1691     muxers
1692     protocols
1693 "
1694
1695 COMPONENT_LIST="
1696     $AVCODEC_COMPONENTS
1697     $AVDEVICE_COMPONENTS
1698     $AVFILTER_COMPONENTS
1699     $AVFORMAT_COMPONENTS
1700 "
1701
1702 EXAMPLE_LIST="
1703     avio_list_dir_example
1704     avio_reading_example
1705     decode_audio_example
1706     decode_video_example
1707     demuxing_decoding_example
1708     encode_audio_example
1709     encode_video_example
1710     extract_mvs_example
1711     filter_audio_example
1712     filtering_audio_example
1713     filtering_video_example
1714     http_multiclient_example
1715     hw_decode_example
1716     metadata_example
1717     muxing_example
1718     qsvdec_example
1719     remuxing_example
1720     resampling_audio_example
1721     scaling_video_example
1722     transcode_aac_example
1723     transcoding_example
1724     vaapi_encode_example
1725     vaapi_transcode_example
1726 "
1727
1728 EXTERNAL_AUTODETECT_LIBRARY_LIST="
1729     alsa
1730     appkit
1731     avfoundation
1732     bzlib
1733     coreimage
1734     iconv
1735     libxcb
1736     libxcb_shm
1737     libxcb_shape
1738     libxcb_xfixes
1739     lzma
1740     mediafoundation
1741     schannel
1742     sdl2
1743     securetransport
1744     sndio
1745     xlib
1746     zlib
1747 "
1748
1749 EXTERNAL_LIBRARY_GPL_LIST="
1750     avisynth
1751     frei0r
1752     libcdio
1753     libdavs2
1754     librubberband
1755     libvidstab
1756     libx264
1757     libx265
1758     libxavs
1759     libxavs2
1760     libxvid
1761 "
1762
1763 EXTERNAL_LIBRARY_NONFREE_LIST="
1764     decklink
1765     libfdk_aac
1766     openssl
1767     libtls
1768 "
1769
1770 EXTERNAL_LIBRARY_VERSION3_LIST="
1771     gmp
1772     libaribb24
1773     liblensfun
1774     libopencore_amrnb
1775     libopencore_amrwb
1776     libvo_amrwbenc
1777     mbedtls
1778     rkmpp
1779 "
1780
1781 EXTERNAL_LIBRARY_GPLV3_LIST="
1782     libsmbclient
1783 "
1784
1785 EXTERNAL_LIBRARY_LIST="
1786     $EXTERNAL_LIBRARY_GPL_LIST
1787     $EXTERNAL_LIBRARY_NONFREE_LIST
1788     $EXTERNAL_LIBRARY_VERSION3_LIST
1789     $EXTERNAL_LIBRARY_GPLV3_LIST
1790     chromaprint
1791     gcrypt
1792     gnutls
1793     jni
1794     ladspa
1795     libaom
1796     libass
1797     libbluray
1798     libbs2b
1799     libcaca
1800     libcelt
1801     libcodec2
1802     libdav1d
1803     libdc1394
1804     libdrm
1805     libflite
1806     libfontconfig
1807     libfreetype
1808     libfribidi
1809     libglslang
1810     libgme
1811     libgsm
1812     libiec61883
1813     libilbc
1814     libjack
1815     libklvanc
1816     libkvazaar
1817     libmodplug
1818     libmp3lame
1819     libmysofa
1820     libopencv
1821     libopenh264
1822     libopenjpeg
1823     libopenmpt
1824     libopenvino
1825     libopus
1826     libpulse
1827     librabbitmq
1828     librav1e
1829     librist
1830     librsvg
1831     librtmp
1832     libshine
1833     libsmbclient
1834     libsnappy
1835     libsoxr
1836     libspeex
1837     libsrt
1838     libssh
1839     libsvtav1
1840     libtensorflow
1841     libtesseract
1842     libtheora
1843     libtwolame
1844     libuavs3d
1845     libv4l2
1846     libvmaf
1847     libvorbis
1848     libvpx
1849     libwebp
1850     libxml2
1851     libzimg
1852     libzmq
1853     libzvbi
1854     lv2
1855     mediacodec
1856     openal
1857     opengl
1858     pocketsphinx
1859     vapoursynth
1860 "
1861
1862 HWACCEL_AUTODETECT_LIBRARY_LIST="
1863     amf
1864     audiotoolbox
1865     crystalhd
1866     cuda
1867     cuda_llvm
1868     cuvid
1869     d3d11va
1870     dxva2
1871     ffnvcodec
1872     nvdec
1873     nvenc
1874     vaapi
1875     vdpau
1876     videotoolbox
1877     v4l2_m2m
1878     xvmc
1879 "
1880
1881 # catchall list of things that require external libs to link
1882 EXTRALIBS_LIST="
1883     cpu_init
1884     cws2fws
1885 "
1886
1887 HWACCEL_LIBRARY_NONFREE_LIST="
1888     cuda_nvcc
1889     cuda_sdk
1890     libnpp
1891 "
1892
1893 HWACCEL_LIBRARY_LIST="
1894     $HWACCEL_LIBRARY_NONFREE_LIST
1895     libmfx
1896     mmal
1897     omx
1898     opencl
1899     vulkan
1900 "
1901
1902 DOCUMENT_LIST="
1903     doc
1904     htmlpages
1905     manpages
1906     podpages
1907     txtpages
1908 "
1909
1910 FEATURE_LIST="
1911     ftrapv
1912     gray
1913     hardcoded_tables
1914     omx_rpi
1915     runtime_cpudetect
1916     safe_bitstream_reader
1917     shared
1918     small
1919     static
1920     swscale_alpha
1921 "
1922
1923 # this list should be kept in linking order
1924 LIBRARY_LIST="
1925     avdevice
1926     avfilter
1927     swscale
1928     postproc
1929     avformat
1930     avcodec
1931     swresample
1932     avutil
1933 "
1934
1935 LICENSE_LIST="
1936     gpl
1937     nonfree
1938     version3
1939 "
1940
1941 PROGRAM_LIST="
1942     ffplay
1943     ffprobe
1944     ffmpeg
1945 "
1946
1947 SUBSYSTEM_LIST="
1948     dct
1949     dwt
1950     error_resilience
1951     faan
1952     fast_unaligned
1953     fft
1954     lsp
1955     lzo
1956     mdct
1957     pixelutils
1958     network
1959     rdft
1960 "
1961
1962 # COMPONENT_LIST needs to come last to ensure correct dependency checking
1963 CONFIG_LIST="
1964     $DOCUMENT_LIST
1965     $EXAMPLE_LIST
1966     $EXTERNAL_LIBRARY_LIST
1967     $EXTERNAL_AUTODETECT_LIBRARY_LIST
1968     $HWACCEL_LIBRARY_LIST
1969     $HWACCEL_AUTODETECT_LIBRARY_LIST
1970     $FEATURE_LIST
1971     $LICENSE_LIST
1972     $LIBRARY_LIST
1973     $PROGRAM_LIST
1974     $SUBSYSTEM_LIST
1975     autodetect
1976     fontconfig
1977     large_tests
1978     linux_perf
1979     memory_poisoning
1980     neon_clobber_test
1981     ossfuzz
1982     pic
1983     thumb
1984     valgrind_backtrace
1985     xmm_clobber_test
1986     $COMPONENT_LIST
1987 "
1988
1989 THREADS_LIST="
1990     pthreads
1991     os2threads
1992     w32threads
1993 "
1994
1995 ATOMICS_LIST="
1996     atomics_gcc
1997     atomics_suncc
1998     atomics_win32
1999 "
2000
2001 AUTODETECT_LIBS="
2002     $EXTERNAL_AUTODETECT_LIBRARY_LIST
2003     $HWACCEL_AUTODETECT_LIBRARY_LIST
2004     $THREADS_LIST
2005 "
2006
2007 ARCH_LIST="
2008     aarch64
2009     alpha
2010     arm
2011     avr32
2012     avr32_ap
2013     avr32_uc
2014     bfin
2015     ia64
2016     m68k
2017     mips
2018     mips64
2019     parisc
2020     ppc
2021     ppc64
2022     s390
2023     sh4
2024     sparc
2025     sparc64
2026     tilegx
2027     tilepro
2028     tomi
2029     x86
2030     x86_32
2031     x86_64
2032 "
2033
2034 ARCH_EXT_LIST_ARM="
2035     armv5te
2036     armv6
2037     armv6t2
2038     armv8
2039     neon
2040     vfp
2041     vfpv3
2042     setend
2043 "
2044
2045 ARCH_EXT_LIST_MIPS="
2046     mipsfpu
2047     mips32r2
2048     mips32r5
2049     mips64r2
2050     mips32r6
2051     mips64r6
2052     mipsdsp
2053     mipsdspr2
2054     msa
2055 "
2056
2057 ARCH_EXT_LIST_LOONGSON="
2058     loongson2
2059     loongson3
2060     mmi
2061 "
2062
2063 ARCH_EXT_LIST_X86_SIMD="
2064     aesni
2065     amd3dnow
2066     amd3dnowext
2067     avx
2068     avx2
2069     avx512
2070     fma3
2071     fma4
2072     mmx
2073     mmxext
2074     sse
2075     sse2
2076     sse3
2077     sse4
2078     sse42
2079     ssse3
2080     xop
2081 "
2082
2083 ARCH_EXT_LIST_PPC="
2084     altivec
2085     dcbzl
2086     ldbrx
2087     power8
2088     ppc4xx
2089     vsx
2090 "
2091
2092 ARCH_EXT_LIST_X86="
2093     $ARCH_EXT_LIST_X86_SIMD
2094     cpunop
2095     i686
2096 "
2097
2098 ARCH_EXT_LIST="
2099     $ARCH_EXT_LIST_ARM
2100     $ARCH_EXT_LIST_PPC
2101     $ARCH_EXT_LIST_X86
2102     $ARCH_EXT_LIST_MIPS
2103     $ARCH_EXT_LIST_LOONGSON
2104 "
2105
2106 ARCH_FEATURES="
2107     aligned_stack
2108     fast_64bit
2109     fast_clz
2110     fast_cmov
2111     local_aligned
2112     simd_align_16
2113     simd_align_32
2114     simd_align_64
2115 "
2116
2117 BUILTIN_LIST="
2118     atomic_cas_ptr
2119     machine_rw_barrier
2120     MemoryBarrier
2121     mm_empty
2122     rdtsc
2123     sem_timedwait
2124     sync_val_compare_and_swap
2125 "
2126 HAVE_LIST_CMDLINE="
2127     inline_asm
2128     symver
2129     x86asm
2130 "
2131
2132 HAVE_LIST_PUB="
2133     bigendian
2134     fast_unaligned
2135 "
2136
2137 HEADERS_LIST="
2138     arpa_inet_h
2139     asm_types_h
2140     cdio_paranoia_h
2141     cdio_paranoia_paranoia_h
2142     cuda_h
2143     dispatch_dispatch_h
2144     dev_bktr_ioctl_bt848_h
2145     dev_bktr_ioctl_meteor_h
2146     dev_ic_bt8xx_h
2147     dev_video_bktr_ioctl_bt848_h
2148     dev_video_meteor_ioctl_meteor_h
2149     direct_h
2150     dirent_h
2151     dxgidebug_h
2152     dxva_h
2153     ES2_gl_h
2154     gsm_h
2155     io_h
2156     linux_dma_buf_h
2157     linux_perf_event_h
2158     machine_ioctl_bt848_h
2159     machine_ioctl_meteor_h
2160     malloc_h
2161     opencv2_core_core_c_h
2162     OpenGL_gl3_h
2163     poll_h
2164     sys_param_h
2165     sys_resource_h
2166     sys_select_h
2167     sys_soundcard_h
2168     sys_time_h
2169     sys_un_h
2170     sys_videoio_h
2171     termios_h
2172     udplite_h
2173     unistd_h
2174     valgrind_valgrind_h
2175     windows_h
2176     winsock2_h
2177 "
2178
2179 INTRINSICS_LIST="
2180     intrinsics_neon
2181 "
2182
2183 COMPLEX_FUNCS="
2184     cabs
2185     cexp
2186 "
2187
2188 MATH_FUNCS="
2189     atanf
2190     atan2f
2191     cbrt
2192     cbrtf
2193     copysign
2194     cosf
2195     erf
2196     exp2
2197     exp2f
2198     expf
2199     hypot
2200     isfinite
2201     isinf
2202     isnan
2203     ldexpf
2204     llrint
2205     llrintf
2206     log2
2207     log2f
2208     log10f
2209     lrint
2210     lrintf
2211     powf
2212     rint
2213     round
2214     roundf
2215     sinf
2216     trunc
2217     truncf
2218 "
2219
2220 SYSTEM_FEATURES="
2221     dos_paths
2222     libc_msvcrt
2223     MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
2224     section_data_rel_ro
2225     threads
2226     uwp
2227     winrt
2228 "
2229
2230 SYSTEM_FUNCS="
2231     access
2232     aligned_malloc
2233     arc4random
2234     clock_gettime
2235     closesocket
2236     CommandLineToArgvW
2237     fcntl
2238     getaddrinfo
2239     gethrtime
2240     getopt
2241     GetModuleHandle
2242     GetProcessAffinityMask
2243     GetProcessMemoryInfo
2244     GetProcessTimes
2245     getrusage
2246     GetStdHandle
2247     GetSystemTimeAsFileTime
2248     gettimeofday
2249     glob
2250     glXGetProcAddress
2251     gmtime_r
2252     inet_aton
2253     isatty
2254     kbhit
2255     localtime_r
2256     lstat
2257     lzo1x_999_compress
2258     mach_absolute_time
2259     MapViewOfFile
2260     memalign
2261     mkstemp
2262     mmap
2263     mprotect
2264     nanosleep
2265     PeekNamedPipe
2266     posix_memalign
2267     pthread_cancel
2268     sched_getaffinity
2269     SecItemImport
2270     SetConsoleTextAttribute
2271     SetConsoleCtrlHandler
2272     SetDllDirectory
2273     setmode
2274     setrlimit
2275     Sleep
2276     strerror_r
2277     sysconf
2278     sysctl
2279     usleep
2280     UTGetOSTypeFromString
2281     VirtualAlloc
2282     wglGetProcAddress
2283 "
2284
2285 SYSTEM_LIBRARIES="
2286     bcrypt
2287     vaapi_drm
2288     vaapi_x11
2289     vdpau_x11
2290 "
2291
2292 TOOLCHAIN_FEATURES="
2293     as_arch_directive
2294     as_dn_directive
2295     as_fpu_directive
2296     as_func
2297     as_object_arch
2298     asm_mod_q
2299     blocks_extension
2300     ebp_available
2301     ebx_available
2302     gnu_as
2303     gnu_windres
2304     ibm_asm
2305     inline_asm_direct_symbol_refs
2306     inline_asm_labels
2307     inline_asm_nonlocal_labels
2308     pragma_deprecated
2309     rsync_contimeout
2310     symver_asm_label
2311     symver_gnu_asm
2312     vfp_args
2313     xform_asm
2314     xmm_clobbers
2315 "
2316
2317 TYPES_LIST="
2318     kCMVideoCodecType_HEVC
2319     kCMVideoCodecType_HEVCWithAlpha
2320     kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
2321     kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
2322     kCVImageBufferTransferFunction_ITU_R_2100_HLG
2323     kCVImageBufferTransferFunction_Linear
2324     socklen_t
2325     struct_addrinfo
2326     struct_group_source_req
2327     struct_ip_mreq_source
2328     struct_ipv6_mreq
2329     struct_msghdr_msg_flags
2330     struct_pollfd
2331     struct_rusage_ru_maxrss
2332     struct_sctp_event_subscribe
2333     struct_sockaddr_in6
2334     struct_sockaddr_sa_len
2335     struct_sockaddr_storage
2336     struct_stat_st_mtim_tv_nsec
2337     struct_v4l2_frmivalenum_discrete
2338 "
2339
2340 HAVE_LIST="
2341     $ARCH_EXT_LIST
2342     $(add_suffix _external $ARCH_EXT_LIST)
2343     $(add_suffix _inline   $ARCH_EXT_LIST)
2344     $ARCH_FEATURES
2345     $BUILTIN_LIST
2346     $COMPLEX_FUNCS
2347     $HAVE_LIST_CMDLINE
2348     $HAVE_LIST_PUB
2349     $HEADERS_LIST
2350     $INTRINSICS_LIST
2351     $MATH_FUNCS
2352     $SYSTEM_FEATURES
2353     $SYSTEM_FUNCS
2354     $SYSTEM_LIBRARIES
2355     $THREADS_LIST
2356     $TOOLCHAIN_FEATURES
2357     $TYPES_LIST
2358     libdrm_getfb2
2359     makeinfo
2360     makeinfo_html
2361     opencl_d3d11
2362     opencl_drm_arm
2363     opencl_drm_beignet
2364     opencl_dxva2
2365     opencl_vaapi_beignet
2366     opencl_vaapi_intel_media
2367     perl
2368     pod2man
2369     texi2html
2370 "
2371
2372 # options emitted with CONFIG_ prefix but not available on the command line
2373 CONFIG_EXTRA="
2374     aandcttables
2375     ac3dsp
2376     adts_header
2377     atsc_a53
2378     audio_frame_queue
2379     audiodsp
2380     blockdsp
2381     bswapdsp
2382     cabac
2383     cbs
2384     cbs_av1
2385     cbs_h264
2386     cbs_h265
2387     cbs_jpeg
2388     cbs_mpeg2
2389     cbs_vp9
2390     dirac_parse
2391     dnn
2392     dvprofile
2393     exif
2394     faandct
2395     faanidct
2396     fdctdsp
2397     flacdsp
2398     fmtconvert
2399     frame_thread_encoder
2400     g722dsp
2401     golomb
2402     gplv3
2403     h263dsp
2404     h264chroma
2405     h264dsp
2406     h264parse
2407     h264pred
2408     h264qpel
2409     hevcparse
2410     hpeldsp
2411     huffman
2412     huffyuvdsp
2413     huffyuvencdsp
2414     idctdsp
2415     iirfilter
2416     mdct15
2417     intrax8
2418     iso_media
2419     ividsp
2420     jpegtables
2421     lgplv3
2422     libx262
2423     llauddsp
2424     llviddsp
2425     llvidencdsp
2426     lpc
2427     lzf
2428     me_cmp
2429     mpeg_er
2430     mpegaudio
2431     mpegaudiodsp
2432     mpegaudioheader
2433     mpegvideo
2434     mpegvideoenc
2435     mss34dsp
2436     pixblockdsp
2437     qpeldsp
2438     qsv
2439     qsvdec
2440     qsvenc
2441     qsvvpp
2442     rangecoder
2443     riffdec
2444     riffenc
2445     rtpdec
2446     rtpenc_chain
2447     rv34dsp
2448     scene_sad
2449     sinewin
2450     snappy
2451     srtp
2452     startcode
2453     texturedsp
2454     texturedspenc
2455     tpeldsp
2456     vaapi_1
2457     vaapi_encode
2458     vc1dsp
2459     videodsp
2460     vp3dsp
2461     vp56dsp
2462     vp8dsp
2463     wma_freqs
2464     wmv2dsp
2465 "
2466
2467 CMDLINE_SELECT="
2468     $ARCH_EXT_LIST
2469     $CONFIG_LIST
2470     $HAVE_LIST_CMDLINE
2471     $THREADS_LIST
2472     asm
2473     cross_compile
2474     debug
2475     extra_warnings
2476     logging
2477     lto
2478     optimizations
2479     rpath
2480     stripping
2481 "
2482
2483 PATHS_LIST="
2484     bindir
2485     datadir
2486     docdir
2487     incdir
2488     libdir
2489     mandir
2490     pkgconfigdir
2491     prefix
2492     shlibdir
2493     install_name_dir
2494 "
2495
2496 CMDLINE_SET="
2497     $PATHS_LIST
2498     ar
2499     arch
2500     as
2501     assert_level
2502     build_suffix
2503     cc
2504     objcc
2505     cpu
2506     cross_prefix
2507     custom_allocator
2508     cxx
2509     dep_cc
2510     doxygen
2511     env
2512     extra_version
2513     gas
2514     host_cc
2515     host_cflags
2516     host_extralibs
2517     host_ld
2518     host_ldflags
2519     host_os
2520     ignore_tests
2521     install
2522     ld
2523     ln_s
2524     logfile
2525     malloc_prefix
2526     nm
2527     optflags
2528     nvcc
2529     nvccflags
2530     pkg_config
2531     pkg_config_flags
2532     progs_suffix
2533     random_seed
2534     ranlib
2535     samples
2536     strip
2537     sws_max_filter_size
2538     sysinclude
2539     sysroot
2540     target_exec
2541     target_os
2542     target_path
2543     target_samples
2544     tempprefix
2545     toolchain
2546     valgrind
2547     windres
2548     x86asmexe
2549 "
2550
2551 CMDLINE_APPEND="
2552     extra_cflags
2553     extra_cxxflags
2554     extra_objcflags
2555     host_cppflags
2556 "
2557
2558 # code dependency declarations
2559
2560 # architecture extensions
2561
2562 armv5te_deps="arm"
2563 armv6_deps="arm"
2564 armv6t2_deps="arm"
2565 armv8_deps="aarch64"
2566 neon_deps_any="aarch64 arm"
2567 intrinsics_neon_deps="neon"
2568 vfp_deps_any="aarch64 arm"
2569 vfpv3_deps="vfp"
2570 setend_deps="arm"
2571
2572 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
2573
2574 altivec_deps="ppc"
2575 dcbzl_deps="ppc"
2576 ldbrx_deps="ppc"
2577 ppc4xx_deps="ppc"
2578 vsx_deps="altivec"
2579 power8_deps="vsx"
2580
2581 loongson2_deps="mips"
2582 loongson3_deps="mips"
2583 mips32r2_deps="mips"
2584 mips32r5_deps="mips"
2585 mips32r6_deps="mips"
2586 mips64r2_deps="mips"
2587 mips64r6_deps="mips"
2588 mipsfpu_deps="mips"
2589 mipsdsp_deps="mips"
2590 mipsdspr2_deps="mips"
2591 mmi_deps_any="loongson2 loongson3"
2592 msa_deps="mipsfpu"
2593
2594 cpunop_deps="i686"
2595 x86_64_select="i686"
2596 x86_64_suggest="fast_cmov"
2597
2598 amd3dnow_deps="mmx"
2599 amd3dnowext_deps="amd3dnow"
2600 i686_deps="x86"
2601 mmx_deps="x86"
2602 mmxext_deps="mmx"
2603 sse_deps="mmxext"
2604 sse2_deps="sse"
2605 sse3_deps="sse2"
2606 ssse3_deps="sse3"
2607 sse4_deps="ssse3"
2608 sse42_deps="sse4"
2609 aesni_deps="sse42"
2610 avx_deps="sse42"
2611 xop_deps="avx"
2612 fma3_deps="avx"
2613 fma4_deps="avx"
2614 avx2_deps="avx"
2615 avx512_deps="avx2"
2616
2617 mmx_external_deps="x86asm"
2618 mmx_inline_deps="inline_asm x86"
2619 mmx_suggest="mmx_external mmx_inline"
2620
2621 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
2622     eval dep=\$${ext}_deps
2623     eval ${ext}_external_deps='"${dep}_external"'
2624     eval ${ext}_inline_deps='"${dep}_inline"'
2625     eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
2626 done
2627
2628 aligned_stack_if_any="aarch64 ppc x86"
2629 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
2630 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
2631 fast_unaligned_if_any="aarch64 ppc x86"
2632 simd_align_16_if_any="altivec neon sse"
2633 simd_align_32_if_any="avx"
2634 simd_align_64_if_any="avx512"
2635
2636 # system capabilities
2637 linux_perf_deps="linux_perf_event_h"
2638 symver_if_any="symver_asm_label symver_gnu_asm"
2639 valgrind_backtrace_conflict="optimizations"
2640 valgrind_backtrace_deps="valgrind_valgrind_h"
2641
2642 # threading support
2643 atomics_gcc_if="sync_val_compare_and_swap"
2644 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
2645 atomics_win32_if="MemoryBarrier"
2646 atomics_native_if_any="$ATOMICS_LIST"
2647 w32threads_deps="atomics_native"
2648 threads_if_any="$THREADS_LIST"
2649
2650 # subsystems
2651 cbs_av1_select="cbs"
2652 cbs_h264_select="cbs"
2653 cbs_h265_select="cbs"
2654 cbs_jpeg_select="cbs"
2655 cbs_mpeg2_select="cbs"
2656 cbs_vp9_select="cbs"
2657 dct_select="rdft"
2658 dirac_parse_select="golomb"
2659 dnn_suggest="libtensorflow libopenvino"
2660 dnn_deps="avformat swscale"
2661 error_resilience_select="me_cmp"
2662 faandct_deps="faan"
2663 faandct_select="fdctdsp"
2664 faanidct_deps="faan"
2665 faanidct_select="idctdsp"
2666 h264dsp_select="startcode"
2667 hevcparse_select="atsc_a53 golomb"
2668 frame_thread_encoder_deps="encoders threads"
2669 intrax8_select="blockdsp idctdsp"
2670 mdct_select="fft"
2671 mdct15_select="fft"
2672 me_cmp_select="fdctdsp idctdsp pixblockdsp"
2673 mpeg_er_select="error_resilience"
2674 mpegaudio_select="mpegaudiodsp mpegaudioheader"
2675 mpegaudiodsp_select="dct"
2676 mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
2677 mpegvideoenc_select="aandcttables me_cmp mpegvideo pixblockdsp qpeldsp"
2678 vc1dsp_select="h264chroma qpeldsp startcode"
2679 rdft_select="fft"
2680
2681 # decoders / encoders
2682 aac_decoder_select="adts_header mdct15 mdct sinewin"
2683 aac_fixed_decoder_select="adts_header mdct"
2684 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
2685 aac_latm_decoder_select="aac_decoder aac_latm_parser"
2686 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2687 ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
2688 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
2689 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
2690 acelp_kelvin_decoder_select="audiodsp"
2691 adpcm_g722_decoder_select="g722dsp"
2692 adpcm_g722_encoder_select="g722dsp"
2693 aic_decoder_select="golomb idctdsp"
2694 alac_encoder_select="lpc"
2695 als_decoder_select="bswapdsp"
2696 amrnb_decoder_select="lsp"
2697 amrwb_decoder_select="lsp"
2698 amv_decoder_select="sp5x_decoder exif"
2699 amv_encoder_select="jpegtables mpegvideoenc"
2700 ape_decoder_select="bswapdsp llauddsp"
2701 apng_decoder_deps="zlib"
2702 apng_encoder_deps="zlib"
2703 apng_encoder_select="llvidencdsp"
2704 aptx_decoder_select="audio_frame_queue"
2705 aptx_encoder_select="audio_frame_queue"
2706 aptx_hd_decoder_select="audio_frame_queue"
2707 aptx_hd_encoder_select="audio_frame_queue"
2708 asv1_decoder_select="blockdsp bswapdsp idctdsp"
2709 asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
2710 asv2_decoder_select="blockdsp bswapdsp idctdsp"
2711 asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
2712 atrac1_decoder_select="mdct sinewin"
2713 atrac3_decoder_select="mdct"
2714 atrac3al_decoder_select="mdct"
2715 atrac3p_decoder_select="mdct sinewin"
2716 atrac3pal_decoder_select="mdct sinewin"
2717 atrac9_decoder_select="mdct"
2718 av1_decoder_select="cbs_av1"
2719 bink_decoder_select="blockdsp hpeldsp"
2720 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
2721 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
2722 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
2723 clearvideo_decoder_select="idctdsp"
2724 cllc_decoder_select="bswapdsp"
2725 comfortnoise_encoder_select="lpc"
2726 cook_decoder_select="audiodsp mdct sinewin"
2727 cscd_decoder_select="lzo"
2728 cscd_decoder_suggest="zlib"
2729 dca_decoder_select="mdct"
2730 dca_encoder_select="mdct"
2731 dds_decoder_select="texturedsp"
2732 dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
2733 dnxhd_decoder_select="blockdsp idctdsp"
2734 dnxhd_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
2735 dolby_e_decoder_select="mdct"
2736 dvvideo_decoder_select="dvprofile idctdsp"
2737 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
2738 dxa_decoder_deps="zlib"
2739 dxv_decoder_select="lzf texturedsp"
2740 eac3_decoder_select="ac3_decoder"
2741 eac3_encoder_select="ac3_encoder"
2742 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
2743 eatgq_decoder_select="aandcttables"
2744 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
2745 exr_decoder_deps="zlib"
2746 exr_encoder_deps="zlib"
2747 ffv1_decoder_select="rangecoder"
2748 ffv1_encoder_select="rangecoder"
2749 ffvhuff_decoder_select="huffyuv_decoder"
2750 ffvhuff_encoder_select="huffyuv_encoder"
2751 fic_decoder_select="golomb"
2752 flac_decoder_select="flacdsp"
2753 flac_encoder_select="bswapdsp flacdsp lpc"
2754 flashsv2_decoder_deps="zlib"
2755 flashsv2_encoder_deps="zlib"
2756 flashsv_decoder_deps="zlib"
2757 flashsv_encoder_deps="zlib"
2758 flv_decoder_select="h263_decoder"
2759 flv_encoder_select="h263_encoder"
2760 fourxm_decoder_select="blockdsp bswapdsp"
2761 fraps_decoder_select="bswapdsp huffman"
2762 g2m_decoder_deps="zlib"
2763 g2m_decoder_select="blockdsp idctdsp jpegtables"
2764 g729_decoder_select="audiodsp"
2765 h261_decoder_select="mpegvideo"
2766 h261_encoder_select="mpegvideoenc"
2767 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
2768 h263_encoder_select="h263dsp mpegvideoenc"
2769 h263i_decoder_select="h263_decoder"
2770 h263p_decoder_select="h263_decoder"
2771 h263p_encoder_select="h263_encoder"
2772 h264_decoder_select="atsc_a53 cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
2773 h264_decoder_suggest="error_resilience"
2774 hap_decoder_select="snappy texturedsp"
2775 hap_encoder_deps="libsnappy"
2776 hap_encoder_select="texturedspenc"
2777 hevc_decoder_select="atsc_a53 bswapdsp cabac golomb hevcparse videodsp"
2778 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
2779 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
2780 hymt_decoder_select="huffyuv_decoder"
2781 iac_decoder_select="imc_decoder"
2782 imc_decoder_select="bswapdsp fft mdct sinewin"
2783 imm4_decoder_select="bswapdsp"
2784 imm5_decoder_select="h264_decoder hevc_decoder"
2785 indeo3_decoder_select="hpeldsp"
2786 indeo4_decoder_select="ividsp"
2787 indeo5_decoder_select="ividsp"
2788 interplay_video_decoder_select="hpeldsp"
2789 jpegls_decoder_select="mjpeg_decoder"
2790 jv_decoder_select="blockdsp"
2791 lagarith_decoder_select="llviddsp"
2792 ljpeg_encoder_select="idctdsp jpegtables"
2793 lscr_decoder_deps="zlib"
2794 magicyuv_decoder_select="llviddsp"
2795 magicyuv_encoder_select="llvidencdsp"
2796 mdec_decoder_select="blockdsp bswapdsp idctdsp mpegvideo"
2797 metasound_decoder_select="lsp mdct sinewin"
2798 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
2799 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
2800 mjpeg_encoder_select="jpegtables mpegvideoenc"
2801 mjpegb_decoder_select="mjpeg_decoder"
2802 mlp_decoder_select="mlp_parser"
2803 mlp_encoder_select="lpc audio_frame_queue"
2804 mobiclip_decoder_select="bswapdsp golomb"
2805 motionpixels_decoder_select="bswapdsp"
2806 mp1_decoder_select="mpegaudio"
2807 mp1float_decoder_select="mpegaudio"
2808 mp2_decoder_select="mpegaudio"
2809 mp2float_decoder_select="mpegaudio"
2810 mp3_decoder_select="mpegaudio"
2811 mp3adu_decoder_select="mpegaudio"
2812 mp3adufloat_decoder_select="mpegaudio"
2813 mp3float_decoder_select="mpegaudio"
2814 mp3on4_decoder_select="mpegaudio"
2815 mp3on4float_decoder_select="mpegaudio"
2816 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2817 mpc8_decoder_select="mpegaudiodsp"
2818 mpegvideo_decoder_select="mpegvideo"
2819 mpeg1video_decoder_select="mpegvideo"
2820 mpeg1video_encoder_select="mpegvideoenc h263dsp"
2821 mpeg2video_decoder_select="mpegvideo"
2822 mpeg2video_encoder_select="mpegvideoenc h263dsp"
2823 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2824 mpeg4_encoder_select="h263_encoder"
2825 msa1_decoder_select="mss34dsp"
2826 mscc_decoder_deps="zlib"
2827 msmpeg4v1_decoder_select="h263_decoder"
2828 msmpeg4v2_decoder_select="h263_decoder"
2829 msmpeg4v2_encoder_select="h263_encoder"
2830 msmpeg4v3_decoder_select="h263_decoder"
2831 msmpeg4v3_encoder_select="h263_encoder"
2832 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
2833 mts2_decoder_select="jpegtables mss34dsp"
2834 mv30_decoder_select="aandcttables blockdsp"
2835 mvha_decoder_deps="zlib"
2836 mvha_decoder_select="llviddsp"
2837 mwsc_decoder_deps="zlib"
2838 mxpeg_decoder_select="mjpeg_decoder"
2839 nellymoser_decoder_select="mdct sinewin"
2840 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2841 notchlc_decoder_select="lzf"
2842 nuv_decoder_select="idctdsp lzo"
2843 on2avc_decoder_select="mdct"
2844 opus_decoder_deps="swresample"
2845 opus_decoder_select="mdct15"
2846 opus_encoder_select="audio_frame_queue mdct15"
2847 png_decoder_deps="zlib"
2848 png_encoder_deps="zlib"
2849 png_encoder_select="llvidencdsp"
2850 prores_decoder_select="blockdsp idctdsp"
2851 prores_encoder_select="fdctdsp"
2852 qcelp_decoder_select="lsp"
2853 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2854 ra_144_decoder_select="audiodsp"
2855 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
2856 ralf_decoder_select="golomb"
2857 rasc_decoder_deps="zlib"
2858 rawvideo_decoder_select="bswapdsp"
2859 rscc_decoder_deps="zlib"
2860 rtjpeg_decoder_select="me_cmp"
2861 rv10_decoder_select="h263_decoder"
2862 rv10_encoder_select="h263_encoder"
2863 rv20_decoder_select="h263_decoder"
2864 rv20_encoder_select="h263_encoder"
2865 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2866 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2867 screenpresso_decoder_deps="zlib"
2868 shorten_decoder_select="bswapdsp"
2869 sipr_decoder_select="lsp"
2870 smvjpeg_decoder_select="mjpeg_decoder"
2871 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
2872 snow_encoder_select="dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
2873 sonic_decoder_select="golomb rangecoder"
2874 sonic_encoder_select="golomb rangecoder"
2875 sonic_ls_encoder_select="golomb rangecoder"
2876 sp5x_decoder_select="mjpeg_decoder"
2877 speedhq_decoder_select="mpegvideo"
2878 speedhq_encoder_select="mpegvideoenc"
2879 srgc_decoder_deps="zlib"
2880 svq1_decoder_select="hpeldsp"
2881 svq1_encoder_select="hpeldsp me_cmp mpegvideoenc"
2882 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
2883 svq3_decoder_suggest="zlib"
2884 tak_decoder_select="audiodsp"
2885 tdsc_decoder_deps="zlib"
2886 tdsc_decoder_select="mjpeg_decoder"
2887 theora_decoder_select="vp3_decoder"
2888 thp_decoder_select="mjpeg_decoder"
2889 tiff_decoder_select="mjpeg_decoder"
2890 tiff_decoder_suggest="zlib lzma"
2891 tiff_encoder_suggest="zlib"
2892 truehd_decoder_select="mlp_parser"
2893 truehd_encoder_select="lpc audio_frame_queue"
2894 truemotion2_decoder_select="bswapdsp"
2895 truespeech_decoder_select="bswapdsp"
2896 tscc_decoder_deps="zlib"
2897 twinvq_decoder_select="mdct lsp sinewin"
2898 txd_decoder_select="texturedsp"
2899 utvideo_decoder_select="bswapdsp llviddsp"
2900 utvideo_encoder_select="bswapdsp huffman llvidencdsp"
2901 vble_decoder_select="llviddsp"
2902 vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
2903 vc1image_decoder_select="vc1_decoder"
2904 vorbis_decoder_select="mdct"
2905 vorbis_encoder_select="audio_frame_queue mdct"
2906 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2907 vp4_decoder_select="vp3_decoder"
2908 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2909 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2910 vp6a_decoder_select="vp6_decoder"
2911 vp6f_decoder_select="vp6_decoder"
2912 vp7_decoder_select="h264pred videodsp vp8dsp"
2913 vp8_decoder_select="h264pred videodsp vp8dsp"
2914 vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
2915 wcmv_decoder_deps="zlib"
2916 webp_decoder_select="vp8_decoder exif"
2917 wmalossless_decoder_select="llauddsp"
2918 wmapro_decoder_select="mdct sinewin wma_freqs"
2919 wmav1_decoder_select="mdct sinewin wma_freqs"
2920 wmav1_encoder_select="mdct sinewin wma_freqs"
2921 wmav2_decoder_select="mdct sinewin wma_freqs"
2922 wmav2_encoder_select="mdct sinewin wma_freqs"
2923 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2924 wmv1_decoder_select="h263_decoder"
2925 wmv1_encoder_select="h263_encoder"
2926 wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2927 wmv2_encoder_select="h263_encoder wmv2dsp"
2928 wmv3_decoder_select="vc1_decoder"
2929 wmv3image_decoder_select="wmv3_decoder"
2930 xma1_decoder_select="wmapro_decoder"
2931 xma2_decoder_select="wmapro_decoder"
2932 ylc_decoder_select="bswapdsp"
2933 zerocodec_decoder_deps="zlib"
2934 zlib_decoder_deps="zlib"
2935 zlib_encoder_deps="zlib"
2936 zmbv_decoder_deps="zlib"
2937 zmbv_encoder_deps="zlib"
2938
2939 # hardware accelerators
2940 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2941 cuda_deps="ffnvcodec"
2942 cuvid_deps="ffnvcodec"
2943 d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
2944 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
2945 ffnvcodec_deps_any="libdl LoadLibrary"
2946 nvdec_deps="ffnvcodec"
2947 vaapi_x11_deps="xlib"
2948 videotoolbox_hwaccel_deps="videotoolbox pthreads"
2949 videotoolbox_hwaccel_extralibs="-framework QuartzCore"
2950 vulkan_deps_any="libdl LoadLibrary"
2951 xvmc_deps="X11_extensions_XvMClib_h"
2952
2953 av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
2954 av1_d3d11va_hwaccel_select="av1_decoder"
2955 av1_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
2956 av1_d3d11va2_hwaccel_select="av1_decoder"
2957 av1_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_AV1"
2958 av1_dxva2_hwaccel_select="av1_decoder"
2959 av1_nvdec_hwaccel_deps="nvdec CUVIDAV1PICPARAMS"
2960 av1_nvdec_hwaccel_select="av1_decoder"
2961 av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx"
2962 av1_vaapi_hwaccel_select="av1_decoder"
2963 h263_vaapi_hwaccel_deps="vaapi"
2964 h263_vaapi_hwaccel_select="h263_decoder"
2965 h263_videotoolbox_hwaccel_deps="videotoolbox"
2966 h263_videotoolbox_hwaccel_select="h263_decoder"
2967 h264_d3d11va_hwaccel_deps="d3d11va"
2968 h264_d3d11va_hwaccel_select="h264_decoder"
2969 h264_d3d11va2_hwaccel_deps="d3d11va"
2970 h264_d3d11va2_hwaccel_select="h264_decoder"
2971 h264_dxva2_hwaccel_deps="dxva2"
2972 h264_dxva2_hwaccel_select="h264_decoder"
2973 h264_nvdec_hwaccel_deps="nvdec"
2974 h264_nvdec_hwaccel_select="h264_decoder"
2975 h264_vaapi_hwaccel_deps="vaapi"
2976 h264_vaapi_hwaccel_select="h264_decoder"
2977 h264_vdpau_hwaccel_deps="vdpau"
2978 h264_vdpau_hwaccel_select="h264_decoder"
2979 h264_videotoolbox_hwaccel_deps="videotoolbox"
2980 h264_videotoolbox_hwaccel_select="h264_decoder"
2981 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2982 hevc_d3d11va_hwaccel_select="hevc_decoder"
2983 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2984 hevc_d3d11va2_hwaccel_select="hevc_decoder"
2985 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2986 hevc_dxva2_hwaccel_select="hevc_decoder"
2987 hevc_nvdec_hwaccel_deps="nvdec"
2988 hevc_nvdec_hwaccel_select="hevc_decoder"
2989 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2990 hevc_vaapi_hwaccel_select="hevc_decoder"
2991 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2992 hevc_vdpau_hwaccel_select="hevc_decoder"
2993 hevc_videotoolbox_hwaccel_deps="videotoolbox"
2994 hevc_videotoolbox_hwaccel_select="hevc_decoder"
2995 mjpeg_nvdec_hwaccel_deps="nvdec"
2996 mjpeg_nvdec_hwaccel_select="mjpeg_decoder"
2997 mjpeg_vaapi_hwaccel_deps="vaapi"
2998 mjpeg_vaapi_hwaccel_select="mjpeg_decoder"
2999 mpeg_xvmc_hwaccel_deps="xvmc"
3000 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
3001 mpeg1_nvdec_hwaccel_deps="nvdec"
3002 mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
3003 mpeg1_vdpau_hwaccel_deps="vdpau"
3004 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
3005 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
3006 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
3007 mpeg1_xvmc_hwaccel_deps="xvmc"
3008 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
3009 mpeg2_d3d11va_hwaccel_deps="d3d11va"
3010 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
3011 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
3012 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
3013 mpeg2_dxva2_hwaccel_deps="dxva2"
3014 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
3015 mpeg2_nvdec_hwaccel_deps="nvdec"
3016 mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
3017 mpeg2_vaapi_hwaccel_deps="vaapi"
3018 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
3019 mpeg2_vdpau_hwaccel_deps="vdpau"
3020 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
3021 mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
3022 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
3023 mpeg2_xvmc_hwaccel_deps="xvmc"
3024 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
3025 mpeg4_nvdec_hwaccel_deps="nvdec"
3026 mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
3027 mpeg4_vaapi_hwaccel_deps="vaapi"
3028 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
3029 mpeg4_vdpau_hwaccel_deps="vdpau"
3030 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
3031 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
3032 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
3033 vc1_d3d11va_hwaccel_deps="d3d11va"
3034 vc1_d3d11va_hwaccel_select="vc1_decoder"
3035 vc1_d3d11va2_hwaccel_deps="d3d11va"
3036 vc1_d3d11va2_hwaccel_select="vc1_decoder"
3037 vc1_dxva2_hwaccel_deps="dxva2"
3038 vc1_dxva2_hwaccel_select="vc1_decoder"
3039 vc1_nvdec_hwaccel_deps="nvdec"
3040 vc1_nvdec_hwaccel_select="vc1_decoder"
3041 vc1_vaapi_hwaccel_deps="vaapi"
3042 vc1_vaapi_hwaccel_select="vc1_decoder"
3043 vc1_vdpau_hwaccel_deps="vdpau"
3044 vc1_vdpau_hwaccel_select="vc1_decoder"
3045 vp8_nvdec_hwaccel_deps="nvdec"
3046 vp8_nvdec_hwaccel_select="vp8_decoder"
3047 vp8_vaapi_hwaccel_deps="vaapi"
3048 vp8_vaapi_hwaccel_select="vp8_decoder"
3049 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
3050 vp9_d3d11va_hwaccel_select="vp9_decoder"
3051 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
3052 vp9_d3d11va2_hwaccel_select="vp9_decoder"
3053 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
3054 vp9_dxva2_hwaccel_select="vp9_decoder"
3055 vp9_nvdec_hwaccel_deps="nvdec"
3056 vp9_nvdec_hwaccel_select="vp9_decoder"
3057 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
3058 vp9_vaapi_hwaccel_select="vp9_decoder"
3059 vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
3060 vp9_vdpau_hwaccel_select="vp9_decoder"
3061 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
3062 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
3063 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
3064 wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
3065 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
3066 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
3067
3068 # hardware-accelerated codecs
3069 mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
3070 mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
3071 omx_deps="libdl pthreads"
3072 omx_rpi_select="omx"
3073 qsv_deps="libmfx"
3074 qsvdec_select="qsv"
3075 qsvenc_select="qsv"
3076 qsvvpp_select="qsv"
3077 vaapi_encode_deps="vaapi"
3078 v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
3079
3080 hwupload_cuda_filter_deps="ffnvcodec"
3081 scale_npp_filter_deps="ffnvcodec libnpp"
3082 scale_cuda_filter_deps="ffnvcodec"
3083 scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
3084 thumbnail_cuda_filter_deps="ffnvcodec"
3085 thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
3086 transpose_npp_filter_deps="ffnvcodec libnpp"
3087 overlay_cuda_filter_deps="ffnvcodec"
3088 overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
3089
3090 amf_deps_any="libdl LoadLibrary"
3091 nvenc_deps="ffnvcodec"
3092 nvenc_deps_any="libdl LoadLibrary"
3093
3094 aac_mf_encoder_deps="mediafoundation"
3095 ac3_mf_encoder_deps="mediafoundation"
3096 av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS"
3097 h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
3098 h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
3099 h264_amf_encoder_deps="amf"
3100 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
3101 h264_cuvid_decoder_deps="cuvid"
3102 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
3103 h264_mediacodec_decoder_deps="mediacodec"
3104 h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
3105 h264_mf_encoder_deps="mediafoundation"
3106 h264_mmal_decoder_deps="mmal"
3107 h264_nvenc_encoder_deps="nvenc"
3108 h264_nvenc_encoder_select="atsc_a53"
3109 h264_omx_encoder_deps="omx"
3110 h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
3111 h264_qsv_encoder_select="atsc_a53 qsvenc"
3112 h264_rkmpp_decoder_deps="rkmpp"
3113 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
3114 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
3115 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
3116 h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
3117 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
3118 hevc_amf_encoder_deps="amf"
3119 hevc_cuvid_decoder_deps="cuvid"
3120 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
3121 hevc_mediacodec_decoder_deps="mediacodec"
3122 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
3123 hevc_mf_encoder_deps="mediafoundation"
3124 hevc_nvenc_encoder_deps="nvenc"
3125 hevc_nvenc_encoder_select="atsc_a53"
3126 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
3127 hevc_qsv_encoder_select="hevcparse qsvenc"
3128 hevc_rkmpp_decoder_deps="rkmpp"
3129 hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
3130 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
3131 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
3132 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
3133 hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
3134 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
3135 mjpeg_cuvid_decoder_deps="cuvid"
3136 mjpeg_qsv_decoder_select="qsvdec"
3137 mjpeg_qsv_encoder_deps="libmfx"
3138 mjpeg_qsv_encoder_select="qsvenc"
3139 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
3140 mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
3141 mp3_mf_encoder_deps="mediafoundation"
3142 mpeg1_cuvid_decoder_deps="cuvid"
3143 mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
3144 mpeg2_crystalhd_decoder_select="crystalhd"
3145 mpeg2_cuvid_decoder_deps="cuvid"
3146 mpeg2_mmal_decoder_deps="mmal"
3147 mpeg2_mediacodec_decoder_deps="mediacodec"
3148 mpeg2_qsv_decoder_select="qsvdec"
3149 mpeg2_qsv_encoder_select="qsvenc"
3150 mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
3151 mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
3152 mpeg4_crystalhd_decoder_select="crystalhd"
3153 mpeg4_cuvid_decoder_deps="cuvid"
3154 mpeg4_mediacodec_decoder_deps="mediacodec"
3155 mpeg4_mmal_decoder_deps="mmal"
3156 mpeg4_omx_encoder_deps="omx"
3157 mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
3158 mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
3159 msmpeg4_crystalhd_decoder_select="crystalhd"
3160 vc1_crystalhd_decoder_select="crystalhd"
3161 vc1_cuvid_decoder_deps="cuvid"
3162 vc1_mmal_decoder_deps="mmal"
3163 vc1_qsv_decoder_select="qsvdec"
3164 vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
3165 vp8_cuvid_decoder_deps="cuvid"
3166 vp8_mediacodec_decoder_deps="mediacodec"
3167 vp8_qsv_decoder_select="qsvdec"
3168 vp8_rkmpp_decoder_deps="rkmpp"
3169 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
3170 vp8_vaapi_encoder_select="vaapi_encode"
3171 vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
3172 vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
3173 vp9_cuvid_decoder_deps="cuvid"
3174 vp9_mediacodec_decoder_deps="mediacodec"
3175 vp9_qsv_decoder_select="qsvdec"
3176 vp9_rkmpp_decoder_deps="rkmpp"
3177 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
3178 vp9_vaapi_encoder_select="vaapi_encode"
3179 vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
3180 vp9_qsv_encoder_select="qsvenc"
3181 vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
3182 wmv3_crystalhd_decoder_select="crystalhd"
3183 av1_qsv_decoder_select="qsvdec"
3184
3185 # parsers
3186 aac_parser_select="adts_header"
3187 av1_parser_select="cbs_av1"
3188 h264_parser_select="atsc_a53 golomb h264dsp h264parse"
3189 hevc_parser_select="hevcparse"
3190 mpegaudio_parser_select="mpegaudioheader"
3191 mpegvideo_parser_select="mpegvideo"
3192 mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
3193 vc1_parser_select="vc1dsp"
3194
3195 # bitstream_filters
3196 aac_adtstoasc_bsf_select="adts_header"
3197 av1_frame_merge_bsf_select="cbs_av1"
3198 av1_frame_split_bsf_select="cbs_av1"
3199 av1_metadata_bsf_select="cbs_av1"
3200 eac3_core_bsf_select="ac3_parser"
3201 filter_units_bsf_select="cbs"
3202 h264_metadata_bsf_deps="const_nan"
3203 h264_metadata_bsf_select="cbs_h264"
3204 h264_redundant_pps_bsf_select="cbs_h264"
3205 hevc_metadata_bsf_select="cbs_h265"
3206 mjpeg2jpeg_bsf_select="jpegtables"
3207 mpeg2_metadata_bsf_select="cbs_mpeg2"
3208 trace_headers_bsf_select="cbs"
3209 vp9_metadata_bsf_select="cbs_vp9"
3210
3211 # external libraries
3212 aac_at_decoder_deps="audiotoolbox"
3213 aac_at_decoder_select="aac_adtstoasc_bsf"
3214 ac3_at_decoder_deps="audiotoolbox"
3215 ac3_at_decoder_select="ac3_parser"
3216 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
3217 alac_at_decoder_deps="audiotoolbox"
3218 amr_nb_at_decoder_deps="audiotoolbox"
3219 avisynth_deps_any="libdl LoadLibrary"
3220 avisynth_demuxer_deps="avisynth"
3221 avisynth_demuxer_select="riffdec"
3222 eac3_at_decoder_deps="audiotoolbox"
3223 eac3_at_decoder_select="ac3_parser"
3224 gsm_ms_at_decoder_deps="audiotoolbox"
3225 ilbc_at_decoder_deps="audiotoolbox"
3226 mp1_at_decoder_deps="audiotoolbox"
3227 mp2_at_decoder_deps="audiotoolbox"
3228 mp3_at_decoder_deps="audiotoolbox"
3229 mp1_at_decoder_select="mpegaudioheader"
3230 mp2_at_decoder_select="mpegaudioheader"
3231 mp3_at_decoder_select="mpegaudioheader"
3232 pcm_alaw_at_decoder_deps="audiotoolbox"
3233 pcm_mulaw_at_decoder_deps="audiotoolbox"
3234 qdmc_decoder_select="fft"
3235 qdmc_at_decoder_deps="audiotoolbox"
3236 qdm2_at_decoder_deps="audiotoolbox"
3237 aac_at_encoder_deps="audiotoolbox"
3238 aac_at_encoder_select="audio_frame_queue"
3239 alac_at_encoder_deps="audiotoolbox"
3240 alac_at_encoder_select="audio_frame_queue"
3241 ilbc_at_encoder_deps="audiotoolbox"
3242 ilbc_at_encoder_select="audio_frame_queue"
3243 pcm_alaw_at_encoder_deps="audiotoolbox"
3244 pcm_alaw_at_encoder_select="audio_frame_queue"
3245 pcm_mulaw_at_encoder_deps="audiotoolbox"
3246 pcm_mulaw_at_encoder_select="audio_frame_queue"
3247 chromaprint_muxer_deps="chromaprint"
3248 h264_videotoolbox_encoder_deps="pthreads"
3249 h264_videotoolbox_encoder_select="atsc_a53 videotoolbox_encoder"
3250 hevc_videotoolbox_encoder_deps="pthreads"
3251 hevc_videotoolbox_encoder_select="atsc_a53 videotoolbox_encoder"
3252 libaom_av1_decoder_deps="libaom"
3253 libaom_av1_encoder_deps="libaom"
3254 libaom_av1_encoder_select="extract_extradata_bsf"
3255 libaribb24_decoder_deps="libaribb24"
3256 libcelt_decoder_deps="libcelt"
3257 libcodec2_decoder_deps="libcodec2"
3258 libcodec2_encoder_deps="libcodec2"
3259 libdav1d_decoder_deps="libdav1d"
3260 libdav1d_decoder_select="atsc_a53"
3261 libdavs2_decoder_deps="libdavs2"
3262 libfdk_aac_decoder_deps="libfdk_aac"
3263 libfdk_aac_encoder_deps="libfdk_aac"
3264 libfdk_aac_encoder_select="audio_frame_queue"
3265 libgme_demuxer_deps="libgme"
3266 libgsm_decoder_deps="libgsm"
3267 libgsm_encoder_deps="libgsm"
3268 libgsm_ms_decoder_deps="libgsm"
3269 libgsm_ms_encoder_deps="libgsm"
3270 libilbc_decoder_deps="libilbc"
3271 libilbc_encoder_deps="libilbc"
3272 libkvazaar_encoder_deps="libkvazaar"
3273 libmodplug_demuxer_deps="libmodplug"
3274 libmp3lame_encoder_deps="libmp3lame"
3275 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
3276 libopencore_amrnb_decoder_deps="libopencore_amrnb"
3277 libopencore_amrnb_encoder_deps="libopencore_amrnb"
3278 libopencore_amrnb_encoder_select="audio_frame_queue"
3279 libopencore_amrwb_decoder_deps="libopencore_amrwb"
3280 libopenh264_decoder_deps="libopenh264"
3281 libopenh264_decoder_select="h264_mp4toannexb_bsf"
3282 libopenh264_encoder_deps="libopenh264"
3283 libopenjpeg_decoder_deps="libopenjpeg"
3284 libopenjpeg_encoder_deps="libopenjpeg"
3285 libopenmpt_demuxer_deps="libopenmpt"
3286 libopus_decoder_deps="libopus"
3287 libopus_encoder_deps="libopus"
3288 libopus_encoder_select="audio_frame_queue"
3289 librav1e_encoder_deps="librav1e"
3290 librav1e_encoder_select="extract_extradata_bsf"
3291 librsvg_decoder_deps="librsvg"
3292 libshine_encoder_deps="libshine"
3293 libshine_encoder_select="audio_frame_queue"
3294 libspeex_decoder_deps="libspeex"
3295 libspeex_encoder_deps="libspeex"
3296 libspeex_encoder_select="audio_frame_queue"
3297 libsvtav1_encoder_deps="libsvtav1"
3298 libtheora_encoder_deps="libtheora"
3299 libtwolame_encoder_deps="libtwolame"
3300 libuavs3d_decoder_deps="libuavs3d"
3301 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
3302 libvorbis_decoder_deps="libvorbis"
3303 libvorbis_encoder_deps="libvorbis libvorbisenc"
3304 libvorbis_encoder_select="audio_frame_queue"
3305 libvpx_vp8_decoder_deps="libvpx"
3306 libvpx_vp8_encoder_deps="libvpx"
3307 libvpx_vp9_decoder_deps="libvpx"
3308 libvpx_vp9_encoder_deps="libvpx"
3309 libwebp_encoder_deps="libwebp"
3310 libwebp_anim_encoder_deps="libwebp"
3311 libx262_encoder_deps="libx262"
3312 libx264_encoder_deps="libx264"
3313 libx264_encoder_select="atsc_a53"
3314 libx264rgb_encoder_deps="libx264 x264_csp_bgr"
3315 libx264rgb_encoder_select="libx264_encoder"
3316 libx265_encoder_deps="libx265"
3317 libxavs_encoder_deps="libxavs"
3318 libxavs2_encoder_deps="libxavs2"
3319 libxvid_encoder_deps="libxvid"
3320 libzvbi_teletext_decoder_deps="libzvbi"
3321 vapoursynth_demuxer_deps="vapoursynth"
3322 videotoolbox_suggest="coreservices"
3323 videotoolbox_deps="corefoundation coremedia corevideo"
3324 videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
3325
3326 # demuxers / muxers
3327 ac3_demuxer_select="ac3_parser"
3328 act_demuxer_select="riffdec"
3329 aiff_muxer_select="iso_media"
3330 asf_demuxer_select="riffdec"
3331 asf_o_demuxer_select="riffdec"
3332 asf_muxer_select="riffenc"
3333 asf_stream_muxer_select="asf_muxer"
3334 av1_demuxer_select="av1_frame_merge_bsf av1_parser"
3335 avi_demuxer_select="riffdec exif"
3336 avi_muxer_select="riffenc"
3337 caf_demuxer_select="iso_media"
3338 caf_muxer_select="iso_media"
3339 dash_muxer_select="mp4_muxer"
3340 dash_demuxer_deps="libxml2"
3341 dirac_demuxer_select="dirac_parser"
3342 dts_demuxer_select="dca_parser"
3343 dtshd_demuxer_select="dca_parser"
3344 dv_demuxer_select="dvprofile"
3345 dv_muxer_select="dvprofile"
3346 dxa_demuxer_select="riffdec"
3347 eac3_demuxer_select="ac3_parser"
3348 f4v_muxer_select="mov_muxer"
3349 fifo_muxer_deps="threads"
3350 flac_demuxer_select="flac_parser"
3351 flv_muxer_select="aac_adtstoasc_bsf"
3352 gxf_muxer_select="pcm_rechunk_bsf"
3353 hds_muxer_select="flv_muxer"
3354 hls_muxer_select="mpegts_muxer"
3355 hls_muxer_suggest="gcrypt openssl"
3356 image2_alias_pix_demuxer_select="image2_demuxer"
3357 image2_brender_pix_demuxer_select="image2_demuxer"
3358 ipod_muxer_select="mov_muxer"
3359 ismv_muxer_select="mov_muxer"
3360 ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
3361 latm_muxer_select="aac_adtstoasc_bsf"
3362 matroska_audio_muxer_select="matroska_muxer"
3363 matroska_demuxer_select="riffdec"
3364 matroska_demuxer_suggest="bzlib lzo zlib"
3365 matroska_muxer_select="riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
3366 mlp_demuxer_select="mlp_parser"
3367 mmf_muxer_select="riffenc"
3368 mov_demuxer_select="iso_media riffdec"
3369 mov_demuxer_suggest="zlib"
3370 mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf"
3371 mp3_demuxer_select="mpegaudio_parser"
3372 mp3_muxer_select="mpegaudioheader"
3373 mp4_muxer_select="mov_muxer"
3374 mpegts_demuxer_select="iso_media"
3375 mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf"
3376 mpegtsraw_demuxer_select="mpegts_demuxer"
3377 mxf_muxer_select="golomb pcm_rechunk_bsf"
3378 mxf_d10_muxer_select="mxf_muxer"
3379 mxf_opatom_muxer_select="mxf_muxer"
3380 nut_muxer_select="riffenc"
3381 nuv_demuxer_select="riffdec"
3382 obu_demuxer_select="av1_frame_merge_bsf av1_parser"
3383 oga_muxer_select="ogg_muxer"
3384 ogg_demuxer_select="dirac_parse"
3385 ogv_muxer_select="ogg_muxer"
3386 opus_muxer_select="ogg_muxer"
3387 psp_muxer_select="mov_muxer"
3388 rtp_demuxer_select="sdp_demuxer"
3389 rtp_muxer_select="golomb jpegtables"
3390 rtp_mpegts_muxer_select="mpegts_muxer rtp_muxer"
3391 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
3392 rtsp_demuxer_select="http_protocol rtpdec"
3393 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
3394 sap_demuxer_select="sdp_demuxer"
3395 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
3396 sdp_demuxer_select="rtpdec"
3397 smoothstreaming_muxer_select="ismv_muxer"
3398 spdif_demuxer_select="adts_header"
3399 spdif_muxer_select="adts_header"
3400 spx_muxer_select="ogg_muxer"
3401 swf_demuxer_suggest="zlib"
3402 tak_demuxer_select="tak_parser"
3403 truehd_demuxer_select="mlp_parser"
3404 tg2_muxer_select="mov_muxer"
3405 tgp_muxer_select="mov_muxer"
3406 vobsub_demuxer_select="mpegps_demuxer"
3407 w64_demuxer_select="wav_demuxer"
3408 w64_muxer_select="wav_muxer"
3409 wav_demuxer_select="riffdec"
3410 wav_muxer_select="riffenc"
3411 webm_chunk_muxer_select="webm_muxer"
3412 webm_muxer_select="riffenc"
3413 webm_dash_manifest_demuxer_select="matroska_demuxer"
3414 wtv_demuxer_select="mpegts_demuxer riffdec"
3415 wtv_muxer_select="mpegts_muxer riffenc"
3416 xmv_demuxer_select="riffdec"
3417 xwma_demuxer_select="riffdec"
3418
3419 # indevs / outdevs
3420 android_camera_indev_deps="android camera2ndk mediandk pthreads"
3421 android_camera_indev_extralibs="-landroid -lcamera2ndk -lmediandk"
3422 alsa_indev_deps="alsa"
3423 alsa_outdev_deps="alsa"
3424 avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
3425 avfoundation_indev_suggest="coregraphics applicationservices"
3426 avfoundation_indev_extralibs="-framework Foundation"
3427 audiotoolbox_outdev_deps="audiotoolbox pthreads"
3428 audiotoolbox_outdev_extralibs="-framework AudioToolbox -framework CoreAudio"
3429 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
3430 caca_outdev_deps="libcaca"
3431 decklink_deps_any="libdl LoadLibrary"
3432 decklink_indev_deps="decklink threads"
3433 decklink_indev_extralibs="-lstdc++"
3434 decklink_outdev_deps="decklink threads"
3435 decklink_outdev_suggest="libklvanc"
3436 decklink_outdev_extralibs="-lstdc++"
3437 dshow_indev_deps="IBaseFilter"
3438 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
3439 fbdev_indev_deps="linux_fb_h"
3440 fbdev_outdev_deps="linux_fb_h"
3441 gdigrab_indev_deps="CreateDIBSection"
3442 gdigrab_indev_extralibs="-lgdi32"
3443 gdigrab_indev_select="bmp_decoder"
3444 iec61883_indev_deps="libiec61883"
3445 jack_indev_deps="libjack"
3446 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
3447 kmsgrab_indev_deps="libdrm"
3448 lavfi_indev_deps="avfilter"
3449 libcdio_indev_deps="libcdio"
3450 libdc1394_indev_deps="libdc1394"
3451 openal_indev_deps="openal"
3452 opengl_outdev_deps="opengl"
3453 opengl_outdev_suggest="sdl2"
3454 oss_indev_deps_any="sys_soundcard_h"
3455 oss_outdev_deps_any="sys_soundcard_h"
3456 pulse_indev_deps="libpulse"
3457 pulse_outdev_deps="libpulse"
3458 sdl2_outdev_deps="sdl2"
3459 sndio_indev_deps="sndio"
3460 sndio_outdev_deps="sndio"
3461 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
3462 v4l2_indev_suggest="libv4l2"
3463 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
3464 v4l2_outdev_suggest="libv4l2"
3465 vfwcap_indev_deps="vfw32 vfwcap_defines"
3466 xcbgrab_indev_deps="libxcb"
3467 xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
3468 xv_outdev_deps="xlib"
3469
3470 # protocols
3471 async_protocol_deps="threads"
3472 bluray_protocol_deps="libbluray"
3473 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
3474 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls"
3475 ffrtmpcrypt_protocol_select="tcp_protocol"
3476 ffrtmphttp_protocol_conflict="librtmp_protocol"
3477 ffrtmphttp_protocol_select="http_protocol"
3478 ftp_protocol_select="tcp_protocol"
3479 gopher_protocol_select="tcp_protocol"
3480 gophers_protocol_select="tls_protocol"
3481 http_protocol_select="tcp_protocol"
3482 http_protocol_suggest="zlib"
3483 httpproxy_protocol_select="tcp_protocol"
3484 httpproxy_protocol_suggest="zlib"
3485 https_protocol_select="tls_protocol"
3486 https_protocol_suggest="zlib"
3487 icecast_protocol_select="http_protocol"
3488 mmsh_protocol_select="http_protocol"
3489 mmst_protocol_select="network"
3490 rtmp_protocol_conflict="librtmp_protocol"
3491 rtmp_protocol_select="tcp_protocol"
3492 rtmp_protocol_suggest="zlib"
3493 rtmpe_protocol_select="ffrtmpcrypt_protocol"
3494 rtmpe_protocol_suggest="zlib"
3495 rtmps_protocol_conflict="librtmp_protocol"
3496 rtmps_protocol_select="tls_protocol"
3497 rtmps_protocol_suggest="zlib"
3498 rtmpt_protocol_select="ffrtmphttp_protocol"
3499 rtmpt_protocol_suggest="zlib"
3500 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
3501 rtmpte_protocol_suggest="zlib"
3502 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
3503 rtmpts_protocol_suggest="zlib"
3504 rtp_protocol_select="udp_protocol"
3505 schannel_conflict="openssl gnutls libtls mbedtls"
3506 sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
3507 sctp_protocol_select="network"
3508 securetransport_conflict="openssl gnutls libtls mbedtls"
3509 srtp_protocol_select="rtp_protocol srtp"
3510 tcp_protocol_select="network"
3511 tls_protocol_deps_any="gnutls openssl schannel securetransport libtls mbedtls"
3512 tls_protocol_select="tcp_protocol"
3513 udp_protocol_select="network"
3514 udplite_protocol_select="network"
3515 unix_protocol_deps="sys_un_h"
3516 unix_protocol_select="network"
3517
3518 # external library protocols
3519 libamqp_protocol_deps="librabbitmq"
3520 libamqp_protocol_select="network"
3521 librist_protocol_deps="librist"
3522 librist_protocol_select="network"
3523 librtmp_protocol_deps="librtmp"
3524 librtmpe_protocol_deps="librtmp"
3525 librtmps_protocol_deps="librtmp"
3526 librtmpt_protocol_deps="librtmp"
3527 librtmpte_protocol_deps="librtmp"
3528 libsmbclient_protocol_deps="libsmbclient gplv3"
3529 libsrt_protocol_deps="libsrt"
3530 libsrt_protocol_select="network"
3531 libssh_protocol_deps="libssh"
3532 libtls_conflict="openssl gnutls mbedtls"
3533 libzmq_protocol_deps="libzmq"
3534 libzmq_protocol_select="network"
3535
3536 # filters
3537 afftdn_filter_deps="avcodec"
3538 afftdn_filter_select="fft"
3539 afftfilt_filter_deps="avcodec"
3540 afftfilt_filter_select="fft"
3541 afir_filter_deps="avcodec"
3542 afir_filter_select="rdft"
3543 amovie_filter_deps="avcodec avformat"
3544 aresample_filter_deps="swresample"
3545 asoftclip_filter_deps="swresample"
3546 asr_filter_deps="pocketsphinx"
3547 ass_filter_deps="libass"
3548 atempo_filter_deps="avcodec"
3549 atempo_filter_select="rdft"
3550 avgblur_opencl_filter_deps="opencl"
3551 avgblur_vulkan_filter_deps="vulkan_lib libglslang"
3552 azmq_filter_deps="libzmq"
3553 blackframe_filter_deps="gpl"
3554 bm3d_filter_deps="avcodec"
3555 bm3d_filter_select="dct"
3556 boxblur_filter_deps="gpl"
3557 boxblur_opencl_filter_deps="opencl gpl"
3558 bs2b_filter_deps="libbs2b"
3559 chromaber_vulkan_filter_deps="vulkan_lib libglslang"
3560 colorkey_opencl_filter_deps="opencl"
3561 colormatrix_filter_deps="gpl"
3562 convolution_opencl_filter_deps="opencl"
3563 convolve_filter_deps="avcodec"
3564 convolve_filter_select="fft"
3565 coreimage_filter_deps="coreimage appkit"
3566 coreimage_filter_extralibs="-framework OpenGL"
3567 coreimagesrc_filter_deps="coreimage appkit"
3568 coreimagesrc_filter_extralibs="-framework OpenGL"
3569 cover_rect_filter_deps="avcodec avformat gpl"
3570 cropdetect_filter_deps="gpl"
3571 deconvolve_filter_deps="avcodec"
3572 deconvolve_filter_select="fft"
3573 deinterlace_qsv_filter_deps="libmfx"
3574 deinterlace_vaapi_filter_deps="vaapi"
3575 delogo_filter_deps="gpl"
3576 denoise_vaapi_filter_deps="vaapi"
3577 derain_filter_select="dnn"
3578 deshake_filter_select="pixelutils"
3579 deshake_opencl_filter_deps="opencl"
3580 dilation_opencl_filter_deps="opencl"
3581 dnn_classify_filter_select="dnn"
3582 dnn_detect_filter_select="dnn"
3583 dnn_processing_filter_select="dnn"
3584 drawtext_filter_deps="libfreetype"
3585 drawtext_filter_suggest="libfontconfig libfribidi"
3586 elbg_filter_deps="avcodec"
3587 eq_filter_deps="gpl"
3588 erosion_opencl_filter_deps="opencl"
3589 fftfilt_filter_deps="avcodec"
3590 fftfilt_filter_select="rdft"
3591 fftdnoiz_filter_deps="avcodec"
3592 fftdnoiz_filter_select="fft"
3593 find_rect_filter_deps="avcodec avformat gpl"
3594 firequalizer_filter_deps="avcodec"
3595 firequalizer_filter_select="rdft"
3596 flite_filter_deps="libflite"
3597 framerate_filter_select="scene_sad"
3598 freezedetect_filter_select="scene_sad"
3599 frei0r_filter_deps="frei0r libdl"
3600 frei0r_src_filter_deps="frei0r libdl"
3601 fspp_filter_deps="gpl"
3602 headphone_filter_select="fft"
3603 histeq_filter_deps="gpl"
3604 hqdn3d_filter_deps="gpl"
3605 interlace_filter_deps="gpl"
3606 kerndeint_filter_deps="gpl"
3607 ladspa_filter_deps="ladspa libdl"
3608 lensfun_filter_deps="liblensfun version3"
3609 lv2_filter_deps="lv2"
3610 mcdeint_filter_deps="avcodec gpl"
3611 movie_filter_deps="avcodec avformat"
3612 mpdecimate_filter_deps="gpl"
3613 mpdecimate_filter_select="pixelutils"
3614 minterpolate_filter_select="scene_sad"
3615 mptestsrc_filter_deps="gpl"
3616 negate_filter_deps="lut_filter"
3617 nlmeans_opencl_filter_deps="opencl"
3618 nnedi_filter_deps="gpl"
3619 ocr_filter_deps="libtesseract"
3620 ocv_filter_deps="libopencv"
3621 openclsrc_filter_deps="opencl"
3622 overlay_opencl_filter_deps="opencl"
3623 overlay_qsv_filter_deps="libmfx"
3624 overlay_qsv_filter_select="qsvvpp"
3625 overlay_vulkan_filter_deps="vulkan_lib libglslang"
3626 owdenoise_filter_deps="gpl"
3627 pad_opencl_filter_deps="opencl"
3628 pan_filter_deps="swresample"
3629 perspective_filter_deps="gpl"
3630 phase_filter_deps="gpl"
3631 pp7_filter_deps="gpl"
3632 pp_filter_deps="gpl postproc"
3633 prewitt_opencl_filter_deps="opencl"
3634 procamp_vaapi_filter_deps="vaapi"
3635 program_opencl_filter_deps="opencl"
3636 pullup_filter_deps="gpl"
3637 removelogo_filter_deps="avcodec avformat swscale"
3638 repeatfields_filter_deps="gpl"
3639 roberts_opencl_filter_deps="opencl"
3640 rubberband_filter_deps="librubberband"
3641 sab_filter_deps="gpl swscale"
3642 scale2ref_filter_deps="swscale"
3643 scale_filter_deps="swscale"
3644 scale_qsv_filter_deps="libmfx"
3645 scdet_filter_select="scene_sad"
3646 select_filter_select="scene_sad"
3647 sharpness_vaapi_filter_deps="vaapi"
3648 showcqt_filter_deps="avcodec avformat swscale"
3649 showcqt_filter_suggest="libfontconfig libfreetype"
3650 showcqt_filter_select="fft"
3651 showfreqs_filter_deps="avcodec"
3652 showfreqs_filter_select="fft"
3653 showspatial_filter_select="fft"
3654 showspectrum_filter_deps="avcodec"
3655 showspectrum_filter_select="fft"
3656 showspectrumpic_filter_deps="avcodec"
3657 showspectrumpic_filter_select="fft"
3658 signature_filter_deps="gpl avcodec avformat"
3659 sinc_filter_select="rdft"
3660 smartblur_filter_deps="gpl swscale"
3661 sobel_opencl_filter_deps="opencl"
3662 sofalizer_filter_deps="libmysofa avcodec"
3663 sofalizer_filter_select="fft"
3664 spectrumsynth_filter_deps="avcodec"
3665 spectrumsynth_filter_select="fft"
3666 spp_filter_deps="gpl avcodec"
3667 spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
3668 sr_filter_deps="avformat swscale"
3669 sr_filter_select="dnn"
3670 stereo3d_filter_deps="gpl"
3671 subtitles_filter_deps="avformat avcodec libass"
3672 super2xsai_filter_deps="gpl"
3673 pixfmts_super2xsai_test_deps="super2xsai_filter"
3674 superequalizer_filter_select="rdft"
3675 surround_filter_select="rdft"
3676 tinterlace_filter_deps="gpl"
3677 tinterlace_merge_test_deps="tinterlace_filter"
3678 tinterlace_pad_test_deps="tinterlace_filter"
3679 tonemap_filter_deps="const_nan"
3680 tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
3681 tonemap_opencl_filter_deps="opencl const_nan"
3682 transpose_opencl_filter_deps="opencl"
3683 transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
3684 unsharp_opencl_filter_deps="opencl"
3685 uspp_filter_deps="gpl avcodec"
3686 vaguedenoiser_filter_deps="gpl"
3687 vidstabdetect_filter_deps="libvidstab"
3688 vidstabtransform_filter_deps="libvidstab"
3689 libvmaf_filter_deps="libvmaf pthreads"
3690 zmq_filter_deps="libzmq"
3691 zoompan_filter_deps="swscale"
3692 zscale_filter_deps="libzimg const_nan"
3693 scale_vaapi_filter_deps="vaapi"
3694 scale_vulkan_filter_deps="vulkan_lib libglslang"
3695 vpp_qsv_filter_deps="libmfx"
3696 vpp_qsv_filter_select="qsvvpp"
3697 xfade_opencl_filter_deps="opencl"
3698 yadif_cuda_filter_deps="ffnvcodec"
3699 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
3700
3701 # examples
3702 avio_list_dir_deps="avformat avutil"
3703 avio_reading_deps="avformat avcodec avutil"
3704 decode_audio_example_deps="avcodec avutil"
3705 decode_video_example_deps="avcodec avutil"
3706 demuxing_decoding_example_deps="avcodec avformat avutil"
3707 encode_audio_example_deps="avcodec avutil"
3708 encode_video_example_deps="avcodec avutil"
3709 extract_mvs_example_deps="avcodec avformat avutil"
3710 filter_audio_example_deps="avfilter avutil"
3711 filtering_audio_example_deps="avfilter avcodec avformat avutil"
3712 filtering_video_example_deps="avfilter avcodec avformat avutil"
3713 http_multiclient_example_deps="avformat avutil fork"
3714 hw_decode_example_deps="avcodec avformat avutil"
3715 metadata_example_deps="avformat avutil"
3716 muxing_example_deps="avcodec avformat avutil swscale"
3717 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
3718 remuxing_example_deps="avcodec avformat avutil"
3719 resampling_audio_example_deps="avutil swresample"
3720 scaling_video_example_deps="avutil swscale"
3721 transcode_aac_example_deps="avcodec avformat swresample"
3722 transcoding_example_deps="avfilter avcodec avformat avutil"
3723 vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
3724 vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
3725
3726 # EXTRALIBS_LIST
3727 cpu_init_extralibs="pthreads_extralibs"
3728 cws2fws_extralibs="zlib_extralibs"
3729
3730 # libraries, in any order
3731 avcodec_deps="avutil"
3732 avcodec_suggest="libm"
3733 avcodec_select="null_bsf"
3734 avdevice_deps="avformat avcodec avutil"
3735 avdevice_suggest="libm"
3736 avfilter_deps="avutil"
3737 avfilter_suggest="libm"
3738 avformat_deps="avcodec avutil"
3739 avformat_suggest="libm network zlib"
3740 avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
3741 postproc_deps="avutil gpl"
3742 postproc_suggest="libm"
3743 swresample_deps="avutil"
3744 swresample_suggest="libm libsoxr"
3745 swscale_deps="avutil"
3746 swscale_suggest="libm"
3747
3748 avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
3749 avfilter_extralibs="pthreads_extralibs"
3750 avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
3751
3752 # programs
3753 ffmpeg_deps="avcodec avfilter avformat"
3754 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
3755                hflip_filter null_filter
3756                transpose_filter trim_filter vflip_filter"
3757 ffmpeg_suggest="ole32 psapi shell32"
3758 ffplay_deps="avcodec avformat swscale swresample sdl2"
3759 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
3760 ffplay_suggest="shell32"
3761 ffprobe_deps="avcodec avformat"
3762 ffprobe_suggest="shell32"
3763
3764 # documentation
3765 podpages_deps="perl"
3766 manpages_deps="perl pod2man"
3767 htmlpages_deps="perl"
3768 htmlpages_deps_any="makeinfo_html texi2html"
3769 txtpages_deps="perl makeinfo"
3770 doc_deps_any="manpages htmlpages podpages txtpages"
3771
3772 # default parameters
3773
3774 logfile="ffbuild/config.log"
3775
3776 # installation paths
3777 prefix_default="/usr/local"
3778 bindir_default='${prefix}/bin'
3779 datadir_default='${prefix}/share/ffmpeg'
3780 docdir_default='${prefix}/share/doc/ffmpeg'
3781 incdir_default='${prefix}/include'
3782 libdir_default='${prefix}/lib'
3783 mandir_default='${prefix}/share/man'
3784
3785 # toolchain
3786 ar_default="ar"
3787 cc_default="gcc"
3788 cxx_default="g++"
3789 host_cc_default="gcc"
3790 doxygen_default="doxygen"
3791 install="install"
3792 ln_s_default="ln -s -f"
3793 nm_default="nm -g"
3794 pkg_config_default=pkg-config
3795 ranlib_default="ranlib"
3796 strip_default="strip"
3797 version_script='--version-script'
3798 objformat="elf32"
3799 x86asmexe_default="nasm"
3800 windres_default="windres"
3801 striptype="direct"
3802
3803 # OS
3804 target_os_default=$(tolower $(uname -s))
3805 host_os=$target_os_default
3806
3807 # machine
3808 if test "$target_os_default" = aix; then
3809     arch_default=$(uname -p)
3810     strip_default="strip -X32_64"
3811     nm_default="nm -g -X32_64"
3812 else
3813     arch_default=$(uname -m)
3814 fi
3815 cpu="generic"
3816 intrinsics="none"
3817
3818 # configurable options
3819 enable $PROGRAM_LIST
3820 enable $DOCUMENT_LIST
3821 enable $EXAMPLE_LIST
3822 enable $LIBRARY_LIST
3823 enable stripping
3824
3825 enable asm
3826 enable debug
3827 enable doc
3828 enable faan faandct faanidct
3829 enable large_tests
3830 enable optimizations
3831 enable runtime_cpudetect
3832 enable safe_bitstream_reader
3833 enable static
3834 enable swscale_alpha
3835 enable valgrind_backtrace
3836
3837 sws_max_filter_size_default=256
3838 set_default sws_max_filter_size
3839
3840 # internal components are enabled by default
3841 enable $EXTRALIBS_LIST
3842
3843 # Avoid external, non-system, libraries getting enabled by dependency resolution
3844 disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
3845
3846 # build settings
3847 SHFLAGS='-shared -Wl,-soname,$$(@F)'
3848 LIBPREF="lib"
3849 LIBSUF=".a"
3850 FULLNAME='$(NAME)$(BUILDSUF)'
3851 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
3852 SLIBPREF="lib"
3853 SLIBSUF=".so"
3854 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
3855 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
3856 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
3857 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
3858 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
3859 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
3860 VERSION_SCRIPT_POSTPROCESS_CMD="cat"
3861
3862 asflags_filter=echo
3863 cflags_filter=echo
3864 ldflags_filter=echo
3865
3866 AS_C='-c'
3867 AS_O='-o $@'
3868 CC_C='-c'
3869 CC_E='-E -o $@'
3870 CC_O='-o $@'
3871 CXX_C='-c'
3872 CXX_O='-o $@'
3873 OBJCC_C='-c'
3874 OBJCC_E='-E -o $@'
3875 OBJCC_O='-o $@'
3876 X86ASM_O='-o $@'
3877 LD_O='-o $@'
3878 LD_LIB='-l%'
3879 LD_PATH='-L'
3880 HOSTCC_C='-c'
3881 HOSTCC_E='-E -o $@'
3882 HOSTCC_O='-o $@'
3883 HOSTLD_O='-o $@'
3884 NVCC_C='-c'
3885 NVCC_O='-o $@'
3886
3887 host_extralibs='-lm'
3888 host_cflags_filter=echo
3889 host_ldflags_filter=echo
3890
3891 target_path='$(CURDIR)'
3892
3893 # since the object filename is not given with the -MM flag, the compiler
3894 # is only able to print the basename, and we must add the path ourselves
3895 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
3896 DEPFLAGS='-MM'
3897
3898 mkdir -p ffbuild
3899
3900 # find source path
3901 if test -f configure; then
3902     source_path=.
3903 elif test -f src/configure; then
3904     source_path=src
3905 else
3906     source_path=$(cd $(dirname "$0"); pwd)
3907     case "$source_path" in
3908         *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
3909     esac
3910     test -e "$source_path/config.h" &&
3911         die "Out of tree builds are impossible with config.h in source dir."
3912 fi
3913
3914 for v in "$@"; do
3915     r=${v#*=}
3916     l=${v%"$r"}
3917     r=$(sh_quote "$r")
3918     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
3919 done
3920
3921 find_things_extern(){
3922     thing=$1
3923     pattern=$2
3924     file=$source_path/$3
3925     out=${4:-$thing}
3926     sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
3927 }
3928
3929 find_filters_extern(){
3930     file=$source_path/$1
3931     sed -n 's/^extern const AVFilter ff_[avfsinkrc]\{2,5\}_\([[:alnum:]_]\{1,\}\);/\1_filter/p' $file
3932 }
3933
3934 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
3935 OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
3936 INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
3937 MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
3938 DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
3939 ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
3940 DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
3941 CODEC_LIST="
3942     $ENCODER_LIST
3943     $DECODER_LIST
3944 "
3945 PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
3946 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
3947 HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
3948 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
3949
3950 AVCODEC_COMPONENTS_LIST="
3951     $BSF_LIST
3952     $DECODER_LIST
3953     $ENCODER_LIST
3954     $HWACCEL_LIST
3955     $PARSER_LIST
3956 "
3957
3958 AVDEVICE_COMPONENTS_LIST="
3959     $INDEV_LIST
3960     $OUTDEV_LIST
3961 "
3962
3963 AVFILTER_COMPONENTS_LIST="
3964     $FILTER_LIST
3965 "
3966
3967 AVFORMAT_COMPONENTS_LIST="
3968     $DEMUXER_LIST
3969     $MUXER_LIST
3970     $PROTOCOL_LIST
3971 "
3972
3973 ALL_COMPONENTS="
3974     $AVCODEC_COMPONENTS_LIST
3975     $AVDEVICE_COMPONENTS_LIST
3976     $AVFILTER_COMPONENTS_LIST
3977     $AVFORMAT_COMPONENTS_LIST
3978 "
3979
3980 for n in $COMPONENT_LIST; do
3981     v=$(toupper ${n%s})_LIST
3982     eval enable \$$v
3983     eval ${n}_if_any="\$$v"
3984 done
3985
3986 enable $ARCH_EXT_LIST
3987
3988 die_unknown(){
3989     echo "Unknown option \"$1\"."
3990     echo "See $0 --help for available options."
3991     exit 1
3992 }
3993
3994 print_in_columns() {
3995     tr ' ' '\n' | sort | tr '\r\n' '  ' | awk -v col_width=24 -v width="$ncols" '
3996     {
3997         num_cols = width > col_width ? int(width / col_width) : 1;
3998         num_rows = int((NF + num_cols-1) / num_cols);
3999         y = x = 1;
4000         for (y = 1; y <= num_rows; y++) {
4001             i = y;
4002             for (x = 1; x <= num_cols; x++) {
4003                 if (i <= NF) {
4004                   line = sprintf("%s%-" col_width "s", line, $i);
4005                 }
4006                 i = i + num_rows;
4007             }
4008             print line; line = "";
4009         }
4010     }' | sed 's/ *$//'
4011 }
4012
4013 show_list() {
4014     suffix=_$1
4015     shift
4016     echo $* | sed s/$suffix//g | print_in_columns
4017     exit 0
4018 }
4019
4020 rand_list(){
4021     IFS=', '
4022     set -- $*
4023     unset IFS
4024     for thing; do
4025         comp=${thing%:*}
4026         prob=${thing#$comp}
4027         prob=${prob#:}
4028         is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
4029         echo "prob ${prob:-0.5}"
4030         printf '%s\n' $comp
4031     done
4032 }
4033
4034 do_random(){
4035     action=$1
4036     shift
4037     random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
4038     $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
4039 }
4040
4041 for opt do
4042     optval="${opt#*=}"
4043     case "$opt" in
4044         --extra-ldflags=*)
4045             add_ldflags $optval
4046         ;;
4047         --extra-ldexeflags=*)
4048             add_ldexeflags $optval
4049         ;;
4050         --extra-ldsoflags=*)
4051             add_ldsoflags $optval
4052         ;;
4053         --extra-ldlibflags=*)
4054             warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
4055                  "removed in the future. Use --extra-ldsoflags instead."
4056             add_ldsoflags $optval
4057         ;;
4058         --extra-libs=*)
4059             add_extralibs $optval
4060         ;;
4061         --disable-devices)
4062             disable $INDEV_LIST $OUTDEV_LIST
4063         ;;
4064         --enable-debug=*)
4065             debuglevel="$optval"
4066         ;;
4067         --disable-programs)
4068             disable $PROGRAM_LIST
4069         ;;
4070         --disable-everything)
4071             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
4072         ;;
4073         --disable-all)
4074             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
4075             disable $LIBRARY_LIST $PROGRAM_LIST doc
4076             enable avutil
4077         ;;
4078         --enable-random|--disable-random)
4079             action=${opt%%-random}
4080             do_random ${action#--} $COMPONENT_LIST
4081         ;;
4082         --enable-random=*|--disable-random=*)
4083             action=${opt%%-random=*}
4084             do_random ${action#--} $optval
4085         ;;
4086         --enable-sdl)
4087             enable sdl2
4088         ;;
4089         --enable-*=*|--disable-*=*)
4090             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
4091             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
4092             eval list=\$$(toupper $thing)_LIST
4093             name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
4094             list=$(filter "$name" $list)
4095             [ "$list" = "" ] && warn "Option $opt did not match anything"
4096             test $action = enable && warn_if_gets_disabled $list
4097             $action $list
4098         ;;
4099         --enable-yasm|--disable-yasm)
4100             warn "The ${opt} option is only provided for compatibility and will be\n"\
4101                  "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
4102             test $opt = --enable-yasm && x86asm=yes || x86asm=no
4103         ;;
4104         --yasmexe=*)
4105             warn "The --yasmexe option is only provided for compatibility and will be\n"\
4106                  "removed in the future. Use --x86asmexe instead."
4107             x86asmexe="$optval"
4108         ;;
4109         --enable-?*|--disable-?*)
4110             eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
4111             if is_in $option $COMPONENT_LIST; then
4112                 test $action = disable && action=unset
4113                 eval $action \$$(toupper ${option%s})_LIST
4114             elif is_in $option $CMDLINE_SELECT; then
4115                 $action $option
4116             else
4117                 die_unknown $opt
4118             fi
4119         ;;
4120         --list-*)
4121             NAME="${opt#--list-}"
4122             is_in $NAME $COMPONENT_LIST || die_unknown $opt
4123             NAME=${NAME%s}
4124             eval show_list $NAME \$$(toupper $NAME)_LIST
4125         ;;
4126         --help|-h) show_help
4127         ;;
4128         --quiet|-q) quiet=yes
4129         ;;
4130         --fatal-warnings) enable fatal_warnings
4131         ;;
4132         --libfuzzer=*)
4133             libfuzzer_path="$optval"
4134         ;;
4135         *)
4136             optname="${opt%%=*}"
4137             optname="${optname#--}"
4138             optname=$(echo "$optname" | sed 's/-/_/g')
4139             if is_in $optname $CMDLINE_SET; then
4140                 eval $optname='$optval'
4141             elif is_in $optname $CMDLINE_APPEND; then
4142                 append $optname "$optval"
4143             else
4144                 die_unknown $opt
4145             fi
4146         ;;
4147     esac
4148 done
4149
4150 for e in $env; do
4151     eval "export $e"
4152 done
4153
4154 if disabled autodetect; then
4155
4156     # Unless iconv is explicitely disabled by the user, we still want to probe
4157     # for the iconv from the libc.
4158     disabled iconv || enable libc_iconv
4159
4160     disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
4161     disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
4162 fi
4163 # Mark specifically enabled, but normally autodetected libraries as requested.
4164 for lib in $AUTODETECT_LIBS; do
4165     enabled $lib && request $lib
4166 done
4167 #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
4168 enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
4169 enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
4170
4171 disabled logging && logfile=/dev/null
4172
4173 # command line configuration sanity checks
4174
4175 # we need to build at least one lib type
4176 if ! enabled_any static shared; then
4177     cat <<EOF
4178 At least one library type must be built.
4179 Specify --enable-static to build the static libraries or --enable-shared to
4180 build the shared libraries as well. To only build the shared libraries specify
4181 --disable-static in addition to --enable-shared.
4182 EOF
4183     exit 1
4184 fi
4185
4186 die_license_disabled() {
4187     enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
4188 }
4189
4190 die_license_disabled_gpl() {
4191     enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
4192 }
4193
4194 map "die_license_disabled gpl"      $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
4195 map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
4196
4197 enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
4198 map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
4199
4200 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
4201
4202 if enabled nonfree; then
4203     license="nonfree and unredistributable"
4204 elif enabled gplv3; then
4205     license="GPL version 3 or later"
4206 elif enabled lgplv3; then
4207     license="LGPL version 3 or later"
4208 elif enabled gpl; then
4209     license="GPL version 2 or later"
4210 else
4211     license="LGPL version 2.1 or later"
4212 fi
4213
4214 enabled_all gnutls openssl &&
4215     die "GnuTLS and OpenSSL must not be enabled at the same time."
4216
4217 enabled_all gnutls mbedtls &&
4218     die "GnuTLS and mbedTLS must not be enabled at the same time."
4219
4220 enabled_all openssl mbedtls &&
4221     die "OpenSSL and mbedTLS must not be enabled at the same time."
4222
4223 # Disable all the library-specific components if the library itself
4224 # is disabled, see AVCODEC_LIST and following _LIST variables.
4225
4226 disable_components(){
4227     disabled ${1} && disable $(
4228         eval components="\$$(toupper ${1})_COMPONENTS"
4229         map 'eval echo \${$(toupper ${v%s})_LIST}' $components
4230     )
4231 }
4232
4233 map 'disable_components $v' $LIBRARY_LIST
4234
4235 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
4236 set >> $logfile
4237
4238 test -n "$valgrind" && toolchain="valgrind-memcheck"
4239
4240 enabled ossfuzz && ! echo $CFLAGS | grep -q -- "-fsanitize="  && ! echo $CFLAGS | grep -q -- "-fcoverage-mapping" &&{
4241     add_cflags  -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
4242     add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
4243 }
4244
4245 case "$toolchain" in
4246     *-asan)
4247         cc_default="${toolchain%-asan}"
4248         add_cflags  -fsanitize=address
4249         add_ldflags -fsanitize=address
4250     ;;
4251     *-msan)
4252         cc_default="${toolchain%-msan}"
4253         add_cflags  -fsanitize=memory -fsanitize-memory-track-origins
4254         add_ldflags -fsanitize=memory
4255     ;;
4256     *-tsan)
4257         cc_default="${toolchain%-tsan}"
4258         add_cflags  -fsanitize=thread
4259         add_ldflags -fsanitize=thread
4260         case "$toolchain" in
4261             gcc-tsan)
4262                 add_cflags  -fPIC
4263                 add_ldflags -fPIC
4264                 ;;
4265         esac
4266     ;;
4267     *-usan)
4268         cc_default="${toolchain%-usan}"
4269         add_cflags  -fsanitize=undefined
4270         add_ldflags -fsanitize=undefined
4271     ;;
4272     valgrind-*)
4273         target_exec_default="valgrind"
4274         case "$toolchain" in
4275             valgrind-massif)
4276                 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"
4277                 ;;
4278             valgrind-memcheck)
4279                 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"
4280                 ;;
4281         esac
4282     ;;
4283     msvc)
4284         # Check whether the current MSVC version needs the C99 converter.
4285         # From MSVC 2013 (compiler major version 18) onwards, it does actually
4286         # support enough of C99 to build ffmpeg. Default to the new
4287         # behaviour if the regexp was unable to match anything, since this
4288         # successfully parses the version number of existing supported
4289         # versions that require the converter (MSVC 2010 and 2012).
4290         cl_major_ver=$(cl.exe 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
4291         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
4292             cc_default="cl.exe"
4293             cxx_default="cl.exe"
4294         else
4295             die "Unsupported MSVC version (2013 or newer required)"
4296         fi
4297         ld_default="$source_path/compat/windows/mslink"
4298         nm_default="dumpbin.exe -symbols"
4299         ar_default="lib.exe"
4300         case "${arch:-$arch_default}" in
4301         aarch64|arm64)
4302             as_default="armasm64.exe"
4303             ;;
4304         arm*)
4305             as_default="armasm.exe"
4306             ;;
4307         esac
4308         target_os_default="win32"
4309         # Use a relative path for TMPDIR. This makes sure all the
4310         # ffconf temp files are written with a relative path, avoiding
4311         # issues with msys/win32 path conversion for MSVC parameters
4312         # such as -Fo<file> or -out:<file>.
4313         TMPDIR=.
4314     ;;
4315     icl)
4316         cc_default="icl"
4317         ld_default="xilink"
4318         nm_default="dumpbin -symbols"
4319         ar_default="xilib"
4320         target_os_default="win32"
4321         TMPDIR=.
4322     ;;
4323     gcov)
4324         add_cflags  -fprofile-arcs -ftest-coverage
4325         add_ldflags -fprofile-arcs -ftest-coverage
4326     ;;
4327     llvm-cov)
4328         add_cflags -fprofile-arcs -ftest-coverage
4329         add_ldflags --coverage
4330     ;;
4331     hardened)
4332         add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
4333         add_cflags   -fno-strict-overflow -fstack-protector-all
4334         add_ldflags  -Wl,-z,relro -Wl,-z,now
4335         add_cflags   -fPIE
4336         add_ldexeflags -fPIE -pie
4337     ;;
4338     ?*)
4339         die "Unknown toolchain $toolchain"
4340     ;;
4341 esac
4342
4343 if test -n "$cross_prefix"; then
4344     test -n "$arch" && test -n "$target_os" ||
4345         die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
4346     enable cross_compile
4347 fi
4348
4349 set_default target_os
4350 if test "$target_os" = android; then
4351     cc_default="clang"
4352 fi
4353
4354 ar_default="${cross_prefix}${ar_default}"
4355 cc_default="${cross_prefix}${cc_default}"
4356 cxx_default="${cross_prefix}${cxx_default}"
4357 nm_default="${cross_prefix}${nm_default}"
4358 pkg_config_default="${cross_prefix}${pkg_config_default}"
4359 if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
4360     ranlib_default="${cross_prefix}${ranlib_default} -D"
4361 else
4362     ranlib_default="${cross_prefix}${ranlib_default}"
4363 fi
4364 strip_default="${cross_prefix}${strip_default}"
4365 windres_default="${cross_prefix}${windres_default}"
4366
4367 sysinclude_default="${sysroot}/usr/include"
4368
4369 if enabled cuda_sdk; then
4370     warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead."
4371     enable cuda_nvcc
4372 fi
4373
4374 if enabled cuda_nvcc; then
4375     nvcc_default="nvcc"
4376     nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
4377 else
4378     nvcc_default="clang"
4379     nvccflags_default="--cuda-gpu-arch=sm_30 -O2"
4380     NVCC_C=""
4381 fi
4382
4383 set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
4384     target_exec x86asmexe nvcc
4385 enabled cross_compile || host_cc_default=$cc
4386 set_default host_cc
4387
4388 pkg_config_fail_message=""
4389 if ! $pkg_config --version >/dev/null 2>&1; then
4390     warn "$pkg_config not found, library detection may fail."
4391     pkg_config=false
4392 elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
4393     pkg_config_fail_message="
4394 Note: When building a static binary, add --pkg-config-flags=\"--static\"."
4395 fi
4396
4397 if test $doxygen != $doxygen_default && \
4398   ! $doxygen --version >/dev/null 2>&1; then
4399     warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
4400 fi
4401
4402 exesuf() {
4403     case $1 in
4404         mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
4405     esac
4406 }
4407
4408 EXESUF=$(exesuf $target_os)
4409 HOSTEXESUF=$(exesuf $host_os)
4410
4411 # set temporary file name
4412 : ${TMPDIR:=$TEMPDIR}
4413 : ${TMPDIR:=$TMP}
4414 : ${TMPDIR:=/tmp}
4415
4416 if [ -n "$tempprefix" ] ; then
4417     mktemp(){
4418         tmpname="$tempprefix.${HOSTNAME}.${UID}"
4419         echo "$tmpname"
4420         mkdir "$tmpname"
4421     }
4422 elif ! test_cmd mktemp -u XXXXXX; then
4423     # simple replacement for missing mktemp
4424     # NOT SAFE FOR GENERAL USE
4425     mktemp(){
4426         tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
4427         echo "$tmpname"
4428         mkdir "$tmpname"
4429     }
4430 fi
4431
4432 FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
4433     die "Unable to create temporary directory in $TMPDIR."
4434
4435 tmpfile(){
4436     tmp="${FFTMPDIR}/test"$2
4437     (set -C; exec > $tmp) 2> /dev/null ||
4438         die "Unable to create temporary file in $FFTMPDIR."
4439     eval $1=$tmp
4440 }
4441
4442 trap 'rm -rf -- "$FFTMPDIR"' EXIT
4443 trap 'exit 2' INT
4444
4445 tmpfile TMPASM .asm
4446 tmpfile TMPC   .c
4447 tmpfile TMPCPP .cpp
4448 tmpfile TMPE   $EXESUF
4449 tmpfile TMPH   .h
4450 tmpfile TMPM   .m
4451 tmpfile TMPCU  .cu
4452 tmpfile TMPO   .o
4453 tmpfile TMPS   .S
4454 tmpfile TMPSH  .sh
4455 tmpfile TMPV   .ver
4456
4457 unset -f mktemp
4458
4459 chmod +x $TMPE
4460
4461 # make sure we can execute files in $TMPDIR
4462 cat > $TMPSH 2>> $logfile <<EOF
4463 #! /bin/sh
4464 EOF
4465 chmod +x $TMPSH >> $logfile 2>&1
4466 if ! $TMPSH >> $logfile 2>&1; then
4467     cat <<EOF
4468 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
4469 variable to another directory and make sure that it is not mounted noexec.
4470 EOF
4471     die "Sanity test failed."
4472 fi
4473
4474 armasm_flags(){
4475     for flag; do
4476         case $flag in
4477             # Filter out MSVC cl.exe options from cflags that shouldn't
4478             # be passed to gas-preprocessor
4479             -M[TD]*)                                            ;;
4480             *)                  echo $flag                      ;;
4481         esac
4482    done
4483 }
4484
4485 cparser_flags(){
4486     for flag; do
4487         case $flag in
4488             -Wno-switch)             echo -Wno-switch-enum ;;
4489             -Wno-format-zero-length) ;;
4490             -Wdisabled-optimization) ;;
4491             -Wno-pointer-sign)       echo -Wno-other ;;
4492             *)                       echo $flag ;;
4493         esac
4494     done
4495 }
4496
4497 msvc_common_flags(){
4498     for flag; do
4499         case $flag in
4500             # In addition to specifying certain flags under the compiler
4501             # specific filters, they must be specified here as well or else the
4502             # generic catch all at the bottom will print the original flag.
4503             -Wall)                ;;
4504             -Wextra)              ;;
4505             -std=c*)              ;;
4506             # Common flags
4507             -fomit-frame-pointer) ;;
4508             -g)                   echo -Z7 ;;
4509             -fno-math-errno)      ;;
4510             -fno-common)          ;;
4511             -fno-signed-zeros)    ;;
4512             -fPIC)                ;;
4513             -mthumb)              ;;
4514             -march=*)             ;;
4515             -lz)                  echo zlib.lib ;;
4516             -lx264)               echo libx264.lib ;;
4517             -lstdc++)             ;;
4518             -l*)                  echo ${flag#-l}.lib ;;
4519             -LARGEADDRESSAWARE)   echo $flag ;;
4520             -L*)                  echo -libpath:${flag#-L} ;;
4521             -Wl,*)                ;;
4522             *)                    echo $flag ;;
4523         esac
4524     done
4525 }
4526
4527 msvc_flags(){
4528     msvc_common_flags "$@"
4529     for flag; do
4530         case $flag in
4531             -Wall)                echo -W3 -wd4018 -wd4146 -wd4244 -wd4305     \
4532                                        -wd4554 ;;
4533             -Wextra)              echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
4534                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
4535                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
4536                                        -wd4307 \
4537                                        -wd4273 -wd4554 -wd4701 -wd4703 ;;
4538         esac
4539     done
4540 }
4541
4542 icl_flags(){
4543     msvc_common_flags "$@"
4544     for flag; do
4545         case $flag in
4546             # Despite what Intel's documentation says -Wall, which is supported
4547             # on Windows, does enable remarks so disable them here.
4548             -Wall)                echo $flag -Qdiag-disable:remark ;;
4549             -std=c99)             echo -Qstd=c99 ;;
4550             -flto)                echo -ipo ;;
4551         esac
4552     done
4553 }
4554
4555 icc_flags(){
4556     for flag; do
4557         case $flag in
4558             -flto)                echo -ipo ;;
4559             *)                    echo $flag ;;
4560         esac
4561     done
4562 }
4563
4564 suncc_flags(){
4565     for flag; do
4566         case $flag in
4567             -march=*|-mcpu=*)
4568                 case "${flag#*=}" in
4569                     native)                   echo -xtarget=native       ;;
4570                     v9|niagara)               echo -xarch=sparc          ;;
4571                     ultrasparc)               echo -xarch=sparcvis       ;;
4572                     ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
4573                     i586|pentium)             echo -xchip=pentium        ;;
4574                     i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
4575                     pentium3*|c3-2)           echo -xtarget=pentium3     ;;
4576                     pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
4577                     pentium4*)          echo -xtarget=pentium4           ;;
4578                     prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
4579                     *-sse3)             echo -xarch=sse3                 ;;
4580                     core2)              echo -xarch=ssse3 -xchip=core2   ;;
4581                     bonnell)                   echo -xarch=ssse3         ;;
4582                     corei7|nehalem)            echo -xtarget=nehalem     ;;
4583                     westmere)                  echo -xtarget=westmere    ;;
4584                     silvermont)                echo -xarch=sse4_2        ;;
4585                     corei7-avx|sandybridge)    echo -xtarget=sandybridge ;;
4586                     core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
4587                                                echo -xarch=avx           ;;
4588                     amdfam10|barcelona)        echo -xtarget=barcelona   ;;
4589                     btver1)                    echo -xarch=amdsse4a      ;;
4590                     btver2|bdver*|znver*)      echo -xarch=avx           ;;
4591                     athlon-4|athlon-[mx]p)     echo -xarch=ssea          ;;
4592                     k8|opteron|athlon64|athlon-fx)
4593                                                echo -xarch=sse2a         ;;
4594                     athlon*)                   echo -xarch=pentium_proa  ;;
4595                 esac
4596                 ;;
4597             -std=c99)             echo -xc99              ;;
4598             -fomit-frame-pointer) echo -xregs=frameptr    ;;
4599             -fPIC)                echo -KPIC -xcode=pic32 ;;
4600             -W*,*)                echo $flag              ;;
4601             -f*-*|-W*|-mimpure-text)                      ;;
4602             -shared)              echo -G                 ;;
4603             *)                    echo $flag              ;;
4604         esac
4605     done
4606 }
4607
4608 probe_cc(){
4609     pfx=$1
4610     _cc=$2
4611     first=$3
4612
4613     unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
4614     unset _ld_o _ldflags _ld_lib _ld_path
4615     unset _depflags _DEPCMD _DEPFLAGS
4616     _flags_filter=echo
4617
4618     if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
4619         true # no-op to avoid reading stdin in following checks
4620     elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
4621         _type=llvm_gcc
4622         gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
4623         _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
4624         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4625         _cflags_speed='-O3'
4626         _cflags_size='-Os'
4627     elif $_cc -v 2>&1 | grep -qi ^gcc; then
4628         _type=gcc
4629         gcc_version=$($_cc --version | head -n1)
4630         gcc_basever=$($_cc -dumpversion)
4631         gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
4632         gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
4633         _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
4634         case $gcc_basever in
4635             2) ;;
4636             2.*) ;;
4637             *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
4638         esac
4639         if [ "$first" = true ]; then
4640             case $gcc_basever in
4641                 4.2*)
4642                 warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
4643             esac
4644         fi
4645         _cflags_speed='-O3'
4646         _cflags_size='-Os'
4647     elif $_cc --version 2>/dev/null | grep -q ^icc; then
4648         _type=icc
4649         _ident=$($_cc --version | head -n1)
4650         _depflags='-MMD'
4651         _cflags_speed='-O3'
4652         _cflags_size='-Os'
4653         _cflags_noopt='-O1'
4654         _flags_filter=icc_flags
4655     elif $_cc -v 2>&1 | grep -q xlc; then
4656         _type=xlc
4657         _ident=$($_cc -qversion 2>/dev/null | head -n1)
4658         _cflags_speed='-O5'
4659         _cflags_size='-O5 -qcompact'
4660     elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
4661         test -d "$sysroot" || die "No valid sysroot specified."
4662         _type=armcc
4663         _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
4664         armcc_conf="$PWD/armcc.conf"
4665         $_cc --arm_linux_configure                 \
4666              --arm_linux_config_file="$armcc_conf" \
4667              --configure_sysroot="$sysroot"        \
4668              --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
4669              die "Error creating armcc configuration file."
4670         $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
4671         _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
4672         as_default="${cross_prefix}gcc"
4673         _depflags='-MMD'
4674         _cflags_speed='-O3'
4675         _cflags_size='-Os'
4676     elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
4677         _type=clang
4678         _ident=$($_cc --version 2>/dev/null | head -n1)
4679         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4680         _cflags_speed='-O3'
4681         _cflags_size='-Oz'
4682     elif $_cc -V 2>&1 | grep -q Sun; then
4683         _type=suncc
4684         _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
4685         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
4686         _DEPFLAGS='-xM1 -xc99'
4687         _ldflags='-std=c99'
4688         _cflags_speed='-O5'
4689         _cflags_size='-O5 -xspace'
4690         _flags_filter=suncc_flags
4691     elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
4692         _type=pathscale
4693         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
4694         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4695         _cflags_speed='-O2'
4696         _cflags_size='-Os'
4697         _flags_filter='filter_out -Wdisabled-optimization'
4698     elif $_cc -v 2>&1 | grep -q Open64; then
4699         _type=open64
4700         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
4701         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4702         _cflags_speed='-O2'
4703         _cflags_size='-Os'
4704         _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
4705     elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
4706         _type=armasm
4707         _ident=$($_cc | head -n1)
4708         # 4509: "This form of conditional instruction is deprecated"
4709         _flags="-nologo -ignore 4509"
4710         _flags_filter=armasm_flags
4711     elif $_cc 2>&1 | grep -q Intel; then
4712         _type=icl
4713         _ident=$($_cc 2>&1 | head -n1)
4714         _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
4715         # Not only is O3 broken on 13.x+ but it is slower on all previous
4716         # versions (tested) as well.
4717         _cflags_speed="-O2"
4718         _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
4719         if $_cc 2>&1 | grep -q Linker; then
4720             _ld_o='-out:$@'
4721         else
4722             _ld_o='-Fe$@'
4723         fi
4724         _cc_o='-Fo$@'
4725         _cc_e='-P'
4726         _flags_filter=icl_flags
4727         _ld_lib='lib%.a'
4728         _ld_path='-libpath:'
4729         # -Qdiag-error to make icl error when seeing certain unknown arguments
4730         _flags='-nologo -Qdiag-error:4044,10157'
4731         # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
4732         # with MSVC which enables it by default.
4733         _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
4734         disable stripping
4735     elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
4736         # lld can emulate multiple different linkers; in ms link.exe mode,
4737         # the -? parameter gives the help output which contains an identifyable
4738         # string, while it gives an error in other modes.
4739         _type=lld-link
4740         # The link.exe mode doesn't have a switch for getting the version,
4741         # but we can force it back to gnu mode and get the version from there.
4742         _ident=$($_cc -flavor gnu --version 2>/dev/null)
4743         _ld_o='-out:$@'
4744         _flags_filter=msvc_flags
4745         _ld_lib='lib%.a'
4746         _ld_path='-libpath:'
4747     elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
4748         _type=msvc
4749         if $_cc -nologo- 2>&1 | grep -q Microsoft; then
4750             _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
4751         else
4752             _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
4753         fi
4754         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
4755         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
4756         _cflags_speed="-O2"
4757         _cflags_size="-O1"
4758         _cflags_noopt="-O1"
4759         if $_cc -nologo- 2>&1 | grep -q Linker; then
4760             _ld_o='-out:$@'
4761         else
4762             _ld_o='-Fe$@'
4763         fi
4764         _cc_o='-Fo$@'
4765         _cc_e='-P -Fi$@'
4766         _flags_filter=msvc_flags
4767         _ld_lib='lib%.a'
4768         _ld_path='-libpath:'
4769         _flags='-nologo'
4770         disable stripping
4771     elif $_cc --version 2>/dev/null | grep -q ^cparser; then
4772         _type=cparser
4773         _ident=$($_cc --version | head -n1)
4774         _depflags='-MMD'
4775         _cflags_speed='-O4'
4776         _cflags_size='-O2'
4777         _flags_filter=cparser_flags
4778     fi
4779
4780     eval ${pfx}_type=\$_type
4781     eval ${pfx}_ident=\$_ident
4782 }
4783
4784 set_ccvars(){
4785     eval ${1}_C=\${_cc_c-\${${1}_C}}
4786     eval ${1}_E=\${_cc_e-\${${1}_E}}
4787     eval ${1}_O=\${_cc_o-\${${1}_O}}
4788
4789     if [ -n "$_depflags" ]; then
4790         eval ${1}_DEPFLAGS=\$_depflags
4791     else
4792         eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
4793         eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
4794         eval DEP${1}FLAGS=\$_flags
4795     fi
4796 }
4797
4798 probe_cc cc "$cc" "true"
4799 cflags_filter=$_flags_filter
4800 cflags_speed=$_cflags_speed
4801 cflags_size=$_cflags_size
4802 cflags_noopt=$_cflags_noopt
4803 add_cflags $_flags $_cflags
4804 cc_ldflags=$_ldflags
4805 set_ccvars CC
4806 set_ccvars CXX
4807
4808 probe_cc hostcc "$host_cc"
4809 host_cflags_filter=$_flags_filter
4810 host_cflags_speed=$_cflags_speed
4811 add_host_cflags  $_flags $_cflags
4812 set_ccvars HOSTCC
4813
4814 test -n "$cc_type" && enable $cc_type ||
4815     warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
4816
4817 : ${as_default:=$cc}
4818 : ${objcc_default:=$cc}
4819 : ${dep_cc_default:=$cc}
4820 : ${ld_default:=$cc}
4821 : ${host_ld_default:=$host_cc}
4822 set_default ar as objcc dep_cc ld ln_s host_ld windres
4823
4824 probe_cc as "$as"
4825 asflags_filter=$_flags_filter
4826 add_asflags $_flags $_cflags
4827 set_ccvars AS
4828
4829 probe_cc objcc "$objcc"
4830 objcflags_filter=$_flags_filter
4831 add_objcflags $_flags $_cflags
4832 set_ccvars OBJC
4833
4834 probe_cc ld "$ld"
4835 ldflags_filter=$_flags_filter
4836 add_ldflags $_flags $_ldflags
4837 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
4838 LD_O=${_ld_o-$LD_O}
4839 LD_LIB=${_ld_lib-$LD_LIB}
4840 LD_PATH=${_ld_path-$LD_PATH}
4841
4842 probe_cc hostld "$host_ld"
4843 host_ldflags_filter=$_flags_filter
4844 add_host_ldflags $_flags $_ldflags
4845 HOSTLD_O=${_ld_o-$HOSTLD_O}
4846
4847 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
4848     probe_cc depcc "$dep_cc"
4849     CCDEP=${_DEPCMD:-$DEPCMD}
4850     CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
4851     DEPCCFLAGS=$_flags
4852 fi
4853
4854 if $ar 2>&1 | grep -q Microsoft; then
4855     arflags="-nologo"
4856     ar_o='-out:$@'
4857 elif $ar 2>&1 | grep -q "\[D\] "; then
4858     arflags="rcD"
4859     ar_o='$@'
4860 else
4861     arflags="rc"
4862     ar_o='$@'
4863 fi
4864
4865 add_cflags $extra_cflags
4866 add_cxxflags $extra_cxxflags
4867 add_objcflags $extra_objcflags
4868 add_asflags $extra_cflags
4869
4870 if test -n "$sysroot"; then
4871     case "$cc_type" in
4872         gcc|llvm_gcc|clang)
4873             add_cppflags --sysroot="$sysroot"
4874             add_ldflags --sysroot="$sysroot"
4875         ;;
4876     esac
4877 fi
4878
4879 if test "$cpu" = host; then
4880     enabled cross_compile &&
4881         warn "--cpu=host makes no sense when cross-compiling."
4882
4883     case "$cc_type" in
4884         gcc|llvm_gcc)
4885             check_native(){
4886                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
4887                 sed -n "/cc1.*$1=/{
4888                             s/.*$1=\\([^ ]*\\).*/\\1/
4889                             p
4890                             q
4891                         }" $TMPE
4892             }
4893             cpu=$(check_native -march || check_native -mcpu)
4894         ;;
4895         clang)
4896             check_native(){
4897                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
4898                 sed -n "/cc1.*-target-cpu /{
4899                             s/.*-target-cpu \\([^ ]*\\).*/\\1/
4900                             p
4901                             q
4902                         }" $TMPE
4903             }
4904             cpu=$(check_native -march)
4905         ;;
4906     esac
4907
4908     test "${cpu:-host}" = host &&
4909         die "--cpu=host not supported with compiler $cc"
4910 fi
4911
4912 # Deal with common $arch aliases
4913 case "$arch" in
4914     aarch64|arm64)
4915         arch="aarch64"
4916     ;;
4917     arm*|iPad*|iPhone*)
4918         arch="arm"
4919     ;;
4920     mips*|IP*)
4921         case "$arch" in
4922         *el)
4923             add_cppflags -EL
4924             add_ldflags -EL
4925         ;;
4926         *eb)
4927             add_cppflags -EB
4928             add_ldflags -EB
4929         ;;
4930         esac
4931         arch="mips"
4932     ;;
4933     parisc*|hppa*)
4934         arch="parisc"
4935     ;;
4936     "Power Macintosh"|ppc*|powerpc*)
4937         arch="ppc"
4938     ;;
4939     s390|s390x)
4940         arch="s390"
4941     ;;
4942     sh4|sh)
4943         arch="sh4"
4944     ;;
4945     sun4*|sparc*)
4946         arch="sparc"
4947     ;;
4948     tilegx|tile-gx)
4949         arch="tilegx"
4950     ;;
4951     i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
4952         arch="x86"
4953     ;;
4954 esac
4955
4956 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
4957 enable $arch
4958
4959 # Add processor-specific flags
4960 if enabled aarch64; then
4961
4962     case $cpu in
4963         armv*)
4964             cpuflags="-march=$cpu"
4965         ;;
4966         *)
4967             cpuflags="-mcpu=$cpu"
4968         ;;
4969     esac
4970
4971 elif enabled alpha; then
4972
4973     cpuflags="-mcpu=$cpu"
4974
4975 elif enabled arm; then
4976
4977     check_arm_arch() {
4978         test_cpp_condition stddef.h \
4979             "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
4980             $cpuflags
4981     }
4982
4983     probe_arm_arch() {
4984         if   check_arm_arch 4;        then echo armv4
4985         elif check_arm_arch 4T;       then echo armv4t
4986         elif check_arm_arch 5;        then echo armv5
4987         elif check_arm_arch 5E;       then echo armv5e
4988         elif check_arm_arch 5T;       then echo armv5t
4989         elif check_arm_arch 5TE;      then echo armv5te
4990         elif check_arm_arch 5TEJ;     then echo armv5te
4991         elif check_arm_arch 6;        then echo armv6
4992         elif check_arm_arch 6J;       then echo armv6j
4993         elif check_arm_arch 6K;       then echo armv6k
4994         elif check_arm_arch 6Z;       then echo armv6z
4995         elif check_arm_arch 6KZ;      then echo armv6zk
4996         elif check_arm_arch 6ZK;      then echo armv6zk
4997         elif check_arm_arch 6T2;      then echo armv6t2
4998         elif check_arm_arch 7;        then echo armv7
4999         elif check_arm_arch 7A  7_A;  then echo armv7-a
5000         elif check_arm_arch 7S;       then echo armv7-a
5001         elif check_arm_arch 7R  7_R;  then echo armv7-r
5002         elif check_arm_arch 7M  7_M;  then echo armv7-m
5003         elif check_arm_arch 7EM 7E_M; then echo armv7-m
5004         elif check_arm_arch 8A  8_A;  then echo armv8-a
5005         fi
5006     }
5007
5008     [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
5009
5010     case $cpu in
5011         armv*)
5012             cpuflags="-march=$cpu"
5013             subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
5014         ;;
5015         *)
5016             cpuflags="-mcpu=$cpu"
5017             case $cpu in
5018                 cortex-a*)                               subarch=armv7a  ;;
5019                 cortex-r*)                               subarch=armv7r  ;;
5020                 cortex-m*)                 enable thumb; subarch=armv7m  ;;
5021                 arm11*)                                  subarch=armv6   ;;
5022                 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
5023                 armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
5024                 *)                             subarch=$(probe_arm_arch) ;;
5025             esac
5026         ;;
5027     esac
5028
5029     case "$subarch" in
5030         armv5t*)    enable fast_clz                ;;
5031         armv[6-8]*)
5032             enable fast_clz
5033             disabled fast_unaligned || enable fast_unaligned
5034             ;;
5035     esac
5036
5037 elif enabled avr32; then
5038
5039     case $cpu in
5040         ap7[02]0[0-2])
5041             subarch="avr32_ap"
5042             cpuflags="-mpart=$cpu"
5043         ;;
5044         ap)
5045             subarch="avr32_ap"
5046             cpuflags="-march=$cpu"
5047         ;;
5048         uc3[ab]*)
5049             subarch="avr32_uc"
5050             cpuflags="-mcpu=$cpu"
5051         ;;
5052         uc)
5053             subarch="avr32_uc"
5054             cpuflags="-march=$cpu"
5055         ;;
5056     esac
5057
5058 elif enabled bfin; then
5059
5060     cpuflags="-mcpu=$cpu"
5061
5062 elif enabled mips; then
5063
5064     if [ "$cpu" != "generic" ]; then
5065         disable mips32r2
5066         disable mips32r5
5067         disable mips64r2
5068         disable mips32r6
5069         disable mips64r6
5070         disable loongson2
5071         disable loongson3
5072         disable mipsdsp
5073         disable mipsdspr2
5074
5075         cpuflags="-march=$cpu"
5076
5077         case $cpu in
5078             # General ISA levels
5079             mips1|mips3)
5080             ;;
5081             mips32r2)
5082                 enable mips32r2
5083             ;;
5084             mips32r5)
5085                 enable mips32r2
5086                 enable mips32r5
5087             ;;
5088             mips64r2|mips64r5)
5089                 enable mips64r2
5090                 enable loongson3
5091             ;;
5092             # Cores from MIPS(MTI)
5093             24kc)
5094                 disable mipsfpu
5095                 enable mips32r2
5096             ;;
5097             24kf*|24kec|34kc|74Kc|1004kc)
5098                 enable mips32r2
5099             ;;
5100             24kef*|34kf*|1004kf*)
5101                 enable mipsdsp
5102                 enable mips32r2
5103             ;;
5104             p5600)
5105                 enable mips32r2
5106                 enable mips32r5
5107                 check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
5108             ;;
5109             i6400)
5110                 enable mips64r6
5111                 check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
5112             ;;
5113             p6600)
5114                 enable mips64r6
5115                 check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
5116             ;;
5117             # Cores from Loongson
5118             loongson2e|loongson2f|loongson3*)
5119                 enable local_aligned
5120                 enable simd_align_16
5121                 enable fast_64bit
5122                 enable fast_clz
5123                 enable fast_cmov
5124                 enable fast_unaligned
5125                 disable aligned_stack
5126                 # When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
5127                 if test "$cc_type" = "gcc"; then
5128                     case $gcc_basever in
5129                         2|2.*|3.*|4.*|5.0|5.1|5.2)
5130                         expensive_optimization_flag="-fno-expensive-optimizations"
5131                         ;;
5132                         *)
5133                         expensive_optimization_flag=""
5134                         ;;
5135                     esac
5136                 fi
5137
5138                 case $cpu in
5139                     loongson3*)
5140                         enable loongson3
5141                         cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
5142                     ;;
5143                     loongson2e)
5144                         enable loongson2
5145                         cpuflags="-march=loongson2e -mhard-float $expensive_optimization_flag"
5146                     ;;
5147                     loongson2f)
5148                         enable loongson2
5149                         cpuflags="-march=loongson2f -mhard-float $expensive_optimization_flag"
5150                     ;;
5151                 esac
5152             ;;
5153             *)
5154                 warn "unknown MIPS CPU"
5155             ;;
5156         esac
5157
5158     else
5159         disable mipsdsp
5160         disable mipsdspr2
5161         # Disable DSP stuff for generic CPU, it can't be detected at runtime.
5162         warn 'generic cpu selected'
5163     fi
5164
5165 elif enabled ppc; then
5166
5167     disable ldbrx
5168
5169     case $(tolower $cpu) in
5170         601|ppc601|powerpc601)
5171             cpuflags="-mcpu=601"
5172             disable altivec
5173         ;;
5174         603*|ppc603*|powerpc603*)
5175             cpuflags="-mcpu=603"
5176             disable altivec
5177         ;;
5178         604*|ppc604*|powerpc604*)
5179             cpuflags="-mcpu=604"
5180             disable altivec
5181         ;;
5182         g3|75*|ppc75*|powerpc75*)
5183             cpuflags="-mcpu=750"
5184             disable altivec
5185         ;;
5186         g4|745*|ppc745*|powerpc745*)
5187             cpuflags="-mcpu=7450"
5188             disable vsx
5189         ;;
5190         74*|ppc74*|powerpc74*)
5191             cpuflags="-mcpu=7400"
5192             disable vsx
5193         ;;
5194         g5|970|ppc970|powerpc970)
5195             cpuflags="-mcpu=970"
5196             disable vsx
5197         ;;
5198         power[3-6]*)
5199             cpuflags="-mcpu=$cpu"
5200             disable vsx
5201         ;;
5202         power[7-8]*)
5203             cpuflags="-mcpu=$cpu"
5204         ;;
5205         cell)
5206             cpuflags="-mcpu=cell"
5207             enable ldbrx
5208             disable vsx
5209         ;;
5210         e500mc)
5211             cpuflags="-mcpu=e500mc"
5212             disable altivec
5213         ;;
5214         e500v2)
5215             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
5216             disable altivec
5217             disable dcbzl
5218         ;;
5219         e500)
5220             cpuflags="-mcpu=8540 -mhard-float"
5221             disable altivec
5222             disable dcbzl
5223         ;;
5224     esac
5225
5226 elif enabled sparc; then
5227
5228     case $cpu in
5229         cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
5230             cpuflags="-mcpu=$cpu"
5231         ;;
5232         ultrasparc*|niagara[234])
5233             cpuflags="-mcpu=$cpu"
5234         ;;
5235     esac
5236
5237 elif enabled x86; then
5238
5239     case $cpu in
5240         i[345]86|pentium)
5241             cpuflags="-march=$cpu"
5242             disable i686
5243             disable mmx
5244         ;;
5245         # targets that do NOT support nopl and conditional mov (cmov)
5246         pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
5247             cpuflags="-march=$cpu"
5248             disable i686
5249         ;;
5250         # targets that do support nopl and conditional mov (cmov)
5251         i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
5252         |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
5253         |amdfam10|barcelona|b[dt]ver*|znver*)
5254             cpuflags="-march=$cpu"
5255             enable i686
5256             enable fast_cmov
5257         ;;
5258         # targets that do support conditional mov but on which it's slow
5259         pentium4|pentium4m|prescott|nocona)
5260             cpuflags="-march=$cpu"
5261             enable i686
5262             disable fast_cmov
5263         ;;
5264     esac
5265
5266 fi
5267
5268 if [ "$cpu" != generic ]; then
5269     add_cflags  $cpuflags
5270     add_asflags $cpuflags
5271     test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
5272 fi
5273
5274 # compiler sanity check
5275 test_exec <<EOF
5276 int main(void){ return 0; }
5277 EOF
5278 if test "$?" != 0; then
5279     echo "$cc is unable to create an executable file."
5280     if test -z "$cross_prefix" && ! enabled cross_compile ; then
5281         echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
5282         echo "Only do this if you know what cross compiling means."
5283     fi
5284     die "C compiler test failed."
5285 fi
5286
5287 add_cppflags -D_ISOC99_SOURCE
5288 add_cxxflags -D__STDC_CONSTANT_MACROS
5289 check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
5290
5291 # some compilers silently accept -std=c11, so we also need to check that the
5292 # version macro is defined properly
5293 test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
5294     add_cflags -std=c11 ||
5295     check_cflags -std=c99
5296
5297 check_cppflags -D_FILE_OFFSET_BITS=64
5298 check_cppflags -D_LARGEFILE_SOURCE
5299
5300 add_host_cppflags -D_ISOC99_SOURCE
5301 check_host_cflags -std=c99
5302 check_host_cflags -Wall
5303 check_host_cflags $host_cflags_speed
5304
5305 check_64bit(){
5306     arch32=$1
5307     arch64=$2
5308     expr=${3:-'sizeof(void *) > 4'}
5309     test_code cc "" "int test[2*($expr) - 1]" &&
5310         subarch=$arch64 || subarch=$arch32
5311     enable $subarch
5312 }
5313
5314 case "$arch" in
5315     aarch64|alpha|ia64)
5316         enabled shared && enable_weak pic
5317     ;;
5318     mips)
5319         check_64bit mips mips64 '_MIPS_SIM > 1'
5320         enabled shared && enable_weak pic
5321     ;;
5322     parisc)
5323         check_64bit parisc parisc64
5324         enabled shared && enable_weak pic
5325     ;;
5326     ppc)
5327         check_64bit ppc ppc64
5328         enabled shared && enable_weak pic
5329     ;;
5330     s390)
5331         check_64bit s390 s390x
5332         enabled shared && enable_weak pic
5333     ;;
5334     sparc)
5335         check_64bit sparc sparc64
5336         enabled shared && enable_weak pic
5337     ;;
5338     x86)
5339         check_64bit x86_32 x86_64
5340         # Treat x32 as x64 for now. Note it also needs pic if shared
5341         test "$subarch" = "x86_32" && test_cpp_condition stddef.h 'defined(__x86_64__)' &&
5342             subarch=x86_64 && enable x86_64 && disable x86_32
5343         if enabled x86_64; then
5344             enabled shared && enable_weak pic
5345             objformat=elf64
5346         fi
5347     ;;
5348 esac
5349
5350 # OS specific
5351 case $target_os in
5352     aix)
5353         SHFLAGS=-shared
5354         add_cppflags '-I\$(SRC_PATH)/compat/aix'
5355         enabled shared && add_ldflags -Wl,-brtl
5356         arflags='-Xany -r -c'
5357         striptype=""
5358         ;;
5359     android)
5360         disable symver
5361         enable section_data_rel_ro
5362         add_cflags -fPIE
5363         add_ldexeflags -fPIE -pie
5364         SLIB_INSTALL_NAME='$(SLIBNAME)'
5365         SLIB_INSTALL_LINKS=
5366         SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
5367         ;;
5368     haiku)
5369         prefix_default="/boot/common"
5370         network_extralibs="-lnetwork"
5371         host_extralibs=
5372         ;;
5373     sunos)
5374         SHFLAGS='-shared -Wl,-h,$$(@F)'
5375         enabled x86 && append SHFLAGS -mimpure-text
5376         network_extralibs="-lsocket -lnsl"
5377         add_cppflags -D__EXTENSIONS__
5378         # When using suncc to build, the Solaris linker will mark
5379         # an executable with each instruction set encountered by
5380         # the Solaris assembler.  As our libraries contain their own
5381         # guards for processor-specific code, instead suppress
5382         # generation of the HWCAPS ELF section on Solaris x86 only.
5383         enabled_all suncc x86 &&
5384             echo "hwcap_1 = OVERRIDE;" > mapfile &&
5385             add_ldflags -Wl,-M,mapfile
5386         nm_default='nm -P -g'
5387         striptype=""
5388         version_script='-M'
5389         VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
5390         ;;
5391     netbsd)
5392         disable symver
5393         oss_indev_extralibs="-lossaudio"
5394         oss_outdev_extralibs="-lossaudio"
5395         enabled gcc || check_ldflags -Wl,-zmuldefs
5396         ;;
5397     openbsd|bitrig)
5398         disable symver
5399         enable section_data_rel_ro
5400         striptype=""
5401         SHFLAGS='-shared'
5402         SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
5403         SLIB_INSTALL_LINKS=
5404         oss_indev_extralibs="-lossaudio"
5405         oss_outdev_extralibs="-lossaudio"
5406         ;;
5407     dragonfly)
5408         disable symver
5409         ;;
5410     freebsd)
5411         ;;
5412     bsd/os)
5413         add_extralibs -lpoll -lgnugetopt
5414         strip="strip -d"
5415         ;;
5416     darwin)
5417         enabled ppc && add_asflags -force_cpusubtype_ALL
5418         install_name_dir_default='$(SHLIBDIR)'
5419         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
5420         enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
5421         strip="${strip} -x"
5422         add_ldflags -Wl,-dynamic,-search_paths_first
5423         check_cflags -Werror=partial-availability
5424         SLIBSUF=".dylib"
5425         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
5426         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
5427         enabled x86_64 && objformat="macho64" || objformat="macho32"
5428         enabled_any pic shared x86_64 ||
5429             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
5430         check_headers dispatch/dispatch.h &&
5431             add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
5432         if test -n "$sysroot"; then
5433             is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
5434             is_in -isysroot $ld $LDFLAGS          || check_ldflags  -isysroot $sysroot
5435         fi
5436         version_script='-exported_symbols_list'
5437         VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
5438         # Workaround for Xcode 11 -fstack-check bug
5439         if enabled clang; then
5440             clang_version=$($cc -dumpversion)
5441             test ${clang_version%%.*} -eq 11 && add_cflags -fno-stack-check
5442         fi
5443         ;;
5444     msys*)
5445         die "Native MSYS builds are discouraged, please use the MINGW environment."
5446         ;;
5447     mingw32*|mingw64*)
5448         target_os=mingw32
5449         LIBTARGET=i386
5450         if enabled x86_64; then
5451             LIBTARGET="i386:x86-64"
5452         elif enabled arm; then
5453             LIBTARGET="arm"
5454         elif enabled aarch64; then
5455             LIBTARGET="arm64"
5456         fi
5457         if enabled shared; then
5458             # Cannot build both shared and static libs when using dllimport.
5459             disable static
5460         fi
5461         enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
5462         enabled x86_32 && check_ldflags -Wl,--large-address-aware
5463         shlibdir_default="$bindir_default"
5464         SLIBPREF=""
5465         SLIBSUF=".dll"
5466         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
5467         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
5468         if test_cmd lib.exe -list; then
5469             SLIB_EXTRA_CMD=-'lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
5470             if enabled x86_64; then
5471                 LIBTARGET=x64
5472             fi
5473         else
5474             SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
5475         fi
5476         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
5477         SLIB_INSTALL_LINKS=
5478         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
5479         SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
5480         SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
5481         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
5482         enabled x86_64 && objformat="win64" || objformat="win32"
5483         dlltool="${cross_prefix}dlltool"
5484         ranlib=:
5485         enable dos_paths
5486         check_ldflags -Wl,--nxcompat,--dynamicbase
5487         # Lets work around some stupidity in binutils.
5488         # ld will strip relocations from executables even though we need them
5489         # for dynamicbase (ASLR).  Using -pie does retain the reloc section
5490         # however ld then forgets what the entry point should be (oops) so we
5491         # have to manually (re)set it.
5492         if enabled x86_32; then
5493             disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
5494         elif enabled x86_64; then
5495             disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
5496             check_ldflags -Wl,--high-entropy-va # binutils 2.25
5497             # Set image base >4GB for extra entropy with HEASLR
5498             add_ldexeflags -Wl,--image-base,0x140000000
5499             append SHFLAGS -Wl,--image-base,0x180000000
5500         fi
5501         ;;
5502     win32|win64)
5503         disable symver
5504         if enabled shared; then
5505             # Link to the import library instead of the normal static library
5506             # for shared libs.
5507             LD_LIB='%.lib'
5508             # Cannot build both shared and static libs with MSVC or icl.
5509             disable static
5510         fi
5511         enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
5512         shlibdir_default="$bindir_default"
5513         SLIBPREF=""
5514         SLIBSUF=".dll"
5515         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
5516         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
5517         SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
5518         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
5519         SLIB_INSTALL_LINKS=
5520         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
5521         SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
5522         SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
5523         enabled x86_64 && objformat="win64" || objformat="win32"
5524         ranlib=:
5525         enable dos_paths
5526         ;;
5527     cygwin*)
5528         target_os=cygwin
5529         shlibdir_default="$bindir_default"
5530         SLIBPREF="cyg"
5531         SLIBSUF=".dll"
5532         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
5533         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
5534         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
5535         SLIB_INSTALL_LINKS=
5536         SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
5537         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
5538         enabled x86_64 && objformat="win64" || objformat="win32"
5539         enable dos_paths
5540         enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
5541         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5542         ;;
5543     *-dos|freedos|opendos)
5544         network_extralibs="-lsocket"
5545         objformat="coff"
5546         enable dos_paths
5547         ;;
5548     linux)
5549         enable section_data_rel_ro
5550         enabled_any arm aarch64 && enable_weak linux_perf
5551         ;;
5552     irix*)
5553         target_os=irix
5554         ranlib="echo ignoring ranlib"
5555         ;;
5556     os/2*)
5557         strip="lxlite -CS"
5558         striptype=""
5559         objformat="aout"
5560         add_cppflags -D_GNU_SOURCE
5561         add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
5562         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
5563         LIBSUF="_s.a"
5564         SLIBPREF=""
5565         SLIBSUF=".dll"
5566         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
5567         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
5568         SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
5569             echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
5570             echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
5571             echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
5572             emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
5573         SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
5574             emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
5575         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
5576         SLIB_INSTALL_LINKS=
5577         SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
5578         enable dos_paths
5579         enable_weak os2threads
5580         ;;
5581     gnu/kfreebsd)
5582         add_cppflags -D_BSD_SOURCE
5583         ;;
5584     gnu)
5585         ;;
5586     qnx)
5587         add_cppflags -D_QNX_SOURCE
5588         network_extralibs="-lsocket"
5589         ;;
5590     symbian)
5591         SLIBSUF=".dll"
5592         enable dos_paths
5593         add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
5594         add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
5595         add_ldflags -Wl,--target1-abs,--no-undefined \
5596                     -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
5597                     -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
5598         add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
5599                       -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
5600                       -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
5601         ;;
5602     minix)
5603         ;;
5604     none)
5605         ;;
5606     *)
5607         die "Unknown OS '$target_os'."
5608         ;;
5609 esac
5610
5611 # test if creating links works
5612 link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
5613 link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
5614 mkdir "$link_dest"
5615 $ln_s "$link_dest" "$link_name"
5616 touch "$link_dest/test_file"
5617 if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
5618     # create link to source path
5619     [ -e src ] && rm src
5620     $ln_s "$source_path" src
5621     source_link=src
5622 else
5623     # creating directory links doesn't work
5624     # fall back to using the full source path
5625     source_link="$source_path"
5626 fi
5627 # cleanup
5628 rm -r "$link_dest"
5629 rm -r "$link_name"
5630
5631 # determine libc flavour
5632
5633 probe_libc(){
5634     pfx=$1
5635     pfx_no_=${pfx%_}
5636     # uclibc defines __GLIBC__, so it needs to be checked before glibc.
5637     if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
5638         eval ${pfx}libc_type=uclibc
5639         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5640     elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
5641         eval ${pfx}libc_type=glibc
5642         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5643     # MinGW headers can be installed on Cygwin, so check for newlib first.
5644     elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
5645         eval ${pfx}libc_type=newlib
5646         add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
5647     # MinGW64 is backwards compatible with MinGW32, so check for it first.
5648     elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
5649         eval ${pfx}libc_type=mingw64
5650         if test_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
5651             add_compat msvcrt/snprintf.o
5652             add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
5653         fi
5654         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
5655         eval test \$${pfx_no_}cc_type = "gcc" &&
5656             add_${pfx}cppflags -D__printf__=__gnu_printf__
5657         test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
5658             add_${pfx}cppflags -D_WIN32_WINNT=0x0600
5659         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5660     elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION"  ||
5661          test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
5662         eval ${pfx}libc_type=mingw32
5663         test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
5664             (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
5665             die "ERROR: MinGW32 runtime version must be >= 3.15."
5666         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
5667         test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
5668             add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
5669         test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
5670             add_${pfx}cppflags -D_WIN32_WINNT=0x0600
5671         eval test \$${pfx_no_}cc_type = "gcc" &&
5672             add_${pfx}cppflags -D__printf__=__gnu_printf__
5673         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5674     elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
5675         eval ${pfx}libc_type=msvcrt
5676         if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
5677             if [ "$pfx" = host_ ]; then
5678                 add_host_cppflags -Dsnprintf=_snprintf
5679             else
5680                 add_compat strtod.o strtod=avpriv_strtod
5681                 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
5682                                              _snprintf=avpriv_snprintf  \
5683                                              vsnprintf=avpriv_vsnprintf
5684             fi
5685         fi
5686         add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
5687         # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
5688         # 0x601 by default unless something else is set by the user.
5689         # This can easily lead to us detecting functions only present
5690         # in such new versions and producing binaries requiring windows 7.0.
5691         # Therefore explicitly set the default to Vista unless the user has
5692         # set something else on the command line.
5693         # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
5694         # family. For these cases, configure is free to use any functions
5695         # found in the SDK headers by default. (Alternatively, we could force
5696         # _WIN32_WINNT to 0x0602 in that case.)
5697         test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
5698             { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
5699 #ifdef WINAPI_FAMILY
5700 #include <winapifamily.h>
5701 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
5702 #error not desktop
5703 #endif
5704 #endif
5705 EOF
5706         if [ "$pfx" = "" ]; then
5707             check_func strtoll || add_cflags -Dstrtoll=_strtoi64
5708             check_func strtoull || add_cflags -Dstrtoull=_strtoui64
5709         fi
5710     elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
5711         eval ${pfx}libc_type=klibc
5712     elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
5713         eval ${pfx}libc_type=bionic
5714     elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
5715         eval ${pfx}libc_type=solaris
5716         add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
5717     elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then
5718         eval ${pfx}libc_type=djgpp
5719         add_cppflags -U__STRICT_ANSI__
5720         add_cflags "-include $source_path/compat/djgpp/math.h"
5721         add_compat djgpp/math.o
5722     fi
5723     test_${pfx}cc <<EOF
5724 #include <time.h>
5725 void *v = localtime_r;
5726 EOF
5727 test "$?" != 0 && test_${pfx}cc -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 <<EOF && add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
5728 #include <time.h>
5729 void *v = localtime_r;
5730 EOF
5731
5732     eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
5733 }
5734
5735 probe_libc
5736 probe_libc host_
5737
5738 # hacks for compiler/libc/os combinations
5739
5740 case $libc_type in
5741     bionic)
5742         add_compat strtod.o strtod=avpriv_strtod
5743         ;;
5744 esac
5745
5746 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
5747     add_cppflags '-I\$(SRC_PATH)/compat/float'
5748
5749 test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
5750
5751 set_default libdir
5752 : ${shlibdir_default:="$libdir"}
5753 : ${pkgconfigdir_default:="$libdir/pkgconfig"}
5754
5755 set_default $PATHS_LIST
5756 set_default nm
5757
5758 disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
5759
5760 enable_weak_pic() {
5761     disabled pic && return
5762     enable pic
5763     add_cppflags -DPIC
5764     case "$target_os" in
5765     mingw*|cygwin*|win*)
5766         ;;
5767     *)
5768         add_cflags -fPIC
5769         add_asflags -fPIC
5770         ;;
5771     esac
5772 }
5773
5774 enabled pic && enable_weak_pic
5775
5776 test_cc <<EOF || die "Symbol mangling check failed."
5777 int ff_extern;
5778 EOF
5779 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
5780 extern_prefix=${sym%%ff_extern*}
5781
5782 ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
5783
5784 for restrict_keyword in restrict __restrict__ __restrict ""; do
5785     test_code cc "" "char * $restrict_keyword p" && break
5786 done
5787
5788 check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
5789
5790 # The global variable ensures the bits appear unchanged in the object file.
5791 test_cc <<EOF || die "endian test failed"
5792 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
5793 EOF
5794 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
5795
5796 check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
5797
5798 if ! enabled ppc64 || enabled bigendian; then
5799     disable vsx
5800 fi
5801
5802 check_gas() {
5803     log "check_gas using '$as' as AS"
5804     # :vararg is used on aarch64, arm and ppc altivec
5805     check_as vararg "
5806 .macro m n, y:vararg=0
5807 \n: .int \y
5808 .endm
5809 m x" || return 1
5810     # .altmacro is only used in arm asm
5811     ! enabled arm || check_as gnu_as ".altmacro"
5812 }
5813
5814 if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
5815     nogas=:
5816     enabled_any arm aarch64 && nogas=die
5817     enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
5818     as_noop=-v
5819
5820     case $as_type in
5821         arm*) gaspp_as_type=armasm; as_noop=-h ;;
5822         gcc)  gaspp_as_type=gas ;;
5823         *)    gaspp_as_type=$as_type ;;
5824    &nbs