mmaldec: add vc1 decoding support
[libav.git] / configure
1 #!/bin/sh
2 #
3 # Libav 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 LIBAV, 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 Libav."
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 --list-decoders show all available decoders
67 --list-encoders show all available encoders
68 --list-hwaccels show all available hardware accelerators
69 --list-demuxers show all available demuxers
70 --list-muxers show all available muxers
71 --list-parsers show all available parsers
72 --list-protocols show all available protocols
73 --list-bsfs show all available bitstream filters
74 --list-indevs show all available input devices
75 --list-outdevs show all available output devices
76 --list-filters show all available filters
77
78 Standard options:
79 --logfile=FILE log tests and output to FILE [config.log]
80 --disable-logging do not log configure debug information
81 --prefix=PREFIX install in PREFIX [$prefix]
82 --bindir=DIR install binaries in DIR [PREFIX/bin]
83 --datadir=DIR install data files in DIR [PREFIX/share/avconv]
84 --docdir=DIR install documentation in DIR [PREFIX/share/doc/libav]
85 --libdir=DIR install libs in DIR [PREFIX/lib]
86 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
87 --incdir=DIR install includes in DIR [PREFIX/include]
88 --mandir=DIR install man page in DIR [PREFIX/share/man]
89 --enable-rpath use rpath when linking programs [USE WITH CARE]
90
91 Licensing options:
92 --enable-gpl allow use of GPL code, the resulting libs
93 and binaries will be under GPL [no]
94 --enable-version3 upgrade (L)GPL to version 3 [no]
95 --enable-nonfree allow use of nonfree code, the resulting libs
96 and binaries will be unredistributable [no]
97
98 Configuration options:
99 --disable-static do not build static libraries [no]
100 --enable-shared build shared libraries [no]
101 --enable-small optimize for size instead of speed
102 --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
103 --enable-gray enable full grayscale support (slower color)
104 --disable-swscale-alpha disable alpha channel support in swscale
105 --disable-all disable building components, libraries and programs
106
107 Program options:
108 --disable-programs do not build command line programs
109 --disable-avconv disable avconv build
110 --disable-avplay disable avplay build
111 --disable-avprobe disable avprobe build
112 --disable-avserver deprecated, does nothing
113
114 Component options:
115 --disable-doc do not build documentation
116 --disable-avdevice disable libavdevice build
117 --disable-avcodec disable libavcodec build
118 --disable-avformat disable libavformat build
119 --disable-avutil disable libavutil build
120 --disable-swscale disable libswscale build
121 --disable-avfilter disable video filter support [no]
122 --disable-avresample disable libavresample build [no]
123 --disable-pthreads disable pthreads [auto]
124 --disable-w32threads disable Win32 threads [auto]
125 --disable-network disable network support [no]
126 --disable-dct disable DCT code
127 --disable-error-resilience disable error resilience code
128 --disable-lsp disable LSP code
129 --disable-lzo disable LZO decoder code
130 --disable-mdct disable MDCT code
131 --disable-rdft disable RDFT code
132 --disable-fft disable FFT code
133 --disable-faan disable floating point AAN (I)DCT code
134
135 Hardware accelerators:
136 --enable-d3d11va enable D3D11VA code
137 --enable-dxva2 enable DXVA2 code
138 --enable-vaapi enable VAAPI code
139 --enable-vda enable VDA code
140 --enable-vdpau enable VDPAU code
141
142 Hardware-accelerated decoding/encoding:
143 --enable-cuda enable dynamically linked CUDA [no]
144 --enable-libmfx enable HW acceleration through libmfx
145 --enable-mmal enable decoding via MMAL [no]
146 --enable-nvenc enable encoding via NVENC [no]
147 --enable-omx enable encoding via OpenMAX IL [no]
148 --enable-omx-rpi enable encoding via OpenMAX IL for Raspberry Pi [no]
149
150 Individual component options:
151 --disable-everything disable all components listed below
152 --disable-encoder=NAME disable encoder NAME
153 --enable-encoder=NAME enable encoder NAME
154 --disable-encoders disable all encoders
155 --disable-decoder=NAME disable decoder NAME
156 --enable-decoder=NAME enable decoder NAME
157 --disable-decoders disable all decoders
158 --disable-hwaccel=NAME disable hwaccel NAME
159 --enable-hwaccel=NAME enable hwaccel NAME
160 --disable-hwaccels disable all hwaccels
161 --disable-muxer=NAME disable muxer NAME
162 --enable-muxer=NAME enable muxer NAME
163 --disable-muxers disable all muxers
164 --disable-demuxer=NAME disable demuxer NAME
165 --enable-demuxer=NAME enable demuxer NAME
166 --disable-demuxers disable all demuxers
167 --enable-parser=NAME enable parser NAME
168 --disable-parser=NAME disable parser NAME
169 --disable-parsers disable all parsers
170 --enable-bsf=NAME enable bitstream filter NAME
171 --disable-bsf=NAME disable bitstream filter NAME
172 --disable-bsfs disable all bitstream filters
173 --enable-protocol=NAME enable protocol NAME
174 --disable-protocol=NAME disable protocol NAME
175 --disable-protocols disable all protocols
176 --enable-indev=NAME enable input device NAME
177 --disable-indev=NAME disable input device NAME
178 --disable-indevs disable input devices
179 --enable-outdev=NAME enable output device NAME
180 --disable-outdev=NAME disable output device NAME
181 --disable-outdevs disable output devices
182 --disable-devices disable all devices
183 --enable-filter=NAME enable filter NAME
184 --disable-filter=NAME disable filter NAME
185 --disable-filters disable all filters
186
187 External library support:
188 --enable-avisynth enable reading of AviSynth script files [no]
189 --enable-bzlib enable bzlib [autodetect]
190 --enable-frei0r enable frei0r video filtering
191 --enable-gnutls enable gnutls [no]
192 --enable-libbs2b enable bs2b DSP library [no]
193 --enable-libcdio enable audio CD grabbing with libcdio
194 --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
195 and libraw1394 [no]
196 --enable-libdcadec enable DCA decoding via libdcadec [no]
197 --enable-libfaac enable AAC encoding via libfaac [no]
198 --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
199 --enable-libfreetype enable libfreetype [no]
200 --enable-libgsm enable GSM de/encoding via libgsm [no]
201 --enable-libilbc enable iLBC de/encoding via libilbc [no]
202 --enable-libkvazaar enable HEVC encoding via libkvazaar [no]
203 --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
204 --enable-libnpp enable NVIDIA Performance Primitives-based code [no]
205 --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
206 --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
207 --enable-libopencv enable video filtering via libopencv [no]
208 --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
209 --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
210 --enable-libopus enable Opus de/encoding via libopus [no]
211 --enable-libpulse enable Pulseaudio input via libpulse [no]
212 --enable-librtmp enable RTMP[E] support via librtmp [no]
213 --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
214 --enable-libsnappy enable Snappy compression [no]
215 --enable-libspeex enable Speex de/encoding via libspeex [no]
216 --enable-libtheora enable Theora encoding via libtheora [no]
217 --enable-libtwolame enable MP2 encoding via libtwolame [no]
218 --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
219 --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
220 --enable-libvorbis enable Vorbis encoding via libvorbis [no]
221 --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
222 --enable-libwavpack enable wavpack encoding via libwavpack [no]
223 --enable-libwebp enable WebP encoding via libwebp [no]
224 --enable-libx264 enable H.264 encoding via x264 [no]
225 --enable-libx265 enable HEVC encoding via x265 [no]
226 --enable-libxavs enable AVS encoding via xavs [no]
227 --enable-libxcb enable X11 grabbing using XCB [no]
228 --enable-libxcb-shm enable X11 grabbing shm communication [auto]
229 --enable-libxcb-xfixes enable X11 grabbing mouse rendering [auto]
230 --enable-libxvid enable Xvid encoding via xvidcore,
231 native MPEG-4/Xvid encoder exists [no]
232 --enable-openssl enable openssl [no]
233 --enable-x11grab enable X11 grabbing (legacy) [no]
234 --enable-zlib enable zlib [autodetect]
235
236 Toolchain options:
237 --arch=ARCH select architecture [$arch]
238 --cpu=CPU select the minimum required CPU (affects
239 instruction selection, may crash on older CPUs)
240 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
241 --enable-cross-compile assume a cross-compiler is used
242 --sysroot=PATH root of cross-build tree
243 --sysinclude=PATH location of cross-build system headers
244 --target-os=OS compiler targets OS [$target_os]
245 --target-exec=CMD command to run executables on target
246 --target-path=DIR path to view of build directory on target
247 --target-samples=DIR path to samples directory on target
248 --toolchain=NAME set tool defaults according to NAME
249 --nm=NM use nm tool
250 --ar=AR use archive tool AR [$ar_default]
251 --as=AS use assembler AS [$as_default]
252 --cc=CC use C compiler CC [$cc_default]
253 --objcc=OCC use ObjC compiler OCC [$cc_default]
254 --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
255 --ld=LD use linker LD
256 --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
257 --pkg-config-flags=FLAGS pass additional flags to pkgconf []
258 --host-cc=HOSTCC use host C compiler HOSTCC
259 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
260 --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
261 --host-ld=HOSTLD use host linker HOSTLD
262 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
263 --host-libs=HLIBS use libs HLIBS when linking for host
264 --host-os=OS compiler host OS [$target_os]
265 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
266 --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
267 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
268 --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
269 --extra-libs=ELIBS add ELIBS [$ELIBS]
270 --extra-version=STRING version string suffix []
271 --optflags=OPTFLAGS override optimization-related compiler flags
272 --build-suffix=SUFFIX library name suffix []
273 --enable-pic build position-independent code
274 --enable-thumb compile for Thumb instruction set
275 --enable-lto use link-time optimization
276 --env="ENV=override" override the environment variables
277
278 Advanced options (experts only):
279 --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
280 --custom-allocator=NAME use a supported custom allocator
281 --disable-symver disable symbol versioning
282 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
283 --disable-safe-bitstream-reader
284 disable buffer boundary checking in bitreaders
285 (faster, but may crash)
286 --enable-memalign-hack emulate memalign, interferes with memory debuggers
287 --enable-sram allow use of on-chip SRAM
288
289 Optimization options (experts only):
290 --disable-asm disable all assembly optimizations
291 --disable-altivec disable AltiVec optimizations
292 --disable-vsx disable VSX optimizations
293 --disable-power8 disable POWER8 optimizations
294 --disable-amd3dnow disable 3DNow! optimizations
295 --disable-amd3dnowext disable 3DNow! extended optimizations
296 --disable-mmx disable MMX optimizations
297 --disable-mmxext disable MMXEXT optimizations
298 --disable-sse disable SSE optimizations
299 --disable-sse2 disable SSE2 optimizations
300 --disable-sse3 disable SSE3 optimizations
301 --disable-ssse3 disable SSSE3 optimizations
302 --disable-sse4 disable SSE4 optimizations
303 --disable-sse42 disable SSE4.2 optimizations
304 --disable-avx disable AVX optimizations
305 --disable-xop disable XOP optimizations
306 --disable-fma3 disable FMA3 optimizations
307 --disable-fma4 disable FMA4 optimizations
308 --disable-avx2 disable AVX2 optimizations
309 --disable-armv5te disable armv5te optimizations
310 --disable-armv6 disable armv6 optimizations
311 --disable-armv6t2 disable armv6t2 optimizations
312 --disable-vfp disable VFP optimizations
313 --disable-neon disable NEON optimizations
314 --disable-inline-asm disable use of inline assembly
315 --disable-yasm disable use of nasm/yasm assembly
316
317 Developer options (useful when working on Libav itself):
318 --disable-debug disable debugging symbols
319 --enable-debug=LEVEL set the debug level [$debuglevel]
320 --disable-optimizations disable compiler optimizations
321 --enable-extra-warnings enable more compiler warnings
322 --samples=PATH location of test samples for FATE, if not set use
323 \$LIBAV_SAMPLES at make invocation time.
324 --enable-neon-clobber-test check NEON registers for clobbering (should be
325 used only for debugging purposes)
326 --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
327 should be used only for debugging purposes)
328 --enable-random randomly enable/disable components
329 --disable-random
330 --enable-random=LIST randomly enable/disable specific components or
331 --disable-random=LIST component groups. LIST is a comma-separated list
332 of NAME[:PROB] entries where NAME is a component
333 (group) and PROB the probability associated with
334 NAME (default 0.5).
335 --random-seed=VALUE seed value for --enable/disable-random
336 --disable-valgrind-backtrace do not print a backtrace under Valgrind
337 (only applies to --disable-optimizations builds)
338
339 NOTE: Object files are built at the place where configure is launched.
340 EOF
341 exit 0
342 }
343
344 quotes='""'
345
346 log(){
347 echo "$@" >> $logfile
348 }
349
350 log_file(){
351 log BEGIN $1
352 i=1
353 while read line; do
354 printf '%5s %s\n' "${i}" "${line}"
355 i=$(($i+1))
356 done < $1 >> $logfile
357 log END $1
358 }
359
360 echolog(){
361 log "$@"
362 echo "$@"
363 }
364
365 warn(){
366 log "WARNING: $*"
367 WARNINGS="${WARNINGS}WARNING: $*\n"
368 }
369
370 die(){
371 echolog "$@"
372 cat <<EOF
373
374 If you think configure made a mistake, make sure you are using the latest
375 version from Git. If the latest version fails, report the problem to the
376 libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
377 EOF
378 if disabled logging; then
379 cat <<EOF
380 Rerun configure with logging enabled (do not use --disable-logging), and
381 include the log this produces with your report.
382 EOF
383 else
384 cat <<EOF
385 Include the log file "$logfile" produced by configure as this will help
386 solving the problem.
387 EOF
388 fi
389 exit 1
390 }
391
392 # Avoid locale weirdness, besides we really just want to translate ASCII.
393 toupper(){
394 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
395 }
396
397 tolower(){
398 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
399 }
400
401 c_escape(){
402 echo "$*" | sed 's/["\\]/\\\0/g'
403 }
404
405 sh_quote(){
406 v=$(echo "$1" | sed "s/'/'\\\\''/g")
407 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
408 echo "$v"
409 }
410
411 cleanws(){
412 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
413 }
414
415 filter(){
416 pat=$1
417 shift
418 for v; do
419 eval "case $v in $pat) echo $v ;; esac"
420 done
421 }
422
423 filter_out(){
424 pat=$1
425 shift
426 for v; do
427 eval "case $v in $pat) ;; *) echo $v ;; esac"
428 done
429 }
430
431 map(){
432 m=$1
433 shift
434 for v; do eval $m; done
435 }
436
437 add_suffix(){
438 suffix=$1
439 shift
440 for v; do echo ${v}${suffix}; done
441 }
442
443 set_all(){
444 value=$1
445 shift
446 for var in $*; do
447 eval $var=$value
448 done
449 }
450
451 set_weak(){
452 value=$1
453 shift
454 for var; do
455 eval : \${$var:=$value}
456 done
457 }
458
459 sanitize_var_name(){
460 echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
461 }
462
463 set_safe(){
464 var=$1
465 shift
466 eval $(sanitize_var_name "$var")='$*'
467 }
468
469 get_safe(){
470 eval echo \$$(sanitize_var_name "$1")
471 }
472
473 pushvar(){
474 for pvar in $*; do
475 eval level=\${${pvar}_level:=0}
476 eval ${pvar}_${level}="\$$pvar"
477 eval ${pvar}_level=$(($level+1))
478 done
479 }
480
481 popvar(){
482 for pvar in $*; do
483 eval level=\${${pvar}_level:-0}
484 test $level = 0 && continue
485 eval level=$(($level-1))
486 eval $pvar="\${${pvar}_${level}}"
487 eval ${pvar}_level=$level
488 eval unset ${pvar}_${level}
489 done
490 }
491
492 enable(){
493 set_all yes $*
494 }
495
496 disable(){
497 set_all no $*
498 }
499
500 enable_weak(){
501 set_weak yes $*
502 }
503
504 disable_weak(){
505 set_weak no $*
506 }
507
508 enable_safe(){
509 for var; do
510 enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
511 done
512 }
513
514 disable_safe(){
515 for var; do
516 disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
517 done
518 }
519
520 do_enable_deep(){
521 for var; do
522 enabled $var && continue
523 eval sel="\$${var}_select"
524 eval sgs="\$${var}_suggest"
525 pushvar var sgs
526 enable_deep $sel
527 popvar sgs
528 enable_deep_weak $sgs
529 popvar var
530 done
531 }
532
533 enable_deep(){
534 do_enable_deep $*
535 enable $*
536 }
537
538 enable_deep_weak(){
539 for var; do
540 disabled $var && continue
541 pushvar var
542 do_enable_deep $var
543 popvar var
544 enable_weak $var
545 done
546 }
547
548 enabled(){
549 test "${1#!}" = "$1" && op== || op=!=
550 eval test "x\$${1#!}" $op "xyes"
551 }
552
553 disabled(){
554 test "${1#!}" = "$1" && op== || op=!=
555 eval test "x\$${1#!}" $op "xno"
556 }
557
558 enabled_all(){
559 for opt; do
560 enabled $opt || return 1
561 done
562 }
563
564 disabled_all(){
565 for opt; do
566 disabled $opt || return 1
567 done
568 }
569
570 enabled_any(){
571 for opt; do
572 enabled $opt && return 0
573 done
574 }
575
576 disabled_any(){
577 for opt; do
578 disabled $opt && return 0
579 done
580 return 1
581 }
582
583 set_default(){
584 for opt; do
585 eval : \${$opt:=\$${opt}_default}
586 done
587 }
588
589 is_in(){
590 value=$1
591 shift
592 for var in $*; do
593 [ $var = $value ] && return 0
594 done
595 return 1
596 }
597
598 do_check_deps(){
599 for cfg; do
600 cfg="${cfg#!}"
601 enabled ${cfg}_checking && die "Circular dependency for $cfg."
602 disabled ${cfg}_checking && continue
603 enable ${cfg}_checking
604 append allopts $cfg
605
606 eval dep_all="\$${cfg}_deps"
607 eval dep_any="\$${cfg}_deps_any"
608 eval dep_sel="\$${cfg}_select"
609 eval dep_sgs="\$${cfg}_suggest"
610 eval dep_ifa="\$${cfg}_if"
611 eval dep_ifn="\$${cfg}_if_any"
612
613 pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
614 do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
615 popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
616
617 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
618 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
619 enabled_all $dep_all || disable $cfg
620 enabled_any $dep_any || disable $cfg
621 disabled_any $dep_sel && disable $cfg
622
623 if enabled $cfg; then
624 enable_deep $dep_sel
625 enable_deep_weak $dep_sgs
626 fi
627
628 disable ${cfg}_checking
629 done
630 }
631
632 check_deps(){
633 unset allopts
634
635 do_check_deps "$@"
636
637 for cfg in $allopts; do
638 enabled $cfg || continue
639 eval dep_extralibs="\$${cfg}_extralibs"
640 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
641 done
642 }
643
644 print_config(){
645 pfx=$1
646 files=$2
647 shift 2
648 map 'eval echo "$v \${$v:-no}"' "$@" |
649 awk "BEGIN { split(\"$files\", files) }
650 {
651 c = \"$pfx\" toupper(\$1);
652 v = \$2;
653 sub(/yes/, 1, v);
654 sub(/no/, 0, v);
655 for (f in files) {
656 file = files[f];
657 if (file ~ /\\.h\$/) {
658 printf(\"#define %s %d\\n\", c, v) >>file;
659 } else if (file ~ /\\.asm\$/) {
660 printf(\"%%define %s %d\\n\", c, v) >>file;
661 } else if (file ~ /\\.mak\$/) {
662 n = -v ? \"\" : \"!\";
663 printf(\"%s%s=yes\\n\", n, c) >>file;
664 }
665 }
666 }"
667 }
668
669 print_enabled(){
670 suf=$1
671 shift
672 for v; do
673 enabled $v && printf "%s\n" ${v%$suf}
674 done
675 }
676
677 append(){
678 var=$1
679 shift
680 eval "$var=\"\$$var $*\""
681 }
682
683 prepend(){
684 var=$1
685 shift
686 eval "$var=\"$* \$$var\""
687 }
688
689 unique(){
690 var=$1
691 uniq_list=""
692 for tok in $(eval echo \$$var); do
693 uniq_list="$(filter_out $tok $uniq_list) $tok"
694 done
695 eval "$var=\"${uniq_list}\""
696 }
697
698 add_cppflags(){
699 append CPPFLAGS "$@"
700 }
701
702 add_cflags(){
703 append CFLAGS $($cflags_filter "$@")
704 }
705
706 add_asflags(){
707 append ASFLAGS $($asflags_filter "$@")
708 }
709
710 add_objcflags(){
711 append OBJCFLAGS $($objcflags_filter "$@")
712 }
713
714 add_ldflags(){
715 append LDFLAGS $($ldflags_filter "$@")
716 }
717
718 add_ldexeflags(){
719 append LDEXEFLAGS $($ldflags_filter "$@")
720 }
721
722 add_stripflags(){
723 append STRIPFLAGS "$@"
724 }
725
726 add_extralibs(){
727 prepend extralibs $($ldflags_filter "$@")
728 }
729
730 add_host_cppflags(){
731 append host_cppflags "$@"
732 }
733
734 add_host_cflags(){
735 append host_cflags $($host_cflags_filter "$@")
736 }
737
738 add_host_ldflags(){
739 append host_ldflags $($host_ldflags_filter "$@")
740 }
741
742 add_compat(){
743 append compat_objs $1
744 shift
745 map 'add_cppflags -D$v' "$@"
746 }
747
748 check_cmd(){
749 log "$@"
750 "$@" >> $logfile 2>&1
751 }
752
753 cc_o(){
754 eval printf '%s\\n' $CC_O
755 }
756
757 cc_e(){
758 eval printf '%s\\n' $CC_E
759 }
760
761 check_cc(){
762 log check_cc "$@"
763 cat > $TMPC
764 log_file $TMPC
765 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
766 }
767
768 check_objcc(){
769 log check_objcc "$@"
770 cat > $TMPC
771 log_file $TMPC
772 check_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC
773 }
774
775 check_cpp(){
776 log check_cpp "$@"
777 cat > $TMPC
778 log_file $TMPC
779 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
780 }
781
782 as_o(){
783 eval printf '%s\\n' $AS_O
784 }
785
786 check_as(){
787 log check_as "$@"
788 cat > $TMPS
789 log_file $TMPS
790 check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
791 }
792
793 check_inline_asm(){
794 log check_inline_asm "$@"
795 name="$1"
796 code="$2"
797 shift 2
798 disable $name
799 check_cc "$@" <<EOF && enable $name
800 void foo(void){ __asm__ volatile($code); }
801 EOF
802 }
803
804 check_insn(){
805 log check_insn "$@"
806 check_inline_asm ${1}_inline "\"$2\""
807 echo "$2" | check_as && enable ${1}_external || disable ${1}_external
808 }
809
810 check_yasm(){
811 log check_yasm "$@"
812 echo "$1" > $TMPS
813 log_file $TMPS
814 shift 1
815 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
816 }
817
818 ld_o(){
819 eval printf '%s\\n' $LD_O
820 }
821
822 check_ld(){
823 log check_ld "$@"
824 flags=$(filter_out '-l*' "$@")
825 libs=$(filter '-l*' "$@")
826 check_cc $($cflags_filter $flags) || return
827 flags=$($ldflags_filter $flags)
828 libs=$($ldflags_filter $libs)
829 check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
830 }
831
832 print_include(){
833 hdr=$1
834 test "${hdr%.h}" = "${hdr}" &&
835 echo "#include $hdr" ||
836 echo "#include <$hdr>"
837 }
838
839 check_code(){
840 log check_code "$@"
841 check=$1
842 headers=$2
843 code=$3
844 shift 3
845 {
846 for hdr in $headers; do
847 print_include $hdr
848 done
849 echo "int main(void) { $code; return 0; }"
850 } | check_$check "$@"
851 }
852
853 check_cppflags(){
854 log check_cppflags "$@"
855 check_cc "$@" <<EOF && append CPPFLAGS "$@"
856 int x;
857 EOF
858 }
859
860 test_cflags(){
861 log test_cflags "$@"
862 set -- $($cflags_filter "$@")
863 check_cc "$@" <<EOF
864 int x;
865 EOF
866 }
867
868 check_cflags(){
869 log check_cflags "$@"
870 test_cflags "$@" && add_cflags "$@"
871 }
872
873 test_objcflags(){
874 log test_cflags "$@"
875 set -- $($cflags_filter "$@")
876 check_objcc "$@" <<EOF
877 int x;
878 EOF
879 }
880
881 check_objcflags(){
882 log check_cflags "$@"
883 test_objcflags "$@" && add_objcflags "$@"
884 }
885
886 test_ldflags(){
887 log test_ldflags "$@"
888 check_ld "$@" <<EOF
889 int main(void){ return 0; }
890 EOF
891 }
892
893 check_ldflags(){
894 log check_ldflags "$@"
895 test_ldflags "$@" && add_ldflags "$@"
896 }
897
898 test_stripflags(){
899 log test_stripflags "$@"
900 # call check_cc to get a fresh TMPO
901 check_cc <<EOF
902 int main(void) { return 0; }
903 EOF
904 check_cmd $strip $STRIPFLAGS "$@" $TMPO
905 }
906
907 check_stripflags(){
908 log check_stripflags "$@"
909 test_stripflags "$@" && add_stripflags "$@"
910 }
911
912 check_header(){
913 log check_header "$@"
914 header=$1
915 shift
916 disable_safe $header
917 check_cpp "$@" <<EOF && enable_safe $header
918 #include <$header>
919 int x;
920 EOF
921 }
922
923 check_func(){
924 log check_func "$@"
925 func=$1
926 shift
927 disable $func
928 check_ld "$@" <<EOF && enable $func
929 extern int $func();
930 int main(void){ $func(); }
931 EOF
932 }
933
934 check_mathfunc(){
935 log check_mathfunc "$@"
936 func=$1
937 narg=$2
938 shift 2
939 test $narg = 2 && args="f, g" || args="f"
940 disable $func
941 check_ld "$@" <<EOF && enable $func
942 #include <math.h>
943 float foo(float f, float g) { return $func($args); }
944 int main(void){ return 0; }
945 EOF
946 }
947
948 check_func_headers(){
949 log check_func_headers "$@"
950 headers=$1
951 funcs=$2
952 shift 2
953 {
954 for hdr in $headers; do
955 print_include $hdr
956 done
957 for func in $funcs; do
958 echo "long check_$func(void) { return (long) $func; }"
959 done
960 echo "int main(void) { return 0; }"
961 } | check_ld "$@" && enable $funcs && enable_safe $headers
962 }
963
964 check_cpp_condition(){
965 log check_cpp_condition "$@"
966 header=$1
967 condition=$2
968 shift 2
969 check_cpp "$@" <<EOF
970 #include <$header>
971 #if !($condition)
972 #error "unsatisfied condition: $condition"
973 #endif
974 EOF
975 }
976
977 check_lib(){
978 log check_lib "$@"
979 header="$1"
980 func="$2"
981 shift 2
982 check_header $header && check_func $func "$@" && add_extralibs "$@"
983 }
984
985 check_lib2(){
986 log check_lib2 "$@"
987 headers="$1"
988 funcs="$2"
989 shift 2
990 check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
991 }
992
993 check_pkg_config(){
994 log check_pkg_config "$@"
995 pkg="$1"
996 headers="$2"
997 funcs="$3"
998 shift 3
999 check_cmd $pkg_config --exists --print-errors $pkg || return
1000 pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1001 pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1002 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1003 set_safe "${pkg}_cflags" $pkg_cflags &&
1004 set_safe "${pkg}_libs" $pkg_libs
1005 }
1006
1007 check_exec(){
1008 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1009 }
1010
1011 check_exec_crash(){
1012 code=$(cat)
1013
1014 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
1015 # are safe but may not be available everywhere. Thus we use
1016 # raise(SIGTERM) instead. The check is run in a subshell so we
1017 # can redirect the "Terminated" message from the shell. SIGBUS
1018 # is not defined by standard C so it is used conditionally.
1019
1020 (check_exec "$@") >> $logfile 2>&1 <<EOF
1021 #include <signal.h>
1022 static void sighandler(int sig){
1023 raise(SIGTERM);
1024 }
1025 int foo(void){
1026 $code
1027 }
1028 int (*func_ptr)(void) = foo;
1029 int main(void){
1030 signal(SIGILL, sighandler);
1031 signal(SIGFPE, sighandler);
1032 signal(SIGSEGV, sighandler);
1033 #ifdef SIGBUS
1034 signal(SIGBUS, sighandler);
1035 #endif
1036 return func_ptr();
1037 }
1038 EOF
1039 }
1040
1041 check_type(){
1042 log check_type "$@"
1043 headers=$1
1044 type=$2
1045 shift 2
1046 disable_safe "$type"
1047 check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
1048 }
1049
1050 check_struct(){
1051 log check_struct "$@"
1052 headers=$1
1053 struct=$2
1054 member=$3
1055 shift 3
1056 disable_safe "${struct}_${member}"
1057 check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1058 enable_safe "${struct}_${member}"
1059 }
1060
1061 check_builtin(){
1062 log check_builtin "$@"
1063 name=$1
1064 headers=$2
1065 builtin=$3
1066 shift 3
1067 disable "$name"
1068 check_code ld "$headers" "$builtin" "$@" && enable "$name"
1069 }
1070
1071 check_compile_assert(){
1072 log check_compile_assert "$@"
1073 name=$1
1074 headers=$2
1075 condition=$3
1076 shift 3
1077 disable "$name"
1078 check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1079 }
1080
1081 require(){
1082 name="$1"
1083 header="$2"
1084 func="$3"
1085 shift 3
1086 check_lib $header $func "$@" || die "ERROR: $name not found"
1087 }
1088
1089 require2(){
1090 name="$1"
1091 headers="$2"
1092 func="$3"
1093 shift 3
1094 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
1095 }
1096
1097 require_pkg_config(){
1098 pkg="$1"
1099 check_pkg_config "$@" || die "ERROR: $pkg not found"
1100 add_cflags $(get_safe "${pkg}_cflags")
1101 add_extralibs $(get_safe "${pkg}_libs")
1102 }
1103
1104 hostcc_e(){
1105 eval printf '%s\\n' $HOSTCC_E
1106 }
1107
1108 hostcc_o(){
1109 eval printf '%s\\n' $HOSTCC_O
1110 }
1111
1112 check_host_cc(){
1113 log check_host_cc "$@"
1114 cat > $TMPC
1115 log_file $TMPC
1116 check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1117 }
1118
1119 check_host_cpp(){
1120 log check_host_cpp "$@"
1121 cat > $TMPC
1122 log_file $TMPC
1123 check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1124 }
1125
1126 check_host_cppflags(){
1127 log check_host_cppflags "$@"
1128 check_host_cc "$@" <<EOF && append host_cppflags "$@"
1129 int x;
1130 EOF
1131 }
1132
1133 check_host_cflags(){
1134 log check_host_cflags "$@"
1135 set -- $($host_cflags_filter "$@")
1136 check_host_cc "$@" <<EOF && append host_cflags "$@"
1137 int x;
1138 EOF
1139 }
1140
1141 check_host_cpp_condition(){
1142 log check_host_cpp_condition "$@"
1143 header=$1
1144 condition=$2
1145 shift 2
1146 check_host_cpp "$@" <<EOF
1147 #include <$header>
1148 #if !($condition)
1149 #error "unsatisfied condition: $condition"
1150 #endif
1151 EOF
1152 }
1153
1154 apply(){
1155 file=$1
1156 shift
1157 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
1158 }
1159
1160 cp_if_changed(){
1161 cmp -s "$1" "$2" && echo "$2 is unchanged" && return
1162 mkdir -p "$(dirname $2)"
1163 $cp_f "$1" "$2"
1164 }
1165
1166 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1167 # system-dependent things.
1168
1169 AVCODEC_COMPONENTS="
1170 bsfs
1171 decoders
1172 encoders
1173 hwaccels
1174 parsers
1175 "
1176
1177 AVDEVICE_COMPONENTS="
1178 indevs
1179 outdevs
1180 "
1181 AVFILTER_COMPONENTS="
1182 filters
1183 "
1184 AVFORMAT_COMPONENTS="
1185 demuxers
1186 muxers
1187 protocols
1188 "
1189
1190 AVRESAMPLE_COMPONENTS=""
1191 AVUTIL_COMPONENTS=""
1192
1193 COMPONENT_LIST="
1194 $AVCODEC_COMPONENTS
1195 $AVDEVICE_COMPONENTS
1196 $AVFILTER_COMPONENTS
1197 $AVFORMAT_COMPONENTS
1198 $AVRESAMPLE_COMPONENTS
1199 $AVUTIL_COMPONENTS
1200 "
1201
1202 EXAMPLE_LIST="
1203 avcodec_example
1204 filter_audio_example
1205 metadata_example
1206 output_example
1207 qsvdec_example
1208 transcode_aac_example
1209 "
1210
1211 EXTERNAL_LIBRARY_LIST="
1212 avisynth
1213 bzlib
1214 frei0r
1215 gnutls
1216 libbs2b
1217 libcdio
1218 libdc1394
1219 libdcadec
1220 libfaac
1221 libfdk_aac
1222 libfontconfig
1223 libfreetype
1224 libgsm
1225 libilbc
1226 libkvazaar
1227 libmp3lame
1228 libnpp
1229 libopencore_amrnb
1230 libopencore_amrwb
1231 libopencv
1232 libopenh264
1233 libopenjpeg
1234 libopus
1235 libpulse
1236 librtmp
1237 libschroedinger
1238 libsnappy
1239 libspeex
1240 libtheora
1241 libtwolame
1242 libvo_aacenc
1243 libvo_amrwbenc
1244 libvorbis
1245 libvpx
1246 libwavpack
1247 libwebp
1248 libx264
1249 libx265
1250 libxavs
1251 libxcb
1252 libxcb_shm
1253 libxcb_xfixes
1254 libxvid
1255 openssl
1256 x11grab
1257 zlib
1258 "
1259
1260 FEATURE_LIST="
1261 gray
1262 hardcoded_tables
1263 omx_rpi
1264 runtime_cpudetect
1265 safe_bitstream_reader
1266 shared
1267 small
1268 sram
1269 static
1270 swscale_alpha
1271 "
1272
1273 HW_CODECS_LIST="
1274 cuda
1275 libmfx
1276 mmal
1277 nvenc
1278 omx
1279 "
1280
1281 HWACCEL_LIST="
1282 d3d11va
1283 dxva2
1284 vaapi
1285 vda
1286 vdpau
1287 "
1288
1289 LIBRARY_LIST="
1290 avcodec
1291 avdevice
1292 avfilter
1293 avformat
1294 avresample
1295 avutil
1296 swscale
1297 "
1298
1299 LICENSE_LIST="
1300 gpl
1301 nonfree
1302 version3
1303 "
1304
1305 PROGRAM_LIST="
1306 avconv
1307 avplay
1308 avprobe
1309 "
1310
1311 SUBSYSTEM_LIST="
1312 dct
1313 doc
1314 error_resilience
1315 faan
1316 fft
1317 lsp
1318 lzo
1319 mdct
1320 network
1321 rdft
1322 "
1323
1324 CONFIG_LIST="
1325 $COMPONENT_LIST
1326 $EXAMPLE_LIST
1327 $EXTERNAL_LIBRARY_LIST
1328 $FEATURE_LIST
1329 $HW_CODECS_LIST
1330 $HWACCEL_LIST
1331 $LICENSE_LIST
1332 $LIBRARY_LIST
1333 $PROGRAM_LIST
1334 $SUBSYSTEM_LIST
1335 memalign_hack
1336 neon_clobber_test
1337 pic
1338 pod2man
1339 texi2html
1340 thumb
1341 valgrind_backtrace
1342 xmm_clobber_test
1343 "
1344
1345 THREADS_LIST="
1346 pthreads
1347 w32threads
1348 "
1349
1350 ATOMICS_LIST="
1351 atomics_gcc
1352 atomics_suncc
1353 atomics_win32
1354 "
1355
1356 ARCH_LIST="
1357 aarch64
1358 alpha
1359 arm
1360 avr32
1361 avr32_ap
1362 avr32_uc
1363 bfin
1364 ia64
1365 m68k
1366 mips
1367 mips64
1368 parisc
1369 ppc
1370 ppc64
1371 s390
1372 sh4
1373 sparc
1374 sparc64
1375 tilegx
1376 tilepro
1377 tomi
1378 x86
1379 x86_32
1380 x86_64
1381 "
1382
1383 ARCH_EXT_LIST_ARM="
1384 armv5te
1385 armv6
1386 armv6t2
1387 armv8
1388 neon
1389 vfp
1390 vfpv3
1391 "
1392
1393 ARCH_EXT_LIST_X86_SIMD="
1394 amd3dnow
1395 amd3dnowext
1396 avx
1397 avx2
1398 fma3
1399 fma4
1400 mmx
1401 mmxext
1402 sse
1403 sse2
1404 sse3
1405 sse4
1406 sse42
1407 ssse3
1408 xop
1409 "
1410
1411 ARCH_EXT_LIST_PPC="
1412 altivec
1413 dcbzl
1414 ldbrx
1415 power8
1416 ppc4xx
1417 vsx
1418 "
1419
1420 ARCH_EXT_LIST_X86="
1421 $ARCH_EXT_LIST_X86_SIMD
1422 cpunop
1423 i686
1424 "
1425
1426 ARCH_EXT_LIST_MIPS="
1427 loongson
1428 mips32r1
1429 mips64r1
1430 mips32r2
1431 mips64r2
1432 mips32r6
1433 mips64r6
1434 "
1435
1436 ARCH_EXT_LIST="
1437 $ARCH_EXT_LIST_ARM
1438 $ARCH_EXT_LIST_MIPS
1439 $ARCH_EXT_LIST_PPC
1440 $ARCH_EXT_LIST_X86
1441 vis
1442 "
1443
1444 ARCH_FEATURES="
1445 aligned_stack
1446 fast_64bit
1447 fast_clz
1448 fast_cmov
1449 local_aligned_8
1450 local_aligned_16
1451 simd_align_16
1452 "
1453
1454 BUILTIN_LIST="
1455 atomic_cas_ptr
1456 machine_rw_barrier
1457 MemoryBarrier
1458 mm_empty
1459 rdtsc
1460 sem_timedwait
1461 sync_val_compare_and_swap
1462 "
1463 HAVE_LIST_CMDLINE="
1464 inline_asm
1465 symver
1466 yasm
1467 "
1468
1469 HAVE_LIST_PUB="
1470 bigendian
1471 fast_unaligned
1472 "
1473
1474 HEADERS_LIST="
1475 AVFoundation_AVFoundation_h
1476 alsa_asoundlib_h
1477 altivec_h
1478 arpa_inet_h
1479 cdio_paranoia_h
1480 cdio_paranoia_paranoia_h
1481 dispatch_dispatch_h
1482 dev_bktr_ioctl_bt848_h
1483 dev_bktr_ioctl_meteor_h
1484 dev_ic_bt8xx_h
1485 dev_video_bktr_ioctl_bt848_h
1486 dev_video_meteor_ioctl_meteor_h
1487 direct_h
1488 dlfcn_h
1489 d3d11_h
1490 dxva_h
1491 gsm_h
1492 io_h
1493 mach_mach_time_h
1494 machine_ioctl_bt848_h
1495 machine_ioctl_meteor_h
1496 malloc_h
1497 poll_h
1498 sndio_h
1499 soundcard_h
1500 sys_mman_h
1501 sys_param_h
1502 sys_resource_h
1503 sys_select_h
1504 sys_soundcard_h
1505 sys_time_h
1506 sys_un_h
1507 sys_videoio_h
1508 unistd_h
1509 valgrind_valgrind_h
1510 windows_h
1511 winsock2_h
1512 "
1513
1514 INTRINSICS_LIST="
1515 intrinsics_neon
1516 "
1517
1518 MATH_FUNCS="
1519 atanf
1520 atan2f
1521 cbrtf
1522 cosf
1523 exp2
1524 exp2f
1525 expf
1526 isinf
1527 isnan
1528 ldexpf
1529 llrint
1530 llrintf
1531 log2
1532 log2f
1533 log10f
1534 lrint
1535 lrintf
1536 powf
1537 rint
1538 round
1539 roundf
1540 sinf
1541 trunc
1542 truncf
1543 "
1544
1545 SYSTEM_FUNCS="
1546 aligned_malloc
1547 clock_gettime
1548 closesocket
1549 CommandLineToArgvW
1550 CoTaskMemFree
1551 CryptGenRandom
1552 dlopen
1553 fcntl
1554 flt_lim
1555 fork
1556 getaddrinfo
1557 gethrtime
1558 getopt
1559 GetProcessAffinityMask
1560 GetProcessMemoryInfo
1561 GetProcessTimes
1562 getrusage
1563 GetSystemTimeAsFileTime
1564 gettimeofday
1565 gmtime_r
1566 inet_aton
1567 isatty
1568 jack_port_get_latency_range
1569 LoadLibrary
1570 localtime_r
1571 mach_absolute_time
1572 MapViewOfFile
1573 memalign
1574 mkstemp
1575 mmap
1576 mprotect
1577 nanosleep
1578 posix_memalign
1579 sched_getaffinity
1580 SetConsoleTextAttribute
1581 setmode
1582 setrlimit
1583 Sleep
1584 strerror_r
1585 sysconf
1586 sysctl
1587 usleep
1588 VirtualAlloc
1589 "
1590
1591 TOOLCHAIN_FEATURES="
1592 as_dn_directive
1593 as_func
1594 as_object_arch
1595 asm_mod_q
1596 attribute_may_alias
1597 attribute_packed
1598 ebp_available
1599 ebx_available
1600 gnu_as
1601 ibm_asm
1602 inline_asm_labels
1603 pragma_deprecated
1604 symver_asm_label
1605 symver_gnu_asm
1606 vfp_args
1607 xform_asm
1608 xmm_clobbers
1609 "
1610
1611 TYPES_LIST="
1612 CONDITION_VARIABLE_Ptr
1613 socklen_t
1614 struct_addrinfo
1615 struct_group_source_req
1616 struct_ip_mreq_source
1617 struct_ipv6_mreq
1618 struct_pollfd
1619 struct_rusage_ru_maxrss
1620 struct_sockaddr_in6
1621 struct_sockaddr_sa_len
1622 struct_sockaddr_storage
1623 struct_v4l2_frmivalenum_discrete
1624 "
1625
1626 HAVE_LIST="
1627 $ARCH_EXT_LIST
1628 $(add_suffix _external $ARCH_EXT_LIST)
1629 $(add_suffix _inline $ARCH_EXT_LIST)
1630 $ARCH_FEATURES
1631 $ATOMICS_LIST
1632 $BUILTIN_LIST
1633 $HAVE_LIST_CMDLINE
1634 $HAVE_LIST_PUB
1635 $HEADERS_LIST
1636 $INTRINSICS_LIST
1637 $MATH_FUNCS
1638 $SYSTEM_FUNCS
1639 $THREADS_LIST
1640 $TOOLCHAIN_FEATURES
1641 $TYPES_LIST
1642 atomics_native
1643 dos_paths
1644 dxva2_lib
1645 libc_msvcrt
1646 libdc1394_1
1647 libdc1394_2
1648 sdl
1649 section_data_rel_ro
1650 threads
1651 vaapi_drm
1652 vaapi_x11
1653 vdpau_x11
1654 xlib
1655 "
1656
1657 # options emitted with CONFIG_ prefix but not available on the command line
1658 CONFIG_EXTRA="
1659 aandcttables
1660 ac3dsp
1661 audio_frame_queue
1662 audiodsp
1663 blockdsp
1664 bswapdsp
1665 cabac
1666 dirac_parse
1667 dvprofile
1668 faandct
1669 faanidct
1670 fdctdsp
1671 flacdsp
1672 fmtconvert
1673 g722dsp
1674 gcrypt
1675 gmp
1676 golomb
1677 gplv3
1678 h263dsp
1679 h264chroma
1680 h264dsp
1681 h264pred
1682 h264qpel
1683 hpeldsp
1684 huffman
1685 huffyuvdsp
1686 huffyuvencdsp
1687 idctdsp
1688 iirfilter
1689 imdct15
1690 intrax8
1691 iso_media
1692 ividsp
1693 jpegtables
1694 libx262
1695 lgplv3
1696 lpc
1697 lzf
1698 me_cmp
1699 mpeg_er
1700 mpegaudio
1701 mpegaudiodsp
1702 mpegvideo
1703 mpegvideoenc
1704 mss34dsp
1705 pixblockdsp
1706 qpeldsp
1707 qsv
1708 qsvdec
1709 qsvenc
1710 rangecoder
1711 riffdec
1712 riffenc
1713 rtpdec
1714 rtpenc_chain
1715 rv34dsp
1716 sinewin
1717 snappy
1718 srtp
1719 startcode
1720 texturedsp
1721 texturedspenc
1722 tpeldsp
1723 vaapi_encode
1724 vc1dsp
1725 videodsp
1726 vp3dsp
1727 vp56dsp
1728 vp8dsp
1729 wma_freqs
1730 wmv2dsp
1731 "
1732
1733 CMDLINE_SELECT="
1734 $ARCH_EXT_LIST
1735 $CONFIG_LIST
1736 $HAVE_LIST_CMDLINE
1737 $THREADS_LIST
1738 asm
1739 cross_compile
1740 debug
1741 extra_warnings
1742 logging
1743 lto
1744 optimizations
1745 rpath
1746 "
1747
1748 PATHS_LIST="
1749 bindir
1750 datadir
1751 docdir
1752 incdir
1753 libdir
1754 mandir
1755 prefix
1756 shlibdir
1757 "
1758
1759 CMDLINE_SET="
1760 $PATHS_LIST
1761 ar
1762 arch
1763 as
1764 build_suffix
1765 cc
1766 objcc
1767 cpu
1768 cross_prefix
1769 custom_allocator
1770 dep_cc
1771 env
1772 extra_version
1773 host_cc
1774 host_cflags
1775 host_ld
1776 host_ldflags
1777 host_libs
1778 host_os
1779 ld
1780 logfile
1781 malloc_prefix
1782 nm
1783 optflags
1784 pkg_config
1785 pkg_config_flags
1786 random_seed
1787 samples
1788 sysinclude
1789 sysroot
1790 target_exec
1791 target_os
1792 target_path
1793 target_samples
1794 toolchain
1795 "
1796
1797 CMDLINE_APPEND="
1798 extra_cflags
1799 extra_objcflags
1800 host_cppflags
1801 "
1802
1803 # code dependency declarations
1804
1805 # architecture extensions
1806
1807 armv5te_deps="arm"
1808 armv6_deps="arm"
1809 armv6t2_deps="arm"
1810 armv8_deps="aarch64"
1811 neon_deps_any="aarch64 arm"
1812 intrinsics_neon_deps="neon"
1813 vfp_deps_any="aarch64 arm"
1814 vfpv3_deps="vfp"
1815
1816 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
1817
1818 altivec_deps="ppc"
1819 ppc4xx_deps="ppc"
1820 vsx_deps="altivec"
1821 power8_deps="vsx"
1822
1823 cpunop_deps="i686"
1824 x86_64_select="i686"
1825 x86_64_suggest="fast_cmov"
1826
1827 amd3dnow_deps="mmx"
1828 amd3dnowext_deps="amd3dnow"
1829 i686_deps="x86"
1830 mmx_deps="x86"
1831 mmxext_deps="mmx"
1832 sse_deps="mmxext"
1833 sse2_deps="sse"
1834 sse3_deps="sse2"
1835 ssse3_deps="sse3"
1836 sse4_deps="ssse3"
1837 sse42_deps="sse4"
1838 avx_deps="sse42"
1839 xop_deps="avx"
1840 fma3_deps="avx"
1841 fma4_deps="avx"
1842 avx2_deps="avx"
1843
1844 mmx_external_deps="yasm"
1845 mmx_inline_deps="inline_asm"
1846 mmx_suggest="mmx_external mmx_inline"
1847
1848 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
1849 eval dep=\$${ext}_deps
1850 eval ${ext}_external_deps='"${dep}_external"'
1851 eval ${ext}_inline_deps='"${dep}_inline"'
1852 eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
1853 done
1854
1855 aligned_stack_if_any="aarch64 ppc x86"
1856 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1857 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
1858 fast_unaligned_if_any="aarch64 ppc x86"
1859 simd_align_16_if_any="altivec neon sse"
1860
1861 # system capabilities
1862 symver_if_any="symver_asm_label symver_gnu_asm"
1863 valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
1864
1865 # threading support
1866 atomics_gcc_if="sync_val_compare_and_swap"
1867 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
1868 atomics_win32_if="MemoryBarrier"
1869 atomics_native_if_any="$ATOMICS_LIST"
1870 w32threads_deps="atomics_native"
1871 threads_if_any="$THREADS_LIST"
1872
1873 # subsystems
1874 dct_select="rdft"
1875 dirac_parse_select="golomb"
1876 error_resilience_select="me_cmp"
1877 faandct_deps="faan fdctdsp"
1878 faanidct_deps="faan idctdsp"
1879 h264dsp_select="startcode"
1880 intrax8_select="blockdsp idctdsp"
1881 mdct_select="fft"
1882 rdft_select="fft"
1883 me_cmp_select="fdctdsp idctdsp pixblockdsp"
1884 mpeg_er_select="error_resilience"
1885 mpegaudio_select="mpegaudiodsp"
1886 mpegaudiodsp_select="dct"
1887 mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp mpeg_er videodsp"
1888 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
1889 vc1dsp_select="h264chroma qpeldsp startcode"
1890
1891 # decoders / encoders
1892 aac_decoder_select="imdct15 mdct sinewin"
1893 aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
1894 aac_latm_decoder_select="aac_decoder aac_latm_parser"
1895 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
1896 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
1897 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
1898 adpcm_g722_decoder_select="g722dsp"
1899 adpcm_g722_encoder_select="g722dsp"
1900 aic_decoder_select="golomb idctdsp"
1901 alac_encoder_select="lpc"
1902 als_decoder_select="bswapdsp"
1903 amrnb_decoder_select="lsp"
1904 amrwb_decoder_select="lsp"
1905 amv_decoder_select="sp5x_decoder"
1906 ape_decoder_select="bswapdsp"
1907 asv1_decoder_select="blockdsp bswapdsp idctdsp"
1908 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
1909 asv2_decoder_select="blockdsp bswapdsp idctdsp"
1910 asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
1911 atrac1_decoder_select="mdct sinewin"
1912 atrac3_decoder_select="mdct"
1913 atrac3p_decoder_select="mdct sinewin"
1914 bink_decoder_select="blockdsp hpeldsp"
1915 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
1916 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
1917 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
1918 cllc_decoder_select="bswapdsp"
1919 comfortnoise_encoder_select="lpc"
1920 cook_decoder_select="audiodsp mdct sinewin"
1921 cscd_decoder_select="lzo"
1922 cscd_decoder_suggest="zlib"
1923 dca_decoder_select="fmtconvert mdct"
1924 dds_decoder_select="texturedsp"
1925 dnxhd_decoder_select="blockdsp idctdsp"
1926 dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
1927 dvvideo_decoder_select="dvprofile idctdsp"
1928 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
1929 dxa_decoder_deps="zlib"
1930 dxv_decoder_select="lzf texturedsp"
1931 eac3_decoder_select="ac3_decoder"
1932 eac3_encoder_select="ac3_encoder"
1933 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
1934 eatgq_decoder_select="aandcttables idctdsp"
1935 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
1936 exr_decoder_deps="zlib"
1937 ffv1_decoder_select="golomb rangecoder"
1938 ffv1_encoder_select="rangecoder"
1939 ffvhuff_decoder_select="huffyuv_decoder"
1940 ffvhuff_encoder_select="huffyuv_encoder"
1941 fic_decoder_select="golomb"
1942 flac_decoder_select="flacdsp golomb"
1943 flac_encoder_select="bswapdsp flacdsp golomb lpc"
1944 flashsv_decoder_deps="zlib"
1945 flashsv_encoder_deps="zlib"
1946 flashsv2_decoder_deps="zlib"
1947 flv_decoder_select="h263_decoder"
1948 flv_encoder_select="h263_encoder"
1949 fourxm_decoder_select="blockdsp bswapdsp"
1950 fraps_decoder_select="bswapdsp huffman"
1951 g2m_decoder_deps="zlib"
1952 g2m_decoder_select="blockdsp idctdsp jpegtables"
1953 h261_decoder_select="mpeg_er mpegvideo"
1954 h261_encoder_select="aandcttables mpegvideoenc"
1955 h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
1956 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
1957 h263i_decoder_select="h263_decoder"
1958 h263p_encoder_select="h263_encoder"
1959 h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp"
1960 h264_decoder_suggest="error_resilience"
1961 hap_decoder_select="snappy texturedsp"
1962 hap_encoder_deps="libsnappy"
1963 hap_encoder_select="texturedspenc"
1964 hevc_decoder_select="bswapdsp cabac golomb videodsp"
1965 huffyuv_decoder_select="bswapdsp huffyuvdsp"
1966 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
1967 iac_decoder_select="imc_decoder"
1968 imc_decoder_select="bswapdsp fft mdct sinewin"
1969 indeo3_decoder_select="hpeldsp"
1970 indeo4_decoder_select="ividsp"
1971 indeo5_decoder_select="ividsp"
1972 interplay_video_decoder_select="hpeldsp"
1973 jpegls_decoder_select="golomb mjpeg_decoder"
1974 jpegls_encoder_select="golomb"
1975 jv_decoder_select="blockdsp"
1976 lagarith_decoder_select="huffyuvdsp"
1977 ljpeg_encoder_select="aandcttables idctdsp jpegtables"
1978 loco_decoder_select="golomb"
1979 mdec_decoder_select="blockdsp idctdsp mpegvideo"
1980 metasound_decoder_select="lsp mdct sinewin"
1981 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
1982 mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
1983 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
1984 mjpegb_decoder_select="mjpeg_decoder"
1985 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
1986 mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
1987 mlp_decoder_select="mlp_parser"
1988 motionpixels_decoder_select="bswapdsp"
1989 mp1_decoder_select="mpegaudio"
1990 mp1float_decoder_select="mpegaudio"
1991 mp2_decoder_select="mpegaudio"
1992 mp2float_decoder_select="mpegaudio"
1993 mp3_decoder_select="mpegaudio"
1994 mp3adu_decoder_select="mpegaudio"
1995 mp3adufloat_decoder_select="mpegaudio"
1996 mp3float_decoder_select="mpegaudio"
1997 mp3on4_decoder_select="mpegaudio"
1998 mp3on4float_decoder_select="mpegaudio"
1999 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2000 mpc8_decoder_select="mpegaudiodsp"
2001 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
2002 mpeg_xvmc_decoder_select="mpeg2video_decoder"
2003 mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
2004 mpeg1video_encoder_select="aandcttables mpegvideoenc"
2005 mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
2006 mpeg2video_encoder_select="aandcttables mpegvideoenc"
2007 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2008 mpeg4_encoder_select="h263_encoder"
2009 msa1_decoder_select="mss34dsp"
2010 msmpeg4v1_decoder_select="h263_decoder"
2011 msmpeg4v2_decoder_select="h263_decoder"
2012 msmpeg4v2_encoder_select="h263_encoder"
2013 msmpeg4v3_decoder_select="h263_decoder"
2014 msmpeg4v3_encoder_select="h263_encoder"
2015 mss2_decoder_select="error_resilience mpeg_er mpegvideo vc1_decoder"
2016 mts2_decoder_select="mss34dsp"
2017 mxpeg_decoder_select="mjpeg_decoder"
2018 nellymoser_decoder_select="mdct sinewin"
2019 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2020 nuv_decoder_select="idctdsp lzo"
2021 on2avc_decoder_select="mdct"
2022 opus_decoder_deps="avresample"
2023 opus_decoder_select="imdct15"
2024 png_decoder_deps="zlib"
2025 png_encoder_deps="zlib"
2026 png_encoder_select="huffyuvencdsp"
2027 prores_decoder_select="idctdsp"
2028 prores_encoder_select="fdctdsp"
2029 qcelp_decoder_select="lsp"
2030 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2031 ra_144_encoder_select="audio_frame_queue lpc"
2032 ralf_decoder_select="golomb"
2033 rscc_decoder_deps="zlib"
2034 rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
2035 rv10_encoder_select="h263_encoder"
2036 rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
2037 rv20_encoder_select="h263_encoder"
2038 rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
2039 rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
2040 screenpresso_decoder_deps="zlib"
2041 shorten_decoder_select="golomb"
2042 sipr_decoder_select="lsp"
2043 sp5x_decoder_select="mjpeg_decoder"
2044 svq1_decoder_select="hpeldsp"
2045 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
2046 svq3_decoder_select="golomb h264dsp h264pred hpeldsp tpeldsp videodsp"
2047 svq3_decoder_suggest="zlib"
2048 tak_decoder_select="audiodsp"
2049 tdsc_decoder_deps="zlib"
2050 tdsc_decoder_select="mjpeg_decoder"
2051 theora_decoder_select="vp3_decoder"
2052 thp_decoder_select="mjpeg_decoder"
2053 tiff_decoder_suggest="zlib"
2054 tiff_encoder_suggest="zlib"
2055 truehd_decoder_select="mlp_decoder"
2056 truemotion2_decoder_select="bswapdsp"
2057 truespeech_decoder_select="bswapdsp"
2058 tscc_decoder_deps="zlib"
2059 txd_decoder_select="texturedsp"
2060 twinvq_decoder_select="mdct lsp sinewin"
2061 utvideo_decoder_select="bswapdsp"
2062 utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
2063 vble_decoder_select="huffyuvdsp"
2064 vc1_decoder_select="blockdsp error_resilience h263_decoder h264qpel intrax8 mpeg_er mpegvideo vc1dsp"
2065 vc1image_decoder_select="vc1_decoder"
2066 vorbis_decoder_select="mdct"
2067 vorbis_encoder_select="mdct"
2068 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2069 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2070 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2071 vp6a_decoder_select="vp6_decoder"
2072 vp6f_decoder_select="vp6_decoder"
2073 vp7_decoder_select="h264pred videodsp vp8dsp"
2074 vp8_decoder_select="h264pred videodsp vp8dsp"
2075 vp9_decoder_select="videodsp"
2076 webp_decoder_select="vp8_decoder"
2077 wmapro_decoder_select="mdct sinewin wma_freqs"
2078 wmav1_decoder_select="mdct sinewin wma_freqs"
2079 wmav1_encoder_select="mdct sinewin wma_freqs"
2080 wmav2_decoder_select="mdct sinewin wma_freqs"
2081 wmav2_encoder_select="mdct sinewin wma_freqs"
2082 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2083 wmv1_decoder_select="h263_decoder"
2084 wmv1_encoder_select="h263_encoder"
2085 wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2086 wmv2_encoder_select="h263_encoder wmv2dsp"
2087 wmv3_decoder_select="vc1_decoder"
2088 wmv3image_decoder_select="wmv3_decoder"
2089 zerocodec_decoder_deps="zlib"
2090 zlib_decoder_deps="zlib"
2091 zlib_encoder_deps="zlib"
2092 zmbv_decoder_deps="zlib"
2093 zmbv_encoder_deps="zlib"
2094
2095 # hardware accelerators
2096 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
2097 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
2098 vaapi_deps="va_va_h"
2099 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
2100 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
2101 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2102
2103 h263_vaapi_hwaccel_deps="vaapi"
2104 h263_vaapi_hwaccel_select="h263_decoder"
2105 h264_d3d11va_hwaccel_deps="d3d11va"
2106 h264_d3d11va_hwaccel_select="h264_decoder"
2107 h264_dxva2_hwaccel_deps="dxva2"
2108 h264_dxva2_hwaccel_select="h264_decoder"
2109 h264_mmal_decoder_deps="mmal"
2110 h264_mmal_hwaccel_deps="mmal"
2111 h264_mmal_decoder_select="h264_decoder"
2112 h264_mmal_encoder_deps="mmal"
2113 h264_omx_encoder_deps="omx"
2114 h264_qsv_hwaccel_deps="libmfx"
2115 h264_vaapi_hwaccel_deps="vaapi"
2116 h264_vaapi_hwaccel_select="h264_decoder"
2117 h264_vda_hwaccel_deps="vda"
2118 h264_vda_hwaccel_select="h264_decoder"
2119 h264_vda_old_hwaccel_deps="vda"
2120 h264_vda_old_hwaccel_select="h264_decoder"
2121 h264_vdpau_hwaccel_deps="vdpau"
2122 h264_vdpau_hwaccel_select="h264_decoder"
2123 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2124 hevc_d3d11va_hwaccel_select="hevc_decoder"
2125 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2126 hevc_dxva2_hwaccel_select="hevc_decoder"
2127 hevc_qsv_hwaccel_deps="libmfx"
2128 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2129 hevc_vdpau_hwaccel_select="hevc_decoder"
2130 mpeg1_vdpau_hwaccel_deps="vdpau"
2131 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2132 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2133 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2134 mpeg2_dxva2_hwaccel_deps="dxva2"
2135 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2136 mpeg2_mmal_decoder_deps="mmal"
2137 mpeg2_mmal_hwaccel_deps="mmal"
2138 mpeg2_mmal_decoder_select="mpeg2video_decoder"
2139 mpeg2_qsv_hwaccel_deps="libmfx"
2140 mpeg2_vaapi_hwaccel_deps="vaapi"
2141 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2142 mpeg2_vdpau_hwaccel_deps="vdpau"
2143 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2144 mpeg4_omx_encoder_deps="omx"
2145 mpeg4_vaapi_hwaccel_deps="vaapi"
2146 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2147 mpeg4_vdpau_hwaccel_deps="vdpau"
2148 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2149 vc1_d3d11va_hwaccel_deps="d3d11va"
2150 vc1_d3d11va_hwaccel_select="vc1_decoder"
2151 vc1_dxva2_hwaccel_deps="dxva2"
2152 vc1_dxva2_hwaccel_select="vc1_decoder"
2153 vc1_vaapi_hwaccel_deps="vaapi"
2154 vc1_vaapi_hwaccel_select="vc1_decoder"
2155 vc1_vdpau_hwaccel_deps="vdpau"
2156 vc1_vdpau_hwaccel_select="vc1_decoder"
2157 vc1_mmal_decoder_deps="mmal"
2158 vc1_mmal_hwaccel_deps="mmal"
2159 vc1_mmal_decoder_select="vc1_decoder"
2160 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2161 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2162 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2163 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2164
2165 # hardware-accelerated codecs
2166 nvenc_deps_any="dlopen LoadLibrary"
2167 nvenc_extralibs='$ldl'
2168 omx_deps="dlopen pthreads"
2169 omx_extralibs='$ldl'
2170 qsvdec_select="qsv"
2171 qsvenc_select="qsv"
2172 vaapi_encode_deps="vaapi"
2173
2174 hwupload_cuda_filter_deps="cuda"
2175 scale_npp_filter_deps="cuda libnpp"
2176
2177 h264_nvenc_encoder_deps="nvenc"
2178 h264_qsv_decoder_deps="libmfx"
2179 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2180 h264_qsv_encoder_deps="libmfx"
2181 h264_qsv_encoder_select="qsvenc"
2182 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2183 h264_vaapi_encoder_select="vaapi_encode golomb"
2184
2185 hevc_nvenc_encoder_deps="nvenc"
2186 hevc_qsv_decoder_deps="libmfx"
2187 hevc_qsv_encoder_deps="libmfx"
2188 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec"
2189 hevc_qsv_encoder_select="qsvenc"
2190 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2191 hevc_vaapi_encoder_select="vaapi_encode golomb"
2192 mpeg2_qsv_decoder_deps="libmfx"
2193 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser"
2194 mpeg2_qsv_encoder_deps="libmfx"
2195 mpeg2_qsv_encoder_select="qsvenc"
2196
2197 nvenc_h264_encoder_deps="nvenc"
2198 nvenc_hevc_encoder_deps="nvenc"
2199
2200 # parsers
2201 h264_parser_select="golomb h264dsp"
2202 hevc_parser_select="golomb"
2203 mpegvideo_parser_select="mpegvideo"
2204 mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
2205 vc1_parser_select="vc1dsp"
2206
2207 # bitstream_filters
2208 mjpeg2jpeg_bsf_select="jpegtables"
2209
2210 # external libraries
2211 libdcadec_decoder_deps="libdcadec"
2212 libfaac_encoder_deps="libfaac"
2213 libfaac_encoder_select="audio_frame_queue"
2214 libfdk_aac_decoder_deps="libfdk_aac"
2215 libfdk_aac_encoder_deps="libfdk_aac"
2216 libfdk_aac_encoder_select="audio_frame_queue"
2217 libgsm_decoder_deps="libgsm"
2218 libgsm_encoder_deps="libgsm"
2219 libgsm_ms_decoder_deps="libgsm"
2220 libgsm_ms_encoder_deps="libgsm"
2221 libilbc_decoder_deps="libilbc"
2222 libilbc_encoder_deps="libilbc"
2223 libkvazaar_encoder_deps="libkvazaar"
2224 libmp3lame_encoder_deps="libmp3lame"
2225 libmp3lame_encoder_select="audio_frame_queue"
2226 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2227 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2228 libopencore_amrnb_encoder_select="audio_frame_queue"
2229 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2230 libopenh264_encoder_deps="libopenh264"
2231 libopenjpeg_decoder_deps="libopenjpeg"
2232 libopenjpeg_encoder_deps="libopenjpeg"
2233 libopus_decoder_deps="libopus"
2234 libopus_encoder_deps="libopus"
2235 libopus_encoder_select="audio_frame_queue"
2236 libschroedinger_decoder_deps="libschroedinger"
2237 libschroedinger_encoder_deps="libschroedinger"
2238 libspeex_decoder_deps="libspeex"
2239 libspeex_encoder_deps="libspeex"
2240 libspeex_encoder_select="audio_frame_queue"
2241 libtheora_encoder_deps="libtheora"
2242 libtwolame_encoder_deps="libtwolame"
2243 libvo_aacenc_encoder_deps="libvo_aacenc"
2244 libvo_aacenc_encoder_select="audio_frame_queue"
2245 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2246 libvorbis_encoder_deps="libvorbis"
2247 libvorbis_encoder_select="audio_frame_queue"
2248 libvpx_vp8_decoder_deps="libvpx"
2249 libvpx_vp8_encoder_deps="libvpx"
2250 libvpx_vp9_decoder_deps="libvpx"
2251 libvpx_vp9_encoder_deps="libvpx"
2252 libwavpack_encoder_deps="libwavpack"
2253 libwebp_encoder_deps="libwebp"
2254 libx262_encoder_deps="libx262"
2255 libx264_encoder_deps="libx264"
2256 libx265_encoder_deps="libx265"
2257 libxavs_encoder_deps="libxavs"
2258 libxvid_encoder_deps="libxvid"
2259
2260 # demuxers / muxers
2261 ac3_demuxer_select="ac3_parser"
2262 asf_demuxer_select="riffdec"
2263 asf_muxer_select="riffenc"
2264 asf_stream_muxer_select="asf_muxer"
2265 avi_demuxer_select="iso_media riffdec"
2266 avi_muxer_select="riffenc"
2267 avisynth_demuxer_deps="avisynth"
2268 avisynth_demuxer_select="riffdec"
2269 caf_demuxer_select="iso_media riffdec"
2270 dash_muxer_select="mp4_muxer"
2271 dirac_demuxer_select="dirac_parser"
2272 dv_demuxer_select="dvprofile"
2273 dv_muxer_select="dvprofile"
2274 dxa_demuxer_select="riffdec"
2275 eac3_demuxer_select="ac3_parser"
2276 f4v_muxer_select="mov_muxer"
2277 flac_demuxer_select="flac_parser"
2278 hds_muxer_select="flv_muxer"
2279 hls_muxer_select="mpegts_muxer"
2280 ipod_muxer_select="mov_muxer"
2281 ismv_muxer_select="mov_muxer"
2282 matroska_audio_muxer_select="matroska_muxer"
2283 matroska_demuxer_select="iso_media riffdec"
2284 matroska_demuxer_suggest="bzlib lzo zlib"
2285 matroska_muxer_select="iso_media riffenc"
2286 mmf_muxer_select="riffenc"
2287 mov_demuxer_select="iso_media riffdec"
2288 mov_demuxer_suggest="zlib"
2289 mov_muxer_select="iso_media riffenc rtpenc_chain"
2290 mp3_demuxer_select="mpegaudio_parser"
2291 mp4_muxer_select="mov_muxer"
2292 mpegts_demuxer_select="iso_media"
2293 mpegts_muxer_select="adts_muxer latm_muxer"
2294 mpegtsraw_demuxer_select="mpegts_demuxer"
2295 mxf_d10_muxer_select="mxf_muxer"
2296 nut_muxer_select="riffenc"
2297 nuv_demuxer_select="riffdec"
2298 oga_muxer_select="ogg_muxer"
2299 ogg_demuxer_select="dirac_parse"
2300 opus_muxer_select="ogg_muxer"
2301 psp_muxer_select="mov_muxer"
2302 rtp_demuxer_select="sdp_demuxer"
2303 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
2304 rtsp_demuxer_select="http_protocol rtpdec"
2305 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2306 sap_demuxer_select="sdp_demuxer"
2307 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2308 sdp_demuxer_select="rtpdec"
2309 smoothstreaming_muxer_select="ismv_muxer"
2310 spdif_muxer_select="aac_parser"
2311 spx_muxer_select="ogg_muxer"
2312 swf_demuxer_suggest="zlib"
2313 tak_demuxer_select="tak_parser"
2314 tg2_muxer_select="mov_muxer"
2315 tgp_muxer_select="mov_muxer"
2316 w64_demuxer_select="wav_demuxer"
2317 wav_demuxer_select="riffdec"
2318 wav_muxer_select="riffenc"
2319 webm_muxer_select="iso_media riffenc"
2320 webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder libvpx_vp9_encoder"
2321 wtv_demuxer_select="mpegts_demuxer riffdec"
2322 xmv_demuxer_select="riffdec"
2323 xwma_demuxer_select="riffdec"
2324
2325 # indevs / outdevs
2326 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
2327 alsa_outdev_deps="alsa_asoundlib_h"
2328 avfoundation_indev_deps="AVFoundation_AVFoundation_h"
2329 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2330 dv1394_indev_deps="dv1394"
2331 dv1394_indev_select="dv_demuxer"
2332 fbdev_indev_deps="linux_fb_h"
2333 jack_indev_deps="jack_jack_h"
2334 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
2335 libcdio_indev_deps="libcdio"
2336 libdc1394_indev_deps="libdc1394"
2337 oss_indev_deps_any="soundcard_h sys_soundcard_h"
2338 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
2339 pulse_indev_deps="libpulse"
2340 sndio_indev_deps="sndio_h"
2341 sndio_outdev_deps="sndio_h"
2342 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2343 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
2344 vfwcap_indev_extralibs="-lavicap32"
2345 x11grab_indev_deps="x11grab"
2346 x11grab_xcb_indev_deps="libxcb"
2347
2348 # protocols
2349 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2350 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
2351 ffrtmpcrypt_protocol_select="tcp_protocol"
2352 ffrtmphttp_protocol_deps="!librtmp_protocol"
2353 ffrtmphttp_protocol_select="http_protocol"
2354 gopher_protocol_select="network"
2355 http_protocol_select="tcp_protocol"
2356 httpproxy_protocol_select="tcp_protocol"
2357 https_protocol_select="tls_protocol"
2358 icecast_protocol_select="http_protocol"
2359 librtmp_protocol_deps="librtmp"
2360 librtmpe_protocol_deps="librtmp"
2361 librtmps_protocol_deps="librtmp"
2362 librtmpt_protocol_deps="librtmp"
2363 librtmpte_protocol_deps="librtmp"
2364 mmsh_protocol_select="http_protocol"
2365 mmst_protocol_select="network"
2366 rtmp_protocol_deps="!librtmp_protocol"
2367 rtmp_protocol_select="tcp_protocol"
2368 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2369 rtmps_protocol_deps="!librtmp_protocol"
2370 rtmps_protocol_select="tls_protocol"
2371 rtmpt_protocol_select="ffrtmphttp_protocol"
2372 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2373 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2374 rtp_protocol_select="udp_protocol"
2375 sctp_protocol_deps="struct_sctp_event_subscribe"
2376 sctp_protocol_select="network"
2377 srtp_protocol_select="rtp_protocol srtp"
2378 tcp_protocol_select="network"
2379 tls_gnutls_protocol_deps="gnutls"
2380 tls_gnutls_protocol_select="tcp_protocol"
2381 tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
2382 tls_openssl_protocol_select="tcp_protocol"
2383 tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"
2384 udp_protocol_select="network"
2385 unix_protocol_deps="sys_un_h"
2386 unix_protocol_select="network"
2387
2388 # filters
2389 blackframe_filter_deps="gpl"
2390 boxblur_filter_deps="gpl"
2391 bs2b_filter_deps="libbs2b"
2392 cropdetect_filter_deps="gpl"
2393 delogo_filter_deps="gpl"
2394 drawtext_filter_deps="libfreetype"
2395 frei0r_filter_deps="frei0r dlopen"
2396 frei0r_filter_extralibs='$ldl'
2397 frei0r_src_filter_deps="frei0r dlopen"
2398 frei0r_src_filter_extralibs='$ldl'
2399 hqdn3d_filter_deps="gpl"
2400 interlace_filter_deps="gpl"
2401 ocv_filter_deps="libopencv"
2402 resample_filter_deps="avresample"
2403 scale_filter_deps="swscale"
2404 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
2405
2406 # examples
2407 avcodec_example_deps="avcodec avutil"
2408 filter_audio_example_deps="avfilter avutil"
2409 metadata_example_deps="avformat avutil"
2410 output_example_deps="avcodec avformat avutil swscale"
2411 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
2412 transcode_aac_example_deps="avcodec avformat avresample"
2413
2414 # libraries, in linking order
2415 avcodec_deps="avutil"
2416 avdevice_deps="avformat avcodec avutil"
2417 avfilter_deps="avutil"
2418 avformat_deps="avcodec avutil"
2419 avresample_deps="avutil"
2420 swscale_deps="avutil"
2421
2422 # programs
2423 avconv_deps="avcodec avfilter avformat avresample swscale"
2424 avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
2425 fps_filter null_filter resample_filter scale_filter
2426 setpts_filter trim_filter"
2427 avplay_deps="avcodec avfilter avformat avresample sdl"
2428 avplay_libs='$sdl_libs'
2429 avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
2430 avprobe_deps="avcodec avformat"
2431
2432 # documentation
2433 pod2man_deps="doc"
2434 texi2html_deps="doc"
2435
2436 # default parameters
2437
2438 logfile="config.log"
2439
2440 # installation paths
2441 prefix_default="/usr/local"
2442 bindir_default='${prefix}/bin'
2443 datadir_default='${prefix}/share/avconv'
2444 docdir_default='${prefix}/share/doc/libav'
2445 incdir_default='${prefix}/include'
2446 libdir_default='${prefix}/lib'
2447 mandir_default='${prefix}/share/man'
2448 shlibdir_default="$libdir_default"
2449
2450 # toolchain
2451 ar_default="ar"
2452 cc_default="gcc"
2453 host_cc_default="gcc"
2454 cp_f="cp -f"
2455 ln_s="ln -s -f"
2456 nm_default="nm -g"
2457 objformat="elf"
2458 pkg_config_default=pkg-config
2459 ranlib="ranlib"
2460 strip="strip"
2461 yasmexe="yasm"
2462
2463 # machine
2464 arch_default=$(uname -m)
2465 cpu="generic"
2466 intrinsics="none"
2467
2468 # OS
2469 target_os_default=$(tolower $(uname -s))
2470 host_os=$target_os_default
2471
2472 # configurable options
2473 enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
2474
2475 enable asm
2476 enable debug
2477 enable doc
2478 enable faan faandct faanidct
2479 enable optimizations
2480 enable safe_bitstream_reader
2481 enable static
2482 enable swscale_alpha
2483 enable valgrind_backtrace
2484
2485 # By default, enable only those hwaccels that have no external dependencies.
2486 enable d3d11va dxva2 vda vdpau
2487
2488 # build settings
2489 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2490 LIBPREF="lib"
2491 LIBSUF=".a"
2492 FULLNAME='$(NAME)$(BUILDSUF)'
2493 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
2494 SLIBPREF="lib"
2495 SLIBSUF=".so"
2496 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
2497 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2498 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2499 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2500 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2501 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2502
2503 asflags_filter=echo
2504 cflags_filter=echo
2505 ldflags_filter=echo
2506
2507 AS_C='-c'
2508 AS_O='-o $@'
2509 CC_C='-c'
2510 CC_E='-E -o $@'
2511 CC_O='-o $@'
2512 OBJCC_C='-c'
2513 OBJCC_E='-E -o $@'
2514 OBJCC_O='-o $@'
2515 LD_O='-o $@'
2516 LD_LIB='-l%'
2517 LD_PATH='-L'
2518 HOSTCC_C='-c'
2519 HOSTCC_E='-E -o $@'
2520 HOSTCC_O='-o $@'
2521 HOSTLD_O='-o $@'
2522
2523 host_libs='-lm'
2524 host_cflags_filter=echo
2525 host_ldflags_filter=echo
2526
2527 target_path='$(CURDIR)'
2528
2529 # since the object filename is not given with the -MM flag, the compiler
2530 # is only able to print the basename, and we must add the path ourselves
2531 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2532 DEPFLAGS='-MM'
2533
2534 # find source path
2535 if test -f configure; then
2536 source_path=.
2537 else
2538 source_path=$(cd $(dirname "$0"); pwd)
2539 echo "$source_path" | grep -q '[[:blank:]]' &&
2540 die "Out of tree builds are impossible with whitespace in source path."
2541 test -e "$source_path/config.h" &&
2542 die "Out of tree builds are impossible with config.h in source dir."
2543 fi
2544
2545 for v in "$@"; do
2546 r=${v#*=}
2547 l=${v%"$r"}
2548 r=$(sh_quote "$r")
2549 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
2550 done
2551
2552 find_things(){
2553 thing=$1
2554 pattern=$2
2555 file=$source_path/$3
2556 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
2557 }
2558
2559 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2560 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
2561 HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
2562 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
2563 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2564 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
2565 OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
2566 INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
2567 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
2568
2569 find_things_extern(){
2570 thing=$1
2571 pattern=$2
2572 file=$source_path/$3
2573 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
2574 }
2575
2576 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
2577 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
2578
2579 ALL_COMPONENTS="
2580 $BSF_LIST
2581 $DECODER_LIST
2582 $DEMUXER_LIST
2583 $ENCODER_LIST
2584 $FILTER_LIST
2585 $HWACCEL_LIST
2586 $INDEV_LIST
2587 $MUXER_LIST
2588 $OUTDEV_LIST
2589 $PARSER_LIST
2590 $PROTOCOL_LIST
2591 "
2592
2593 for n in $COMPONENT_LIST; do
2594 v=$(toupper ${n%s})_LIST
2595 eval enable \$$v
2596 eval ${n}_if_any="\$$v"
2597 done
2598
2599 enable $ARCH_EXT_LIST
2600
2601 die_unknown(){
2602 echo "Unknown option \"$1\"."
2603 echo "See $0 --help for available options."
2604 exit 1
2605 }
2606
2607 print_3_columns() {
2608 printf "%-25s %-25s %-25s\n" $(cat | tr ' ' '\n' | sort)
2609 }
2610
2611 show_list() {
2612 suffix=_$1
2613 shift
2614 echo $* | sed s/$suffix//g | print_3_columns
2615 exit 0
2616 }
2617
2618 rand_list(){
2619 IFS=', '
2620 set -- $*
2621 unset IFS
2622 for thing; do
2623 comp=${thing%:*}
2624 prob=${thing#$comp}
2625 prob=${prob#:}
2626 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
2627 echo "prob ${prob:-0.5}"
2628 printf '%s\n' $comp
2629 done
2630 }
2631
2632 do_random(){
2633 action=$1
2634 shift
2635 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
2636 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
2637 }
2638
2639 for opt do
2640 optval="${opt#*=}"
2641 case "$opt" in
2642 --extra-ldflags=*)
2643 add_ldflags $optval
2644 ;;
2645 --extra-ldexeflags=*)
2646 add_ldexeflags $optval
2647 ;;
2648 --extra-libs=*)
2649 add_extralibs $optval
2650 ;;
2651 --disable-devices)
2652 disable $INDEV_LIST $OUTDEV_LIST
2653 ;;
2654 --enable-debug=*)
2655 debuglevel="$optval"
2656 ;;
2657 --disable-programs)
2658 disable $PROGRAM_LIST
2659 ;;
2660 --disable-everything)
2661 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2662 ;;
2663 --disable-all)
2664 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2665 disable $LIBRARY_LIST $PROGRAM_LIST doc
2666 ;;
2667 --enable-random|--disable-random)
2668 action=${opt%%-random}
2669 do_random ${action#--} $COMPONENT_LIST
2670 ;;
2671 --enable-random=*|--disable-random=*)
2672 action=${opt%%-random=*}
2673 do_random ${action#--} $optval
2674 ;;
2675 --enable-*=*|--disable-*=*)
2676 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2677 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2678 eval list=\$$(toupper $thing)_LIST
2679 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2680 $action $(filter "$name" $list)
2681 ;;
2682 --enable-avserver|--disable-avserver*)
2683 warn "avserver has been removed, the ${opt} option is only"\
2684 "provided for compatibility and will be removed in the future"
2685 ;;
2686 --enable-?*|--disable-?*)
2687 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2688 if is_in $option $COMPONENT_LIST; then
2689 test $action = disable && action=unset
2690 eval $action \$$(toupper ${option%s})_LIST
2691 elif is_in $option $CMDLINE_SELECT; then
2692 $action $option
2693 else
2694 die_unknown $opt
2695 fi
2696 ;;
2697 --list-*)
2698 NAME="${opt#--list-}"
2699 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2700 NAME=${NAME%s}
2701 eval show_list $NAME \$$(toupper $NAME)_LIST
2702 ;;
2703 --help|-h) show_help
2704 ;;
2705 *)
2706 optname="${opt%%=*}"
2707 optname="${optname#--}"
2708 optname=$(echo "$optname" | sed 's/-/_/g')
2709 if is_in $optname $CMDLINE_SET; then
2710 eval $optname='$optval'
2711 elif is_in $optname $CMDLINE_APPEND; then
2712 append $optname "$optval"
2713 else
2714 die_unknown $opt
2715 fi
2716 ;;
2717 esac
2718 done
2719
2720 for e in $env; do
2721 eval "export $e"
2722 done
2723
2724 disabled logging && logfile=/dev/null
2725
2726 # Disable all the library-specific components if the library itself
2727 # is disabled, see AVCODEC_LIST and following _LIST variables.
2728
2729 disable_components(){
2730 disabled ${1} && disable $(
2731 eval components="\$$(toupper ${1})_COMPONENTS"
2732 map 'eval echo \${$(toupper ${v%s})_LIST}' $components
2733 )
2734 }
2735
2736 map 'disable_components $v' $LIBRARY_LIST
2737
2738 echo "# $0 $LIBAV_CONFIGURATION" > $logfile
2739 set >> $logfile
2740
2741 case "$toolchain" in
2742 *-asan)
2743 cc_default="${toolchain%-asan}"
2744 add_cflags -fsanitize=address
2745 add_ldflags -fsanitize=address
2746 ;;
2747 *-msan)
2748 cc_default="${toolchain%-msan}"
2749 add_cflags -fsanitize=memory -fsanitize-memory-track-origins
2750 add_ldflags -fsanitize=memory
2751 ;;
2752 *-tsan)
2753 cc_default="${toolchain%-tsan}"
2754 add_cflags -fsanitize=thread -pie
2755 add_ldflags -fsanitize=thread -pie
2756 case "$toolchain" in
2757 gcc-tsan)
2758 add_cflags -fPIC
2759 add_ldflags -fPIC
2760 ;;
2761 esac
2762 ;;
2763 *-usan)
2764 cc_default="${toolchain%-usan}"
2765 add_cflags -fsanitize=undefined
2766 add_ldflags -fsanitize=undefined
2767 case "$toolchain" in
2768 clang-usan)
2769 add_cflags -O1
2770 ;;
2771 esac
2772 ;;
2773 valgrind-*)
2774 target_exec_default="valgrind"
2775 case "$toolchain" in
2776 valgrind-massif)
2777 target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
2778 ;;
2779 valgrind-memcheck)
2780 target_exec_args="--track-origins=yes --leak-check=full"
2781 ;;
2782 esac
2783 ;;
2784 msvc)
2785 # Check whether the current MSVC version needs the C99 converter.
2786 # From MSVC 2013 (compiler major version 18) onwards, it does actually
2787 # support enough of C99 to build libav. Default to the new
2788 # behaviour if the regexp was unable to match anything, since this
2789 # successfully parses the version number of existing supported
2790 # versions that require the converter (MSVC 2010 and 2012).
2791 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2792 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
2793 cc_default="cl"
2794 else
2795 cc_default="c99wrap cl"
2796 fi
2797 ld_default="$source_path/compat/windows/mslink"
2798 nm_default="dumpbin -symbols"
2799 ar_default="lib"
2800 case "$arch" in
2801 arm*)
2802 as_default="armasm"
2803 ;;
2804 esac
2805 target_os_default="win32"
2806 # Use a relative path for TMPDIR. This makes sure all the
2807 # ffconf temp files are written with a relative path, avoiding
2808 # issues with msys/win32 path conversion for MSVC parameters
2809 # such as -Fo<file> or -out:<file>.
2810 TMPDIR=.
2811 ;;
2812 icl)
2813 cc_default="icl"
2814 ld_default="xilink"
2815 nm_default="dumpbin -symbols"
2816 ar_default="xilib"
2817 target_os_default="win32"
2818 TMPDIR=.
2819 ;;
2820 gcov)
2821 add_cflags -fprofile-arcs -ftest-coverage
2822 add_ldflags -fprofile-arcs -ftest-coverage
2823 ;;
2824 llvm-cov)
2825 add_cflags -fprofile-arcs -ftest-coverage
2826 add_ldflags --coverage
2827 ;;
2828 hardened)
2829 add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
2830 add_cflags -fno-strict-overflow -fstack-protector-all
2831 add_ldflags -Wl,-z,relro -Wl,-z,now
2832 ;;
2833 ?*)
2834 die "Unknown toolchain $toolchain"
2835 ;;
2836 esac
2837
2838 test -n "$cross_prefix" && enable cross_compile
2839
2840 if enabled cross_compile; then
2841 test -n "$arch" && test -n "$target_os" ||
2842 die "Must specify target arch and OS when cross-compiling"
2843 fi
2844
2845 ar_default="${cross_prefix}${ar_default}"
2846 cc_default="${cross_prefix}${cc_default}"
2847 occ_default="${cross_prefix}${occ_default}"
2848 nm_default="${cross_prefix}${nm_default}"
2849 pkg_config_default="${cross_prefix}${pkg_config_default}"
2850 ranlib="${cross_prefix}${ranlib}"
2851 strip="${cross_prefix}${strip}"
2852
2853 sysinclude_default="${sysroot}/usr/include"
2854
2855 set_default arch cc pkg_config sysinclude target_exec target_os
2856 enabled cross_compile || host_cc_default=$cc
2857 set_default host_cc
2858
2859 if ! $pkg_config --version >/dev/null 2>&1; then
2860 warn "$pkg_config not found, library detection may fail."
2861 pkg_config=false
2862 fi
2863
2864 exesuf() {
2865 case $1 in
2866 mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
2867 esac
2868 }
2869
2870 EXESUF=$(exesuf $target_os)
2871 HOSTEXESUF=$(exesuf $host_os)
2872
2873 # set temporary file name
2874 : ${TMPDIR:=$TEMPDIR}
2875 : ${TMPDIR:=$TMP}
2876 : ${TMPDIR:=/tmp}
2877
2878 if ! check_cmd mktemp -u XXXXXX; then
2879 # simple replacement for missing mktemp
2880 # NOT SAFE FOR GENERAL USE
2881 mktemp(){
2882 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
2883 }
2884 fi
2885
2886 tmpfile(){
2887 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2888 (set -C; exec > $tmp) 2>/dev/null ||
2889 die "Unable to create temporary file in $TMPDIR."
2890 append TMPFILES $tmp
2891 eval $1=$tmp
2892 }
2893
2894 trap 'rm -f -- $TMPFILES' EXIT
2895
2896 tmpfile TMPASM .asm
2897 tmpfile TMPC .c
2898 tmpfile TMPE $EXESUF
2899 tmpfile TMPH .h
2900 tmpfile TMPO .o
2901 tmpfile TMPS .S
2902 tmpfile TMPSH .sh
2903 tmpfile TMPV .ver
2904
2905 unset -f mktemp
2906
2907 chmod +x $TMPE
2908
2909 # make sure we can execute files in $TMPDIR
2910 cat > $TMPSH 2>> $logfile <<EOF
2911 #! /bin/sh
2912 EOF
2913 chmod +x $TMPSH >> $logfile 2>&1
2914 if ! $TMPSH >> $logfile 2>&1; then
2915 cat <<EOF
2916 Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2917 variable to another directory and make sure that it is not mounted noexec.
2918 EOF
2919 die "Sanity test failed."
2920 fi
2921
2922 armasm_flags(){
2923 for flag; do
2924 case $flag in
2925 # Filter out MSVC cl.exe options from cflags that shouldn't
2926 # be passed to gas-preprocessor
2927 -M[TD]*) ;;
2928 *) echo $flag ;;
2929 esac
2930 done
2931 }
2932
2933 ccc_flags(){
2934 for flag; do
2935 case $flag in
2936 -std=c99) echo -c99 ;;
2937 -mcpu=*) echo -arch ${flag#*=} ;;
2938 -mieee) echo -ieee ;;
2939 -O*|-fast) echo $flag ;;
2940 -fno-math-errno) echo -assume nomath_errno ;;
2941 -g) echo -g3 ;;
2942 -Wall) echo -msg_enable level2 ;;
2943 -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
2944 -Wl,*) echo $flag ;;
2945 -f*|-W*) ;;
2946 *) echo $flag ;;
2947 esac
2948 done
2949 }
2950
2951 cparser_flags(){
2952 for flag; do
2953 case $flag in
2954 -Wno-switch) echo -Wno-switch-enum ;;
2955 -Wno-format-zero-length) ;;
2956 -Wdisabled-optimization) ;;
2957 -Wno-pointer-sign) echo -Wno-other ;;
2958 *) echo $flag ;;
2959 esac
2960 done
2961 }
2962
2963 msvc_common_flags(){
2964 for flag; do
2965 case $flag in
2966 # In addition to specifying certain flags under the compiler
2967 # specific filters, they must be specified here as well or else the
2968 # generic catch all at the bottom will print the original flag.
2969 -Wall) ;;
2970 -std=c99) ;;
2971 # Common flags
2972 -fomit-frame-pointer) ;;
2973 -g) echo -Z7 ;;
2974 -fno-math-errno) ;;
2975 -fno-common) ;;
2976 -fno-signed-zeros) ;;
2977 -fPIC) ;;
2978 -mthumb) ;;
2979 -march=*) ;;
2980 -lz) echo zlib.lib ;;
2981 -lavifil32) echo vfw32.lib ;;
2982 -lavicap32) echo vfw32.lib user32.lib ;;
2983 -lx264) echo libx264.lib ;;
2984 -l*) echo ${flag#-l}.lib ;;
2985 -L*) echo -libpath:${flag#-L} ;;
2986 *) echo $flag ;;
2987 esac
2988 done
2989 }
2990
2991 msvc_flags(){
2992 msvc_common_flags "$@"
2993 for flag; do
2994 case $flag in
2995 -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
2996 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
2997 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
2998 -wd4273 -wd4554 -wd4701 ;;
2999 esac
3000 done
3001 }
3002
3003 icl_flags(){
3004 msvc_common_flags "$@"
3005 for flag; do
3006 case $flag in
3007 # Despite what Intel's documentation says -Wall, which is supported
3008 # on Windows, does enable remarks so disable them here.
3009 -Wall) echo $flag -Qdiag-disable:remark ;;
3010 -std=c99) echo -Qstd=c99 ;;
3011 esac
3012 done
3013 }
3014
3015 pgi_flags(){
3016 for flag; do
3017 case $flag in
3018 -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
3019 -fomit-frame-pointer) echo -Mnoframe ;;
3020 -g) echo -gopt ;;
3021 *) echo $flag ;;
3022 esac
3023 done
3024 }
3025
3026 suncc_flags(){
3027 for flag; do
3028 case $flag in
3029 -march=*|-mcpu=*)
3030 case "${flag#*=}" in
3031 native) echo -xtarget=native ;;
3032 v9|niagara) echo -xarch=sparc ;;
3033 ultrasparc) echo -xarch=sparcvis ;;
3034 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
3035 i586|pentium) echo -xchip=pentium ;;
3036 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
3037 pentium3*|c3-2) echo -xtarget=pentium3 ;;
3038 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
3039 pentium4*) echo -xtarget=pentium4 ;;
3040 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
3041 *-sse3) echo -xarch=sse3 ;;
3042 core2) echo -xarch=ssse3 -xchip=core2 ;;
3043 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
3044 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
3045 amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
3046 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
3047 k8|opteron|athlon64|athlon-fx)
3048 echo -xarch=sse2a ;;
3049 athlon*) echo -xarch=pentium_proa ;;
3050 esac
3051 ;;
3052 -std=c99) echo -xc99 ;;
3053 -fomit-frame-pointer) echo -xregs=frameptr ;;
3054 -fPIC) echo -KPIC -xcode=pic32 ;;
3055 -W*,*) echo $flag ;;
3056 -f*-*|-W*|-mimpure-text) ;;
3057 -shared) echo -G ;;
3058 *) echo $flag ;;
3059 esac
3060 done
3061 }
3062
3063 tms470_flags(){
3064 for flag; do
3065 case $flag in
3066 -march=*|-mcpu=*)
3067 case "${flag#*=}" in
3068 armv7-a|cortex-a*) echo -mv=7a8 ;;
3069 armv7-r|cortex-r*) echo -mv=7r4 ;;
3070 armv7-m|cortex-m*) echo -mv=7m3 ;;
3071 armv6*|arm11*) echo -mv=6 ;;
3072 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3073 echo -mv=5e ;;
3074 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
3075 esac
3076 ;;
3077 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
3078 -mfpu=vfp) echo --float_support=vfpv2 ;;
3079 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
3080 -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
3081 -msoft-float) echo --float_support=vfplib ;;
3082 -O[0-3]|-mf=*) echo $flag ;;
3083 -g) echo -g -mn ;;
3084 -pds=*) echo $flag ;;
3085 -D*|-I*) echo $flag ;;
3086 --gcc|--abi=*) echo $flag ;;
3087 -me) echo $flag ;;
3088 esac
3089 done
3090 }
3091
3092 probe_cc(){
3093 pfx=$1
3094 _cc=$2
3095
3096 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3097 unset _ld_o _ldflags _ld_lib _ld_path
3098 unset _depflags _DEPCMD _DEPFLAGS
3099 _flags_filter=echo
3100
3101 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3102 _type=llvm_gcc
3103 gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3104 _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
3105 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3106 _cflags_speed='-O3'
3107 _cflags_size='-Os'
3108 elif $_cc -v 2>&1 | grep -qi ^gcc; then
3109 _type=gcc
3110 gcc_version=$($_cc --version | head -n1)
3111 gcc_basever=$($_cc -dumpversion)
3112 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3113 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3114 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3115 if ! $_cc -dumpversion | grep -q '^2\.'; then
3116 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3117 fi
3118 _cflags_speed='-O3'
3119 _cflags_size='-Os'
3120 elif $_cc --version 2>/dev/null | grep -q ^icc; then
3121 _type=icc
3122 _ident=$($_cc --version | head -n1)
3123 _depflags='-MMD'
3124 _cflags_speed='-O3'
3125 _cflags_size='-Os'
3126 _cflags_noopt='-O1'
3127 elif $_cc -v 2>&1 | grep -q xlc; then
3128 _type=xlc
3129 _ident=$($_cc -qversion 2>/dev/null | head -n1)
3130 _cflags_speed='-O5'
3131 _cflags_size='-O5 -qcompact'
3132 elif $_cc -V 2>/dev/null | grep -q Compaq; then
3133 _type=ccc
3134 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3135 _DEPFLAGS='-M'
3136 _cflags_speed='-fast'
3137 _cflags_size='-O1'
3138 _flags_filter=ccc_flags
3139 elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
3140 test -d "$sysroot" || die "No valid sysroot specified."
3141 _type=armcc
3142 _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
3143 armcc_conf="$PWD/armcc.conf"
3144 $_cc --arm_linux_configure \
3145 --arm_linux_config_file="$armcc_conf" \
3146 --configure_sysroot="$sysroot" \
3147 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3148 die "Error creating armcc configuration file."
3149 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3150 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3151 as_default="${cross_prefix}gcc"
3152 _depflags='-MMD'
3153 _cflags_speed='-O3'
3154 _cflags_size='-Os'
3155 elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
3156 _type=tms470
3157 _ident=$($_cc -version | head -n1 | tr -s ' ')
3158 _flags='--gcc --abi=eabi -me'
3159 _cc_e='-ppl -fe=$@'
3160 _cc_o='-fe=$@'
3161 _depflags='-ppa -ppd=$(@:.o=.d)'
3162 _cflags_speed='-O3 -mf=5'
3163 _cflags_size='-O3 -mf=2'
3164 _flags_filter=tms470_flags
3165 elif $_cc -v 2>&1 | grep -q clang; then
3166 _type=clang
3167 _ident=$($_cc --version 2>/dev/null | head -n1)
3168 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3169 _cflags_speed='-O3'
3170 _cflags_size='-Os'
3171 elif $_cc -V 2>&1 | grep -q Sun; then
3172 _type=suncc
3173 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3174 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3175 _DEPFLAGS='-xM1 -xc99'
3176 _ldflags='-std=c99'
3177 _cflags_speed='-O5'
3178 _cflags_size='-O5 -xspace'
3179 _flags_filter=suncc_flags
3180 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3181 _type=pathscale
3182 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3183 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3184 _cflags_speed='-O2'
3185 _cflags_size='-Os'
3186 _flags_filter='filter_out -Wdisabled-optimization'
3187 elif $_cc -v 2>&1 | grep -q Open64; then
3188 _type=open64
3189 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3190 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3191 _cflags_speed='-O2'
3192 _cflags_size='-Os'
3193 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3194 elif $_cc -V 2>&1 | grep -q Portland; then
3195 _type=pgi
3196 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
3197 opt_common='-alias=ansi -Mdse -Mlre -Mpre'
3198 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3199 _cflags_size="-O2 -Munroll=c:1 $opt_common"
3200 _cflags_noopt="-O1"
3201 _flags_filter=pgi_flags
3202 elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3203 _type=armasm
3204 _ident=$($_cc | head -n1)
3205 # 4509: "This form of conditional instruction is deprecated"
3206 _flags="-nologo -ignore 4509"
3207 _flags_filter=armasm_flags
3208 elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
3209 _type=msvc
3210 _ident=$($_cc 2>&1 | head -n1)
3211 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3212 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3213 _cflags_speed="-O2"
3214 _cflags_size="-O1"
3215 if $_cc -nologo- 2>&1 | grep -q Linker; then
3216 _ld_o='-out:$@'
3217 else
3218 _ld_o='-Fe$@'
3219 fi
3220 _cc_o='-Fo$@'
3221 _cc_e='-P -Fi$@'
3222 _flags_filter=msvc_flags
3223 _ld_lib='lib%.a'
3224 _ld_path='-libpath:'
3225 _flags='-nologo'
3226 _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS'
3227 elif $_cc 2>&1 | grep -q Intel; then
3228 _type=icl
3229 _ident=$($_cc 2>&1 | head -n1)
3230 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3231 # Not only is O3 broken on 13.x+ but it is slower on all previous
3232 # versions (tested) as well.
3233 _cflags_speed="-O2"
3234 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3235 if $_cc 2>&1 | grep -q Linker; then
3236 _ld_o='-out:$@'
3237 else
3238 _ld_o='-Fe$@'
3239 fi
3240 _cc_o='-Fo$@'
3241 _cc_e='-P'
3242 _flags_filter=icl_flags
3243 _ld_lib='lib%.a'
3244 _ld_path='-libpath:'
3245 # -Qdiag-error to make icl error when seeing certain unknown arguments
3246 _flags='-nologo -Qdiag-error:4044,10157'
3247 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3248 # with MSVC which enables it by default.
3249 _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS'
3250 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3251 _type=cparser
3252 _ident=$($_cc --version | head -n1)
3253 _depflags='-MMD'
3254 _cflags_speed='-O4'
3255 _cflags_size='-O2'
3256 _flags_filter=cparser_flags
3257 fi
3258
3259 eval ${pfx}_type=\$_type
3260 eval ${pfx}_ident=\$_ident
3261 }
3262
3263 set_ccvars(){
3264 eval ${1}_C=\${_cc_c-\${${1}_C}}
3265 eval ${1}_E=\${_cc_e-\${${1}_E}}
3266 eval ${1}_O=\${_cc_o-\${${1}_O}}
3267
3268 if [ -n "$_depflags" ]; then
3269 eval ${1}_DEPFLAGS=\$_depflags
3270 else
3271 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3272 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3273 eval DEP${1}FLAGS=\$_flags
3274 fi
3275 }
3276
3277 probe_cc cc "$cc"
3278 cflags_filter=$_flags_filter
3279 cflags_speed=$_cflags_speed
3280 cflags_size=$_cflags_size
3281 cflags_noopt=$_cflags_noopt
3282 add_cflags $_flags $_cflags
3283 cc_ldflags=$_ldflags
3284 set_ccvars CC
3285
3286 probe_cc hostcc "$host_cc"
3287 host_cflags_filter=$_flags_filter
3288 add_host_cflags $_flags $_cflags
3289 set_ccvars HOSTCC
3290
3291 test -n "$cc_type" && enable $cc_type ||
3292 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3293
3294 : ${as_default:=$cc}
3295 : ${objcc_default:=$cc}
3296 : ${dep_cc_default:=$cc}
3297 : ${ld_default:=$cc}
3298 : ${host_ld_default:=$host_cc}
3299 set_default ar as objcc dep_cc ld host_ld
3300
3301 probe_cc as "$as"
3302 asflags_filter=$_flags_filter
3303 add_asflags $_flags $_cflags
3304 set_ccvars AS
3305
3306 probe_cc objcc "$objcc"
3307 objcflags_filter=$_flags_filter
3308 add_objcflags $_flags $_cflags
3309 set_ccvars OBJC
3310
3311 probe_cc ld "$ld"
3312 ldflags_filter=$_flags_filter
3313 add_ldflags $_flags $_ldflags
3314 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3315 LD_O=${_ld_o-$LD_O}
3316 LD_LIB=${_ld_lib-$LD_LIB}
3317 LD_PATH=${_ld_path-$LD_PATH}
3318
3319 probe_cc hostld "$host_ld"
3320 host_ldflags_filter=$_flags_filter
3321 add_host_ldflags $_flags $_ldflags
3322 HOSTLD_O=${_ld_o-$HOSTLD_O}
3323
3324 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3325 probe_cc depcc "$dep_cc"
3326 CCDEP=${_DEPCMD:-$DEPCMD}
3327 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3328 DEPCCFLAGS=$_flags
3329 fi
3330
3331 if $ar 2>&1 | grep -q Microsoft; then
3332 arflags="-nologo"
3333 ar_o='-out:$@'
3334 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3335 arflags="rq"
3336 ar_o='$@'
3337 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3338 arflags='-Xany -r -c'
3339 ar_o='$@'
3340 else
3341 arflags="rc"
3342 ar_o='$@'
3343 fi
3344
3345 add_cflags $extra_cflags
3346 add_objcflags $extra_objcflags
3347 add_asflags $extra_cflags
3348
3349 if test -n "$sysroot"; then
3350 case "$cc_type" in
3351 gcc|llvm_gcc|clang)
3352 add_cppflags --sysroot="$sysroot"
3353 add_ldflags --sysroot="$sysroot"
3354 ;;
3355 tms470)
3356 add_cppflags -I"$sysinclude"
3357 add_ldflags --sysroot="$sysroot"
3358 ;;
3359 esac
3360 fi
3361
3362 if test "$cpu" = host; then
3363 enabled cross_compile &&
3364 die "--cpu=host makes no sense when cross-compiling."
3365
3366 case "$cc_type" in
3367 gcc|llvm_gcc)
3368 check_native(){
3369 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3370 sed -n "/cc1.*$1=/{
3371 s/.*$1=\\([^ ]*\\).*/\\1/
3372 p
3373 q
3374 }" $TMPE
3375 }
3376 cpu=$(check_native -march || check_native -mcpu)
3377 ;;
3378 esac
3379
3380 test "${cpu:-host}" = host &&
3381 die "--cpu=host not supported with compiler $cc"
3382 fi
3383
3384 # Deal with common $arch aliases
3385 case "$arch" in
3386 aarch64|arm64)
3387 arch="aarch64"
3388 ;;
3389 arm*)
3390 arch="arm"
3391 ;;
3392 mips*|IP*)
3393 case "$arch" in
3394 *el)
3395 add_cppflags -EL
3396 add_ldflags -EL
3397 ;;
3398 *eb)
3399 add_cppflags -EB
3400 add_ldflags -EB
3401 ;;
3402 esac
3403 arch="mips"
3404 ;;
3405 parisc*|hppa*)
3406 arch="parisc"
3407 ;;
3408 "Power Macintosh"|ppc*|powerpc*)
3409 arch="ppc"
3410 ;;
3411 s390|s390x)
3412 arch="s390"
3413 ;;
3414 sh4|sh)
3415 arch="sh4"
3416 ;;
3417 sun4u|sparc*)
3418 arch="sparc"
3419 ;;
3420 tilegx|tile-gx)
3421 arch="tilegx"
3422 ;;
3423 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
3424 arch="x86"
3425 ;;
3426 esac
3427
3428 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3429 enable $arch
3430
3431 # Add processor-specific flags
3432 if enabled aarch64; then
3433
3434 case $cpu in
3435 armv*)
3436 cpuflags="-march=$cpu"
3437 ;;
3438 *)
3439 cpuflags="-mcpu=$cpu"
3440 ;;
3441 esac
3442
3443 elif enabled alpha; then
3444
3445 cpuflags="-mcpu=$cpu"
3446
3447 elif enabled arm; then
3448
3449 check_arm_arch() {
3450 check_cpp_condition stddef.h \
3451 "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3452 $cpuflags
3453 }
3454
3455 probe_arm_arch() {
3456 if check_arm_arch 4; then echo armv4
3457 elif check_arm_arch 4T; then echo armv4t
3458 elif check_arm_arch 5; then echo armv5
3459 elif check_arm_arch 5E; then echo armv5e
3460 elif check_arm_arch 5T; then echo armv5t
3461 elif check_arm_arch 5TE; then echo armv5te
3462 elif check_arm_arch 5TEJ; then echo armv5te
3463 elif check_arm_arch 6; then echo armv6
3464 elif check_arm_arch 6J; then echo armv6j
3465 elif check_arm_arch 6K; then echo armv6k
3466 elif check_arm_arch 6Z; then echo armv6z
3467 elif check_arm_arch 6ZK; then echo armv6zk
3468 elif check_arm_arch 6T2; then echo armv6t2
3469 elif check_arm_arch 7; then echo armv7
3470 elif check_arm_arch 7A 7_A; then echo armv7-a
3471 elif check_arm_arch 7S; then echo armv7-a
3472 elif check_arm_arch 7R 7_R; then echo armv7-r
3473 elif check_arm_arch 7M 7_M; then echo armv7-m
3474 elif check_arm_arch 7EM 7E_M; then echo armv7-m
3475 elif check_arm_arch 8A 8_A; then echo armv8-a
3476 fi
3477 }
3478
3479 [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3480
3481 case $cpu in
3482 armv*)
3483 cpuflags="-march=$cpu"
3484 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3485 ;;
3486 *)
3487 cpuflags="-mcpu=$cpu"
3488 case $cpu in
3489 cortex-a*) subarch=armv7a ;;
3490 cortex-r*) subarch=armv7r ;;
3491 cortex-m*) enable thumb; subarch=armv7m ;;
3492 arm11*) subarch=armv6 ;;
3493 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3494 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
3495 *) subarch=$(probe_arm_arch) ;;
3496 esac
3497 ;;
3498 esac
3499
3500 case "$subarch" in
3501 armv5t*) enable fast_clz ;;
3502 armv[6-8]*) enable fast_clz fast_unaligned ;;
3503 esac
3504
3505 elif enabled avr32; then
3506
3507 case $cpu in
3508 ap7[02]0[0-2])
3509 subarch="avr32_ap"
3510 cpuflags="-mpart=$cpu"
3511 ;;
3512 ap)
3513 subarch="avr32_ap"
3514 cpuflags="-march=$cpu"
3515 ;;
3516 uc3[ab]*)
3517 subarch="avr32_uc"
3518 cpuflags="-mcpu=$cpu"
3519 ;;
3520 uc)
3521 subarch="avr32_uc"
3522 cpuflags="-march=$cpu"
3523 ;;
3524 esac
3525
3526 elif enabled bfin; then
3527
3528 cpuflags="-mcpu=$cpu"
3529
3530 elif enabled mips; then
3531
3532 cpuflags="-march=$cpu"
3533
3534 elif enabled ppc; then
3535
3536 disable ldbrx
3537
3538 case $(tolower $cpu) in
3539 601|ppc601|powerpc601)
3540 cpuflags="-mcpu=601"
3541 disable altivec
3542 ;;
3543 603*|ppc603*|powerpc603*)
3544 cpuflags="-mcpu=603"
3545 disable altivec
3546 ;;
3547 604*|ppc604*|powerpc604*)
3548 cpuflags="-mcpu=604"
3549 disable altivec
3550 ;;
3551 g3|75*|ppc75*|powerpc75*)
3552 cpuflags="-mcpu=750"
3553 disable altivec
3554 ;;
3555 g4|745*|ppc745*|powerpc745*)
3556 cpuflags="-mcpu=7450"
3557 disable vsx
3558 ;;
3559 74*|ppc74*|powerpc74*)
3560 cpuflags="-mcpu=7400"
3561 disable vsx
3562 ;;
3563 g5|970|ppc970|powerpc970)
3564 cpuflags="-mcpu=970"
3565 disable vsx
3566 ;;
3567 power[3-6]*)
3568 cpuflags="-mcpu=$cpu"
3569 disable vsx
3570 ;;
3571 power[7-8]*)
3572 cpuflags="-mcpu=$cpu"
3573 enable ldbrx
3574 ;;
3575 cell)
3576 cpuflags="-mcpu=cell"
3577 enable ldbrx
3578 disable vsx
3579 ;;
3580 e500mc)
3581 cpuflags="-mcpu=e500mc"
3582 disable altivec
3583 ;;
3584 e500v2)
3585 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
3586 disable altivec
3587 disable dcbzl
3588 ;;
3589 e500)
3590 cpuflags="-mcpu=8540 -mhard-float"
3591 disable altivec
3592 disable dcbzl
3593 ;;
3594 esac
3595
3596 elif enabled sparc; then
3597
3598 case $cpu in
3599 cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
3600 cpuflags="-mcpu=$cpu"
3601 ;;
3602 ultrasparc*|niagara[234])
3603 cpuflags="-mcpu=$cpu"
3604 ;;
3605 esac
3606
3607 elif enabled x86; then
3608
3609 case $cpu in
3610 i[345]86|pentium)
3611 cpuflags="-march=$cpu"
3612 disable i686
3613 disable mmx
3614 ;;
3615 # targets that do NOT support nopl and conditional mov (cmov)
3616 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
3617 cpuflags="-march=$cpu"
3618 disable i686
3619 ;;
3620 # targets that do support nopl and conditional mov (cmov)
3621 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
3622 cpuflags="-march=$cpu"
3623 enable i686
3624 enable fast_cmov
3625 ;;
3626 # targets that do support conditional mov but on which it's slow
3627 pentium4|pentium4m|prescott|nocona)
3628 cpuflags="-march=$cpu"
3629 enable i686
3630 disable fast_cmov
3631 ;;
3632 esac
3633
3634 fi
3635
3636 if [ "$cpu" != generic ]; then
3637 add_cflags $cpuflags
3638 add_asflags $cpuflags
3639 test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
3640 fi
3641
3642 # compiler sanity check
3643 check_exec <<EOF
3644 int main(void){ return 0; }
3645 EOF
3646 if test "$?" != 0; then
3647 echo "$cc is unable to create an executable file."
3648 if test -z "$cross_prefix" && ! enabled cross_compile ; then
3649 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
3650 echo "Only do this if you know what cross compiling means."
3651 fi
3652 die "C compiler test failed."
3653 fi
3654
3655 add_cppflags -D_ISOC99_SOURCE
3656 check_cflags -std=c99
3657 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
3658 #include <stdlib.h>
3659 EOF
3660 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
3661 #include <stdlib.h>
3662 EOF
3663
3664 add_host_cppflags -D_ISOC99_SOURCE
3665 check_host_cflags -std=c99
3666 check_host_cflags -Wall
3667 check_host_cflags -O3
3668
3669 check_64bit(){
3670 arch32=$1
3671 arch64=$2
3672 expr=$3
3673 check_code cc "" "int test[2*($expr) - 1]" &&
3674 subarch=$arch64 || subarch=$arch32
3675 }
3676
3677 case "$arch" in
3678 aarch64|alpha|ia64)
3679 spic=$shared
3680 ;;
3681 mips)
3682 check_64bit mips mips64 '_MIPS_SIM > 1'
3683 spic=$shared
3684 ;;
3685 parisc)
3686 check_64bit parisc parisc64 'sizeof(void *) > 4'
3687 spic=$shared
3688 ;;
3689 ppc)
3690 check_64bit ppc ppc64 'sizeof(void *) > 4'
3691 spic=$shared
3692 ;;
3693 s390)
3694 check_64bit s390 s390x 'sizeof(void *) > 4'
3695 spic=$shared
3696 ;;
3697 sparc)
3698 check_64bit sparc sparc64 'sizeof(void *) > 4'
3699 spic=$shared
3700 ;;
3701 x86)
3702 check_64bit x86_32 x86_64 'sizeof(void *) > 4'
3703 if test "$subarch" = "x86_64"; then
3704 spic=$shared
3705 fi
3706 ;;
3707 esac
3708
3709 enable $subarch
3710 enabled spic && enable_weak pic
3711
3712 # OS specific
3713 case $target_os in
3714 aix)
3715 SHFLAGS=-shared
3716 add_cppflags '-I\$(SRC_PATH)/compat/aix'
3717 enabled shared && add_ldflags -Wl,-brtl
3718 ;;
3719 android)
3720 disable symver
3721 enable section_data_rel_ro
3722 SLIB_INSTALL_NAME='$(SLIBNAME)'
3723 SLIB_INSTALL_LINKS=
3724 SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
3725 ;;
3726 haiku)
3727 prefix_default="/boot/common"
3728 network_extralibs="-lnetwork"
3729 host_libs=
3730 ;;
3731 sunos)
3732 SHFLAGS='-shared -Wl,-h,$$(@F)'
3733 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
3734 network_extralibs="-lsocket -lnsl"
3735 # When using suncc to build, the Solaris linker will mark
3736 # an executable with each instruction set encountered by
3737 # the Solaris assembler. As our libraries contain their own
3738 # guards for processor-specific code, instead suppress
3739 # generation of the HWCAPS ELF section on Solaris x86 only.
3740 enabled_all suncc x86 &&
3741 echo "hwcap_1 = OVERRIDE;" > mapfile &&
3742 add_ldflags -Wl,-M,mapfile
3743 nm_default='nm -P -g'
3744 SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
3745 ;;
3746 netbsd)
3747 disable symver
3748 oss_indev_extralibs="-lossaudio"
3749 oss_outdev_extralibs="-lossaudio"
3750 ;;
3751 openbsd|bitrig)
3752 disable symver
3753 SHFLAGS='-shared'
3754 SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
3755 SLIB_INSTALL_LINKS=
3756 oss_indev_extralibs="-lossaudio"
3757 oss_outdev_extralibs="-lossaudio"
3758 ;;
3759 dragonfly)
3760 disable symver
3761 ;;
3762 freebsd)
3763 ;;
3764 bsd/os)
3765 add_extralibs -lpoll -lgnugetopt
3766 ;;
3767 darwin)
3768 enabled ppc && add_asflags -force_cpusubtype_ALL
3769 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
3770 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
3771 add_ldflags -Wl,-dynamic,-search_paths_first
3772 SLIBSUF=".dylib"
3773 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
3774 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
3775 objformat="macho"
3776 enabled x86_64 && objformat="macho64"
3777 enabled_any pic shared ||
3778 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
3779 check_header dispatch/dispatch.h &&
3780 add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
3781 ;;
3782 msys*)
3783 die "Native MSYS builds are discouraged, please use the MINGW environment."
3784 ;;
3785 mingw32*|mingw64*)
3786 if test $target_os = "mingw32ce"; then
3787 disable network
3788 else
3789 target_os=mingw32
3790 fi
3791 LIBTARGET=i386
3792 if enabled x86_64; then
3793 LIBTARGET="i386:x86-64"
3794 elif enabled arm; then
3795 LIBTARGET=arm-wince
3796 fi
3797 check_ldflags -Wl,--nxcompat
3798 check_ldflags -Wl,--dynamicbase
3799 shlibdir_default="$bindir_default"
3800 SLIBPREF=""
3801 SLIBSUF=".dll"
3802 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3803 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3804 SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
3805 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3806 SLIB_INSTALL_LINKS=
3807 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3808 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3809 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
3810 objformat="win32"
3811 dlltool="${cross_prefix}dlltool"
3812 ranlib=:
3813 enable dos_paths
3814 ;;
3815 win32|win64)
3816 disable symver
3817 if enabled shared; then
3818 # Link to the import library instead of the normal static library
3819 # for shared libs.
3820 LD_LIB='%.lib'
3821 # Cannot build both shared and static libs with MSVC or icl.
3822 disable static
3823 fi
3824 shlibdir_default="$bindir_default"
3825 SLIBPREF=""
3826 SLIBSUF=".dll"
3827 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3828 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3829 SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
3830 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3831 SLIB_INSTALL_LINKS=
3832 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3833 SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3834 SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
3835 objformat="win32"
3836 ranlib=:
3837 enable dos_paths
3838 ;;
3839 cygwin*)
3840 target_os=cygwin
3841 shlibdir_default="$bindir_default"
3842 SLIBPREF="cyg"
3843 SLIBSUF=".dll"
3844 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3845 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3846 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3847 SLIB_INSTALL_LINKS=
3848 SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
3849 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
3850 objformat="win32"
3851 enable dos_paths
3852 ;;
3853 *-dos|freedos|opendos)
3854 network_extralibs="-lsocket"
3855 objformat="coff"
3856 enable dos_paths
3857 add_cppflags -U__STRICT_ANSI__
3858 ;;
3859 linux)
3860 enable dv1394
3861 enable section_data_rel_ro
3862 ;;
3863 irix*)
3864 target_os=irix
3865 ranlib="echo ignoring ranlib"
3866 ;;
3867 os/2*)
3868 ln_s="cp -f"
3869 objformat="aout"
3870 add_cppflags -D_GNU_SOURCE
3871 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
3872 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
3873 LIBSUF="_s.a"
3874 SLIBPREF=""
3875 SLIBSUF=".dll"
3876 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3877 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
3878 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
3879 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
3880 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
3881 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
3882 emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
3883 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
3884 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
3885 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
3886 enable dos_paths
3887 ;;
3888 gnu/kfreebsd)
3889 add_cppflags -D_BSD_SOURCE
3890 ;;
3891 gnu)
3892 ;;
3893 qnx)
3894 add_cppflags -D_QNX_SOURCE
3895 network_extralibs="-lsocket"
3896 ;;
3897 symbian)
3898 SLIBSUF=".dll"
3899 enable dos_paths
3900 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
3901 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
3902 add_ldflags -Wl,--target1-abs,--no-undefined \
3903 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
3904 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
3905 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
3906 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
3907 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
3908 ;;
3909 osf1)
3910 add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
3911 ;;
3912 minix)
3913 ;;
3914 plan9)
3915 add_cppflags -D_C99_SNPRINTF_EXTENSION \
3916 -D_REENTRANT_SOURCE \
3917 -D_RESEARCH_SOURCE \
3918 -DFD_SETSIZE=96 \
3919 -DHAVE_SOCK_OPTS
3920 add_compat strtod.o strtod=avpriv_strtod
3921 network_extralibs='-lbsd'
3922 exeobjs=compat/plan9/main.o
3923 cp_f='cp'
3924 ;;
3925 none)
3926 ;;
3927 *)
3928 die "Unknown OS '$target_os'."
3929 ;;
3930 esac
3931
3932 # determine libc flavour
3933
3934 probe_libc(){
3935 pfx=$1
3936 pfx_no_=${pfx%_}
3937 # uclibc defines __GLIBC__, so it needs to be checked before glibc.
3938 if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
3939 eval ${pfx}libc_type=uclibc
3940 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3941 elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
3942 eval ${pfx}libc_type=glibc
3943 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3944 # MinGW headers can be installed on Cygwin, so check for newlib first.
3945 elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
3946 eval ${pfx}libc_type=newlib
3947 add_${pfx}cppflags -U__STRICT_ANSI__
3948 # MinGW64 is backwards compatible with MinGW32, so check for it first.
3949 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
3950 eval ${pfx}libc_type=mingw64
3951 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3952 eval test \$${pfx_no_}cc_type = "gcc" &&
3953 add_${pfx}cppflags -D__printf__=__gnu_printf__
3954 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
3955 check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
3956 eval ${pfx}libc_type=mingw32
3957 check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
3958 (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
3959 die "ERROR: MinGW32 runtime version must be >= 3.15."
3960 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3961 eval test \$${pfx_no_}cc_type = "gcc" &&
3962 add_${pfx}cppflags -D__printf__=__gnu_printf__
3963 elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
3964 eval ${pfx}libc_type=msvcrt
3965 if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
3966 if [ "$pfx" = host_ ]; then
3967 add_host_cppflags -Dsnprintf=_snprintf
3968 else
3969 add_compat strtod.o strtod=avpriv_strtod
3970 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
3971 _snprintf=avpriv_snprintf \
3972 vsnprintf=avpriv_vsnprintf
3973 fi
3974 fi
3975 # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
3976 # 0x601 by default unless something else is set by the user.
3977 # This can easily lead to us detecting functions only present
3978 # in such new versions and producing binaries requiring windows 7.0.
3979 # Therefore explicitly set the default to XP unless the user has
3980 # set something else on the command line.
3981 # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
3982 # family. For these cases, configure is free to use any functions
3983 # found in the SDK headers by default. (Alternatively, we could force
3984 # _WIN32_WINNT to 0x0602 in that case.)
3985 check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
3986 { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
3987 #ifdef WINAPI_FAMILY
3988 #include <winapifamily.h>
3989 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
3990 #error not desktop
3991 #endif
3992 #endif
3993 EOF
3994 elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
3995 eval ${pfx}libc_type=klibc
3996 elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
3997 eval ${pfx}libc_type=bionic
3998 elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
3999 eval ${pfx}libc_type=solaris
4000 add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
4001 else
4002 eval ${pfx}libc_type=default
4003 add_${pfx}cppflags -D_DEFAULT_SOURCE
4004 fi
4005 }
4006
4007 probe_libc
4008 test -n "$libc_type" && enable libc_$libc_type
4009 probe_libc host_
4010 test -n "$host_libc_type" && enable host_libc_$host_libc_type
4011
4012 case $libc_type in
4013 bionic)
4014 add_compat strtod.o strtod=avpriv_strtod
4015 ;;
4016 esac
4017
4018 # hacks for compiler/libc/os combinations
4019
4020 if enabled_all tms470 libc_glibc; then
4021 CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
4022 add_cppflags -D__USER_LABEL_PREFIX__=
4023 add_cppflags -D__builtin_memset=memset
4024 add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
4025 add_cflags -pds=48 # incompatible redefinition of macro
4026 fi
4027
4028 if enabled_all ccc libc_glibc; then
4029 add_ldflags -Wl,-z,now # calls to libots crash without this
4030 fi
4031
4032 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
4033 add_cppflags '-I\$(SRC_PATH)/compat/float'
4034
4035 esc(){
4036 echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
4037 }
4038
4039 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
4040
4041 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
4042
4043 set_default $PATHS_LIST
4044 set_default nm
4045
4046 # we need to build at least one lib type
4047 if ! enabled_any static shared; then
4048 cat <<EOF
4049 At least one library type must be built.
4050 Specify --enable-static to build the static libraries or --enable-shared to
4051 build the shared libraries as well. To only build the shared libraries specify
4052 --disable-static in addition to --enable-shared.
4053 EOF
4054 exit 1
4055 fi
4056
4057 die_license_disabled() {
4058 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
4059 }
4060
4061 die_license_disabled gpl libcdio
4062 die_license_disabled gpl libx264
4063 die_license_disabled gpl libx265
4064 die_license_disabled gpl libxavs
4065 die_license_disabled gpl libxvid
4066 die_license_disabled gpl x11grab
4067
4068 die_license_disabled nonfree cuda
4069 die_license_disabled nonfree libfaac
4070 die_license_disabled nonfree libfdk_aac
4071 die_license_disabled nonfree libnpp
4072 die_license_disabled nonfree nvenc
4073 die_license_disabled nonfree openssl
4074
4075 die_license_disabled version3 libopencore_amrnb
4076 die_license_disabled version3 libopencore_amrwb
4077 die_license_disabled version3 libvo_aacenc
4078 die_license_disabled version3 libvo_amrwbenc
4079
4080 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
4081
4082 disabled optimizations || check_cflags -fomit-frame-pointer
4083
4084 enable_weak_pic() {
4085 disabled pic && return
4086 enable pic
4087 add_cppflags -DPIC
4088 case "$target_os" in
4089 mingw*|cygwin*)
4090 ;;
4091 *)
4092 add_cflags -fPIC
4093 ;;
4094 esac
4095 add_asflags -fPIC
4096 }
4097
4098 enabled pic && enable_weak_pic
4099
4100 check_cc <<EOF || die "Symbol mangling check failed."
4101 int ff_extern;
4102 EOF
4103 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
4104 extern_prefix=${sym%%ff_extern*}
4105
4106 check_cc <<EOF && enable_weak inline_asm
4107 void foo(void) { __asm__ volatile ("" ::); }
4108 EOF
4109
4110 _restrict=
4111 for restrict_keyword in restrict __restrict__ __restrict; do
4112 check_cc <<EOF && _restrict=$restrict_keyword && break
4113 void foo(char * $restrict_keyword p);
4114 EOF
4115 done
4116
4117 check_cc <<EOF && enable pragma_deprecated
4118 void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
4119 EOF
4120
4121 check_cc <<EOF && enable attribute_packed
4122 struct { int x; } __attribute__((packed)) x;
4123 EOF
4124
4125 check_cc <<EOF && enable attribute_may_alias
4126 union { int x; } __attribute__((may_alias)) x;
4127 EOF
4128
4129 check_cc <<EOF || die "endian test failed"
4130 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
4131 EOF
4132 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
4133
4134 check_gas() {
4135 log "check_gas using '$as' as AS"
4136 # :vararg is used on aarch64, arm and ppc altivec
4137 check_as <<EOF || return 1
4138 .macro m n, y:vararg=0
4139 \n: .int \y
4140 .endm
4141 m x
4142 EOF
4143 # .altmacro is only used in arm asm
4144 ! enabled arm || check_as <<EOF || return 1
4145 .altmacro
4146 EOF
4147 enable gnu_as
4148 return 0
4149 }
4150
4151 if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
4152 nogas=:
4153 enabled_any arm aarch64 && nogas=die
4154 enabled_all ppc altivec && nogas=warn
4155 as_noop=-v
4156
4157 case $as_type in
4158 arm*) gaspp_as_type=armasm; as_noop=-h ;;
4159 gcc) gaspp_as_type=gas ;;
4160 *) gaspp_as_type=$as_type ;;
4161 esac
4162
4163 [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
4164
4165 check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
4166 gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
4167
4168 if ! check_gas ; then
4169 as=${gas:=$as}
4170 check_gas || \
4171 $nogas "GNU assembler not found, install/update gas-preprocessor"
4172 fi
4173
4174 check_as <<EOF && enable as_func
4175 .func test
4176 .endfunc
4177 EOF
4178 fi
4179
4180 check_inline_asm inline_asm_labels '"1:\n"'
4181
4182 if enabled aarch64; then
4183 enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
4184 # internal assembler in clang 3.3 does not support this instruction
4185 enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
4186 enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
4187
4188 map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
4189
4190 elif enabled alpha; then
4191
4192 check_cflags -mieee
4193
4194 elif enabled arm; then
4195
4196 enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
4197 check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
4198 enabled thumb && check_cflags -mthumb || check_cflags -marm
4199
4200 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
4201 enable vfp_args
4202 elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
4203 enable vfp_args
4204 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
4205 case "${cross_prefix:-$cc}" in
4206 *hardfloat*) enable vfp_args; fpabi=vfp ;;
4207 *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
4208 __asm__ (".eabi_attribute 28, 1");
4209 int main(void) { return 0; }
4210 EOF
4211 esac
4212 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
4213 fi
4214
4215 enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
4216 enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
4217 enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
4218 enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
4219 enabled vfp && check_insn vfp 'fadds s0, s0, s0'
4220 enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
4221
4222 [ $target_os = linux ] || [ $target_os = android ] ||
4223 map 'enabled_any ${v}_external ${v}_inline || disable $v' \
4224 $ARCH_EXT_LIST_ARM
4225
4226 check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
4227
4228 check_as <<EOF && enable as_dn_directive
4229 ra .dn d0.i16
4230 .unreq ra
4231 EOF
4232
4233 # llvm's integrated assembler supports .object_arch from llvm 3.5
4234 [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
4235 .object_arch armv4
4236 EOF
4237
4238 [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
4239
4240 elif enabled mips; then
4241
4242 check_inline_asm loongson '"dmult.g $1, $2, $3"'
4243
4244 # make sure that only an instruction set is enabled
4245 disable mips64r6 mips32r6 mips64r2 mips32r2 mips64r1 mips32r1
4246
4247 if enabled mips64; then
4248 check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
4249 check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
4250 check_inline_asm mips64r1 '"daddi $0, $0, 0"'
4251 else
4252 check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
4253 check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
4254 check_inline_asm mips32r1 '"addi $0, $0, 0"'
4255 fi
4256
4257 elif enabled parisc; then
4258
4259 if enabled gcc; then
4260 case $($cc -dumpversion) in
4261 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
4262 esac
4263 fi
4264
4265 elif enabled ppc; then
4266
4267 enable local_aligned_8 local_aligned_16
4268
4269 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
4270 check_inline_asm ibm_asm '"add 0, 0, 0"'
4271 check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
4272 check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
4273
4274 # AltiVec flags: The FSF version of GCC differs from the Apple version
4275 if enabled altivec; then
4276 check_cflags -maltivec -mabi=altivec &&
4277 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
4278 check_cflags -faltivec
4279
4280 # check if our compiler supports Motorola AltiVec C API
4281 check_cc <<EOF || disable altivec
4282 $inc_altivec_h
4283 int main(void) {
4284 vector signed int v1 = (vector signed int) { 0 };
4285 vector signed int v2 = (vector signed int) { 1 };
4286 v1 = vec_add(v1, v2);
4287 return 0;
4288 }
4289 EOF
4290
4291 enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
4292 fi
4293
4294 if enabled vsx; then
4295 check_cflags -mvsx &&
4296 check_builtin vec_vsx_ld "altivec.h" "__builtin_vec_vsx_ld" || disable vsx
4297 fi
4298
4299 if enabled power8; then
4300 check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
4301 fi
4302
4303 elif enabled x86; then
4304
4305 check_builtin rdtsc intrin.h "__rdtsc()"
4306 check_builtin mm_empty mmintrin.h "_mm_empty()"
4307
4308 enable local_aligned_8 local_aligned_16
4309
4310 # check whether EBP is available on x86
4311 # As 'i' is stored on the stack, this program will crash
4312 # if the base pointer is used to access it because the
4313 # base pointer is cleared in the inline assembly code.
4314 check_exec_crash <<EOF && enable ebp_available
4315 volatile int i=0;
4316 __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
4317 return i;
4318 EOF
4319
4320 # check whether EBX is available on x86
4321 check_inline_asm ebx_available '""::"b"(0)' &&
4322 check_inline_asm ebx_available '"":::"%ebx"'
4323
4324 # check whether xmm clobbers are supported
4325 check_inline_asm xmm_clobbers '"":::"%xmm0"'
4326
4327 # check whether binutils is new enough to compile SSSE3/MMXEXT
4328 enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
4329 enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
4330
4331 if ! disabled_any asm mmx yasm; then
4332 if check_cmd $yasmexe --version; then
4333 enabled x86_64 && yasm_extra="-m amd64"
4334 yasm_debug="-g dwarf2"
4335 elif check_cmd nasm -v; then
4336 yasmexe=nasm
4337 yasm_debug="-g -F dwarf"
4338 enabled x86_64 && test "$objformat" = elf && objformat=elf64
4339 fi
4340
4341 YASMFLAGS="-f $objformat $yasm_extra"
4342 enabled pic && append YASMFLAGS "-DPIC"
4343 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
4344 case "$objformat" in
4345 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
4346 esac
4347
4348 check_yasm "movbe ecx, [5]" && enable yasm ||
4349 die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
4350 check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
4351 check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
4352 check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
4353 check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
4354 check_yasm "CPU amdnop" || disable cpunop
4355 fi
4356
4357 case "$cpu" in
4358 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
4359 disable fast_clz
4360 ;;
4361 esac
4362
4363 fi
4364
4365 check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
4366
4367 check_ldflags -Wl,--as-needed
4368
4369 if check_func dlopen; then
4370 ldl=
4371 elif check_func dlopen -ldl; then
4372 ldl=-ldl
4373 fi
4374
4375 if ! disabled network; then
4376 check_func getaddrinfo $network_extralibs
4377 check_func inet_aton $network_extralibs
4378
4379 check_type netdb.h "struct addrinfo"
4380 check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE