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