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