avfilter/thumbnail_cuda: add cuda thumbnail filter
[ffmpeg.git] / configure
1 #!/bin/sh
2 #
3 # FFmpeg configure script
4 #
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
8 #
9
10 # Prevent locale nonsense from breaking basic text processing.
11 LC_ALL=C
12 export LC_ALL
13
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
16
17 try_exec(){
18     echo "Trying shell $1"
19     type "$1" > /dev/null 2>&1 && exec "$@"
20 }
21
22 unset foo
23 (: ${foo%%bar}) 2> /dev/null
24 E1="$?"
25
26 (: ${foo?}) 2> /dev/null
27 E2="$?"
28
29 if test "$E1" != 0 || test "$E2" = 0; then
30     echo "Broken shell detected.  Trying alternatives."
31     export FF_CONF_EXEC
32     if test "0$FF_CONF_EXEC" -lt 1; then
33         FF_CONF_EXEC=1
34         try_exec bash "$0" "$@"
35     fi
36     if test "0$FF_CONF_EXEC" -lt 2; then
37         FF_CONF_EXEC=2
38         try_exec ksh "$0" "$@"
39     fi
40     if test "0$FF_CONF_EXEC" -lt 3; then
41         FF_CONF_EXEC=3
42         try_exec /usr/xpg4/bin/sh "$0" "$@"
43     fi
44     echo "No compatible shell script interpreter found."
45     echo "This configure script requires a POSIX-compatible shell"
46     echo "such as bash or ksh."
47     echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
48     echo "Instead, install a working POSIX-compatible shell."
49     echo "Disabling this configure test will create a broken FFmpeg."
50     if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51         echo "This bash version ($BASH_VERSION) is broken on your platform."
52         echo "Upgrade to a later version if available."
53     fi
54     exit 1
55 fi
56
57 test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
58
59 show_help(){
60     cat <<EOF
61 Usage: configure [options]
62 Options: [defaults in brackets after descriptions]
63
64 Help options:
65   --help                   print this message
66   --quiet                  Suppress showing informative output
67   --list-decoders          show all available decoders
68   --list-encoders          show all available encoders
69   --list-hwaccels          show all available hardware accelerators
70   --list-demuxers          show all available demuxers
71   --list-muxers            show all available muxers
72   --list-parsers           show all available parsers
73   --list-protocols         show all available protocols
74   --list-bsfs              show all available bitstream filters
75   --list-indevs            show all available input devices
76   --list-outdevs           show all available output devices
77   --list-filters           show all available filters
78
79 Standard options:
80   --logfile=FILE           log tests and output to FILE [ffbuild/config.log]
81   --disable-logging        do not log configure debug information
82   --fatal-warnings         fail if any configure warning is generated
83   --prefix=PREFIX          install in PREFIX [$prefix_default]
84   --bindir=DIR             install binaries in DIR [PREFIX/bin]
85   --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
86   --docdir=DIR             install documentation in DIR [PREFIX/share/doc/ffmpeg]
87   --libdir=DIR             install libs in DIR [PREFIX/lib]
88   --shlibdir=DIR           install shared libs in DIR [LIBDIR]
89   --incdir=DIR             install includes in DIR [PREFIX/include]
90   --mandir=DIR             install man page in DIR [PREFIX/share/man]
91   --pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]
92   --enable-rpath           use rpath to allow installing libraries in paths
93                            not part of the dynamic linker search path
94                            use rpath when linking programs (USE WITH CARE)
95   --install-name-dir=DIR   Darwin directory name for installed targets
96
97 Licensing options:
98   --enable-gpl             allow use of GPL code, the resulting libs
99                            and binaries will be under GPL [no]
100   --enable-version3        upgrade (L)GPL to version 3 [no]
101   --enable-nonfree         allow use of nonfree code, the resulting libs
102                            and binaries will be unredistributable [no]
103
104 Configuration options:
105   --disable-static         do not build static libraries [no]
106   --enable-shared          build shared libraries [no]
107   --enable-small           optimize for size instead of speed
108   --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
109   --enable-gray            enable full grayscale support (slower color)
110   --disable-swscale-alpha  disable alpha channel support in swscale
111   --disable-all            disable building components, libraries and programs
112   --disable-autodetect     disable automatically detected external libraries [no]
113
114 Program options:
115   --disable-programs       do not build command line programs
116   --disable-ffmpeg         disable ffmpeg build
117   --disable-ffplay         disable ffplay build
118   --disable-ffprobe        disable ffprobe build
119   --disable-ffserver       disable ffserver build
120
121 Documentation options:
122   --disable-doc            do not build documentation
123   --disable-htmlpages      do not build HTML documentation pages
124   --disable-manpages       do not build man documentation pages
125   --disable-podpages       do not build POD documentation pages
126   --disable-txtpages       do not build text documentation pages
127
128 Component options:
129   --disable-avdevice       disable libavdevice build
130   --disable-avcodec        disable libavcodec build
131   --disable-avformat       disable libavformat build
132   --disable-swresample     disable libswresample build
133   --disable-swscale        disable libswscale build
134   --disable-postproc       disable libpostproc build
135   --disable-avfilter       disable libavfilter build
136   --enable-avresample      enable libavresample build [no]
137   --disable-pthreads       disable pthreads [autodetect]
138   --disable-w32threads     disable Win32 threads [autodetect]
139   --disable-os2threads     disable OS/2 threads [autodetect]
140   --disable-network        disable network support [no]
141   --disable-dct            disable DCT code
142   --disable-dwt            disable DWT code
143   --disable-error-resilience disable error resilience code
144   --disable-lsp            disable LSP code
145   --disable-lzo            disable LZO decoder code
146   --disable-mdct           disable MDCT code
147   --disable-rdft           disable RDFT code
148   --disable-fft            disable FFT code
149   --disable-faan           disable floating point AAN (I)DCT code
150   --disable-pixelutils     disable pixel utils in libavutil
151
152 Individual component options:
153   --disable-everything     disable all components listed below
154   --disable-encoder=NAME   disable encoder NAME
155   --enable-encoder=NAME    enable encoder NAME
156   --disable-encoders       disable all encoders
157   --disable-decoder=NAME   disable decoder NAME
158   --enable-decoder=NAME    enable decoder NAME
159   --disable-decoders       disable all decoders
160   --disable-hwaccel=NAME   disable hwaccel NAME
161   --enable-hwaccel=NAME    enable hwaccel NAME
162   --disable-hwaccels       disable all hwaccels
163   --disable-muxer=NAME     disable muxer NAME
164   --enable-muxer=NAME      enable muxer NAME
165   --disable-muxers         disable all muxers
166   --disable-demuxer=NAME   disable demuxer NAME
167   --enable-demuxer=NAME    enable demuxer NAME
168   --disable-demuxers       disable all demuxers
169   --enable-parser=NAME     enable parser NAME
170   --disable-parser=NAME    disable parser NAME
171   --disable-parsers        disable all parsers
172   --enable-bsf=NAME        enable bitstream filter NAME
173   --disable-bsf=NAME       disable bitstream filter NAME
174   --disable-bsfs           disable all bitstream filters
175   --enable-protocol=NAME   enable protocol NAME
176   --disable-protocol=NAME  disable protocol NAME
177   --disable-protocols      disable all protocols
178   --enable-indev=NAME      enable input device NAME
179   --disable-indev=NAME     disable input device NAME
180   --disable-indevs         disable input devices
181   --enable-outdev=NAME     enable output device NAME
182   --disable-outdev=NAME    disable output device NAME
183   --disable-outdevs        disable output devices
184   --disable-devices        disable all devices
185   --enable-filter=NAME     enable filter NAME
186   --disable-filter=NAME    disable filter NAME
187   --disable-filters        disable all filters
188
189 External library support:
190
191   Using any of the following switches will allow FFmpeg to link to the
192   corresponding external library. All the components depending on that library
193   will become enabled, if all their other dependencies are met and they are not
194   explicitly disabled. E.g. --enable-libwavpack will enable linking to
195   libwavpack and allow the libwavpack encoder to be built, unless it is
196   specifically disabled with --disable-encoder=libwavpack.
197
198   Note that only the system libraries are auto-detected. All the other external
199   libraries must be explicitly enabled.
200
201   Also note that the following help text describes the purpose of the libraries
202   themselves, not all their features will necessarily be usable by FFmpeg.
203
204   --disable-alsa           disable ALSA support [autodetect]
205   --disable-appkit         disable Apple AppKit framework [autodetect]
206   --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
207   --enable-avisynth        enable reading of AviSynth script files [no]
208   --disable-bzlib          disable bzlib [autodetect]
209   --disable-coreimage      disable Apple CoreImage framework [autodetect]
210   --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
211   --enable-frei0r          enable frei0r video filtering [no]
212   --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support
213                            if openssl, librtmp or gmp is not used [no]
214   --enable-gmp             enable gmp, needed for rtmp(t)e support
215                            if openssl or librtmp is not used [no]
216   --enable-gnutls          enable gnutls, needed for https support
217                            if openssl is not used [no]
218   --disable-iconv          disable iconv [autodetect]
219   --disable-jack           disable libjack support [autodetect]
220   --enable-jni             enable JNI support [no]
221   --enable-ladspa          enable LADSPA audio filtering [no]
222   --enable-libass          enable libass subtitles rendering,
223                            needed for subtitles and ass filter [no]
224   --enable-libbluray       enable BluRay reading using libbluray [no]
225   --enable-libbs2b         enable bs2b DSP library [no]
226   --enable-libcaca         enable textual display using libcaca [no]
227   --enable-libcelt         enable CELT decoding via libcelt [no]
228   --enable-libcdio         enable audio CD grabbing with libcdio [no]
229   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
230                            and libraw1394 [no]
231   --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
232   --enable-libflite        enable flite (voice synthesis) support via libflite [no]
233   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
234   --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
235   --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
236   --enable-libgme          enable Game Music Emu via libgme [no]
237   --enable-libgsm          enable GSM de/encoding via libgsm [no]
238   --enable-libiec61883     enable iec61883 via libiec61883 [no]
239   --enable-libilbc         enable iLBC de/encoding via libilbc [no]
240   --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
241   --enable-libmodplug      enable ModPlug via libmodplug [no]
242   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
243   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
244   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
245   --enable-libopencv       enable video filtering via libopencv [no]
246   --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
247   --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
248   --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
249   --enable-libopus         enable Opus de/encoding via libopus [no]
250   --enable-libpulse        enable Pulseaudio input via libpulse [no]
251   --enable-librsvg         enable SVG rasterization via librsvg [no]
252   --enable-librubberband   enable rubberband needed for rubberband filter [no]
253   --enable-librtmp         enable RTMP[E] support via librtmp [no]
254   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
255   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
256   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
257   --enable-libsoxr         enable Include libsoxr resampling [no]
258   --enable-libspeex        enable Speex de/encoding via libspeex [no]
259   --enable-libssh          enable SFTP protocol via libssh [no]
260   --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
261   --enable-libtheora       enable Theora encoding via libtheora [no]
262   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
263   --enable-libv4l2         enable libv4l2/v4l-utils [no]
264   --enable-libvidstab      enable video stabilization using vid.stab [no]
265   --enable-libvmaf         enable vmaf filter via libvmaf [no]
266   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
267   --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
268                            native implementation exists [no]
269   --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
270   --enable-libwavpack      enable wavpack encoding via libwavpack [no]
271   --enable-libwebp         enable WebP encoding via libwebp [no]
272   --enable-libx264         enable H.264 encoding via x264 [no]
273   --enable-libx265         enable HEVC encoding via x265 [no]
274   --enable-libxavs         enable AVS encoding via xavs [no]
275   --enable-libxcb          enable X11 grabbing using XCB [autodetect]
276   --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
277   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
278   --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
279   --enable-libxvid         enable Xvid encoding via xvidcore,
280                            native MPEG-4/Xvid encoder exists [no]
281   --enable-libxml2         enable XML parsing using the C library libxml2 [no]
282   --enable-libzimg         enable z.lib, needed for zscale filter [no]
283   --enable-libzmq          enable message passing via libzmq [no]
284   --enable-libzvbi         enable teletext support via libzvbi [no]
285   --disable-lzma           disable lzma [autodetect]
286   --enable-decklink        enable Blackmagic DeckLink I/O support [no]
287   --enable-libndi_newtek   enable Newteck NDI I/O support [no]
288   --enable-mediacodec      enable Android MediaCodec support [no]
289   --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
290   --enable-openal          enable OpenAL 1.1 capture support [no]
291   --enable-opencl          enable OpenCL code
292   --enable-opengl          enable OpenGL rendering [no]
293   --enable-openssl         enable openssl, needed for https support
294                            if gnutls is not used [no]
295   --disable-sndio          disable sndio support [autodetect]
296   --disable-schannel       disable SChannel SSP, needed for TLS support on
297                            Windows if openssl and gnutls are not used [autodetect]
298   --disable-sdl2           disable sdl2 [autodetect]
299   --disable-securetransport disable Secure Transport, needed for TLS support
300                            on OSX if openssl and gnutls are not used [autodetect]
301   --disable-xlib           disable xlib [autodetect]
302   --disable-zlib           disable zlib [autodetect]
303
304   The following libraries provide various hardware acceleration features:
305   --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
306   --disable-cuda           disable dynamically linked Nvidia CUDA code [autodetect]
307   --enable-cuda-sdk        enable CUDA features that require the CUDA SDK [no]
308   --disable-cuvid          disable Nvidia CUVID support [autodetect]
309   --disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]
310   --disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]
311   --enable-libdrm          enable DRM code (Linux) [no]
312   --enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
313   --enable-libnpp          enable Nvidia Performance Primitives-based code [no]
314   --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
315   --disable-nvenc          disable Nvidia video encoding code [autodetect]
316   --enable-omx             enable OpenMAX IL code [no]
317   --enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]
318   --disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
319   --disable-vda            disable Apple Video Decode Acceleration code [autodetect]
320   --disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
321   --disable-videotoolbox   disable VideoToolbox code [autodetect]
322
323 Toolchain options:
324   --arch=ARCH              select architecture [$arch]
325   --cpu=CPU                select the minimum required CPU (affects
326                            instruction selection, may crash on older CPUs)
327   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
328   --progs-suffix=SUFFIX    program name suffix []
329   --enable-cross-compile   assume a cross-compiler is used
330   --sysroot=PATH           root of cross-build tree
331   --sysinclude=PATH        location of cross-build system headers
332   --target-os=OS           compiler targets OS [$target_os]
333   --target-exec=CMD        command to run executables on target
334   --target-path=DIR        path to view of build directory on target
335   --target-samples=DIR     path to samples directory on target
336   --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
337   --toolchain=NAME         set tool defaults according to NAME
338   --nm=NM                  use nm tool NM [$nm_default]
339   --ar=AR                  use archive tool AR [$ar_default]
340   --as=AS                  use assembler AS [$as_default]
341   --ln_s=LN_S              use symbolic link tool LN_S [$ln_s_default]
342   --strip=STRIP            use strip tool STRIP [$strip_default]
343   --windres=WINDRES        use windows resource compiler WINDRES [$windres_default]
344   --x86asmexe=EXE          use nasm-compatible assembler EXE [$x86asmexe_default]
345   --cc=CC                  use C compiler CC [$cc_default]
346   --cxx=CXX                use C compiler CXX [$cxx_default]
347   --objcc=OCC              use ObjC compiler OCC [$cc_default]
348   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
349   --nvcc=NVCC              use Nvidia CUDA compiler NVCC [$nvcc_default]
350   --ld=LD                  use linker LD [$ld_default]
351   --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [$pkg_config_default]
352   --pkg-config-flags=FLAGS pass additional flags to pkgconf []
353   --ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]
354   --doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]
355   --host-cc=HOSTCC         use host C compiler HOSTCC
356   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
357   --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
358   --host-ld=HOSTLD         use host linker HOSTLD
359   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
360   --host-libs=HLIBS        use libs HLIBS when linking for host
361   --host-os=OS             compiler host OS [$target_os]
362   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
363   --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
364   --extra-objcflags=FLAGS  add FLAGS to OBJCFLAGS [$CFLAGS]
365   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
366   --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
367   --extra-ldlibflags=ELDFLAGS add ELDFLAGS to LDLIBFLAGS [$LDLIBFLAGS]
368   --extra-libs=ELIBS       add ELIBS [$ELIBS]
369   --extra-version=STRING   version string suffix []
370   --optflags=OPTFLAGS      override optimization-related compiler flags
371   --nvccflags=NVCCFLAGS    override nvcc flags [$nvccflags_default]
372   --build-suffix=SUFFIX    library name suffix []
373   --enable-pic             build position-independent code
374   --enable-thumb           compile for Thumb instruction set
375   --enable-lto             use link-time optimization
376   --env="ENV=override"     override the environment variables
377
378 Advanced options (experts only):
379   --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
380   --custom-allocator=NAME  use a supported custom allocator
381   --disable-symver         disable symbol versioning
382   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
383   --disable-safe-bitstream-reader
384                            disable buffer boundary checking in bitreaders
385                            (faster, but may crash)
386   --sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]
387
388 Optimization options (experts only):
389   --disable-asm            disable all assembly optimizations
390   --disable-altivec        disable AltiVec optimizations
391   --disable-vsx            disable VSX optimizations
392   --disable-power8         disable POWER8 optimizations
393   --disable-amd3dnow       disable 3DNow! optimizations
394   --disable-amd3dnowext    disable 3DNow! extended optimizations
395   --disable-mmx            disable MMX optimizations
396   --disable-mmxext         disable MMXEXT optimizations
397   --disable-sse            disable SSE optimizations
398   --disable-sse2           disable SSE2 optimizations
399   --disable-sse3           disable SSE3 optimizations
400   --disable-ssse3          disable SSSE3 optimizations
401   --disable-sse4           disable SSE4 optimizations
402   --disable-sse42          disable SSE4.2 optimizations
403   --disable-avx            disable AVX optimizations
404   --disable-xop            disable XOP optimizations
405   --disable-fma3           disable FMA3 optimizations
406   --disable-fma4           disable FMA4 optimizations
407   --disable-avx2           disable AVX2 optimizations
408   --disable-aesni          disable AESNI optimizations
409   --disable-armv5te        disable armv5te optimizations
410   --disable-armv6          disable armv6 optimizations
411   --disable-armv6t2        disable armv6t2 optimizations
412   --disable-vfp            disable VFP optimizations
413   --disable-neon           disable NEON optimizations
414   --disable-inline-asm     disable use of inline assembly
415   --disable-x86asm         disable use of standalone x86 assembly
416   --disable-mipsdsp        disable MIPS DSP ASE R1 optimizations
417   --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
418   --disable-msa            disable MSA optimizations
419   --disable-mipsfpu        disable floating point MIPS optimizations
420   --disable-mmi            disable Loongson SIMD optimizations
421   --disable-fast-unaligned consider unaligned accesses slow
422
423 Developer options (useful when working on FFmpeg itself):
424   --disable-debug          disable debugging symbols
425   --enable-debug=LEVEL     set the debug level [$debuglevel]
426   --disable-optimizations  disable compiler optimizations
427   --enable-extra-warnings  enable more compiler warnings
428   --disable-stripping      disable stripping of executables and shared libraries
429   --assert-level=level     0(default), 1 or 2, amount of assertion testing,
430                            2 causes a slowdown at runtime.
431   --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
432   --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
433                            leaks and errors, using the specified valgrind binary.
434                            Cannot be combined with --target-exec
435   --enable-ftrapv          Trap arithmetic overflows
436   --samples=PATH           location of test samples for FATE, if not set use
437                            \$FATE_SAMPLES at make invocation time.
438   --enable-neon-clobber-test check NEON registers for clobbering (should be
439                            used only for debugging purposes)
440   --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
441                            should be used only for debugging purposes)
442   --enable-random          randomly enable/disable components
443   --disable-random
444   --enable-random=LIST     randomly enable/disable specific components or
445   --disable-random=LIST    component groups. LIST is a comma-separated list
446                            of NAME[:PROB] entries where NAME is a component
447                            (group) and PROB the probability associated with
448                            NAME (default 0.5).
449   --random-seed=VALUE      seed value for --enable/disable-random
450   --disable-valgrind-backtrace do not print a backtrace under Valgrind
451                            (only applies to --disable-optimizations builds)
452   --enable-osfuzz          Enable building fuzzer tool
453   --libfuzzer=PATH         path to libfuzzer
454   --ignore-tests=TESTS     comma-separated list (without "fate-" prefix
455                            in the name) of tests whose result is ignored
456   --enable-linux-perf      enable Linux Performance Monitor API
457
458 NOTE: Object files are built at the place where configure is launched.
459 EOF
460   exit 0
461 }
462
463 quotes='""'
464 if test -t 1 && which tput >/dev/null 2>&1; then
465     ncolors=$(tput colors)
466     if test -n "$ncolors" && test $ncolors -ge 8; then
467         bold_color=$(tput bold)
468         warn_color=$(tput setaf 3)
469         error_color=$(tput setaf 1)
470         reset_color=$(tput sgr0)
471     fi
472     # 72 used instead of 80 since that's the default of pr
473     ncols=$(tput cols)
474 fi
475 : ${ncols:=72}
476
477 log(){
478     echo "$@" >> $logfile
479 }
480
481 log_file(){
482     log BEGIN $1
483     pr -n -t $1 >> $logfile
484     log END $1
485 }
486
487 warn(){
488     log "WARNING: $*"
489     WARNINGS="${WARNINGS}WARNING: $*\n"
490 }
491
492 die(){
493     log "$@"
494     echo "$error_color$bold_color$@$reset_color"
495     cat <<EOF
496
497 If you think configure made a mistake, make sure you are using the latest
498 version from Git.  If the latest version fails, report the problem to the
499 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
500 EOF
501     if disabled logging; then
502         cat <<EOF
503 Rerun configure with logging enabled (do not use --disable-logging), and
504 include the log this produces with your report.
505 EOF
506     else
507         cat <<EOF
508 Include the log file "$logfile" produced by configure as this will help
509 solve the problem.
510 EOF
511     fi
512     exit 1
513 }
514
515 # Avoid locale weirdness, besides we really just want to translate ASCII.
516 toupper(){
517     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
518 }
519
520 tolower(){
521     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
522 }
523
524 c_escape(){
525     echo "$*" | sed 's/["\\]/\\\0/g'
526 }
527
528 sh_quote(){
529     v=$(echo "$1" | sed "s/'/'\\\\''/g")
530     test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
531     echo "$v"
532 }
533
534 cleanws(){
535     echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
536 }
537
538 filter(){
539     pat=$1
540     shift
541     for v; do
542         eval "case $v in $pat) printf '%s ' $v ;; esac"
543     done
544 }
545
546 filter_out(){
547     pat=$1
548     shift
549     for v; do
550         eval "case $v in $pat) ;; *) printf '%s ' $v ;; esac"
551     done
552 }
553
554 map(){
555     m=$1
556     shift
557     for v; do eval $m; done
558 }
559
560 add_suffix(){
561     suffix=$1
562     shift
563     for v; do echo ${v}${suffix}; done
564 }
565
566 set_all(){
567     value=$1
568     shift
569     for var in $*; do
570         eval $var=$value
571     done
572 }
573
574 set_weak(){
575     value=$1
576     shift
577     for var; do
578         eval : \${$var:=$value}
579     done
580 }
581
582 sanitize_var_name(){
583     echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
584 }
585
586 set_safe(){
587     var=$1
588     shift
589     eval $(sanitize_var_name "$var")='$*'
590 }
591
592 get_safe(){
593     eval echo \$$(sanitize_var_name "$1")
594 }
595
596 pushvar(){
597     for pvar in $*; do
598         eval level=\${${pvar}_level:=0}
599         eval ${pvar}_${level}="\$$pvar"
600         eval ${pvar}_level=$(($level+1))
601     done
602 }
603
604 popvar(){
605     for pvar in $*; do
606         eval level=\${${pvar}_level:-0}
607         test $level = 0 && continue
608         eval level=$(($level-1))
609         eval $pvar="\${${pvar}_${level}}"
610         eval ${pvar}_level=$level
611         eval unset ${pvar}_${level}
612     done
613 }
614
615 request(){
616     for var in $*; do
617         eval ${var}_requested=yes
618         eval $var=
619     done
620 }
621
622 enable(){
623     set_all yes $*
624 }
625
626 disable(){
627     set_all no $*
628 }
629
630 enable_weak(){
631     set_weak yes $*
632 }
633
634 disable_weak(){
635     set_weak no $*
636 }
637
638 enable_safe(){
639     for var; do
640         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
641     done
642 }
643
644 disable_safe(){
645     for var; do
646         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
647     done
648 }
649
650 do_enable_deep(){
651     for var; do
652         enabled $var && continue
653         eval sel="\$${var}_select"
654         eval sgs="\$${var}_suggest"
655         pushvar var sgs
656         enable_deep $sel
657         popvar sgs
658         enable_deep_weak $sgs
659         popvar var
660     done
661 }
662
663 enable_deep(){
664     do_enable_deep $*
665     enable $*
666 }
667
668 enable_deep_weak(){
669     for var; do
670         disabled $var && continue
671         pushvar var
672         do_enable_deep $var
673         popvar var
674         enable_weak $var
675     done
676 }
677
678 requested(){
679     test "${1#!}" = "$1" && op='=' || op=!=
680     eval test "x\$${1#!}_requested" $op "xyes"
681 }
682
683 enabled(){
684     test "${1#!}" = "$1" && op='=' || op=!=
685     eval test "x\$${1#!}" $op "xyes"
686 }
687
688 disabled(){
689     test "${1#!}" = "$1" && op='=' || op=!=
690     eval test "x\$${1#!}" $op "xno"
691 }
692
693 enabled_all(){
694     for opt; do
695         enabled $opt || return 1
696     done
697 }
698
699 disabled_all(){
700     for opt; do
701         disabled $opt || return 1
702     done
703 }
704
705 enabled_any(){
706     for opt; do
707         enabled $opt && return 0
708     done
709 }
710
711 disabled_any(){
712     for opt; do
713         disabled $opt && return 0
714     done
715     return 1
716 }
717
718 set_default(){
719     for opt; do
720         eval : \${$opt:=\$${opt}_default}
721     done
722 }
723
724 is_in(){
725     value=$1
726     shift
727     for var in $*; do
728         [ $var = $value ] && return 0
729     done
730     return 1
731 }
732
733 do_check_deps(){
734     for cfg; do
735         cfg="${cfg#!}"
736         enabled ${cfg}_checking && die "Circular dependency for $cfg."
737         disabled ${cfg}_checking && continue
738         enable ${cfg}_checking
739         append allopts $cfg
740
741         eval dep_all="\$${cfg}_deps"
742         eval dep_any="\$${cfg}_deps_any"
743         eval dep_sel="\$${cfg}_select"
744         eval dep_sgs="\$${cfg}_suggest"
745         eval dep_ifa="\$${cfg}_if"
746         eval dep_ifn="\$${cfg}_if_any"
747
748         pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
749         do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
750         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
751
752         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
753         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
754         enabled_all  $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
755         enabled_any  $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
756         disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
757
758         if enabled $cfg; then
759             enable_deep $dep_sel
760             enable_deep_weak $dep_sgs
761         fi
762
763         disable ${cfg}_checking
764     done
765 }
766
767 check_deps(){
768     unset allopts
769
770     do_check_deps "$@"
771
772     for cfg in $allopts; do
773         enabled $cfg || continue
774         eval dep_extralibs="\$${cfg}_extralibs"
775         test -n "$dep_extralibs" && add_extralibs $dep_extralibs
776     done
777 }
778
779 print_config(){
780     pfx=$1
781     files=$2
782     shift 2
783     map 'eval echo "$v \${$v:-no}"' "$@" |
784     awk "BEGIN { split(\"$files\", files) }
785         {
786             c = \"$pfx\" toupper(\$1);
787             v = \$2;
788             sub(/yes/, 1, v);
789             sub(/no/,  0, v);
790             for (f in files) {
791                 file = files[f];
792                 if (file ~ /\\.h\$/) {
793                     printf(\"#define %s %d\\n\", c, v) >>file;
794                 } else if (file ~ /\\.asm\$/) {
795                     printf(\"%%define %s %d\\n\", c, v) >>file;
796                 } else if (file ~ /\\.mak\$/) {
797                     n = -v ? \"\" : \"!\";
798                     printf(\"%s%s=yes\\n\", n, c) >>file;
799                 } else if (file ~ /\\.texi\$/) {
800                     pre = -v ? \"\" : \"@c \";
801                     yesno = \$2;
802                     c2 = tolower(c);
803                     gsub(/_/, \"-\", c2);
804                     printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
805                 }
806             }
807         }"
808 }
809
810 print_enabled(){
811     suf=$1
812     shift
813     for v; do
814         enabled $v && printf "%s\n" ${v%$suf}
815     done
816 }
817
818 append(){
819     var=$1
820     shift
821     eval "$var=\"\$$var $*\""
822 }
823
824 prepend(){
825     var=$1
826     shift
827     eval "$var=\"$* \$$var\""
828 }
829
830 unique(){
831     var=$1
832     uniq_list=""
833     for tok in $(eval echo \$$var); do
834         uniq_list="$(filter_out $tok $uniq_list) $tok"
835     done
836     eval "$var=\"${uniq_list}\""
837 }
838
839 add_cppflags(){
840     append CPPFLAGS "$@"
841 }
842
843 add_cflags(){
844     append CFLAGS $($cflags_filter "$@")
845 }
846
847 add_cflags_headers(){
848     append CFLAGS_HEADERS $($cflags_filter "$@")
849 }
850
851 add_cxxflags(){
852     append CXXFLAGS $($cflags_filter "$@")
853 }
854
855 add_asflags(){
856     append ASFLAGS $($asflags_filter "$@")
857 }
858
859 add_objcflags(){
860     append OBJCFLAGS $($objcflags_filter "$@")
861 }
862
863 add_ldflags(){
864     append LDFLAGS $($ldflags_filter "$@")
865 }
866
867 add_ldexeflags(){
868     append LDEXEFLAGS $($ldflags_filter "$@")
869 }
870
871 add_ldlibflags(){
872     append LDLIBFLAGS $($ldflags_filter "$@")
873 }
874
875 add_stripflags(){
876     append ASMSTRIPFLAGS "$@"
877 }
878
879 add_extralibs(){
880     prepend extralibs $($ldflags_filter "$@")
881 }
882
883 add_host_cppflags(){
884     append host_cppflags "$@"
885 }
886
887 add_host_cflags(){
888     append host_cflags $($host_cflags_filter "$@")
889 }
890
891 add_host_ldflags(){
892     append host_ldflags $($host_ldflags_filter "$@")
893 }
894
895 add_compat(){
896     append compat_objs $1
897     shift
898     map 'add_cppflags -D$v' "$@"
899 }
900
901 check_cmd(){
902     log "$@"
903     "$@" >> $logfile 2>&1
904 }
905
906 check_stat(){
907     log check_stat "$@"
908     stat "$1" >> $logfile 2>&1
909 }
910
911 cc_o(){
912     eval printf '%s\\n' $CC_O
913 }
914
915 cc_e(){
916     eval printf '%s\\n' $CC_E
917 }
918
919 check_cc(){
920     log check_cc "$@"
921     cat > $TMPC
922     log_file $TMPC
923     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
924 }
925
926 check_cxx(){
927     log check_cxx "$@"
928     cat > $TMPCPP
929     log_file $TMPCPP
930     check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
931 }
932
933 check_objcc(){
934     log check_objcc "$@"
935     cat > $TMPM
936     log_file $TMPM
937     check_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM
938 }
939
940 check_cpp(){
941     log check_cpp "$@"
942     cat > $TMPC
943     log_file $TMPC
944     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
945 }
946
947 as_o(){
948     eval printf '%s\\n' $AS_O
949 }
950
951 check_as(){
952     log check_as "$@"
953     cat > $TMPS
954     log_file $TMPS
955     check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
956 }
957
958 check_inline_asm(){
959     log check_inline_asm "$@"
960     name="$1"
961     code="$2"
962     shift 2
963     disable $name
964     check_cc "$@" <<EOF && enable $name
965 void foo(void){ __asm__ volatile($code); }
966 EOF
967 }
968
969 check_inline_asm_flags(){
970     log check_inline_asm_flags "$@"
971     name="$1"
972     code="$2"
973     flags=''
974     shift 2
975     while [ "$1" != "" ]; do
976       append flags $1
977       shift
978     done;
979     disable $name
980     cat > $TMPC <<EOF
981 void foo(void){ __asm__ volatile($code); }
982 EOF
983     log_file $TMPC
984     check_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
985     enable $name && add_cflags $flags && add_asflags $flags && add_ldflags $flags
986 }
987
988 check_insn(){
989     log check_insn "$@"
990     check_inline_asm ${1}_inline "\"$2\""
991     echo "$2" | check_as && enable ${1}_external || disable ${1}_external
992 }
993
994 check_x86asm(){
995     log check_x86asm "$@"
996     echo "$1" > $TMPS
997     log_file $TMPS
998     shift 1
999     check_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" -o $TMPO $TMPS
1000 }
1001
1002 ld_o(){
1003     eval printf '%s\\n' $LD_O
1004 }
1005
1006 check_ld(){
1007     log check_ld "$@"
1008     type=$1
1009     shift 1
1010     flags=$(filter_out '-l*|*.so' $@)
1011     libs=$(filter '-l*|*.so' $@)
1012     check_$type $($cflags_filter $flags) || return
1013     flags=$($ldflags_filter $flags)
1014     libs=$($ldflags_filter $libs)
1015     check_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
1016 }
1017
1018 print_include(){
1019     hdr=$1
1020     test "${hdr%.h}" = "${hdr}" &&
1021         echo "#include $hdr"    ||
1022         echo "#include <$hdr>"
1023 }
1024
1025 check_code(){
1026     log check_code "$@"
1027     check=$1
1028     headers=$2
1029     code=$3
1030     shift 3
1031     {
1032         for hdr in $headers; do
1033             print_include $hdr
1034         done
1035         echo "int main(void) { $code; return 0; }"
1036     } | check_$check "$@"
1037 }
1038
1039 check_cppflags(){
1040     log check_cppflags "$@"
1041     check_cpp "$@" <<EOF && append CPPFLAGS "$@"
1042 int x;
1043 EOF
1044 }
1045
1046 test_cflags(){
1047     log test_cflags "$@"
1048     set -- $($cflags_filter "$@")
1049     check_cc "$@" <<EOF
1050 int x;
1051 EOF
1052 }
1053
1054 check_cflags(){
1055     log check_cflags "$@"
1056     test_cflags "$@" && add_cflags "$@"
1057 }
1058
1059 check_cxxflags(){
1060     log check_cxxflags "$@"
1061     set -- $($cflags_filter "$@")
1062     check_cxx "$@" <<EOF && append CXXFLAGS "$@"
1063 int x;
1064 EOF
1065 }
1066
1067 test_objcflags(){
1068     log test_objcflags "$@"
1069     set -- $($objcflags_filter "$@")
1070     check_objcc "$@" <<EOF
1071 int x;
1072 EOF
1073 }
1074
1075 check_objcflags(){
1076     log check_objcflags "$@"
1077     test_objcflags "$@" && add_objcflags "$@"
1078 }
1079
1080 test_ldflags(){
1081     log test_ldflags "$@"
1082     check_ld "cc" "$@" <<EOF
1083 int main(void){ return 0; }
1084 EOF
1085 }
1086
1087 check_ldflags(){
1088     log check_ldflags "$@"
1089     test_ldflags "$@" && add_ldflags "$@"
1090 }
1091
1092 test_stripflags(){
1093     log test_stripflags "$@"
1094     # call check_cc to get a fresh TMPO
1095     check_cc <<EOF
1096 int main(void) { return 0; }
1097 EOF
1098     check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
1099 }
1100
1101 check_stripflags(){
1102     log check_stripflags "$@"
1103     test_stripflags "$@" && add_stripflags "$@"
1104 }
1105
1106 check_header(){
1107     log check_header "$@"
1108     header=$1
1109     shift
1110     disable_safe $header
1111     check_cpp "$@" <<EOF && enable_safe $header
1112 #include <$header>
1113 int x;
1114 EOF
1115 }
1116
1117 check_header_objcc(){
1118     log check_header_objcc "$@"
1119     rm -f -- "$TMPO"
1120     header=$1
1121     shift
1122     disable_safe $header
1123     {
1124        echo "#include <$header>"
1125        echo "int main(void) { return 0; }"
1126     } | check_objcc && check_stat "$TMPO" && enable_safe $header
1127 }
1128
1129 check_apple_framework(){
1130     log check_apple_framework "$@"
1131     framework="$1"
1132     name="$(tolower $framework)"
1133     header="${framework}/${framework}.h"
1134     disable $name
1135     check_header_objcc $header && enable $name && add_extralibs "-framework $framework"
1136 }
1137
1138 check_func(){
1139     log check_func "$@"
1140     func=$1
1141     shift
1142     disable $func
1143     check_ld "cc" "$@" <<EOF && enable $func
1144 extern int $func();
1145 int main(void){ $func(); }
1146 EOF
1147 }
1148
1149 check_complexfunc(){
1150     log check_complexfunc "$@"
1151     func=$1
1152     narg=$2
1153     shift 2
1154     test $narg = 2 && args="f, g" || args="f * I"
1155     disable $func
1156     check_ld "cc" "$@" <<EOF && enable $func
1157 #include <complex.h>
1158 #include <math.h>
1159 float foo(complex float f, complex float g) { return $func($args); }
1160 int main(void){ return (int) foo; }
1161 EOF
1162 }
1163
1164 check_mathfunc(){
1165     log check_mathfunc "$@"
1166     func=$1
1167     narg=$2
1168     shift 2
1169     test $narg = 2 && args="f, g" || args="f"
1170     disable $func
1171     check_ld "cc" "$@" <<EOF && enable $func
1172 #include <math.h>
1173 float foo(float f, float g) { return $func($args); }
1174 int main(void){ return (int) foo; }
1175 EOF
1176 }
1177
1178 check_func_headers(){
1179     log check_func_headers "$@"
1180     headers=$1
1181     funcs=$2
1182     shift 2
1183     {
1184         for hdr in $headers; do
1185             print_include $hdr
1186         done
1187         echo "#include <stdint.h>"
1188         for func in $funcs; do
1189             echo "long check_$func(void) { return (long) $func; }"
1190         done
1191         echo "int main(void) { int ret = 0;"
1192         # LTO could optimize out the test functions without this
1193         for func in $funcs; do
1194             echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
1195         done
1196         echo "return ret; }"
1197     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
1198 }
1199
1200 check_class_headers_cpp(){
1201     log check_class_headers_cpp "$@"
1202     headers=$1
1203     classes=$2
1204     shift 2
1205     {
1206         for hdr in $headers; do
1207             echo "#include <$hdr>"
1208         done
1209         echo "int main(void) { "
1210         i=1
1211         for class in $classes; do
1212             echo "$class obj$i;"
1213             i=$(expr $i + 1)
1214         done
1215         echo "return 0; }"
1216     } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
1217 }
1218
1219 check_cpp_condition(){
1220     log check_cpp_condition "$@"
1221     header=$1
1222     condition=$2
1223     shift 2
1224     check_cpp "$@" <<EOF
1225 #include <$header>
1226 #if !($condition)
1227 #error "unsatisfied condition: $condition"
1228 #endif
1229 EOF
1230 }
1231
1232 test_cflags_cc(){
1233     log test_cflags_cc "$@"
1234     flags=$1
1235     header=$2
1236     condition=$3
1237     shift 3
1238     set -- $($cflags_filter "$flags")
1239     check_cc "$@" <<EOF
1240 #include <$header>
1241 #if !($condition)
1242 #error "unsatisfied condition: $condition"
1243 #endif
1244 EOF
1245 }
1246
1247 check_lib(){
1248     log check_lib "$@"
1249     name="$1"
1250     headers="$2"
1251     funcs="$3"
1252     shift 3
1253     disable $name
1254     check_func_headers "$headers" "$funcs" "$@" &&
1255         enable $name && add_extralibs "$@"
1256 }
1257
1258 check_lib_cpp(){
1259     log check_lib_cpp "$@"
1260     headers="$1"
1261     classes="$2"
1262     shift 2
1263     check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
1264 }
1265
1266 check_pkg_config(){
1267     log check_pkg_config "$@"
1268     pkg_version="$1"
1269     pkg="${1%% *}"
1270     headers="$2"
1271     funcs="$3"
1272     shift 3
1273     check_cmd $pkg_config --exists --print-errors $pkg_version || return
1274     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1275     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1276     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1277         set_safe "${pkg}_cflags"    $pkg_cflags &&
1278         set_safe "${pkg}_extralibs" $pkg_libs
1279 }
1280
1281 check_exec(){
1282     check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1283 }
1284
1285 check_exec_crash(){
1286     log check_exec_crash "$@"
1287     code=$(cat)
1288
1289     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
1290     # are safe but may not be available everywhere.  Thus we use
1291     # raise(SIGTERM) instead.  The check is run in a subshell so we
1292     # can redirect the "Terminated" message from the shell.  SIGBUS
1293     # is not defined by standard C so it is used conditionally.
1294
1295     (check_exec "$@") >> $logfile 2>&1 <<EOF
1296 #include <signal.h>
1297 static void sighandler(int sig){
1298     raise(SIGTERM);
1299 }
1300 int foo(void){
1301     $code
1302 }
1303 int (*func_ptr)(void) = foo;
1304 int main(void){
1305     signal(SIGILL, sighandler);
1306     signal(SIGFPE, sighandler);
1307     signal(SIGSEGV, sighandler);
1308 #ifdef SIGBUS
1309     signal(SIGBUS, sighandler);
1310 #endif
1311     return func_ptr();
1312 }
1313 EOF
1314 }
1315
1316 check_type(){
1317     log check_type "$@"
1318     headers=$1
1319     type=$2
1320     shift 2
1321     disable_safe "$type"
1322     check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
1323 }
1324
1325 check_struct(){
1326     log check_struct "$@"
1327     headers=$1
1328     struct=$2
1329     member=$3
1330     shift 3
1331     disable_safe "${struct}_${member}"
1332     check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1333         enable_safe "${struct}_${member}"
1334 }
1335
1336 check_builtin(){
1337     log check_builtin "$@"
1338     name=$1
1339     headers=$2
1340     builtin=$3
1341     shift 3
1342     disable "$name"
1343     check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
1344 }
1345
1346 check_compile_assert(){
1347     log check_compile_assert "$@"
1348     name=$1
1349     headers=$2
1350     condition=$3
1351     shift 3
1352     disable "$name"
1353     check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1354 }
1355
1356 require(){
1357     log require "$@"
1358     name_version="$1"
1359     name="${1%% *}"
1360     headers="$2"
1361     func="$3"
1362     shift 3
1363     check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found"
1364 }
1365
1366 require_cpp(){
1367     name="$1"
1368     headers="$2"
1369     classes="$3"
1370     shift 3
1371     check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
1372 }
1373
1374 use_pkg_config(){
1375     log use_pkg_config "$@"
1376     pkg="$1"
1377     check_pkg_config "$@" || return 1
1378     add_cflags    $(get_safe "${pkg}_cflags")
1379     add_extralibs $(get_safe "${pkg}_extralibs")
1380 }
1381
1382 require_pkg_config(){
1383     use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
1384 }
1385
1386 hostcc_e(){
1387     eval printf '%s\\n' $HOSTCC_E
1388 }
1389
1390 hostcc_o(){
1391     eval printf '%s\\n' $HOSTCC_O
1392 }
1393
1394 check_host_cc(){
1395     log check_host_cc "$@"
1396     cat > $TMPC
1397     log_file $TMPC
1398     check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1399 }
1400
1401 check_host_cpp(){
1402     log check_host_cpp "$@"
1403     cat > $TMPC
1404     log_file $TMPC
1405     check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1406 }
1407
1408 check_host_cppflags(){
1409     log check_host_cppflags "$@"
1410     check_host_cpp "$@" <<EOF && append host_cppflags "$@"
1411 int x;
1412 EOF
1413 }
1414
1415 check_host_cflags(){
1416     log check_host_cflags "$@"
1417     set -- $($host_cflags_filter "$@")
1418     check_host_cc "$@" <<EOF && append host_cflags "$@"
1419 int x;
1420 EOF
1421 }
1422
1423 check_host_cpp_condition(){
1424     log check_host_cpp_condition "$@"
1425     header=$1
1426     condition=$2
1427     shift 2
1428     check_host_cpp "$@" <<EOF
1429 #include <$header>
1430 #if !($condition)
1431 #error "unsatisfied condition: $condition"
1432 #endif
1433 EOF
1434 }
1435
1436 cp_if_changed(){
1437     cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
1438     mkdir -p "$(dirname $2)"
1439     cp -f "$1" "$2"
1440 }
1441
1442 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1443 # system-dependent things.
1444
1445 AVCODEC_COMPONENTS="
1446     bsfs
1447     decoders
1448     encoders
1449     hwaccels
1450     parsers
1451 "
1452
1453 AVDEVICE_COMPONENTS="
1454     indevs
1455     outdevs
1456 "
1457
1458 AVFILTER_COMPONENTS="
1459     filters
1460 "
1461
1462 AVFORMAT_COMPONENTS="
1463     demuxers
1464     muxers
1465     protocols
1466 "
1467
1468 AVRESAMPLE_COMPONENTS=""
1469
1470 AVUTIL_COMPONENTS=""
1471
1472 COMPONENT_LIST="
1473     $AVCODEC_COMPONENTS
1474     $AVDEVICE_COMPONENTS
1475     $AVFILTER_COMPONENTS
1476     $AVFORMAT_COMPONENTS
1477     $AVRESAMPLE_COMPONENTS
1478     $AVUTIL_COMPONENTS
1479 "
1480
1481 EXAMPLE_LIST="
1482     avio_dir_cmd_example
1483     avio_reading_example
1484     decode_audio_example
1485     decode_video_example
1486     demuxing_decoding_example
1487     encode_audio_example
1488     encode_video_example
1489     extract_mvs_example
1490     filter_audio_example
1491     filtering_audio_example
1492     filtering_video_example
1493     http_multiclient_example
1494     hw_decode_example
1495     metadata_example
1496     muxing_example
1497     qsvdec_example
1498     remuxing_example
1499     resampling_audio_example
1500     scaling_video_example
1501     transcode_aac_example
1502     transcoding_example
1503 "
1504
1505 EXTERNAL_AUTODETECT_LIBRARY_LIST="
1506     alsa
1507     appkit
1508     avfoundation
1509     bzlib
1510     coreimage
1511     iconv
1512     jack
1513     libxcb
1514     libxcb_shm
1515     libxcb_shape
1516     libxcb_xfixes
1517     lzma
1518     schannel
1519     sdl2
1520     securetransport
1521     sndio
1522     xlib
1523     zlib
1524 "
1525
1526 EXTERNAL_LIBRARY_GPL_LIST="
1527     avisynth
1528     frei0r
1529     libcdio
1530     librubberband
1531     libvidstab
1532     libx264
1533     libx265
1534     libxavs
1535     libxvid
1536 "
1537
1538 EXTERNAL_LIBRARY_NONFREE_LIST="
1539     decklink
1540     libndi_newtek
1541     libfdk_aac
1542     openssl
1543 "
1544
1545 EXTERNAL_LIBRARY_VERSION3_LIST="
1546     gmp
1547     libopencore_amrnb
1548     libopencore_amrwb
1549     libvo_amrwbenc
1550 "
1551
1552 EXTERNAL_LIBRARY_GPLV3_LIST="
1553     libsmbclient
1554 "
1555
1556 EXTERNAL_LIBRARY_LIST="
1557     $EXTERNAL_AUTODETECT_LIBRARY_LIST
1558     $EXTERNAL_LIBRARY_GPL_LIST
1559     $EXTERNAL_LIBRARY_NONFREE_LIST
1560     $EXTERNAL_LIBRARY_VERSION3_LIST
1561     $EXTERNAL_LIBRARY_GPLV3_LIST
1562     chromaprint
1563     gcrypt
1564     gnutls
1565     jni
1566     ladspa
1567     libass
1568     libbluray
1569     libbs2b
1570     libcaca
1571     libcelt
1572     libdc1394
1573     libdrm
1574     libflite
1575     libfontconfig
1576     libfreetype
1577     libfribidi
1578     libgme
1579     libgsm
1580     libiec61883
1581     libilbc
1582     libkvazaar
1583     libmodplug
1584     libmp3lame
1585     libmysofa
1586     libopencv
1587     libopenh264
1588     libopenjpeg
1589     libopenmpt
1590     libopus
1591     libpulse
1592     librsvg
1593     librtmp
1594     libshine
1595     libsmbclient
1596     libsnappy
1597     libsoxr
1598     libspeex
1599     libssh
1600     libtesseract
1601     libtheora
1602     libtwolame
1603     libv4l2
1604     libvmaf
1605     libvorbis
1606     libvpx
1607     libwavpack
1608     libwebp
1609     libxml2
1610     libzimg
1611     libzmq
1612     libzvbi
1613     mediacodec
1614     openal
1615     opencl
1616     opengl
1617 "
1618
1619 HWACCEL_AUTODETECT_LIBRARY_LIST="
1620     audiotoolbox
1621     crystalhd
1622     cuda
1623     cuvid
1624     d3d11va
1625     dxva2
1626     nvenc
1627     vaapi
1628     vda
1629     vdpau
1630     videotoolbox
1631     xvmc
1632 "
1633
1634 HWACCEL_LIBRARY_NONFREE_LIST="
1635     cuda_sdk
1636     libnpp
1637 "
1638
1639 HWACCEL_LIBRARY_LIST="
1640     $HWACCEL_AUTODETECT_LIBRARY_LIST
1641     $HWACCEL_LIBRARY_NONFREE_LIST
1642     libmfx
1643     mmal
1644     omx
1645 "
1646
1647 DOCUMENT_LIST="
1648     doc
1649     htmlpages
1650     manpages
1651     podpages
1652     txtpages
1653 "
1654
1655 FEATURE_LIST="
1656     ftrapv
1657     gray
1658     hardcoded_tables
1659     omx_rpi
1660     runtime_cpudetect
1661     safe_bitstream_reader
1662     shared
1663     small
1664     static
1665     swscale_alpha
1666 "
1667
1668 LIBRARY_LIST="
1669     avcodec
1670     avdevice
1671     avfilter
1672     avformat
1673     avresample
1674     avutil
1675     postproc
1676     swresample
1677     swscale
1678 "
1679
1680 LICENSE_LIST="
1681     gpl
1682     nonfree
1683     version3
1684 "
1685
1686 PROGRAM_LIST="
1687     ffplay
1688     ffprobe
1689     ffserver
1690     ffmpeg
1691 "
1692
1693 SUBSYSTEM_LIST="
1694     dct
1695     dwt
1696     error_resilience
1697     faan
1698     fast_unaligned
1699     fft
1700     lsp
1701     lzo
1702     mdct
1703     pixelutils
1704     network
1705     rdft
1706 "
1707
1708 # COMPONENT_LIST needs to come last to ensure correct dependency checking
1709 CONFIG_LIST="
1710     $DOCUMENT_LIST
1711     $EXAMPLE_LIST
1712     $EXTERNAL_LIBRARY_LIST
1713     $HWACCEL_LIBRARY_LIST
1714     $FEATURE_LIST
1715     $LICENSE_LIST
1716     $LIBRARY_LIST
1717     $PROGRAM_LIST
1718     $SUBSYSTEM_LIST
1719     autodetect
1720     fontconfig
1721     linux_perf
1722     memory_poisoning
1723     neon_clobber_test
1724     ossfuzz
1725     pic
1726     thumb
1727     valgrind_backtrace
1728     xmm_clobber_test
1729     $COMPONENT_LIST
1730 "
1731
1732 THREADS_LIST="
1733     pthreads
1734     os2threads
1735     w32threads
1736 "
1737
1738 ATOMICS_LIST="
1739     atomics_gcc
1740     atomics_suncc
1741     atomics_win32
1742 "
1743
1744 AUTODETECT_LIBS="
1745     $EXTERNAL_AUTODETECT_LIBRARY_LIST
1746     $HWACCEL_AUTODETECT_LIBRARY_LIST
1747     $THREADS_LIST
1748 "
1749
1750 ARCH_LIST="
1751     aarch64
1752     alpha
1753     arm
1754     avr32
1755     avr32_ap
1756     avr32_uc
1757     bfin
1758     ia64
1759     m68k
1760     mips
1761     mips64
1762     parisc
1763     ppc
1764     ppc64
1765     s390
1766     sh4
1767     sparc
1768     sparc64
1769     tilegx
1770     tilepro
1771     tomi
1772     x86
1773     x86_32
1774     x86_64
1775 "
1776
1777 ARCH_EXT_LIST_ARM="
1778     armv5te
1779     armv6
1780     armv6t2
1781     armv8
1782     neon
1783     vfp
1784     vfpv3
1785     setend
1786 "
1787
1788 ARCH_EXT_LIST_MIPS="
1789     mipsfpu
1790     mips32r2
1791     mips32r5
1792     mips64r2
1793     mips32r6
1794     mips64r6
1795     mipsdsp
1796     mipsdspr2
1797     msa
1798 "
1799
1800 ARCH_EXT_LIST_LOONGSON="
1801     loongson2
1802     loongson3
1803     mmi
1804 "
1805
1806 ARCH_EXT_LIST_X86_SIMD="
1807     aesni
1808     amd3dnow
1809     amd3dnowext
1810     avx
1811     avx2
1812     fma3
1813     fma4
1814     mmx
1815     mmxext
1816     sse
1817     sse2
1818     sse3
1819     sse4
1820     sse42
1821     ssse3
1822     xop
1823 "
1824
1825 ARCH_EXT_LIST_PPC="
1826     altivec
1827     dcbzl
1828     ldbrx
1829     power8
1830     ppc4xx
1831     vsx
1832 "
1833
1834 ARCH_EXT_LIST_X86="
1835     $ARCH_EXT_LIST_X86_SIMD
1836     cpunop
1837     i686
1838 "
1839
1840 ARCH_EXT_LIST="
1841     $ARCH_EXT_LIST_ARM
1842     $ARCH_EXT_LIST_PPC
1843     $ARCH_EXT_LIST_X86
1844     $ARCH_EXT_LIST_MIPS
1845     $ARCH_EXT_LIST_LOONGSON
1846 "
1847
1848 ARCH_FEATURES="
1849     aligned_stack
1850     fast_64bit
1851     fast_clz
1852     fast_cmov
1853     local_aligned_8
1854     local_aligned_16
1855     local_aligned_32
1856     simd_align_16
1857     simd_align_32
1858 "
1859
1860 BUILTIN_LIST="
1861     atomic_cas_ptr
1862     machine_rw_barrier
1863     MemoryBarrier
1864     mm_empty
1865     rdtsc
1866     sarestart
1867     sem_timedwait
1868     sync_val_compare_and_swap
1869 "
1870 HAVE_LIST_CMDLINE="
1871     inline_asm
1872     symver
1873     x86asm
1874 "
1875
1876 HAVE_LIST_PUB="
1877     bigendian
1878     fast_unaligned
1879 "
1880
1881 HEADERS_LIST="
1882     altivec_h
1883     arpa_inet_h
1884     asm_types_h
1885     cdio_paranoia_h
1886     cdio_paranoia_paranoia_h
1887     cuda_h
1888     d3d11_h
1889     dispatch_dispatch_h
1890     dev_bktr_ioctl_bt848_h
1891     dev_bktr_ioctl_meteor_h
1892     dev_ic_bt8xx_h
1893     dev_video_bktr_ioctl_bt848_h
1894     dev_video_meteor_ioctl_meteor_h
1895     direct_h
1896     dirent_h
1897     dlfcn_h
1898     dxgidebug_h
1899     dxva_h
1900     ES2_gl_h
1901     gsm_h
1902     io_h
1903     mach_mach_time_h
1904     machine_ioctl_bt848_h
1905     machine_ioctl_meteor_h
1906     malloc_h
1907     opencv2_core_core_c_h
1908     openjpeg_2_2_openjpeg_h
1909     openjpeg_2_1_openjpeg_h
1910     openjpeg_2_0_openjpeg_h
1911     openjpeg_1_5_openjpeg_h
1912     OpenGL_gl3_h
1913     poll_h
1914     soundcard_h
1915     stdatomic_h
1916     sys_mman_h
1917     sys_param_h
1918     sys_resource_h
1919     sys_select_h
1920     sys_soundcard_h
1921     sys_time_h
1922     sys_un_h
1923     sys_videoio_h
1924     termios_h
1925     udplite_h
1926     unistd_h
1927     valgrind_valgrind_h
1928     windows_h
1929     winsock2_h
1930 "
1931
1932 INTRINSICS_LIST="
1933     intrinsics_neon
1934 "
1935
1936 COMPLEX_FUNCS="
1937     cabs
1938     cexp
1939 "
1940
1941 MATH_FUNCS="
1942     atanf
1943     atan2f
1944     cbrt
1945     cbrtf
1946     copysign
1947     cosf
1948     erf
1949     exp2
1950     exp2f
1951     expf
1952     hypot
1953     isfinite
1954     isinf
1955     isnan
1956     ldexpf
1957     llrint
1958     llrintf
1959     log2
1960     log2f
1961     log10f
1962     lrint
1963     lrintf
1964     powf
1965     rint
1966     round
1967     roundf
1968     sinf
1969     trunc
1970     truncf
1971 "
1972
1973 SYSTEM_FUNCS="
1974     access
1975     aligned_malloc
1976     arc4random
1977     clock_gettime
1978     closesocket
1979     CommandLineToArgvW
1980     CoTaskMemFree
1981     CryptGenRandom
1982     dlopen
1983     fcntl
1984     flt_lim
1985     fork
1986     getaddrinfo
1987     gethrtime
1988     getopt
1989     GetProcessAffinityMask
1990     GetProcessMemoryInfo
1991     GetProcessTimes
1992     getrusage
1993     GetSystemTimeAsFileTime
1994     gettimeofday
1995     glob
1996     glXGetProcAddress
1997     gmtime_r
1998     inet_aton
1999     isatty
2000     jack_port_get_latency_range
2001     kbhit
2002     LoadLibrary
2003     localtime_r
2004     lstat
2005     lzo1x_999_compress
2006     mach_absolute_time
2007     MapViewOfFile
2008     memalign
2009     mkstemp
2010     mmap
2011     mprotect
2012     nanosleep
2013     PeekNamedPipe
2014     posix_memalign
2015     pthread_cancel
2016     sched_getaffinity
2017     SetConsoleTextAttribute
2018     SetConsoleCtrlHandler
2019     setmode
2020     setrlimit
2021     Sleep
2022     strerror_r
2023     sysconf
2024     sysctl
2025     usleep
2026     UTGetOSTypeFromString
2027     VirtualAlloc
2028     wglGetProcAddress
2029 "
2030
2031 TOOLCHAIN_FEATURES="
2032     as_dn_directive
2033     as_fpu_directive
2034     as_func
2035     as_object_arch
2036     asm_mod_q
2037     attribute_may_alias
2038     attribute_packed
2039     blocks_extension
2040     ebp_available
2041     ebx_available
2042     gnu_as
2043     gnu_windres
2044     ibm_asm
2045     inline_asm_direct_symbol_refs
2046     inline_asm_labels
2047     inline_asm_nonlocal_labels
2048     pragma_deprecated
2049     rsync_contimeout
2050     symver_asm_label
2051     symver_gnu_asm
2052     vfp_args
2053     xform_asm
2054     xmm_clobbers
2055 "
2056
2057 TYPES_LIST="
2058     CONDITION_VARIABLE_Ptr
2059     socklen_t
2060     struct_addrinfo
2061     struct_group_source_req
2062     struct_ip_mreq_source
2063     struct_ipv6_mreq
2064     struct_msghdr_msg_flags
2065     struct_pollfd
2066     struct_rusage_ru_maxrss
2067     struct_sctp_event_subscribe
2068     struct_sockaddr_in6
2069     struct_sockaddr_sa_len
2070     struct_sockaddr_storage
2071     struct_stat_st_mtim_tv_nsec
2072     struct_v4l2_frmivalenum_discrete
2073 "
2074
2075 HAVE_LIST="
2076     $ARCH_EXT_LIST
2077     $(add_suffix _external $ARCH_EXT_LIST)
2078     $(add_suffix _inline   $ARCH_EXT_LIST)
2079     $ARCH_FEATURES
2080     $ATOMICS_LIST
2081     $BUILTIN_LIST
2082     $COMPLEX_FUNCS
2083     $HAVE_LIST_CMDLINE
2084     $HAVE_LIST_PUB
2085     $HEADERS_LIST
2086     $INTRINSICS_LIST
2087     $MATH_FUNCS
2088     $SYSTEM_FUNCS
2089     $THREADS_LIST
2090     $TOOLCHAIN_FEATURES
2091     $TYPES_LIST
2092     atomics_native
2093     dos_paths
2094     libc_msvcrt
2095     makeinfo
2096     makeinfo_html
2097     MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
2098     perl
2099     pod2man
2100     section_data_rel_ro
2101     texi2html
2102     threads
2103     uwp
2104     vaapi_drm
2105     vaapi_x11
2106     vdpau_x11
2107     winrt
2108 "
2109
2110 # options emitted with CONFIG_ prefix but not available on the command line
2111 CONFIG_EXTRA="
2112     aandcttables
2113     ac3dsp
2114     audio_frame_queue
2115     audiodsp
2116     blockdsp
2117     bswapdsp
2118     cabac
2119     dirac_parse
2120     dvprofile
2121     exif
2122     faandct
2123     faanidct
2124     fdctdsp
2125     flacdsp
2126     fmtconvert
2127     frame_thread_encoder
2128     g722dsp
2129     golomb
2130     gplv3
2131     h263dsp
2132     h264chroma
2133     h264dsp
2134     h264parse
2135     h264pred
2136     h264qpel
2137     hevcparse
2138     hpeldsp
2139     huffman
2140     huffyuvdsp
2141     huffyuvencdsp
2142     idctdsp
2143     iirfilter
2144     mdct15
2145     intrax8
2146     iso_media
2147     ividsp
2148     jpegtables
2149     lgplv3
2150     libx262
2151     llauddsp
2152     llviddsp
2153     llvidencdsp
2154     lpc
2155     lzf
2156     me_cmp
2157     mpeg_er
2158     mpegaudio
2159     mpegaudiodsp
2160     mpegaudioheader
2161     mpegvideo
2162     mpegvideoenc
2163     mss34dsp
2164     pixblockdsp
2165     qpeldsp
2166     qsv
2167     qsvdec
2168     qsvenc
2169     rangecoder
2170     riffdec
2171     riffenc
2172     rtpdec
2173     rtpenc_chain
2174     rv34dsp
2175     sinewin
2176     snappy
2177     srtp
2178     startcode
2179     texturedsp
2180     texturedspenc
2181     tpeldsp
2182     vaapi_encode
2183     vc1dsp
2184     videodsp
2185     vp3dsp
2186     vp56dsp
2187     vp8dsp
2188     wma_freqs
2189     wmv2dsp
2190 "
2191
2192 CMDLINE_SELECT="
2193     $ARCH_EXT_LIST
2194     $CONFIG_LIST
2195     $HAVE_LIST_CMDLINE
2196     $THREADS_LIST
2197     asm
2198     cross_compile
2199     debug
2200     extra_warnings
2201     logging
2202     lto
2203     optimizations
2204     rpath
2205     stripping
2206 "
2207
2208 PATHS_LIST="
2209     bindir
2210     datadir
2211     docdir
2212     incdir
2213     libdir
2214     mandir
2215     pkgconfigdir
2216     prefix
2217     shlibdir
2218     install_name_dir
2219 "
2220
2221 CMDLINE_SET="
2222     $PATHS_LIST
2223     ar
2224     arch
2225     as
2226     assert_level
2227     build_suffix
2228     cc
2229     objcc
2230     cpu
2231     cross_prefix
2232     custom_allocator
2233     cxx
2234     dep_cc
2235     doxygen
2236     env
2237     extra_version
2238     gas
2239     host_cc
2240     host_cflags
2241     host_extralibs
2242     host_ld
2243     host_ldflags
2244     host_os
2245     ignore_tests
2246     install
2247     ld
2248     ln_s
2249     logfile
2250     malloc_prefix
2251     nm
2252     optflags
2253     nvccflags
2254     pkg_config
2255     pkg_config_flags
2256     progs_suffix
2257     random_seed
2258     ranlib
2259     samples
2260     strip
2261     sws_max_filter_size
2262     sysinclude
2263     sysroot
2264     target_exec
2265     target_os
2266     target_path
2267     target_samples
2268     tempprefix
2269     toolchain
2270     valgrind
2271     x86asmexe
2272 "
2273
2274 CMDLINE_APPEND="
2275     extra_cflags
2276     extra_cxxflags
2277     extra_objcflags
2278     host_cppflags
2279 "
2280
2281 # code dependency declarations
2282
2283 # architecture extensions
2284
2285 armv5te_deps="arm"
2286 armv6_deps="arm"
2287 armv6t2_deps="arm"
2288 armv8_deps="aarch64"
2289 neon_deps_any="aarch64 arm"
2290 intrinsics_neon_deps="neon"
2291 vfp_deps_any="aarch64 arm"
2292 vfpv3_deps="vfp"
2293 setend_deps="arm"
2294
2295 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
2296
2297 loongson2_deps="mips"
2298 loongson3_deps="mips"
2299 mipsfpu_deps="mips"
2300 mipsdsp_deps="mips"
2301 mipsdspr2_deps="mips"
2302 mips32r2_deps="mips"
2303 mips32r5_deps="mips"
2304 mips32r6_deps="mips"
2305 mips64r2_deps="mips"
2306 mips64r6_deps="mips"
2307 msa_deps="mipsfpu"
2308 mmi_deps="mips"
2309
2310 altivec_deps="ppc"
2311 dcbzl_deps="ppc"
2312 ldbrx_deps="ppc"
2313 ppc4xx_deps="ppc"
2314 vsx_deps="altivec"
2315 power8_deps="vsx"
2316
2317 cpunop_deps="i686"
2318 x86_64_select="i686"
2319 x86_64_suggest="fast_cmov"
2320
2321 amd3dnow_deps="mmx"
2322 amd3dnowext_deps="amd3dnow"
2323 i686_deps="x86"
2324 mmx_deps="x86"
2325 mmxext_deps="mmx"
2326 sse_deps="mmxext"
2327 sse2_deps="sse"
2328 sse3_deps="sse2"
2329 ssse3_deps="sse3"
2330 sse4_deps="ssse3"
2331 sse42_deps="sse4"
2332 aesni_deps="sse42"
2333 avx_deps="sse42"
2334 xop_deps="avx"
2335 fma3_deps="avx"
2336 fma4_deps="avx"
2337 avx2_deps="avx"
2338
2339 mmx_external_deps="x86asm"
2340 mmx_inline_deps="inline_asm"
2341 mmx_suggest="mmx_external mmx_inline"
2342
2343 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
2344     eval dep=\$${ext}_deps
2345     eval ${ext}_external_deps='"${dep}_external"'
2346     eval ${ext}_inline_deps='"${dep}_inline"'
2347     eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
2348 done
2349
2350 aligned_stack_if_any="aarch64 ppc x86"
2351 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
2352 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
2353 fast_unaligned_if_any="aarch64 ppc x86"
2354 simd_align_16_if_any="altivec neon sse"
2355 simd_align_32_if_any="avx"
2356
2357 # system capabilities
2358 symver_if_any="symver_asm_label symver_gnu_asm"
2359 valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
2360
2361 # threading support
2362 atomics_gcc_if="sync_val_compare_and_swap"
2363 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
2364 atomics_win32_if="MemoryBarrier"
2365 atomics_native_if_any="$ATOMICS_LIST"
2366 w32threads_deps="atomics_native"
2367 threads_if_any="$THREADS_LIST"
2368
2369 # subsystems
2370 dct_select="rdft"
2371 dirac_parse_select="golomb"
2372 error_resilience_select="me_cmp"
2373 faandct_deps="faan fdctdsp"
2374 faanidct_deps="faan idctdsp"
2375 h264dsp_select="startcode"
2376 hevcparse_select="golomb"
2377 frame_thread_encoder_deps="encoders threads"
2378 intrax8_select="blockdsp idctdsp"
2379 mdct_select="fft"
2380 mdct15_select="fft"
2381 me_cmp_select="fdctdsp idctdsp pixblockdsp"
2382 mpeg_er_select="error_resilience"
2383 mpegaudio_select="mpegaudiodsp mpegaudioheader"
2384 mpegaudiodsp_select="dct"
2385 mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
2386 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
2387 vc1dsp_select="h264chroma qpeldsp startcode"
2388 rdft_select="fft"
2389
2390 # decoders / encoders
2391 aac_decoder_select="mdct15 mdct sinewin"
2392 aac_fixed_decoder_select="mdct sinewin"
2393 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
2394 aac_latm_decoder_select="aac_decoder aac_latm_parser"
2395 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2396 ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
2397 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
2398 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
2399 adpcm_g722_decoder_select="g722dsp"
2400 adpcm_g722_encoder_select="g722dsp"
2401 aic_decoder_select="golomb idctdsp"
2402 alac_encoder_select="lpc"
2403 als_decoder_select="bswapdsp"
2404 amrnb_decoder_select="lsp"
2405 amrwb_decoder_select="lsp"
2406 amv_decoder_select="sp5x_decoder exif"
2407 amv_encoder_select="aandcttables jpegtables mpegvideoenc"
2408 ape_decoder_select="bswapdsp llauddsp"
2409 apng_decoder_select="zlib"
2410 apng_encoder_select="llvidencdsp zlib"
2411 asv1_decoder_select="blockdsp bswapdsp idctdsp"
2412 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
2413 asv2_decoder_select="blockdsp bswapdsp idctdsp"
2414 asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
2415 atrac1_decoder_select="mdct sinewin"
2416 atrac3_decoder_select="mdct"
2417 atrac3p_decoder_select="mdct sinewin"
2418 avrn_decoder_select="exif jpegtables"
2419 bink_decoder_select="blockdsp hpeldsp"
2420 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
2421 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
2422 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
2423 clearvideo_decoder_select="idctdsp"
2424 cllc_decoder_select="bswapdsp"
2425 comfortnoise_encoder_select="lpc"
2426 cook_decoder_select="audiodsp mdct sinewin"
2427 cscd_decoder_select="lzo"
2428 cscd_decoder_suggest="zlib"
2429 dca_decoder_select="mdct"
2430 dds_decoder_select="texturedsp"
2431 dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
2432 dnxhd_decoder_select="blockdsp idctdsp"
2433 dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
2434 dolby_e_decoder_select="mdct"
2435 dvvideo_decoder_select="dvprofile idctdsp"
2436 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
2437 dxa_decoder_select="zlib"
2438 dxv_decoder_select="lzf texturedsp"
2439 eac3_decoder_select="ac3_decoder"
2440 eac3_encoder_select="ac3_encoder"
2441 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
2442 eatgq_decoder_select="aandcttables"
2443 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
2444 exr_decoder_select="zlib"
2445 ffv1_decoder_select="rangecoder"
2446 ffv1_encoder_select="rangecoder"
2447 ffvhuff_decoder_select="huffyuv_decoder"
2448 ffvhuff_encoder_select="huffyuv_encoder"
2449 fic_decoder_select="golomb"
2450 flac_decoder_select="flacdsp"
2451 flac_encoder_select="bswapdsp flacdsp lpc"
2452 flashsv2_decoder_select="zlib"
2453 flashsv2_encoder_select="zlib"
2454 flashsv_decoder_select="zlib"
2455 flashsv_encoder_select="zlib"
2456 flv_decoder_select="h263_decoder"
2457 flv_encoder_select="h263_encoder"
2458 fourxm_decoder_select="blockdsp bswapdsp"
2459 fraps_decoder_select="bswapdsp huffman"
2460 g2m_decoder_select="blockdsp idctdsp jpegtables zlib"
2461 g729_decoder_select="audiodsp"
2462 h261_decoder_select="mpegvideo"
2463 h261_encoder_select="aandcttables mpegvideoenc"
2464 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
2465 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
2466 h263i_decoder_select="h263_decoder"
2467 h263p_decoder_select="h263_decoder"
2468 h263p_encoder_select="h263_encoder"
2469 h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
2470 h264_decoder_suggest="error_resilience"
2471 hap_decoder_select="snappy texturedsp"
2472 hap_encoder_deps="libsnappy"
2473 hap_encoder_select="texturedspenc"
2474 hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp"
2475 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
2476 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
2477 iac_decoder_select="imc_decoder"
2478 imc_decoder_select="bswapdsp fft mdct sinewin"
2479 indeo3_decoder_select="hpeldsp"
2480 indeo4_decoder_select="ividsp"
2481 indeo5_decoder_select="ividsp"
2482 interplay_video_decoder_select="hpeldsp"
2483 jpegls_decoder_select="mjpeg_decoder"
2484 jv_decoder_select="blockdsp"
2485 lagarith_decoder_select="llviddsp"
2486 ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc"
2487 magicyuv_decoder_select="llviddsp"
2488 mdec_decoder_select="blockdsp idctdsp mpegvideo"
2489 metasound_decoder_select="lsp mdct sinewin"
2490 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
2491 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
2492 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
2493 mjpegb_decoder_select="mjpeg_decoder"
2494 mlp_decoder_select="mlp_parser"
2495 mlp_encoder_select="lpc"
2496 motionpixels_decoder_select="bswapdsp"
2497 mp1_decoder_select="mpegaudio"
2498 mp1float_decoder_select="mpegaudio"
2499 mp2_decoder_select="mpegaudio"
2500 mp2float_decoder_select="mpegaudio"
2501 mp3_decoder_select="mpegaudio"
2502 mp3adu_decoder_select="mpegaudio"
2503 mp3adufloat_decoder_select="mpegaudio"
2504 mp3float_decoder_select="mpegaudio"
2505 mp3on4_decoder_select="mpegaudio"
2506 mp3on4float_decoder_select="mpegaudio"
2507 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2508 mpc8_decoder_select="mpegaudiodsp"
2509 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
2510 mpeg_xvmc_decoder_select="mpeg2video_decoder"
2511 mpegvideo_decoder_select="mpegvideo"
2512 mpeg1video_decoder_select="mpegvideo"
2513 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
2514 mpeg2video_decoder_select="mpegvideo"
2515 mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
2516 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2517 mpeg4_encoder_select="h263_encoder"
2518 msa1_decoder_select="mss34dsp"
2519 mscc_decoder_select="zlib"
2520 msmpeg4v1_decoder_select="h263_decoder"
2521 msmpeg4v2_decoder_select="h263_decoder"
2522 msmpeg4v2_encoder_select="h263_encoder"
2523 msmpeg4v3_decoder_select="h263_decoder"
2524 msmpeg4v3_encoder_select="h263_encoder"
2525 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
2526 mts2_decoder_select="mss34dsp"
2527 mxpeg_decoder_select="mjpeg_decoder"
2528 nellymoser_decoder_select="mdct sinewin"
2529 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2530 nuv_decoder_select="idctdsp lzo"
2531 on2avc_decoder_select="mdct"
2532 opus_decoder_deps="swresample"
2533 opus_decoder_select="mdct15"
2534 opus_encoder_select="audio_frame_queue mdct15"
2535 png_decoder_select="zlib"
2536 png_encoder_select="llvidencdsp zlib"
2537 prores_decoder_select="blockdsp idctdsp"
2538 prores_encoder_select="fdctdsp"
2539 qcelp_decoder_select="lsp"
2540 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2541 ra_144_decoder_select="audiodsp"
2542 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
2543 ralf_decoder_select="golomb"
2544 rawvideo_decoder_select="bswapdsp"
2545 rscc_decoder_select="zlib"
2546 rtjpeg_decoder_select="me_cmp"
2547 rv10_decoder_select="h263_decoder"
2548 rv10_encoder_select="h263_encoder"
2549 rv20_decoder_select="h263_decoder"
2550 rv20_encoder_select="h263_encoder"
2551 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2552 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2553 screenpresso_decoder_select="zlib"
2554 shorten_decoder_select="bswapdsp"
2555 sipr_decoder_select="lsp"
2556 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
2557 snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
2558 sonic_decoder_select="golomb rangecoder"
2559 sonic_encoder_select="golomb rangecoder"
2560 sonic_ls_encoder_select="golomb rangecoder"
2561 sp5x_decoder_select="mjpeg_decoder"
2562 srgc_decoder_select="zlib"
2563 svq1_decoder_select="hpeldsp"
2564 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
2565 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
2566 svq3_decoder_suggest="zlib"
2567 tak_decoder_select="audiodsp"
2568 tdsc_decoder_select="zlib mjpeg_decoder"
2569 theora_decoder_select="vp3_decoder"
2570 thp_decoder_select="mjpeg_decoder"
2571 tiff_decoder_suggest="zlib lzma"
2572 tiff_encoder_suggest="zlib"
2573 truehd_decoder_select="mlp_parser"
2574 truehd_encoder_select="lpc"
2575 truemotion2_decoder_select="bswapdsp"
2576 truespeech_decoder_select="bswapdsp"
2577 tscc_decoder_select="zlib"
2578 twinvq_decoder_select="mdct lsp sinewin"
2579 txd_decoder_select="texturedsp"
2580 utvideo_decoder_select="bswapdsp llviddsp"
2581 utvideo_encoder_select="bswapdsp huffman llvidencdsp"
2582 vble_decoder_select="llviddsp"
2583 vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
2584 vc1_qsv_decoder_deps="libmfx"
2585 vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser"
2586 vc1image_decoder_select="vc1_decoder"
2587 vorbis_decoder_select="mdct"
2588 vorbis_encoder_select="mdct"
2589 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2590 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2591 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2592 vp6a_decoder_select="vp6_decoder"
2593 vp6f_decoder_select="vp6_decoder"
2594 vp7_decoder_select="h264pred videodsp vp8dsp"
2595 vp8_decoder_select="h264pred videodsp vp8dsp"
2596 vp9_decoder_select="videodsp vp9_parser"
2597 webp_decoder_select="vp8_decoder exif"
2598 wmalossless_decoder_select="llauddsp"
2599 wmapro_decoder_select="mdct sinewin wma_freqs"
2600 wmav1_decoder_select="mdct sinewin wma_freqs"
2601 wmav1_encoder_select="mdct sinewin wma_freqs"
2602 wmav2_decoder_select="mdct sinewin wma_freqs"
2603 wmav2_encoder_select="mdct sinewin wma_freqs"
2604 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2605 wmv1_decoder_select="h263_decoder"
2606 wmv1_encoder_select="h263_encoder"
2607 wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2608 wmv2_encoder_select="h263_encoder wmv2dsp"
2609 wmv3_decoder_select="vc1_decoder"
2610 wmv3image_decoder_select="wmv3_decoder"
2611 xma1_decoder_select="wmapro_decoder"
2612 xma2_decoder_select="wmapro_decoder"
2613 zerocodec_decoder_select="zlib"
2614 zlib_decoder_select="zlib"
2615 zlib_encoder_select="zlib"
2616 zmbv_decoder_select="zlib"
2617 zmbv_encoder_select="zlib"
2618
2619 # hardware accelerators
2620 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2621 cuda_deps_any="dlopen LoadLibrary"
2622 cuvid_deps="cuda"
2623 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
2624 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32"
2625 dxva2_extralibs="-luser32"
2626 vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h blocks_extension"
2627 vda_framework_extralibs="-framework VideoDecodeAcceleration"
2628 vda_deps="vda_framework pthreads"
2629 vda_extralibs="-framework CoreFoundation -framework QuartzCore"
2630 videotoolbox_hwaccel_deps="videotoolbox pthreads"
2631 videotoolbox_hwaccel_extralibs="-framework QuartzCore"
2632 xvmc_deps="X11_extensions_XvMClib_h"
2633
2634 h263_vaapi_hwaccel_deps="vaapi"
2635 h263_vaapi_hwaccel_select="h263_decoder"
2636 h263_videotoolbox_hwaccel_deps="videotoolbox"
2637 h263_videotoolbox_hwaccel_select="h263_decoder"
2638 h264_cuvid_hwaccel_deps="cuda cuvid"
2639 h264_cuvid_hwaccel_select="h264_cuvid_decoder"
2640 h264_d3d11va_hwaccel_deps="d3d11va"
2641 h264_d3d11va_hwaccel_select="h264_decoder"
2642 h264_d3d11va2_hwaccel_deps="d3d11va"
2643 h264_d3d11va2_hwaccel_select="h264_decoder"
2644 h264_dxva2_hwaccel_deps="dxva2"
2645 h264_dxva2_hwaccel_select="h264_decoder"
2646 h264_mediacodec_hwaccel_deps="mediacodec"
2647 h264_mmal_hwaccel_deps="mmal"
2648 h264_qsv_hwaccel_deps="libmfx"
2649 h264_vaapi_hwaccel_deps="vaapi"
2650 h264_vaapi_hwaccel_select="h264_decoder"
2651 h264_vda_hwaccel_deps="vda"
2652 h264_vda_hwaccel_select="h264_decoder"
2653 h264_vda_old_hwaccel_deps="vda"
2654 h264_vda_old_hwaccel_select="h264_decoder"
2655 h264_vdpau_hwaccel_deps="vdpau"
2656 h264_vdpau_hwaccel_select="h264_decoder"
2657 h264_videotoolbox_hwaccel_deps="videotoolbox"
2658 h264_videotoolbox_hwaccel_select="h264_decoder"
2659 hevc_cuvid_hwaccel_deps="cuda cuvid"
2660 hevc_cuvid_hwaccel_select="hevc_cuvid_decoder"
2661 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2662 hevc_d3d11va_hwaccel_select="hevc_decoder"
2663 hevc_mediacodec_hwaccel_deps="mediacodec"
2664 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2665 hevc_d3d11va2_hwaccel_select="hevc_decoder"
2666 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2667 hevc_dxva2_hwaccel_select="hevc_decoder"
2668 hevc_qsv_hwaccel_deps="libmfx"
2669 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2670 hevc_vaapi_hwaccel_select="hevc_decoder"
2671 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2672 hevc_vdpau_hwaccel_select="hevc_decoder"
2673 mjpeg_cuvid_hwaccel_deps="cuda cuvid"
2674 mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
2675 mpeg_xvmc_hwaccel_deps="xvmc"
2676 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2677 mpeg1_cuvid_hwaccel_deps="cuda cuvid"
2678 mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder"
2679 mpeg1_vdpau_hwaccel_deps="vdpau"
2680 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2681 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
2682 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
2683 mpeg1_xvmc_hwaccel_deps="xvmc"
2684 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2685 mpeg2_cuvid_hwaccel_deps="cuda cuvid"
2686 mpeg2_cuvid_hwaccel_select="mpeg2_cuvid_decoder"
2687 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2688 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2689 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
2690 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
2691 mpeg2_dxva2_hwaccel_deps="dxva2"
2692 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2693 mpeg2_mediacodec_hwaccel_deps="mediacodec"
2694 mpeg2_mmal_hwaccel_deps="mmal"
2695 mpeg2_qsv_hwaccel_deps="libmfx"
2696 mpeg2_qsv_hwaccel_select="qsvdec_mpeg2"
2697 mpeg2_vaapi_hwaccel_deps="vaapi"
2698 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2699 mpeg2_vdpau_hwaccel_deps="vdpau"
2700 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2701 mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
2702 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
2703 mpeg2_xvmc_hwaccel_deps="xvmc"
2704 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2705 mpeg4_cuvid_hwaccel_deps="cuda cuvid"
2706 mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder"
2707 mpeg4_mediacodec_hwaccel_deps="mediacodec"
2708 mpeg4_mmal_hwaccel_deps="mmal"
2709 mpeg4_vaapi_hwaccel_deps="vaapi"
2710 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2711 mpeg4_vdpau_hwaccel_deps="vdpau"
2712 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2713 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
2714 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
2715 vc1_cuvid_hwaccel_deps="cuda cuvid"
2716 vc1_cuvid_hwaccel_select="vc1_cuvid_decoder"
2717 vc1_d3d11va_hwaccel_deps="d3d11va"
2718 vc1_d3d11va_hwaccel_select="vc1_decoder"
2719 vc1_d3d11va2_hwaccel_deps="d3d11va"
2720 vc1_d3d11va2_hwaccel_select="vc1_decoder"
2721 vc1_dxva2_hwaccel_deps="dxva2"
2722 vc1_dxva2_hwaccel_select="vc1_decoder"
2723 vc1_mmal_hwaccel_deps="mmal"
2724 vc1_qsv_hwaccel_deps="libmfx"
2725 vc1_qsv_hwaccel_select="qsvdec_vc1"
2726 vc1_vaapi_hwaccel_deps="vaapi"
2727 vc1_vaapi_hwaccel_select="vc1_decoder"
2728 vc1_vdpau_hwaccel_deps="vdpau"
2729 vc1_vdpau_hwaccel_select="vc1_decoder"
2730 vp8_cuvid_hwaccel_deps="cuda cuvid"
2731 vp8_cuvid_hwaccel_select="vp8_cuvid_decoder"
2732 vp9_cuvid_hwaccel_deps="cuda cuvid"
2733 vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
2734 vp8_mediacodec_hwaccel_deps="mediacodec"
2735 vp8_qsv_hwaccel_deps="libmfx"
2736 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
2737 vp9_d3d11va_hwaccel_select="vp9_decoder"
2738 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
2739 vp9_d3d11va2_hwaccel_select="vp9_decoder"
2740 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
2741 vp9_dxva2_hwaccel_select="vp9_decoder"
2742 vp9_mediacodec_hwaccel_deps="mediacodec"
2743 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
2744 vp9_vaapi_hwaccel_select="vp9_decoder"
2745 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2746 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
2747 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2748 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2749 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2750
2751 # hardware-accelerated codecs
2752 omx_deps="dlopen pthreads"
2753 omx_extralibs='$ldl'
2754 omx_rpi_select="omx"
2755 qsvdec_select="qsv"
2756 qsvenc_select="qsv"
2757 vaapi_encode_deps="vaapi"
2758
2759 hwupload_cuda_filter_deps="cuda"
2760 scale_npp_filter_deps="cuda libnpp"
2761 scale_cuda_filter_deps="cuda_sdk"
2762 thumbnail_cuda_filter_deps="cuda_sdk"
2763
2764 nvenc_deps="cuda"
2765 nvenc_deps_any="dlopen LoadLibrary"
2766 nvenc_encoder_deps="nvenc"
2767
2768 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
2769 h264_cuvid_decoder_deps="cuda cuvid"
2770 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
2771 h264_mediacodec_decoder_deps="mediacodec"
2772 h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
2773 h264_mmal_decoder_deps="mmal"
2774 h264_nvenc_encoder_deps="nvenc"
2775 h264_omx_encoder_deps="omx"
2776 h264_qsv_decoder_deps="libmfx"
2777 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2778 h264_qsv_encoder_deps="libmfx"
2779 h264_qsv_encoder_select="qsvenc"
2780 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2781 h264_vaapi_encoder_select="vaapi_encode golomb"
2782 h264_vda_decoder_deps="vda"
2783 h264_vda_decoder_select="h264_decoder"
2784 h264_vdpau_decoder_deps="vdpau"
2785 h264_vdpau_decoder_select="h264_decoder"
2786 hevc_cuvid_decoder_deps="cuda cuvid"
2787 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
2788 hevc_mediacodec_decoder_deps="mediacodec"
2789 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
2790 hevc_nvenc_encoder_deps="nvenc"
2791 hevc_qsv_decoder_deps="libmfx"
2792 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
2793 hevc_qsv_encoder_deps="libmfx"
2794 hevc_qsv_encoder_select="hevcparse qsvenc"
2795 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2796 hevc_vaapi_encoder_select="vaapi_encode golomb"
2797 mjpeg_cuvid_decoder_deps="cuda cuvid"
2798 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
2799 mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
2800 mpeg1_cuvid_decoder_deps="cuda cuvid"
2801 mpeg1_vdpau_decoder_deps="vdpau"
2802 mpeg1_vdpau_decoder_select="mpeg1video_decoder"
2803 mpeg2_crystalhd_decoder_select="crystalhd"
2804 mpeg2_cuvid_decoder_deps="cuda cuvid"
2805 mpeg2_mmal_decoder_deps="mmal"
2806 mpeg2_mediacodec_decoder_deps="mediacodec"
2807 mpeg2_qsv_decoder_deps="libmfx"
2808 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel"
2809 mpeg2_qsv_encoder_deps="libmfx"
2810 mpeg2_qsv_encoder_select="qsvenc"
2811 mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2"
2812 mpeg2_vaapi_encoder_select="vaapi_encode"
2813 mpeg4_crystalhd_decoder_select="crystalhd"
2814 mpeg4_cuvid_decoder_deps="cuda cuvid"
2815 mpeg4_mediacodec_decoder_deps="mediacodec"
2816 mpeg4_mmal_decoder_deps="mmal"
2817 mpeg4_omx_encoder_deps="omx"
2818 mpeg4_vdpau_decoder_deps="vdpau"
2819 mpeg4_vdpau_decoder_select="mpeg4_decoder"
2820 mpeg_vdpau_decoder_deps="vdpau"
2821 mpeg_vdpau_decoder_select="mpeg2video_decoder"
2822 msmpeg4_crystalhd_decoder_select="crystalhd"
2823 nvenc_h264_encoder_select="h264_nvenc_encoder"
2824 nvenc_hevc_encoder_select="hevc_nvenc_encoder"
2825 vc1_crystalhd_decoder_select="crystalhd"
2826 vc1_cuvid_decoder_deps="cuda cuvid"
2827 vc1_mmal_decoder_deps="mmal"
2828 vc1_vdpau_decoder_deps="vdpau"
2829 vc1_vdpau_decoder_select="vc1_decoder"
2830 vp8_cuvid_decoder_deps="cuda cuvid"
2831 vp8_mediacodec_decoder_deps="mediacodec"
2832 vp8_qsv_decoder_deps="libmfx"
2833 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
2834 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
2835 vp8_vaapi_encoder_select="vaapi_encode"
2836 vp9_cuvid_decoder_deps="cuda cuvid"
2837 vp9_mediacodec_decoder_deps="mediacodec"
2838 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
2839 vp9_vaapi_encoder_select="vaapi_encode"
2840 wmv3_crystalhd_decoder_select="crystalhd"
2841 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
2842
2843 # parsers
2844 h264_parser_select="golomb h264dsp h264parse"
2845 hevc_parser_select="hevcparse"
2846 mpegaudio_parser_select="mpegaudioheader"
2847 mpegvideo_parser_select="mpegvideo"
2848 mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
2849 vc1_parser_select="vc1dsp"
2850
2851 # bitstream_filters
2852 mjpeg2jpeg_bsf_select="jpegtables"
2853
2854 # external libraries
2855 aac_at_decoder_deps="audiotoolbox"
2856 ac3_at_decoder_deps="audiotoolbox"
2857 ac3_at_decoder_select="ac3_parser"
2858 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
2859 alac_at_decoder_deps="audiotoolbox"
2860 amr_nb_at_decoder_deps="audiotoolbox"
2861 avisynth_deps_any="dlopen LoadLibrary"
2862 avisynth_demuxer_deps="avisynth"
2863 avisynth_demuxer_select="riffdec"
2864 eac3_at_decoder_deps="audiotoolbox"
2865 eac3_at_decoder_select="ac3_parser"
2866 gsm_ms_at_decoder_deps="audiotoolbox"
2867 ilbc_at_decoder_deps="audiotoolbox"
2868 mp1_at_decoder_deps="audiotoolbox"
2869 mp2_at_decoder_deps="audiotoolbox"
2870 mp3_at_decoder_deps="audiotoolbox"
2871 mp1_at_decoder_select="mpegaudioheader"
2872 mp2_at_decoder_select="mpegaudioheader"
2873 mp3_at_decoder_select="mpegaudioheader"
2874 pcm_alaw_at_decoder_deps="audiotoolbox"
2875 pcm_mulaw_at_decoder_deps="audiotoolbox"
2876 qdmc_at_decoder_deps="audiotoolbox"
2877 qdm2_at_decoder_deps="audiotoolbox"
2878 aac_at_encoder_deps="audiotoolbox"
2879 aac_at_encoder_select="audio_frame_queue"
2880 alac_at_encoder_deps="audiotoolbox"
2881 alac_at_encoder_select="audio_frame_queue"
2882 ilbc_at_encoder_deps="audiotoolbox"
2883 ilbc_at_encoder_select="audio_frame_queue"
2884 pcm_alaw_at_encoder_deps="audiotoolbox"
2885 pcm_alaw_at_encoder_select="audio_frame_queue"
2886 pcm_mulaw_at_encoder_deps="audiotoolbox"
2887 pcm_mulaw_at_encoder_select="audio_frame_queue"
2888 chromaprint_muxer_deps="chromaprint"
2889 h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
2890 libcelt_decoder_deps="libcelt"
2891 libfdk_aac_decoder_deps="libfdk_aac"
2892 libfdk_aac_encoder_deps="libfdk_aac"
2893 libfdk_aac_encoder_select="audio_frame_queue"
2894 libgme_demuxer_deps="libgme"
2895 libgsm_decoder_deps="libgsm"
2896 libgsm_encoder_deps="libgsm"
2897 libgsm_ms_decoder_deps="libgsm"
2898 libgsm_ms_encoder_deps="libgsm"
2899 libilbc_decoder_deps="libilbc"
2900 libilbc_encoder_deps="libilbc"
2901 libkvazaar_encoder_deps="libkvazaar"
2902 libmodplug_demuxer_deps="libmodplug"
2903 libmp3lame_encoder_deps="libmp3lame"
2904 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
2905 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2906 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2907 libopencore_amrnb_encoder_select="audio_frame_queue"
2908 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2909 libopenh264_decoder_deps="libopenh264"
2910 libopenh264_decoder_select="h264_mp4toannexb_bsf"
2911 libopenh264_encoder_deps="libopenh264"
2912 libopenjpeg_decoder_deps="libopenjpeg"
2913 libopenjpeg_encoder_deps="libopenjpeg"
2914 libopenmpt_demuxer_deps="libopenmpt"
2915 libopus_decoder_deps="libopus"
2916 libopus_encoder_deps="libopus"
2917 libopus_encoder_select="audio_frame_queue"
2918 librsvg_decoder_deps="librsvg"
2919 libshine_encoder_deps="libshine"
2920 libshine_encoder_select="audio_frame_queue"
2921 libspeex_decoder_deps="libspeex"
2922 libspeex_encoder_deps="libspeex"
2923 libspeex_encoder_select="audio_frame_queue"
2924 libtheora_encoder_deps="libtheora"
2925 libtwolame_encoder_deps="libtwolame"
2926 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2927 libvorbis_decoder_deps="libvorbis"
2928 libvorbis_encoder_deps="libvorbis"
2929 libvorbis_encoder_select="audio_frame_queue"
2930 libvpx_vp8_decoder_deps="libvpx"
2931 libvpx_vp8_encoder_deps="libvpx"
2932 libvpx_vp9_decoder_deps="libvpx"
2933 libvpx_vp9_encoder_deps="libvpx"
2934 libwavpack_encoder_deps="libwavpack"
2935 libwavpack_encoder_select="audio_frame_queue"
2936 libwebp_encoder_deps="libwebp"
2937 libwebp_anim_encoder_deps="libwebp"
2938 libx262_encoder_deps="libx262"
2939 libx264_encoder_deps="libx264"
2940 libx264rgb_encoder_deps="libx264 x264_csp_bgr"
2941 libx264rgb_encoder_select="libx264_encoder"
2942 libx265_encoder_deps="libx265"
2943 libxavs_encoder_deps="libxavs"
2944 libxvid_encoder_deps="libxvid"
2945 libzvbi_teletext_decoder_deps="libzvbi"
2946 videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo"
2947 videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
2948 videotoolbox_encoder_suggest="vda_framework"
2949
2950 # demuxers / muxers
2951 ac3_demuxer_select="ac3_parser"
2952 aiff_muxer_select="iso_media"
2953 asf_demuxer_select="riffdec"
2954 asf_o_demuxer_select="riffdec"
2955 asf_muxer_select="riffenc"
2956 asf_stream_muxer_select="asf_muxer"
2957 avi_demuxer_select="iso_media riffdec exif"
2958 avi_muxer_select="riffenc"
2959 caf_demuxer_select="iso_media riffdec"
2960 caf_muxer_select="iso_media"
2961 dash_muxer_select="mp4_muxer"
2962 dash_demuxer_deps="libxml2"
2963 dirac_demuxer_select="dirac_parser"
2964 dts_demuxer_select="dca_parser"
2965 dtshd_demuxer_select="dca_parser"
2966 dv_demuxer_select="dvprofile"
2967 dv_muxer_select="dvprofile"
2968 dxa_demuxer_select="riffdec"
2969 eac3_demuxer_select="ac3_parser"
2970 f4v_muxer_select="mov_muxer"
2971 fifo_muxer_deps="threads"
2972 flac_demuxer_select="flac_parser"
2973 hds_muxer_select="flv_muxer"
2974 hls_muxer_select="mpegts_muxer"
2975 image2_alias_pix_demuxer_select="image2_demuxer"
2976 image2_brender_pix_demuxer_select="image2_demuxer"
2977 ipod_muxer_select="mov_muxer"
2978 ismv_muxer_select="mov_muxer"
2979 matroska_audio_muxer_select="matroska_muxer"
2980 matroska_demuxer_select="iso_media riffdec"
2981 matroska_demuxer_suggest="bzlib lzo zlib"
2982 matroska_muxer_select="iso_media riffenc"
2983 mmf_muxer_select="riffenc"
2984 mov_demuxer_select="iso_media riffdec"
2985 mov_demuxer_suggest="zlib"
2986 mov_muxer_select="iso_media riffenc rtpenc_chain"
2987 mp3_demuxer_select="mpegaudio_parser"
2988 mp3_muxer_select="mpegaudioheader"
2989 mp4_muxer_select="mov_muxer"
2990 mpegts_demuxer_select="iso_media"
2991 mpegts_muxer_select="adts_muxer latm_muxer"
2992 mpegtsraw_demuxer_select="mpegts_demuxer"
2993 mxf_d10_muxer_select="mxf_muxer"
2994 mxf_opatom_muxer_select="mxf_muxer"
2995 nut_muxer_select="riffenc"
2996 nuv_demuxer_select="riffdec"
2997 oga_muxer_select="ogg_muxer"
2998 ogg_demuxer_select="dirac_parse"
2999 ogv_muxer_select="ogg_muxer"
3000 opus_muxer_select="ogg_muxer"
3001 psp_muxer_select="mov_muxer"
3002 rtp_demuxer_select="sdp_demuxer"
3003 rtp_muxer_select="golomb"
3004 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
3005 rtsp_demuxer_select="http_protocol rtpdec"
3006 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
3007 sap_demuxer_select="sdp_demuxer"
3008 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
3009 sdp_demuxer_select="rtpdec"
3010 smoothstreaming_muxer_select="ismv_muxer"
3011 spdif_muxer_select="aac_parser"
3012 spx_muxer_select="ogg_muxer"
3013 swf_demuxer_suggest="zlib"
3014 tak_demuxer_select="tak_parser"
3015 tg2_muxer_select="mov_muxer"
3016 tgp_muxer_select="mov_muxer"
3017 vobsub_demuxer_select="mpegps_demuxer"
3018 w64_demuxer_select="wav_demuxer"
3019 w64_muxer_select="wav_muxer"
3020 wav_demuxer_select="riffdec"
3021 wav_muxer_select="riffenc"
3022 webm_muxer_select="iso_media riffenc"
3023 webm_dash_manifest_demuxer_select="matroska_demuxer"
3024 wtv_demuxer_select="mpegts_demuxer riffdec"
3025 wtv_muxer_select="mpegts_muxer riffenc"
3026 xmv_demuxer_select="riffdec"
3027 xwma_demuxer_select="riffdec"
3028
3029 # indevs / outdevs
3030 alsa_indev_deps="alsa"
3031 alsa_outdev_deps="alsa"
3032 avfoundation_indev_deps="avfoundation pthreads"
3033 avfoundation_indev_extralibs="-framework Foundation -framework CoreVideo -framework CoreMedia"
3034 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
3035 caca_outdev_deps="libcaca"
3036 decklink_indev_deps="decklink threads"
3037 decklink_indev_extralibs="-lstdc++"
3038 decklink_outdev_deps="decklink threads"
3039 decklink_outdev_extralibs="-lstdc++"
3040 libndi_newtek_indev_deps="libndi_newtek"
3041 libndi_newtek_indev_extralibs="-lndi"
3042 libndi_newtek_outdev_deps="libndi_newtek"
3043 libndi_newtek_outdev_extralibs="-lndi"
3044 dshow_indev_deps="IBaseFilter"
3045 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
3046 dv1394_indev_deps="dv1394"
3047 dv1394_indev_select="dv_demuxer"
3048 fbdev_indev_deps="linux_fb_h"
3049 fbdev_outdev_deps="linux_fb_h"
3050 gdigrab_indev_deps="CreateDIBSection"
3051 gdigrab_indev_extralibs="-lgdi32"
3052 gdigrab_indev_select="bmp_decoder"
3053 iec61883_indev_deps="libiec61883"
3054 jack_indev_deps="jack"
3055 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
3056 kmsgrab_indev_deps="libdrm"
3057 lavfi_indev_deps="avfilter"
3058 libcdio_indev_deps="libcdio"
3059 libdc1394_indev_deps="libdc1394"
3060 libv4l2_indev_deps="libv4l2"
3061 openal_indev_deps="openal"
3062 opengl_outdev_deps="opengl"
3063 oss_indev_deps_any="soundcard_h sys_soundcard_h"
3064 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
3065 pulse_indev_deps="libpulse"
3066 pulse_outdev_deps="libpulse"
3067 sdl2_outdev_deps="sdl2"
3068 sndio_indev_deps="sndio"
3069 sndio_outdev_deps="sndio"
3070 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
3071 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
3072 vfwcap_indev_deps="vfw32 vfwcap_defines"
3073 xcbgrab_indev_deps="libxcb"
3074 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
3075 xv_outdev_extralibs="-lXv -lX11 -lXext"
3076
3077 # protocols
3078 async_protocol_deps="threads"
3079 bluray_protocol_deps="libbluray"
3080 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
3081 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
3082 ffrtmpcrypt_protocol_select="tcp_protocol"
3083 ffrtmphttp_protocol_deps="!librtmp_protocol"
3084 ffrtmphttp_protocol_select="http_protocol"
3085 ftp_protocol_select="tcp_protocol"
3086 gopher_protocol_select="network"
3087 http_protocol_select="tcp_protocol"
3088 httpproxy_protocol_select="tcp_protocol"
3089 https_protocol_select="tls_protocol"
3090 icecast_protocol_select="http_protocol"
3091 librtmp_protocol_deps="librtmp"
3092 librtmpe_protocol_deps="librtmp"
3093 librtmps_protocol_deps="librtmp"
3094 librtmpt_protocol_deps="librtmp"
3095 librtmpte_protocol_deps="librtmp"
3096 libsmbclient_protocol_deps="libsmbclient gplv3"
3097 libssh_protocol_deps="libssh"
3098 mmsh_protocol_select="http_protocol"
3099 mmst_protocol_select="network"
3100 rtmp_protocol_deps="!librtmp_protocol"
3101 rtmp_protocol_select="tcp_protocol"
3102 rtmpe_protocol_select="ffrtmpcrypt_protocol"
3103 rtmps_protocol_deps="!librtmp_protocol"
3104 rtmps_protocol_select="tls_protocol"
3105 rtmpt_protocol_select="ffrtmphttp_protocol"
3106 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
3107 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
3108 rtp_protocol_select="udp_protocol"
3109 sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
3110 sctp_protocol_select="network"
3111 srtp_protocol_select="rtp_protocol srtp"
3112 tcp_protocol_select="network"
3113 tls_gnutls_protocol_deps="gnutls !tls_schannel_protocol !tls_securetransport_protocol"
3114 tls_gnutls_protocol_select="tcp_protocol"
3115 tls_openssl_protocol_deps="openssl !tls_schannel_protocol !tls_securetransport_protocol !tls_gnutls_protocol"
3116 tls_openssl_protocol_select="tcp_protocol"
3117 tls_schannel_protocol_deps="schannel"
3118 tls_schannel_protocol_select="tcp_protocol"
3119 tls_securetransport_protocol_deps="securetransport"
3120 tls_securetransport_protocol_select="tcp_protocol"
3121 tls_protocol_deps_any="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
3122 udp_protocol_select="network"
3123 udplite_protocol_select="network"
3124 unix_protocol_deps="sys_un_h"
3125 unix_protocol_select="network"
3126
3127 # filters
3128 afftfilt_filter_deps="avcodec"
3129 afftfilt_filter_select="fft"
3130 afir_filter_deps="avcodec"
3131 afir_filter_select="fft"
3132 amovie_filter_deps="avcodec avformat"
3133 aresample_filter_deps="swresample"
3134 ass_filter_deps="libass"
3135 atempo_filter_deps="avcodec"
3136 atempo_filter_select="rdft"
3137 azmq_filter_deps="libzmq"
3138 blackframe_filter_deps="gpl"
3139 boxblur_filter_deps="gpl"
3140 bs2b_filter_deps="libbs2b"
3141 colormatrix_filter_deps="gpl"
3142 coreimage_filter_deps="coreimage appkit"
3143 coreimage_filter_extralibs="-framework OpenGL"
3144 coreimagesrc_filter_deps="coreimage appkit"
3145 coreimagesrc_filter_extralibs="-framework OpenGL"
3146 cover_rect_filter_deps="avcodec avformat gpl"
3147 cropdetect_filter_deps="gpl"
3148 deinterlace_qsv_filter_deps="libmfx"
3149 deinterlace_vaapi_filter_deps="vaapi"
3150 delogo_filter_deps="gpl"
3151 deshake_filter_select="pixelutils"
3152 drawtext_filter_deps="libfreetype"
3153 elbg_filter_deps="avcodec"
3154 eq_filter_deps="gpl"
3155 fftfilt_filter_deps="avcodec"
3156 fftfilt_filter_select="rdft"
3157 find_rect_filter_deps="avcodec avformat gpl"
3158 firequalizer_filter_deps="avcodec"
3159 firequalizer_filter_select="rdft"
3160 flite_filter_deps="libflite"
3161 framerate_filter_select="pixelutils"
3162 frei0r_filter_deps="frei0r dlopen"
3163 frei0r_src_filter_deps="frei0r dlopen"
3164 fspp_filter_deps="gpl"
3165 geq_filter_deps="gpl"
3166 histeq_filter_deps="gpl"
3167 hqdn3d_filter_deps="gpl"
3168 interlace_filter_deps="gpl"
3169 kerndeint_filter_deps="gpl"
3170 ladspa_filter_deps="ladspa dlopen"
3171 mcdeint_filter_deps="avcodec gpl"
3172 movie_filter_deps="avcodec avformat"
3173 mpdecimate_filter_deps="gpl"
3174 mpdecimate_filter_select="pixelutils"
3175 mptestsrc_filter_deps="gpl"
3176 negate_filter_deps="lut_filter"
3177 nnedi_filter_deps="gpl"
3178 ocr_filter_deps="libtesseract"
3179 ocv_filter_deps="libopencv"
3180 owdenoise_filter_deps="gpl"
3181 pan_filter_deps="swresample"
3182 perspective_filter_deps="gpl"
3183 phase_filter_deps="gpl"
3184 pp7_filter_deps="gpl"
3185 pp_filter_deps="gpl postproc"
3186 pullup_filter_deps="gpl"
3187 removelogo_filter_deps="avcodec avformat swscale"
3188 repeatfields_filter_deps="gpl"
3189 resample_filter_deps="avresample"
3190 rubberband_filter_deps="librubberband"
3191 sab_filter_deps="gpl swscale"
3192 scale2ref_filter_deps="swscale"
3193 scale_filter_deps="swscale"
3194 scale_qsv_filter_deps="libmfx"
3195 select_filter_select="pixelutils"
3196 showcqt_filter_deps="avcodec avformat swscale"
3197 showcqt_filter_select="fft"
3198 showfreqs_filter_deps="avcodec"
3199 showfreqs_filter_select="fft"
3200 showspectrum_filter_deps="avcodec"
3201 showspectrum_filter_select="fft"
3202 showspectrumpic_filter_deps="avcodec"
3203 showspectrumpic_filter_select="fft"
3204 signature_filter_deps="gpl avcodec avformat"
3205 smartblur_filter_deps="gpl swscale"
3206 sofalizer_filter_deps="libmysofa avcodec"
3207 sofalizer_filter_select="fft"
3208 spectrumsynth_filter_deps="avcodec"
3209 spectrumsynth_filter_select="fft"
3210 spp_filter_deps="gpl avcodec"
3211 spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
3212 stereo3d_filter_deps="gpl"
3213 subtitles_filter_deps="avformat avcodec libass"
3214 super2xsai_filter_deps="gpl"
3215 pixfmts_super2xsai_test_deps="super2xsai_filter"
3216 tinterlace_filter_deps="gpl"
3217 tinterlace_merge_test_deps="tinterlace_filter"
3218 tinterlace_pad_test_deps="tinterlace_filter"
3219 tonemap_filter_deps="const_nan"
3220 uspp_filter_deps="gpl avcodec"
3221 vaguedenoiser_filter_deps="gpl"
3222 vidstabdetect_filter_deps="libvidstab"
3223 vidstabtransform_filter_deps="libvidstab"
3224 libvmaf_filter_deps="libvmaf"
3225 zmq_filter_deps="libzmq"
3226 zoompan_filter_deps="swscale"
3227 zscale_filter_deps="libzimg const_nan"
3228 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
3229
3230 # examples
3231 avio_dir_cmd_deps="avformat avutil"
3232 avio_reading_deps="avformat avcodec avutil"
3233 decode_audio_example_deps="avcodec avutil"
3234 decode_video_example_deps="avcodec avutil"
3235 demuxing_decoding_example_deps="avcodec avformat avutil"
3236 encode_audio_example_deps="avcodec avutil"
3237 encode_video_example_deps="avcodec avutil"
3238 extract_mvs_example_deps="avcodec avformat avutil"
3239 filter_audio_example_deps="avfilter avutil"
3240 filtering_audio_example_deps="avfilter avcodec avformat avutil"
3241 filtering_video_example_deps="avfilter avcodec avformat avutil"
3242 http_multiclient_example_deps="avformat avutil fork"
3243 hw_decode_example_deps="avcodec avformat avutil"
3244 metadata_example_deps="avformat avutil"
3245 muxing_example_deps="avcodec avformat avutil swscale"
3246 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
3247 remuxing_example_deps="avcodec avformat avutil"
3248 resampling_audio_example_deps="avutil swresample"
3249 scaling_video_example_deps="avutil swscale"
3250 transcode_aac_example_deps="avcodec avformat swresample"
3251 transcoding_example_deps="avfilter avcodec avformat avutil"
3252
3253 # libraries, in linking order
3254 avcodec_deps="avutil"
3255 avcodec_select="null_bsf"
3256 avdevice_deps="avformat avcodec avutil"
3257 avfilter_deps="avutil"
3258 avformat_deps="avcodec avutil"
3259 avresample_deps="avutil"
3260 postproc_deps="avutil gpl"
3261 swresample_deps="avutil"
3262 swscale_deps="avutil"
3263
3264 # programs
3265 ffmpeg_deps="avcodec avfilter avformat swresample"
3266 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
3267                null_filter
3268                trim_filter"
3269 ffplay_deps="avcodec avformat swscale swresample sdl2"
3270 ffplay_extralibs='$sdl2_extralibs'
3271 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
3272 ffprobe_deps="avcodec avformat"
3273 ffserver_deps="avformat fork sarestart"
3274 ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
3275
3276 # documentation
3277 podpages_deps="perl"
3278 manpages_deps="perl pod2man"
3279 htmlpages_deps="perl"
3280 htmlpages_deps_any="makeinfo_html texi2html"
3281 txtpages_deps="perl makeinfo"
3282 doc_deps_any="manpages htmlpages podpages txtpages"
3283
3284 # default parameters
3285
3286 logfile="ffbuild/config.log"
3287
3288 # installation paths
3289 prefix_default="/usr/local"
3290 bindir_default='${prefix}/bin'
3291 datadir_default='${prefix}/share/ffmpeg'
3292 docdir_default='${prefix}/share/doc/ffmpeg'
3293 incdir_default='${prefix}/include'
3294 libdir_default='${prefix}/lib'
3295 mandir_default='${prefix}/share/man'
3296
3297 # toolchain
3298 ar_default="ar"
3299 cc_default="gcc"
3300 cxx_default="g++"
3301 host_cc_default="gcc"
3302 doxygen_default="doxygen"
3303 install="install"
3304 ln_s_default="ln -s -f"
3305 nm_default="nm -g"
3306 pkg_config_default=pkg-config
3307 ranlib_default="ranlib"
3308 strip_default="strip"
3309 version_script='--version-script'
3310 x86asmexe_default="nasm"
3311 windres_default="windres"
3312 nvcc_default="nvcc"
3313 nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
3314
3315 # OS
3316 target_os_default=$(tolower $(uname -s))
3317 host_os=$target_os_default
3318
3319 # machine
3320 if test "$target_os_default" = aix; then
3321     arch_default=$(uname -p)
3322     strip_default="strip -X32_64"
3323 else
3324     arch_default=$(uname -m)
3325 fi
3326 cpu="generic"
3327 intrinsics="none"
3328
3329 # configurable options
3330 enable $PROGRAM_LIST
3331 enable $DOCUMENT_LIST
3332 enable $EXAMPLE_LIST
3333 enable $(filter_out avresample $LIBRARY_LIST)
3334 enable stripping
3335
3336 enable asm
3337 enable debug
3338 enable doc
3339 enable faan faandct faanidct
3340 enable optimizations
3341 enable runtime_cpudetect
3342 enable safe_bitstream_reader
3343 enable static
3344 enable swscale_alpha
3345 enable valgrind_backtrace
3346
3347 sws_max_filter_size_default=256
3348 set_default sws_max_filter_size
3349
3350 # build settings
3351 SHFLAGS='-shared -Wl,-soname,$$(@F)'
3352 LIBPREF="lib"
3353 LIBSUF=".a"
3354 FULLNAME='$(NAME)$(BUILDSUF)'
3355 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
3356 SLIBPREF="lib"
3357 SLIBSUF=".so"
3358 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
3359 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
3360 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
3361 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
3362 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
3363 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
3364 VERSION_SCRIPT_POSTPROCESS_CMD="cat"
3365
3366 asflags_filter=echo
3367 cflags_filter=echo
3368 ldflags_filter=echo
3369
3370 AS_C='-c'
3371 AS_O='-o $@'
3372 CC_C='-c'
3373 CC_E='-E -o $@'
3374 CC_O='-o $@'
3375 CXX_C='-c'
3376 CXX_O='-o $@'
3377 OBJCC_C='-c'
3378 OBJCC_E='-E -o $@'
3379 OBJCC_O='-o $@'
3380 X86ASM_O='-o $@'
3381 LD_O='-o $@'
3382 LD_LIB='-l%'
3383 LD_PATH='-L'
3384 HOSTCC_C='-c'
3385 HOSTCC_E='-E -o $@'
3386 HOSTCC_O='-o $@'
3387 HOSTLD_O='-o $@'
3388 NVCC_C='-c'
3389 NVCC_O='-o $@'
3390
3391 host_extralibs='-lm'
3392 host_cflags_filter=echo
3393 host_ldflags_filter=echo
3394
3395 target_path='$(CURDIR)'
3396
3397 # since the object filename is not given with the -MM flag, the compiler
3398 # is only able to print the basename, and we must add the path ourselves
3399 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
3400 DEPFLAGS='-MM'
3401
3402 mkdir -p ffbuild
3403
3404 # find source path
3405 if test -f configure; then
3406     source_path=.
3407 else
3408     source_path=$(cd $(dirname "$0"); pwd)
3409     case "$source_path" in
3410         *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
3411     esac
3412     test -e "$source_path/config.h" &&
3413         die "Out of tree builds are impossible with config.h in source dir."
3414 fi
3415
3416 for v in "$@"; do
3417     r=${v#*=}
3418     l=${v%"$r"}
3419     r=$(sh_quote "$r")
3420     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
3421 done
3422
3423 find_things(){
3424     thing=$1
3425     pattern=$2
3426     file=$source_path/$3
3427     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
3428 }
3429
3430 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
3431 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
3432 HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
3433 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
3434 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
3435 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
3436 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
3437 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
3438 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
3439
3440 find_things_extern(){
3441     thing=$1
3442     pattern=$2
3443     file=$source_path/$3
3444     sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
3445 }
3446
3447 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
3448 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
3449
3450 ALL_COMPONENTS="
3451     $BSF_LIST
3452     $DECODER_LIST
3453     $DEMUXER_LIST
3454     $ENCODER_LIST
3455     $FILTER_LIST
3456     $HWACCEL_LIST
3457     $INDEV_LIST
3458     $MUXER_LIST
3459     $OUTDEV_LIST
3460     $PARSER_LIST
3461     $PROTOCOL_LIST
3462 "
3463
3464 for n in $COMPONENT_LIST; do
3465     v=$(toupper ${n%s})_LIST
3466     eval enable \$$v
3467     eval ${n}_if_any="\$$v"
3468 done
3469
3470 enable $ARCH_EXT_LIST
3471
3472 die_unknown(){
3473     echo "Unknown option \"$1\"."
3474     echo "See $0 --help for available options."
3475     exit 1
3476 }
3477
3478 print_in_columns() {
3479     cols=$(expr $ncols / 24)
3480     cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
3481 }
3482
3483 show_list() {
3484     suffix=_$1
3485     shift
3486     echo $* | sed s/$suffix//g | print_in_columns
3487     exit 0
3488 }
3489
3490 rand_list(){
3491     IFS=', '
3492     set -- $*
3493     unset IFS
3494     for thing; do
3495         comp=${thing%:*}
3496         prob=${thing#$comp}
3497         prob=${prob#:}
3498         is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
3499         echo "prob ${prob:-0.5}"
3500         printf '%s\n' $comp
3501     done
3502 }
3503
3504 do_random(){
3505     action=$1
3506     shift
3507     random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
3508     $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
3509 }
3510
3511 for opt do
3512     optval="${opt#*=}"
3513     case "$opt" in
3514         --extra-ldflags=*)
3515             add_ldflags $optval
3516         ;;
3517         --extra-ldexeflags=*)
3518             add_ldexeflags $optval
3519         ;;
3520         --extra-ldlibflags=*)
3521             add_ldlibflags $optval
3522         ;;
3523         --extra-libs=*)
3524             add_extralibs $optval
3525         ;;
3526         --disable-devices)
3527             disable $INDEV_LIST $OUTDEV_LIST
3528         ;;
3529         --enable-debug=*)
3530             debuglevel="$optval"
3531         ;;
3532         --disable-programs)
3533             disable $PROGRAM_LIST
3534         ;;
3535         --disable-everything)
3536             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3537         ;;
3538         --disable-all)
3539             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3540             disable $LIBRARY_LIST $PROGRAM_LIST doc
3541             enable avutil
3542         ;;
3543         --enable-random|--disable-random)
3544             action=${opt%%-random}
3545             do_random ${action#--} $COMPONENT_LIST
3546         ;;
3547         --enable-random=*|--disable-random=*)
3548             action=${opt%%-random=*}
3549             do_random ${action#--} $optval
3550         ;;
3551         --enable-sdl)
3552             enable sdl2
3553         ;;
3554         --enable-*=*|--disable-*=*)
3555             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
3556             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
3557             eval list=\$$(toupper $thing)_LIST
3558             name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
3559             list=$(filter "$name" $list)
3560             [ "$list" = "" ] && warn "Option $opt did not match anything"
3561             $action $list
3562         ;;
3563         --enable-yasm|--disable-yasm)
3564             warn "The ${opt} option is only provided for compatibility and will be\n"\
3565                  "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
3566             test $opt = --enable-yasm && x86asm=yes || x86asm=no
3567         ;;
3568         --yasmexe=*)
3569             warn "The --yasmexe option is only provided for compatibility and will be\n"\
3570                  "removed in the future. Use --x86asmexe instead."
3571             x86asmexe="$optval"
3572         ;;
3573         --enable-?*|--disable-?*)
3574             eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
3575             if is_in $option $COMPONENT_LIST; then
3576                 test $action = disable && action=unset
3577                 eval $action \$$(toupper ${option%s})_LIST
3578             elif is_in $option $CMDLINE_SELECT; then
3579                 $action $option
3580             else
3581                 die_unknown $opt
3582             fi
3583         ;;
3584         --list-*)
3585             NAME="${opt#--list-}"
3586             is_in $NAME $COMPONENT_LIST || die_unknown $opt
3587             NAME=${NAME%s}
3588             eval show_list $NAME \$$(toupper $NAME)_LIST
3589         ;;
3590         --help|-h) show_help
3591         ;;
3592         --quiet|-q) quiet=yes
3593         ;;
3594         --fatal-warnings) enable fatal_warnings
3595         ;;
3596         --libfuzzer=*)
3597             libfuzzer_path="$optval"
3598         ;;
3599         *)
3600             optname="${opt%%=*}"
3601             optname="${optname#--}"
3602             optname=$(echo "$optname" | sed 's/-/_/g')
3603             if is_in $optname $CMDLINE_SET; then
3604                 eval $optname='$optval'
3605             elif is_in $optname $CMDLINE_APPEND; then
3606                 append $optname "$optval"
3607             else
3608                 die_unknown $opt
3609             fi
3610         ;;
3611     esac
3612 done
3613
3614 for e in $env; do
3615     eval "export $e"
3616 done
3617
3618 if disabled autodetect; then
3619
3620     # Unless iconv is explicitely disabled by the user, we still want to probe
3621     # for the iconv from the libc.
3622     disabled iconv || enable libc_iconv
3623
3624     disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
3625     disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
3626 fi
3627 # Mark specifically enabled, but normally autodetected libraries as requested.
3628 for lib in $AUTODETECT_LIBS; do
3629     enabled $lib && request $lib
3630 done
3631 #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
3632 enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
3633 enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
3634
3635 disabled logging && logfile=/dev/null
3636
3637 die_license_disabled() {
3638     enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
3639 }
3640
3641 die_license_disabled_gpl() {
3642     enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
3643 }
3644
3645 map "die_license_disabled gpl"      $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
3646 map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
3647
3648 enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
3649 map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
3650
3651 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
3652
3653 # Disable all the library-specific components if the library itself
3654 # is disabled, see AVCODEC_LIST and following _LIST variables.
3655
3656 disable_components(){
3657     disabled ${1} && disable $(
3658         eval components="\$$(toupper ${1})_COMPONENTS"
3659         map 'eval echo \${$(toupper ${v%s})_LIST}' $components
3660     )
3661 }
3662
3663 map 'disable_components $v' $LIBRARY_LIST
3664
3665 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
3666 set >> $logfile
3667
3668 test -n "$valgrind" && toolchain="valgrind-memcheck"
3669
3670 enabled ossfuzz && {
3671     add_cflags  -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
3672     add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
3673 }
3674
3675 case "$toolchain" in
3676     *-asan)
3677         cc_default="${toolchain%-asan}"
3678         add_cflags  -fsanitize=address
3679         add_ldflags -fsanitize=address
3680     ;;
3681     *-msan)
3682         cc_default="${toolchain%-msan}"
3683         add_cflags  -fsanitize=memory -fsanitize-memory-track-origins
3684         add_ldflags -fsanitize=memory
3685     ;;
3686     *-tsan)
3687         cc_default="${toolchain%-tsan}"
3688         add_cflags  -fsanitize=thread -fPIE
3689         add_ldflags -fsanitize=thread -pie
3690         case "$toolchain" in
3691             gcc-tsan)
3692                 add_cflags  -fPIC
3693                 add_ldflags -fPIC
3694                 ;;
3695         esac
3696     ;;
3697     *-usan)
3698         cc_default="${toolchain%-usan}"
3699         add_cflags  -fsanitize=undefined
3700         add_ldflags -fsanitize=undefined
3701     ;;
3702     valgrind-*)
3703         target_exec_default="valgrind"
3704         case "$toolchain" in
3705             valgrind-massif)
3706                 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"
3707                 ;;
3708             valgrind-memcheck)
3709                 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"
3710                 ;;
3711         esac
3712     ;;
3713     msvc)
3714         # Check whether the current MSVC version needs the C99 converter.
3715         # From MSVC 2013 (compiler major version 18) onwards, it does actually
3716         # support enough of C99 to build ffmpeg. Default to the new
3717         # behaviour if the regexp was unable to match anything, since this
3718         # successfully parses the version number of existing supported
3719         # versions that require the converter (MSVC 2010 and 2012).
3720         cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
3721         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
3722             cc_default="cl"
3723             cxx_default="cl"
3724         else
3725             cc_default="c99wrap cl"
3726             cxx_default="c99wrap cl"
3727         fi
3728         ld_default="$source_path/compat/windows/mslink"
3729         nm_default="dumpbin -symbols"
3730         ar_default="lib"
3731         case "$arch" in
3732         arm*)
3733             as_default="armasm"
3734             ;;
3735         esac
3736         target_os_default="win32"
3737         # Use a relative path for TMPDIR. This makes sure all the
3738         # ffconf temp files are written with a relative path, avoiding
3739         # issues with msys/win32 path conversion for MSVC parameters
3740         # such as -Fo<file> or -out:<file>.
3741         TMPDIR=.
3742     ;;
3743     icl)
3744         cc_default="icl"
3745         ld_default="xilink"
3746         nm_default="dumpbin -symbols"
3747         ar_default="xilib"
3748         target_os_default="win32"
3749         TMPDIR=.
3750     ;;
3751     gcov)
3752         add_cflags  -fprofile-arcs -ftest-coverage
3753         add_ldflags -fprofile-arcs -ftest-coverage
3754     ;;
3755     llvm-cov)
3756         add_cflags -fprofile-arcs -ftest-coverage
3757         add_ldflags --coverage
3758     ;;
3759     hardened)
3760         add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3761         add_cflags   -fno-strict-overflow -fstack-protector-all
3762         add_ldflags  -Wl,-z,relro -Wl,-z,now
3763         add_cflags   -fPIE
3764         add_ldexeflags -fPIE -pie
3765     ;;
3766     ?*)
3767         die "Unknown toolchain $toolchain"
3768     ;;
3769 esac
3770
3771 test -n "$cross_prefix" && enable cross_compile
3772
3773 if enabled cross_compile; then
3774     test -n "$arch" && test -n "$target_os" ||
3775         die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
3776 fi
3777
3778 ar_default="${cross_prefix}${ar_default}"
3779 cc_default="${cross_prefix}${cc_default}"
3780 cxx_default="${cross_prefix}${cxx_default}"
3781 nm_default="${cross_prefix}${nm_default}"
3782 pkg_config_default="${cross_prefix}${pkg_config_default}"
3783 if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
3784     ranlib_default="${cross_prefix}${ranlib_default} -D"
3785 else
3786     ranlib_default="${cross_prefix}${ranlib_default}"
3787 fi
3788 strip_default="${cross_prefix}${strip_default}"
3789 windres_default="${cross_prefix}${windres_default}"
3790
3791 sysinclude_default="${sysroot}/usr/include"
3792
3793 set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
3794     target_exec target_os x86asmexe nvcc
3795 enabled cross_compile || host_cc_default=$cc
3796 set_default host_cc
3797
3798 pkg_config_fail_message=""
3799 if ! $pkg_config --version >/dev/null 2>&1; then
3800     warn "$pkg_config not found, library detection may fail."
3801     pkg_config=false
3802 elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
3803     pkg_config_fail_message="
3804 Note: When building a static binary, add --pkg-config-flags=\"--static\"."
3805 fi
3806
3807 if test $doxygen != $doxygen_default && \
3808   ! $doxygen --version >/dev/null 2>&1; then
3809     warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
3810 fi
3811
3812 exesuf() {
3813     case $1 in
3814         mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
3815     esac
3816 }
3817
3818 EXESUF=$(exesuf $target_os)
3819 HOSTEXESUF=$(exesuf $host_os)
3820
3821 # set temporary file name
3822 : ${TMPDIR:=$TEMPDIR}
3823 : ${TMPDIR:=$TMP}
3824 : ${TMPDIR:=/tmp}
3825
3826 if [ -n "$tempprefix" ] ; then
3827     mktemp(){
3828         tmpname="$tempprefix.${HOSTNAME}.${UID}"
3829         echo "$tmpname"
3830         mkdir "$tmpname"
3831     }
3832 elif ! check_cmd mktemp -u XXXXXX; then
3833     # simple replacement for missing mktemp
3834     # NOT SAFE FOR GENERAL USE
3835     mktemp(){
3836         tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
3837         echo "$tmpname"
3838         mkdir "$tmpname"
3839     }
3840 fi
3841
3842 FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
3843     die "Unable to create temporary directory in $TMPDIR."
3844
3845 tmpfile(){
3846     tmp="${FFTMPDIR}/test"$2
3847     (set -C; exec > $tmp) 2> /dev/null ||
3848         die "Unable to create temporary file in $FFTMPDIR."
3849     eval $1=$tmp
3850 }
3851
3852 trap 'rm -rf -- "$FFTMPDIR"' EXIT
3853 trap 'exit 2' INT
3854
3855 tmpfile TMPASM .asm
3856 tmpfile TMPC   .c
3857 tmpfile TMPCPP .cpp
3858 tmpfile TMPE   $EXESUF
3859 tmpfile TMPH   .h
3860 tmpfile TMPM   .m
3861 tmpfile TMPO   .o
3862 tmpfile TMPS   .S
3863 tmpfile TMPSH  .sh
3864 tmpfile TMPV   .ver
3865
3866 unset -f mktemp
3867
3868 chmod +x $TMPE
3869
3870 # make sure we can execute files in $TMPDIR
3871 cat > $TMPSH 2>> $logfile <<EOF
3872 #! /bin/sh
3873 EOF
3874 chmod +x $TMPSH >> $logfile 2>&1
3875 if ! $TMPSH >> $logfile 2>&1; then
3876     cat <<EOF
3877 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
3878 variable to another directory and make sure that it is not mounted noexec.
3879 EOF
3880     die "Sanity test failed."
3881 fi
3882
3883 armasm_flags(){
3884     for flag; do
3885         case $flag in
3886             # Filter out MSVC cl.exe options from cflags that shouldn't
3887             # be passed to gas-preprocessor
3888             -M[TD]*)                                            ;;
3889             *)                  echo $flag                      ;;
3890         esac
3891    done
3892 }
3893
3894 ccc_flags(){
3895     for flag; do
3896         case $flag in
3897             -std=c99)           echo -c99                       ;;
3898             -mcpu=*)            echo -arch ${flag#*=}           ;;
3899             -mieee)             echo -ieee                      ;;
3900             -O*|-fast)          echo $flag                      ;;
3901             -fno-math-errno)    echo -assume nomath_errno       ;;
3902             -g)                 echo -g3                        ;;
3903             -Wall)              echo -msg_enable level2         ;;
3904             -Wno-pointer-sign)  echo -msg_disable ptrmismatch1  ;;
3905             -Wl,*)              echo $flag                      ;;
3906             -f*|-W*)                                            ;;
3907             *)                  echo $flag                      ;;
3908         esac
3909    done
3910 }
3911
3912 cparser_flags(){
3913     for flag; do
3914         case $flag in
3915             -Wno-switch)             echo -Wno-switch-enum ;;
3916             -Wno-format-zero-length) ;;
3917             -Wdisabled-optimization) ;;
3918             -Wno-pointer-sign)       echo -Wno-other ;;
3919             *)                       echo $flag ;;
3920         esac
3921     done
3922 }
3923
3924 msvc_common_flags(){
3925     for flag; do
3926         case $flag in
3927             # In addition to specifying certain flags under the compiler
3928             # specific filters, they must be specified here as well or else the
3929             # generic catch all at the bottom will print the original flag.
3930             -Wall)                ;;
3931             -Wextra)              ;;
3932             -std=c99)             ;;
3933             # Common flags
3934             -fomit-frame-pointer) ;;
3935             -g)                   echo -Z7 ;;
3936             -fno-math-errno)      ;;
3937             -fno-common)          ;;
3938             -fno-signed-zeros)    ;;
3939             -fPIC)                ;;
3940             -mthumb)              ;;
3941             -march=*)             ;;
3942             -lz)                  echo zlib.lib ;;
3943             -lx264)               echo libx264.lib ;;
3944             -lstdc++)             ;;
3945             -l*)                  echo ${flag#-l}.lib ;;
3946             -LARGEADDRESSAWARE)   echo $flag ;;
3947             -L*)                  echo -libpath:${flag#-L} ;;
3948             *)                    echo $flag ;;
3949         esac
3950     done
3951 }
3952
3953 msvc_flags(){
3954     msvc_common_flags "$@"
3955     for flag; do
3956         case $flag in
3957             -Wall)                echo -W3 -wd4018 -wd4146 -wd4244 -wd4305     \
3958                                        -wd4554 ;;
3959             -Wextra)              echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
3960                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
3961                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
3962                                        -wd4307 \
3963                                        -wd4273 -wd4554 -wd4701 -wd4703 ;;
3964         esac
3965     done
3966 }
3967
3968 icl_flags(){
3969     msvc_common_flags "$@"
3970     for flag; do
3971         case $flag in
3972             # Despite what Intel's documentation says -Wall, which is supported
3973             # on Windows, does enable remarks so disable them here.
3974             -Wall)                echo $flag -Qdiag-disable:remark ;;
3975             -std=c99)             echo -Qstd=c99 ;;
3976             -flto)                echo -ipo ;;
3977         esac
3978     done
3979 }
3980
3981 icc_flags(){
3982     for flag; do
3983         case $flag in
3984             -flto)                echo -ipo ;;
3985             *)                    echo $flag ;;
3986         esac
3987     done
3988 }
3989
3990 pgi_flags(){
3991     for flag; do
3992         case $flag in
3993             -flto)                echo -Mipa=fast,libopt,libinline,vestigial ;;
3994             -fomit-frame-pointer) echo -Mnoframe ;;
3995             -g)                   echo -gopt ;;
3996             *)                    echo $flag ;;
3997         esac
3998     done
3999 }
4000
4001 suncc_flags(){
4002     for flag; do
4003         case $flag in
4004             -march=*|-mcpu=*)
4005                 case "${flag#*=}" in
4006                     native)                   echo -xtarget=native       ;;
4007                     v9|niagara)               echo -xarch=sparc          ;;
4008                     ultrasparc)               echo -xarch=sparcvis       ;;
4009                     ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
4010                     i586|pentium)             echo -xchip=pentium        ;;
4011                     i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
4012                     pentium3*|c3-2)           echo -xtarget=pentium3     ;;
4013                     pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
4014                     pentium4*)          echo -xtarget=pentium4           ;;
4015                     prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
4016                     *-sse3)             echo -xarch=sse3                 ;;
4017                     core2)              echo -xarch=ssse3 -xchip=core2   ;;
4018                     bonnell)                   echo -xarch=ssse3         ;;
4019                     corei7|nehalem)            echo -xtarget=nehalem     ;;
4020                     westmere)                  echo -xtarget=westmere    ;;
4021                     silvermont)                echo -xarch=sse4_2        ;;
4022                     corei7-avx|sandybridge)    echo -xtarget=sandybridge ;;
4023                     core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
4024                                                echo -xarch=avx           ;;
4025                     amdfam10|barcelona)        echo -xtarget=barcelona   ;;
4026                     btver1)                    echo -xarch=amdsse4a      ;;
4027                     btver2|bdver*|znver*)      echo -xarch=avx           ;;
4028                     athlon-4|athlon-[mx]p)     echo -xarch=ssea          ;;
4029                     k8|opteron|athlon64|athlon-fx)
4030                                                echo -xarch=sse2a         ;;
4031                     athlon*)                   echo -xarch=pentium_proa  ;;
4032                 esac
4033                 ;;
4034             -std=c99)             echo -xc99              ;;
4035             -fomit-frame-pointer) echo -xregs=frameptr    ;;
4036             -fPIC)                echo -KPIC -xcode=pic32 ;;
4037             -W*,*)                echo $flag              ;;
4038             -f*-*|-W*|-mimpure-text)                      ;;
4039             -shared)              echo -G                 ;;
4040             *)                    echo $flag              ;;
4041         esac
4042     done
4043 }
4044
4045 tms470_flags(){
4046     for flag; do
4047         case $flag in
4048             -march=*|-mcpu=*)
4049                 case "${flag#*=}" in
4050                     armv7-a|cortex-a*)      echo -mv=7a8 ;;
4051                     armv7-r|cortex-r*)      echo -mv=7r4 ;;
4052                     armv7-m|cortex-m*)      echo -mv=7m3 ;;
4053                     armv6*|arm11*)          echo -mv=6   ;;
4054                     armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
4055                                             echo -mv=5e  ;;
4056                     armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
4057                 esac
4058                 ;;
4059             -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
4060             -mfpu=vfp)      echo --float_support=vfpv2        ;;
4061             -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
4062             -mfpu=vfpv3-d16) echo --float_support=vfpv3d16    ;;
4063             -msoft-float)   echo --float_support=vfplib       ;;
4064             -O[0-3]|-mf=*)  echo $flag                        ;;
4065             -g)             echo -g -mn                       ;;
4066             -pds=*)         echo $flag                        ;;
4067             -D*|-I*)        echo $flag                        ;;
4068             --gcc|--abi=*)  echo $flag                        ;;
4069             -me)            echo $flag                        ;;
4070         esac
4071     done
4072 }
4073
4074 probe_cc(){
4075     pfx=$1
4076     _cc=$2
4077     first=$3
4078
4079     unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
4080     unset _ld_o _ldflags _ld_lib _ld_path
4081     unset _depflags _DEPCMD _DEPFLAGS
4082     _flags_filter=echo
4083
4084     if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
4085         true # no-op to avoid reading stdin in following checks
4086     elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
4087         _type=llvm_gcc
4088         gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
4089         _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
4090         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4091         _cflags_speed='-O3'
4092         _cflags_size='-Os'
4093     elif $_cc -v 2>&1 | grep -qi ^gcc; then
4094         _type=gcc
4095         gcc_version=$($_cc --version | head -n1)
4096         gcc_basever=$($_cc -dumpversion)
4097         gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
4098         gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
4099         _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
4100         case $gcc_basever in
4101             2) ;;
4102             2.*) ;;
4103             *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
4104         esac
4105         if [ "$first" = true ]; then
4106             case $gcc_basever in
4107                 4.2*)
4108                 warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
4109             esac
4110         fi
4111         _cflags_speed='-O3'
4112         _cflags_size='-Os'
4113     elif $_cc --version 2>/dev/null | grep -q ^icc; then
4114         _type=icc
4115         _ident=$($_cc --version | head -n1)
4116         _depflags='-MMD'
4117         _cflags_speed='-O3'
4118         _cflags_size='-Os'
4119         _cflags_noopt='-O1'
4120         _flags_filter=icc_flags
4121     elif $_cc -v 2>&1 | grep -q xlc; then
4122         _type=xlc
4123         _ident=$($_cc -qversion 2>/dev/null | head -n1)
4124         _cflags_speed='-O5'
4125         _cflags_size='-O5 -qcompact'
4126     elif $_cc -V 2>/dev/null | grep -q Compaq; then
4127         _type=ccc
4128         _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
4129         _DEPFLAGS='-M'
4130         _cflags_speed='-fast'
4131         _cflags_size='-O1'
4132         _flags_filter=ccc_flags
4133     elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
4134         test -d "$sysroot" || die "No valid sysroot specified."
4135         _type=armcc
4136         _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
4137         armcc_conf="$PWD/armcc.conf"
4138         $_cc --arm_linux_configure                 \
4139              --arm_linux_config_file="$armcc_conf" \
4140              --configure_sysroot="$sysroot"        \
4141              --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
4142              die "Error creating armcc configuration file."
4143         $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
4144         _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
4145         as_default="${cross_prefix}gcc"
4146         _depflags='-MMD'
4147         _cflags_speed='-O3'
4148         _cflags_size='-Os'
4149     elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
4150         _type=tms470
4151         _ident=$($_cc -version | head -n1 | tr -s ' ')
4152         _flags='--gcc --abi=eabi -me'
4153         _cc_e='-ppl -fe=$@'
4154         _cc_o='-fe=$@'
4155         _depflags='-ppa -ppd=$(@:.o=.d)'
4156         _cflags_speed='-O3 -mf=5'
4157         _cflags_size='-O3 -mf=2'
4158         _flags_filter=tms470_flags
4159     elif $_cc -v 2>&1 | grep -q clang; then
4160         _type=clang
4161         _ident=$($_cc --version 2>/dev/null | head -n1)
4162         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4163         _cflags_speed='-O3'
4164         _cflags_size='-Oz'
4165     elif $_cc -V 2>&1 | grep -q Sun; then
4166         _type=suncc
4167         _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
4168         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
4169         _DEPFLAGS='-xM1 -xc99'
4170         _ldflags='-std=c99'
4171         _cflags_speed='-O5'
4172         _cflags_size='-O5 -xspace'
4173         _flags_filter=suncc_flags
4174     elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
4175         _type=pathscale
4176         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
4177         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4178         _cflags_speed='-O2'
4179         _cflags_size='-Os'
4180         _flags_filter='filter_out -Wdisabled-optimization'
4181     elif $_cc -v 2>&1 | grep -q Open64; then
4182         _type=open64
4183         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
4184         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
4185         _cflags_speed='-O2'
4186         _cflags_size='-Os'
4187         _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
4188     elif $_cc -V 2>&1 | grep -q Portland; then
4189         _type=pgi
4190         _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
4191         opt_common='-alias=ansi -Mdse -Mlre -Mpre'
4192         _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
4193         _cflags_size="-O2 -Munroll=c:1 $opt_common"
4194         _cflags_noopt="-O"
4195         _flags_filter=pgi_flags
4196     elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
4197         _type=armasm
4198         _ident=$($_cc | head -n1)
4199         # 4509: "This form of conditional instruction is deprecated"
4200         _flags="-nologo -ignore 4509"
4201         _flags_filter=armasm_flags
4202     elif $_cc 2>&1 | grep -q Intel; then
4203         _type=icl
4204         _ident=$($_cc 2>&1 | head -n1)
4205         _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
4206         # Not only is O3 broken on 13.x+ but it is slower on all previous
4207         # versions (tested) as well.
4208         _cflags_speed="-O2"
4209         _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
4210         if $_cc 2>&1 | grep -q Linker; then
4211             _ld_o='-out:$@'
4212         else
4213             _ld_o='-Fe$@'
4214         fi
4215         _cc_o='-Fo$@'
4216         _cc_e='-P'
4217         _flags_filter=icl_flags
4218         _ld_lib='lib%.a'
4219         _ld_path='-libpath:'
4220         # -Qdiag-error to make icl error when seeing certain unknown arguments
4221         _flags='-nologo -Qdiag-error:4044,10157'
4222         # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
4223         # with MSVC which enables it by default.
4224         _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
4225         disable stripping
4226     elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
4227         # lld can emulate multiple different linkers; in ms link.exe mode,
4228         # the -? parameter gives the help output which contains an identifyable
4229         # string, while it gives an error in other modes.
4230         _type=lld-link
4231         # The link.exe mode doesn't have a switch for getting the version,
4232         # but we can force it back to gnu mode and get the version from there.
4233         _ident=$($_cc -flavor gnu --version 2>/dev/null)
4234         _ld_o='-out:$@'
4235         _flags_filter=msvc_flags
4236         _ld_lib='lib%.a'
4237         _ld_path='-libpath:'
4238     elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
4239         _type=msvc
4240         _ident=$($_cc 2>&1 | head -n1)
4241         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
4242         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
4243         _cflags_speed="-O2"
4244         _cflags_size="-O1"
4245         _cflags_noopt="-O1"
4246         if $_cc -nologo- 2>&1 | grep -q Linker; then
4247             _ld_o='-out:$@'
4248         else
4249             _ld_o='-Fe$@'
4250         fi
4251         _cc_o='-Fo$@'
4252         _cc_e='-P -Fi$@'
4253         _flags_filter=msvc_flags
4254         _ld_lib='lib%.a'
4255         _ld_path='-libpath:'
4256         _flags='-nologo'
4257         disable stripping
4258     elif $_cc --version 2>/dev/null | grep -q ^cparser; then
4259         _type=cparser
4260         _ident=$($_cc --version | head -n1)
4261         _depflags='-MMD'
4262         _cflags_speed='-O4'
4263         _cflags_size='-O2'
4264         _flags_filter=cparser_flags
4265     fi
4266
4267     eval ${pfx}_type=\$_type
4268     eval ${pfx}_ident=\$_ident
4269 }
4270
4271 set_ccvars(){
4272     eval ${1}_C=\${_cc_c-\${${1}_C}}
4273     eval ${1}_E=\${_cc_e-\${${1}_E}}
4274     eval ${1}_O=\${_cc_o-\${${1}_O}}
4275
4276     if [ -n "$_depflags" ]; then
4277         eval ${1}_DEPFLAGS=\$_depflags
4278     else
4279         eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
4280         eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
4281         eval DEP${1}FLAGS=\$_flags
4282     fi
4283 }
4284
4285 probe_cc cc "$cc" "true"
4286 cflags_filter=$_flags_filter
4287 cflags_speed=$_cflags_speed
4288 cflags_size=$_cflags_size
4289 cflags_noopt=$_cflags_noopt
4290 add_cflags $_flags $_cflags
4291 cc_ldflags=$_ldflags
4292 set_ccvars CC
4293 set_ccvars CXX
4294
4295 probe_cc hostcc "$host_cc"
4296 host_cflags_filter=$_flags_filter
4297 host_cflags_speed=$_cflags_speed
4298 add_host_cflags  $_flags $_cflags
4299 set_ccvars HOSTCC
4300
4301 test -n "$cc_type" && enable $cc_type ||
4302     warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
4303
4304 : ${as_default:=$cc}
4305 : ${objcc_default:=$cc}
4306 : ${dep_cc_default:=$cc}
4307 : ${ld_default:=$cc}
4308 : ${host_ld_default:=$host_cc}
4309 set_default ar as objcc dep_cc ld ln_s host_ld windres
4310
4311 probe_cc as "$as"
4312 asflags_filter=$_flags_filter
4313 add_asflags $_flags $_cflags
4314 set_ccvars AS
4315
4316 probe_cc objcc "$objcc"
4317 objcflags_filter=$_flags_filter
4318 add_objcflags $_flags $_cflags
4319 set_ccvars OBJC
4320
4321 probe_cc ld "$ld"
4322 ldflags_filter=$_flags_filter
4323 add_ldflags $_flags $_ldflags
4324 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
4325 LD_O=${_ld_o-$LD_O}
4326 LD_LIB=${_ld_lib-$LD_LIB}
4327 LD_PATH=${_ld_path-$LD_PATH}
4328
4329 probe_cc hostld "$host_ld"
4330 host_ldflags_filter=$_flags_filter
4331 add_host_ldflags $_flags $_ldflags
4332 HOSTLD_O=${_ld_o-$HOSTLD_O}
4333
4334 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
4335     probe_cc depcc "$dep_cc"
4336     CCDEP=${_DEPCMD:-$DEPCMD}
4337     CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
4338     DEPCCFLAGS=$_flags
4339 fi
4340
4341 if $ar 2>&1 | grep -q Microsoft; then
4342     arflags="-nologo"
4343     ar_o='-out:$@'
4344 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
4345     arflags="rq"
4346     ar_o='$@'
4347 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
4348     arflags='-Xany -r -c'
4349     ar_o='$@'
4350 elif $ar 2>&1 | grep -q "\[D\] "; then
4351     arflags="rcD"
4352     ar_o='$@'
4353 else
4354     arflags="rc"
4355     ar_o='$@'
4356 fi
4357
4358 add_cflags $extra_cflags
4359 add_cxxflags $extra_cxxflags
4360 add_objcflags $extra_objcflags
4361 add_asflags $extra_cflags
4362
4363 if test -n "$sysroot"; then
4364     case "$cc_type" in
4365         gcc|llvm_gcc|clang)
4366             add_cppflags --sysroot="$sysroot"
4367             add_ldflags --sysroot="$sysroot"
4368 # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
4369             add_cppflags -isysroot "$sysroot"
4370             add_ldflags -isysroot "$sysroot"
4371         ;;
4372         tms470)
4373             add_cppflags -I"$sysinclude"
4374             add_ldflags  --sysroot="$sysroot"
4375         ;;
4376     esac
4377 fi
4378
4379 if test "$cpu" = host; then
4380     enabled cross_compile &&
4381         die "--cpu=host makes no sense when cross-compiling."
4382
4383     case "$cc_type" in
4384         gcc|llvm_gcc)
4385             check_native(){
4386                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
4387                 sed -n "/cc1.*$1=/{
4388                             s/.*$1=\\([^ ]*\\).*/\\1/
4389                             p
4390                             q
4391                         }" $TMPE
4392             }
4393             cpu=$(check_native -march || check_native -mcpu)
4394         ;;
4395         clang)
4396             check_native(){
4397                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
4398                 sed -n "/cc1.*-target-cpu /{
4399                             s/.*-target-cpu \\([^ ]*\\).*/\\1/
4400                             p
4401                             q
4402                         }" $TMPE
4403             }
4404             cpu=$(check_native -march)
4405         ;;
4406     esac
4407
4408     test "${cpu:-host}" = host &&
4409         die "--cpu=host not supported with compiler $cc"
4410 fi
4411
4412 # Deal with common $arch aliases
4413 case "$arch" in
4414     aarch64|arm64)
4415         arch="aarch64"
4416     ;;
4417     arm*|iPad*|iPhone*)
4418         arch="arm"
4419     ;;
4420     mips*|IP*)
4421         case "$arch" in
4422         *el)
4423             add_cppflags -EL
4424             add_ldflags -EL
4425         ;;
4426         *eb)
4427             add_cppflags -EB
4428             add_ldflags -EB
4429         ;;
4430         esac
4431         arch="mips"
4432     ;;
4433     parisc*|hppa*)
4434         arch="parisc"
4435     ;;
4436     "Power Macintosh"|ppc*|powerpc*)
4437         arch="ppc"
4438     ;;
4439     s390|s390x)
4440         arch="s390"
4441     ;;
4442     sh4|sh)
4443         arch="sh4"
4444     ;;
4445     sun4*|sparc*)
4446         arch="sparc"
4447     ;;
4448     tilegx|tile-gx)
4449         arch="tilegx"
4450     ;;
4451     i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
4452         arch="x86"
4453     ;;
4454 esac
4455
4456 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
4457 enable $arch
4458
4459 # Add processor-specific flags
4460 if enabled aarch64; then
4461
4462     case $cpu in
4463         armv*)
4464             cpuflags="-march=$cpu"
4465         ;;
4466         *)
4467             cpuflags="-mcpu=$cpu"
4468         ;;
4469     esac
4470
4471 elif enabled alpha; then
4472
4473     cpuflags="-mcpu=$cpu"
4474
4475 elif enabled arm; then
4476
4477     check_arm_arch() {
4478         check_cpp_condition stddef.h \
4479             "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
4480             $cpuflags
4481     }
4482
4483     probe_arm_arch() {
4484         if   check_arm_arch 4;        then echo armv4
4485         elif check_arm_arch 4T;       then echo armv4t
4486         elif check_arm_arch 5;        then echo armv5
4487         elif check_arm_arch 5E;       then echo armv5e
4488         elif check_arm_arch 5T;       then echo armv5t
4489         elif check_arm_arch 5TE;      then echo armv5te
4490         elif check_arm_arch 5TEJ;     then echo armv5te
4491         elif check_arm_arch 6;        then echo armv6
4492         elif check_arm_arch 6J;       then echo armv6j
4493         elif check_arm_arch 6K;       then echo armv6k
4494         elif check_arm_arch 6Z;       then echo armv6z
4495         elif check_arm_arch 6ZK;      then echo armv6zk
4496         elif check_arm_arch 6T2;      then echo armv6t2
4497         elif check_arm_arch 7;        then echo armv7
4498         elif check_arm_arch 7A  7_A;  then echo armv7-a
4499         elif check_arm_arch 7S;       then echo armv7-a
4500         elif check_arm_arch 7R  7_R;  then echo armv7-r
4501         elif check_arm_arch 7M  7_M;  then echo armv7-m
4502         elif check_arm_arch 7EM 7E_M; then echo armv7-m
4503         elif check_arm_arch 8A  8_A;  then echo armv8-a
4504         fi
4505     }
4506
4507     [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
4508
4509     case $cpu in
4510         armv*)
4511             cpuflags="-march=$cpu"
4512             subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
4513         ;;
4514         *)
4515             cpuflags="-mcpu=$cpu"
4516             case $cpu in
4517                 cortex-a*)                               subarch=armv7a  ;;
4518                 cortex-r*)                               subarch=armv7r  ;;
4519                 cortex-m*)                 enable thumb; subarch=armv7m  ;;
4520                 arm11*)                                  subarch=armv6   ;;
4521                 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
4522                 armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
4523                 *)                             subarch=$(probe_arm_arch) ;;
4524             esac
4525         ;;
4526     esac
4527
4528     case "$subarch" in
4529         armv5t*)    enable fast_clz                ;;
4530         armv[6-8]*)
4531             enable fast_clz
4532             disabled fast_unaligned || enable fast_unaligned
4533             ;;
4534     esac
4535
4536 elif enabled avr32; then
4537
4538     case $cpu in
4539         ap7[02]0[0-2])
4540             subarch="avr32_ap"
4541             cpuflags="-mpart=$cpu"
4542         ;;
4543         ap)
4544             subarch="avr32_ap"
4545             cpuflags="-march=$cpu"
4546         ;;
4547         uc3[ab]*)
4548             subarch="avr32_uc"
4549             cpuflags="-mcpu=$cpu"
4550         ;;
4551         uc)
4552             subarch="avr32_uc"
4553             cpuflags="-march=$cpu"
4554         ;;
4555     esac
4556
4557 elif enabled bfin; then
4558
4559     cpuflags="-mcpu=$cpu"
4560
4561 elif enabled mips; then
4562
4563     cpuflags="-march=$cpu"
4564
4565     if [ "$cpu" != "generic" ]; then
4566         disable mips32r2
4567         disable mips32r5
4568         disable mips64r2
4569         disable mips32r6
4570         disable mips64r6
4571         disable loongson2
4572         disable loongson3
4573
4574         case $cpu in
4575             24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
4576                 enable mips32r2
4577                 disable msa
4578             ;;
4579             p5600|i6400|p6600)
4580                 disable mipsdsp
4581                 disable mipsdspr2
4582             ;;
4583             loongson*)
4584                 enable loongson2
4585                 enable loongson3
4586                 enable local_aligned_8 local_aligned_16 local_aligned_32
4587                 enable simd_align_16
4588                 enable fast_64bit
4589                 enable fast_clz
4590                 enable fast_cmov
4591                 enable fast_unaligned
4592                 disable aligned_stack
4593                 disable mipsfpu
4594                 disable mipsdsp
4595                 disable mipsdspr2
4596                 case $cpu in
4597                     loongson3*)
4598                         cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
4599                     ;;
4600                     loongson2e)
4601                         cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
4602                     ;;
4603                     loongson2f)
4604                         cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
4605                     ;;
4606                 esac
4607             ;;
4608             *)
4609                 # Unknown CPU. Disable everything.
4610                 warn "unknown CPU. Disabling all MIPS optimizations."
4611                 disable mipsfpu
4612                 disable mipsdsp
4613                 disable mipsdspr2
4614                 disable msa
4615                 disable mmi
4616             ;;
4617         esac
4618
4619         case $cpu in
4620             24kc)
4621                 disable mipsfpu
4622                 disable mipsdsp
4623                 disable mipsdspr2
4624             ;;
4625             24kf*)
4626                 disable mipsdsp
4627                 disable mipsdspr2
4628             ;;
4629             24kec|34kc|1004kc)
4630                 disable mipsfpu
4631                 disable mipsdspr2
4632             ;;
4633             24kef*|34kf*|1004kf*)
4634                 disable mipsdspr2
4635             ;;
4636             74kc)
4637                 disable mipsfpu
4638             ;;
4639             p5600)
4640                 enable mips32r5
4641                 check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
4642             ;;
4643             i6400)
4644                 enable mips64r6
4645                 check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
4646             ;;
4647             p6600)
4648                 enable mips64r6
4649                 check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
4650             ;;
4651         esac
4652     else
4653         # We do not disable anything. Is up to the user to disable the unwanted features.
4654         warn 'generic cpu selected'
4655     fi
4656
4657 elif enabled ppc; then
4658
4659     disable ldbrx
4660
4661     case $(tolower $cpu) in
4662         601|ppc601|powerpc601)
4663             cpuflags="-mcpu=601"
4664             disable altivec
4665         ;;
4666         603*|ppc603*|powerpc603*)
4667             cpuflags="-mcpu=603"
4668             disable altivec
4669         ;;
4670         604*|ppc604*|powerpc604*)
4671             cpuflags="-mcpu=604"
4672             disable altivec
4673         ;;
4674         g3|75*|ppc75*|powerpc75*)
4675             cpuflags="-mcpu=750"
4676             disable altivec
4677         ;;
4678         g4|745*|ppc745*|powerpc745*)
4679             cpuflags="-mcpu=7450"
4680             disable vsx
4681         ;;
4682         74*|ppc74*|powerpc74*)
4683             cpuflags="-mcpu=7400"
4684             disable vsx
4685         ;;
4686         g5|970|ppc970|powerpc970)
4687             cpuflags="-mcpu=970"
4688             disable vsx
4689         ;;
4690         power[3-6]*)
4691             cpuflags="-mcpu=$cpu"
4692             disable vsx
4693         ;;
4694         power[7-8]*)
4695             cpuflags="-mcpu=$cpu"
4696         ;;
4697         cell)
4698             cpuflags="-mcpu=cell"
4699             enable ldbrx
4700             disable vsx
4701         ;;
4702         e500mc)
4703             cpuflags="-mcpu=e500mc"
4704             disable altivec
4705         ;;
4706         e500v2)
4707             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
4708             disable altivec
4709             disable dcbzl
4710         ;;
4711         e500)
4712             cpuflags="-mcpu=8540 -mhard-float"
4713             disable altivec
4714             disable dcbzl
4715         ;;
4716     esac
4717
4718 elif enabled sparc; then
4719
4720     case $cpu in
4721         cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
4722             cpuflags="-mcpu=$cpu"
4723         ;;
4724         ultrasparc*|niagara[234])
4725             cpuflags="-mcpu=$cpu"
4726         ;;
4727     esac
4728
4729 elif enabled x86; then
4730
4731     case $cpu in
4732         i[345]86|pentium)
4733             cpuflags="-march=$cpu"
4734             disable i686
4735             disable mmx
4736         ;;
4737         # targets that do NOT support nopl and conditional mov (cmov)
4738         pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
4739             cpuflags="-march=$cpu"
4740             disable i686
4741         ;;
4742         # targets that do support nopl and conditional mov (cmov)
4743         i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
4744         |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
4745         |amdfam10|barcelona|b[dt]ver*|znver*)
4746             cpuflags="-march=$cpu"
4747             enable i686
4748             enable fast_cmov
4749         ;;
4750         # targets that do support conditional mov but on which it's slow
4751         pentium4|pentium4m|prescott|nocona)
4752             cpuflags="-march=$cpu"
4753             enable i686
4754             disable fast_cmov
4755         ;;
4756     esac
4757
4758 fi
4759
4760 if [ "$cpu" != generic ]; then
4761     add_cflags  $cpuflags
4762     add_asflags $cpuflags
4763     test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
4764 fi
4765
4766 # compiler sanity check
4767 check_exec <<EOF
4768 int main(void){ return 0; }
4769 EOF
4770 if test "$?" != 0; then
4771     echo "$cc is unable to create an executable file."
4772     if test -z "$cross_prefix" && ! enabled cross_compile ; then
4773         echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
4774         echo "Only do this if you know what cross compiling means."
4775     fi
4776     die "C compiler test failed."
4777 fi
4778
4779 add_cppflags -D_ISOC99_SOURCE
4780 add_cxxflags -D__STDC_CONSTANT_MACROS
4781 check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
4782
4783 # some compilers silently accept -std=c11, so we also need to check that the
4784 # version macro is defined properly
4785 if test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L"; then
4786     add_cflags -std=c11
4787 else
4788     check_cflags -std=c99
4789 fi
4790
4791 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
4792 #include <stdlib.h>
4793 EOF
4794 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
4795 #include <stdlib.h>
4796 EOF
4797
4798 add_host_cppflags -D_ISOC99_SOURCE
4799 check_host_cflags -std=c99
4800 check_host_cflags -Wall
4801 check_host_cflags $host_cflags_speed
4802
4803 check_64bit(){
4804     arch32=$1
4805     arch64=$2
4806     expr=$3
4807     check_code cc "" "int test[2*($expr) - 1]" &&
4808         subarch=$arch64 || subarch=$arch32
4809 }
4810
4811 case "$arch" in
4812     aarch64|alpha|ia64)
4813         spic=$shared
4814     ;;
4815     mips)
4816         check_64bit mips mips64 '_MIPS_SIM > 1'
4817         spic=$shared
4818     ;;
4819     parisc)
4820         check_64bit parisc parisc64 'sizeof(void *) > 4'
4821         spic=$shared
4822     ;;
4823     ppc)
4824         check_64bit ppc ppc64 'sizeof(void *) > 4'
4825         spic=$shared
4826     ;;
4827     s390)
4828         check_64bit s390 s390x 'sizeof(void *) > 4'
4829         spic=$shared
4830     ;;
4831     sparc)
4832         check_64bit sparc sparc64 'sizeof(void *) > 4'
4833         spic=$shared
4834     ;;
4835     x86)
4836         check_64bit x86_32 x86_64 'sizeof(void *) > 4'
4837         # Treat x32 as x64 for now. Note it also needs spic=$shared
4838         test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
4839             subarch=x86_64
4840         if test "$subarch" = "x86_64"; then
4841             spic=$shared
4842         fi
4843     ;;
4844     ppc)
4845         check_cc <<EOF && subarch="ppc64"
4846         int test[(int)sizeof(char*) - 7];
4847 EOF
4848     ;;
4849 esac
4850
4851 enable $subarch
4852 enabled spic && enable_weak pic
4853
4854 enabled x86_64 && objformat=elf64 || objformat="elf32"
4855
4856 # OS specific
4857 case $target_os in
4858     aix)
4859         SHFLAGS=-shared
4860         add_cppflags '-I\$(SRC_PATH)/compat/aix'
4861         enabled shared && add_ldflags -Wl,-brtl
4862         ;;
4863     android)
4864         disable symver
4865         enable section_data_rel_ro
4866         SLIB_INSTALL_NAME='$(SLIBNAME)'
4867         SLIB_INSTALL_LINKS=
4868         SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
4869         ;;
4870     haiku)
4871         prefix_default="/boot/common"