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