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