2eb686a59178d19335c4af05f1b4a25890dd1ad2
[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_qsv_hwaccel_deps="libmfx"
2137 mpeg2_vaapi_hwaccel_deps="vaapi"
2138 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2139 mpeg2_vdpau_hwaccel_deps="vdpau"
2140 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2141 mpeg4_omx_encoder_deps="omx"
2142 mpeg4_vaapi_hwaccel_deps="vaapi"
2143 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2144 mpeg4_vdpau_hwaccel_deps="vdpau"
2145 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2146 vc1_d3d11va_hwaccel_deps="d3d11va"
2147 vc1_d3d11va_hwaccel_select="vc1_decoder"
2148 vc1_dxva2_hwaccel_deps="dxva2"
2149 vc1_dxva2_hwaccel_select="vc1_decoder"
2150 vc1_vaapi_hwaccel_deps="vaapi"
2151 vc1_vaapi_hwaccel_select="vc1_decoder"
2152 vc1_vdpau_hwaccel_deps="vdpau"
2153 vc1_vdpau_hwaccel_select="vc1_decoder"
2154 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2155 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2156 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2157 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2158
2159 # hardware-accelerated codecs
2160 nvenc_deps_any="dlopen LoadLibrary"
2161 nvenc_extralibs='$ldl'
2162 omx_deps="dlopen pthreads"
2163 omx_extralibs='$ldl'
2164 qsvdec_select="qsv"
2165 qsvenc_select="qsv"
2166 vaapi_encode_deps="vaapi"
2167
2168 hwupload_cuda_filter_deps="cuda"
2169 scale_npp_filter_deps="cuda libnpp"
2170
2171 h264_nvenc_encoder_deps="nvenc"
2172 h264_qsv_decoder_deps="libmfx"
2173 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2174 h264_qsv_encoder_deps="libmfx"
2175 h264_qsv_encoder_select="qsvenc"
2176 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2177 h264_vaapi_encoder_select="vaapi_encode golomb"
2178
2179 hevc_nvenc_encoder_deps="nvenc"
2180 hevc_qsv_decoder_deps="libmfx"
2181 hevc_qsv_encoder_deps="libmfx"
2182 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec"
2183 hevc_qsv_encoder_select="qsvenc"
2184 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2185 hevc_vaapi_encoder_select="vaapi_encode golomb"
2186 mpeg2_qsv_decoder_deps="libmfx"
2187 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser"
2188 mpeg2_qsv_encoder_deps="libmfx"
2189 mpeg2_qsv_encoder_select="qsvenc"
2190
2191 nvenc_h264_encoder_deps="nvenc"
2192 nvenc_hevc_encoder_deps="nvenc"
2193
2194 # parsers
2195 h264_parser_select="h264_decoder"
2196 hevc_parser_select="golomb"
2197 mpegvideo_parser_select="mpegvideo"
2198 mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
2199 vc1_parser_select="vc1dsp"
2200
2201 # bitstream_filters
2202 mjpeg2jpeg_bsf_select="jpegtables"
2203
2204 # external libraries
2205 libdcadec_decoder_deps="libdcadec"
2206 libfaac_encoder_deps="libfaac"
2207 libfaac_encoder_select="audio_frame_queue"
2208 libfdk_aac_decoder_deps="libfdk_aac"
2209 libfdk_aac_encoder_deps="libfdk_aac"
2210 libfdk_aac_encoder_select="audio_frame_queue"
2211 libgsm_decoder_deps="libgsm"
2212 libgsm_encoder_deps="libgsm"
2213 libgsm_ms_decoder_deps="libgsm"
2214 libgsm_ms_encoder_deps="libgsm"
2215 libilbc_decoder_deps="libilbc"
2216 libilbc_encoder_deps="libilbc"
2217 libkvazaar_encoder_deps="libkvazaar"
2218 libmp3lame_encoder_deps="libmp3lame"
2219 libmp3lame_encoder_select="audio_frame_queue"
2220 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2221 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2222 libopencore_amrnb_encoder_select="audio_frame_queue"
2223 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2224 libopenh264_encoder_deps="libopenh264"
2225 libopenjpeg_decoder_deps="libopenjpeg"
2226 libopenjpeg_encoder_deps="libopenjpeg"
2227 libopus_decoder_deps="libopus"
2228 libopus_encoder_deps="libopus"
2229 libopus_encoder_select="audio_frame_queue"
2230 libschroedinger_decoder_deps="libschroedinger"
2231 libschroedinger_encoder_deps="libschroedinger"
2232 libspeex_decoder_deps="libspeex"
2233 libspeex_encoder_deps="libspeex"
2234 libspeex_encoder_select="audio_frame_queue"
2235 libtheora_encoder_deps="libtheora"
2236 libtwolame_encoder_deps="libtwolame"
2237 libvo_aacenc_encoder_deps="libvo_aacenc"
2238 libvo_aacenc_encoder_select="audio_frame_queue"
2239 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2240 libvorbis_encoder_deps="libvorbis"
2241 libvorbis_encoder_select="audio_frame_queue"
2242 libvpx_vp8_decoder_deps="libvpx"
2243 libvpx_vp8_encoder_deps="libvpx"
2244 libvpx_vp9_decoder_deps="libvpx"
2245 libvpx_vp9_encoder_deps="libvpx"
2246 libwavpack_encoder_deps="libwavpack"
2247 libwebp_encoder_deps="libwebp"
2248 libx262_encoder_deps="libx262"
2249 libx264_encoder_deps="libx264"
2250 libx265_encoder_deps="libx265"
2251 libxavs_encoder_deps="libxavs"
2252 libxvid_encoder_deps="libxvid"
2253
2254 # demuxers / muxers
2255 ac3_demuxer_select="ac3_parser"
2256 asf_demuxer_select="riffdec"
2257 asf_muxer_select="riffenc"
2258 asf_stream_muxer_select="asf_muxer"
2259 avi_demuxer_select="iso_media riffdec"
2260 avi_muxer_select="riffenc"
2261 avisynth_demuxer_deps="avisynth"
2262 avisynth_demuxer_select="riffdec"
2263 caf_demuxer_select="iso_media riffdec"
2264 dash_muxer_select="mp4_muxer"
2265 dirac_demuxer_select="dirac_parser"
2266 dv_demuxer_select="dvprofile"
2267 dv_muxer_select="dvprofile"
2268 dxa_demuxer_select="riffdec"
2269 eac3_demuxer_select="ac3_parser"
2270 f4v_muxer_select="mov_muxer"
2271 flac_demuxer_select="flac_parser"
2272 hds_muxer_select="flv_muxer"
2273 hls_muxer_select="mpegts_muxer"
2274 ipod_muxer_select="mov_muxer"
2275 ismv_muxer_select="mov_muxer"
2276 matroska_audio_muxer_select="matroska_muxer"
2277 matroska_demuxer_select="iso_media riffdec"
2278 matroska_demuxer_suggest="bzlib lzo zlib"
2279 matroska_muxer_select="iso_media riffenc"
2280 mmf_muxer_select="riffenc"
2281 mov_demuxer_select="iso_media riffdec"
2282 mov_demuxer_suggest="zlib"
2283 mov_muxer_select="iso_media riffenc rtpenc_chain"
2284 mp3_demuxer_select="mpegaudio_parser"
2285 mp4_muxer_select="mov_muxer"
2286 mpegts_demuxer_select="iso_media"
2287 mpegts_muxer_select="adts_muxer latm_muxer"
2288 mpegtsraw_demuxer_select="mpegts_demuxer"
2289 mxf_d10_muxer_select="mxf_muxer"
2290 nut_muxer_select="riffenc"
2291 nuv_demuxer_select="riffdec"
2292 oga_muxer_select="ogg_muxer"
2293 ogg_demuxer_select="dirac_parse"
2294 opus_muxer_select="ogg_muxer"
2295 psp_muxer_select="mov_muxer"
2296 rtp_demuxer_select="sdp_demuxer"
2297 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
2298 rtsp_demuxer_select="http_protocol rtpdec"
2299 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2300 sap_demuxer_select="sdp_demuxer"
2301 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2302 sdp_demuxer_select="rtpdec"
2303 smoothstreaming_muxer_select="ismv_muxer"
2304 spdif_muxer_select="aac_parser"
2305 spx_muxer_select="ogg_muxer"
2306 swf_demuxer_suggest="zlib"
2307 tak_demuxer_select="tak_parser"
2308 tg2_muxer_select="mov_muxer"
2309 tgp_muxer_select="mov_muxer"
2310 w64_demuxer_select="wav_demuxer"
2311 wav_demuxer_select="riffdec"
2312 wav_muxer_select="riffenc"
2313 webm_muxer_select="iso_media riffenc"
2314 webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder libvpx_vp9_encoder"
2315 wtv_demuxer_select="mpegts_demuxer riffdec"
2316 xmv_demuxer_select="riffdec"
2317 xwma_demuxer_select="riffdec"
2318
2319 # indevs / outdevs
2320 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
2321 alsa_outdev_deps="alsa_asoundlib_h"
2322 avfoundation_indev_deps="AVFoundation_AVFoundation_h"
2323 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2324 dv1394_indev_deps="dv1394"
2325 dv1394_indev_select="dv_demuxer"
2326 fbdev_indev_deps="linux_fb_h"
2327 jack_indev_deps="jack_jack_h"
2328 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
2329 libcdio_indev_deps="libcdio"
2330 libdc1394_indev_deps="libdc1394"
2331 oss_indev_deps_any="soundcard_h sys_soundcard_h"
2332 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
2333 pulse_indev_deps="libpulse"
2334 sndio_indev_deps="sndio_h"
2335 sndio_outdev_deps="sndio_h"
2336 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2337 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
2338 vfwcap_indev_extralibs="-lavicap32"
2339 x11grab_indev_deps="x11grab"
2340 x11grab_xcb_indev_deps="libxcb"
2341
2342 # protocols
2343 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2344 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
2345 ffrtmpcrypt_protocol_select="tcp_protocol"
2346 ffrtmphttp_protocol_deps="!librtmp_protocol"
2347 ffrtmphttp_protocol_select="http_protocol"
2348 gopher_protocol_select="network"
2349 http_protocol_select="tcp_protocol"
2350 httpproxy_protocol_select="tcp_protocol"
2351 https_protocol_select="tls_protocol"
2352 icecast_protocol_select="http_protocol"
2353 librtmp_protocol_deps="librtmp"
2354 librtmpe_protocol_deps="librtmp"
2355 librtmps_protocol_deps="librtmp"
2356 librtmpt_protocol_deps="librtmp"
2357 librtmpte_protocol_deps="librtmp"
2358 mmsh_protocol_select="http_protocol"
2359 mmst_protocol_select="network"
2360 rtmp_protocol_deps="!librtmp_protocol"
2361 rtmp_protocol_select="tcp_protocol"
2362 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2363 rtmps_protocol_deps="!librtmp_protocol"
2364 rtmps_protocol_select="tls_protocol"
2365 rtmpt_protocol_select="ffrtmphttp_protocol"
2366 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2367 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2368 rtp_protocol_select="udp_protocol"
2369 sctp_protocol_deps="struct_sctp_event_subscribe"
2370 sctp_protocol_select="network"
2371 srtp_protocol_select="rtp_protocol srtp"
2372 tcp_protocol_select="network"
2373 tls_gnutls_protocol_deps="gnutls"
2374 tls_gnutls_protocol_select="tcp_protocol"
2375 tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
2376 tls_openssl_protocol_select="tcp_protocol"
2377 tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"
2378 udp_protocol_select="network"
2379 unix_protocol_deps="sys_un_h"
2380 unix_protocol_select="network"
2381
2382 # filters
2383 blackframe_filter_deps="gpl"
2384 boxblur_filter_deps="gpl"
2385 bs2b_filter_deps="libbs2b"
2386 cropdetect_filter_deps="gpl"
2387 delogo_filter_deps="gpl"
2388 drawtext_filter_deps="libfreetype"
2389 frei0r_filter_deps="frei0r dlopen"
2390 frei0r_filter_extralibs='$ldl'
2391 frei0r_src_filter_deps="frei0r dlopen"
2392 frei0r_src_filter_extralibs='$ldl'
2393 hqdn3d_filter_deps="gpl"
2394 interlace_filter_deps="gpl"
2395 ocv_filter_deps="libopencv"
2396 resample_filter_deps="avresample"
2397 scale_filter_deps="swscale"
2398 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
2399
2400 # examples
2401 avcodec_example_deps="avcodec avutil"
2402 filter_audio_example_deps="avfilter avutil"
2403 metadata_example_deps="avformat avutil"
2404 output_example_deps="avcodec avformat avutil swscale"
2405 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
2406 transcode_aac_example_deps="avcodec avformat avresample"
2407
2408 # libraries, in linking order
2409 avcodec_deps="avutil"
2410 avdevice_deps="avformat avcodec avutil"
2411 avfilter_deps="avutil"
2412 avformat_deps="avcodec avutil"
2413 avresample_deps="avutil"
2414 swscale_deps="avutil"
2415
2416 # programs
2417 avconv_deps="avcodec avfilter avformat avresample swscale"
2418 avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
2419 fps_filter null_filter resample_filter scale_filter
2420 setpts_filter trim_filter"
2421 avplay_deps="avcodec avfilter avformat avresample sdl"
2422 avplay_libs='$sdl_libs'
2423 avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
2424 avprobe_deps="avcodec avformat"
2425
2426 # documentation
2427 pod2man_deps="doc"
2428 texi2html_deps="doc"
2429
2430 # default parameters
2431
2432 logfile="config.log"
2433
2434 # installation paths
2435 prefix_default="/usr/local"
2436 bindir_default='${prefix}/bin'
2437 datadir_default='${prefix}/share/avconv'
2438 docdir_default='${prefix}/share/doc/libav'
2439 incdir_default='${prefix}/include'
2440 libdir_default='${prefix}/lib'
2441 mandir_default='${prefix}/share/man'
2442 shlibdir_default="$libdir_default"
2443
2444 # toolchain
2445 ar_default="ar"
2446 cc_default="gcc"
2447 host_cc_default="gcc"
2448 cp_f="cp -f"
2449 ln_s="ln -s -f"
2450 nm_default="nm -g"
2451 objformat="elf"
2452 pkg_config_default=pkg-config
2453 ranlib="ranlib"
2454 strip="strip"
2455 yasmexe="yasm"
2456
2457 # machine
2458 arch_default=$(uname -m)
2459 cpu="generic"
2460 intrinsics="none"
2461
2462 # OS
2463 target_os_default=$(tolower $(uname -s))
2464 host_os=$target_os_default
2465
2466 # configurable options
2467 enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
2468
2469 enable asm
2470 enable debug
2471 enable doc
2472 enable faan faandct faanidct
2473 enable optimizations
2474 enable safe_bitstream_reader
2475 enable static
2476 enable swscale_alpha
2477 enable valgrind_backtrace
2478
2479 # By default, enable only those hwaccels that have no external dependencies.
2480 enable d3d11va dxva2 vda vdpau
2481
2482 # build settings
2483 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2484 LIBPREF="lib"
2485 LIBSUF=".a"
2486 FULLNAME='$(NAME)$(BUILDSUF)'
2487 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
2488 SLIBPREF="lib"
2489 SLIBSUF=".so"
2490 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
2491 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2492 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2493 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2494 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2495 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2496
2497 asflags_filter=echo
2498 cflags_filter=echo
2499 ldflags_filter=echo
2500
2501 AS_C='-c'
2502 AS_O='-o $@'
2503 CC_C='-c'
2504 CC_E='-E -o $@'
2505 CC_O='-o $@'
2506 OBJCC_C='-c'
2507 OBJCC_E='-E -o $@'
2508 OBJCC_O='-o $@'
2509 LD_O='-o $@'
2510 LD_LIB='-l%'
2511 LD_PATH='-L'
2512 HOSTCC_C='-c'
2513 HOSTCC_E='-E -o $@'
2514 HOSTCC_O='-o $@'
2515 HOSTLD_O='-o $@'
2516
2517 host_libs='-lm'
2518 host_cflags_filter=echo
2519 host_ldflags_filter=echo
2520
2521 target_path='$(CURDIR)'
2522
2523 # since the object filename is not given with the -MM flag, the compiler
2524 # is only able to print the basename, and we must add the path ourselves
2525 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2526 DEPFLAGS='-MM'
2527
2528 # find source path
2529 if test -f configure; then
2530 source_path=.
2531 else
2532 source_path=$(cd $(dirname "$0"); pwd)
2533 echo "$source_path" | grep -q '[[:blank:]]' &&
2534 die "Out of tree builds are impossible with whitespace in source path."
2535 test -e "$source_path/config.h" &&
2536 die "Out of tree builds are impossible with config.h in source dir."
2537 fi
2538
2539 for v in "$@"; do
2540 r=${v#*=}
2541 l=${v%"$r"}
2542 r=$(sh_quote "$r")
2543 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
2544 done
2545
2546 find_things(){
2547 thing=$1
2548 pattern=$2
2549 file=$source_path/$3
2550 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
2551 }
2552
2553 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2554 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
2555 HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
2556 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
2557 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2558 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
2559 OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
2560 INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
2561 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
2562
2563 find_things_extern(){
2564 thing=$1
2565 pattern=$2
2566 file=$source_path/$3
2567 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
2568 }
2569
2570 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
2571 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
2572
2573 ALL_COMPONENTS="
2574 $BSF_LIST
2575 $DECODER_LIST
2576 $DEMUXER_LIST
2577 $ENCODER_LIST
2578 $FILTER_LIST
2579 $HWACCEL_LIST
2580 $INDEV_LIST
2581 $MUXER_LIST
2582 $OUTDEV_LIST
2583 $PARSER_LIST
2584 $PROTOCOL_LIST
2585 "
2586
2587 for n in $COMPONENT_LIST; do
2588 v=$(toupper ${n%s})_LIST
2589 eval enable \$$v
2590 eval ${n}_if_any="\$$v"
2591 done
2592
2593 enable $ARCH_EXT_LIST
2594
2595 die_unknown(){
2596 echo "Unknown option \"$1\"."
2597 echo "See $0 --help for available options."
2598 exit 1
2599 }
2600
2601 print_3_columns() {
2602 printf "%-25s %-25s %-25s\n" $(cat | tr ' ' '\n' | sort)
2603 }
2604
2605 show_list() {
2606 suffix=_$1
2607 shift
2608 echo $* | sed s/$suffix//g | print_3_columns
2609 exit 0
2610 }
2611
2612 rand_list(){
2613 IFS=', '
2614 set -- $*
2615 unset IFS
2616 for thing; do
2617 comp=${thing%:*}
2618 prob=${thing#$comp}
2619 prob=${prob#:}
2620 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
2621 echo "prob ${prob:-0.5}"
2622 printf '%s\n' $comp
2623 done
2624 }
2625
2626 do_random(){
2627 action=$1
2628 shift
2629 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
2630 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
2631 }
2632
2633 for opt do
2634 optval="${opt#*=}"
2635 case "$opt" in
2636 --extra-ldflags=*)
2637 add_ldflags $optval
2638 ;;
2639 --extra-ldexeflags=*)
2640 add_ldexeflags $optval
2641 ;;
2642 --extra-libs=*)
2643 add_extralibs $optval
2644 ;;
2645 --disable-devices)
2646 disable $INDEV_LIST $OUTDEV_LIST
2647 ;;
2648 --enable-debug=*)
2649 debuglevel="$optval"
2650 ;;
2651 --disable-programs)
2652 disable $PROGRAM_LIST
2653 ;;
2654 --disable-everything)
2655 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2656 ;;
2657 --disable-all)
2658 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2659 disable $LIBRARY_LIST $PROGRAM_LIST doc
2660 ;;
2661 --enable-random|--disable-random)
2662 action=${opt%%-random}
2663 do_random ${action#--} $COMPONENT_LIST
2664 ;;
2665 --enable-random=*|--disable-random=*)
2666 action=${opt%%-random=*}
2667 do_random ${action#--} $optval
2668 ;;
2669 --enable-*=*|--disable-*=*)
2670 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2671 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2672 eval list=\$$(toupper $thing)_LIST
2673 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2674 $action $(filter "$name" $list)
2675 ;;
2676 --enable-avserver|--disable-avserver*)
2677 warn "avserver has been removed, the ${opt} option is only"\
2678 "provided for compatibility and will be removed in the future"
2679 ;;
2680 --enable-?*|--disable-?*)
2681 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2682 if is_in $option $COMPONENT_LIST; then
2683 test $action = disable && action=unset
2684 eval $action \$$(toupper ${option%s})_LIST
2685 elif is_in $option $CMDLINE_SELECT; then
2686 $action $option
2687 else
2688 die_unknown $opt
2689 fi
2690 ;;
2691 --list-*)
2692 NAME="${opt#--list-}"
2693 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2694 NAME=${NAME%s}
2695 eval show_list $NAME \$$(toupper $NAME)_LIST
2696 ;;
2697 --help|-h) show_help
2698 ;;
2699 *)
2700 optname="${opt%%=*}"
2701 optname="${optname#--}"
2702 optname=$(echo "$optname" | sed 's/-/_/g')
2703 if is_in $optname $CMDLINE_SET; then
2704 eval $optname='$optval'
2705 elif is_in $optname $CMDLINE_APPEND; then
2706 append $optname "$optval"
2707 else
2708 die_unknown $opt
2709 fi
2710 ;;
2711 esac
2712 done
2713
2714 for e in $env; do
2715 eval "export $e"
2716 done
2717
2718 disabled logging && logfile=/dev/null
2719
2720 # Disable all the library-specific components if the library itself
2721 # is disabled, see AVCODEC_LIST and following _LIST variables.
2722
2723 disable_components(){
2724 disabled ${1} && disable $(
2725 eval components="\$$(toupper ${1})_COMPONENTS"
2726 map 'eval echo \${$(toupper ${v%s})_LIST}' $components
2727 )
2728 }
2729
2730 map 'disable_components $v' $LIBRARY_LIST
2731
2732 echo "# $0 $LIBAV_CONFIGURATION" > $logfile
2733 set >> $logfile
2734
2735 case "$toolchain" in
2736 *-asan)
2737 cc_default="${toolchain%-asan}"
2738 add_cflags -fsanitize=address
2739 add_ldflags -fsanitize=address
2740 ;;
2741 *-msan)
2742 cc_default="${toolchain%-msan}"
2743 add_cflags -fsanitize=memory -fsanitize-memory-track-origins
2744 add_ldflags -fsanitize=memory
2745 ;;
2746 *-tsan)
2747 cc_default="${toolchain%-tsan}"
2748 add_cflags -fsanitize=thread -pie
2749 add_ldflags -fsanitize=thread -pie
2750 case "$toolchain" in
2751 gcc-tsan)
2752 add_cflags -fPIC
2753 add_ldflags -fPIC
2754 ;;
2755 esac
2756 ;;
2757 *-usan)
2758 cc_default="${toolchain%-usan}"
2759 add_cflags -fsanitize=undefined
2760 add_ldflags -fsanitize=undefined
2761 case "$toolchain" in
2762 clang-usan)
2763 add_cflags -O1
2764 ;;
2765 esac
2766 ;;
2767 valgrind-*)
2768 target_exec_default="valgrind"
2769 case "$toolchain" in
2770 valgrind-massif)
2771 target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
2772 ;;
2773 valgrind-memcheck)
2774 target_exec_args="--track-origins=yes --leak-check=full"
2775 ;;
2776 esac
2777 ;;
2778 msvc)
2779 # Check whether the current MSVC version needs the C99 converter.
2780 # From MSVC 2013 (compiler major version 18) onwards, it does actually
2781 # support enough of C99 to build libav. Default to the new
2782 # behaviour if the regexp was unable to match anything, since this
2783 # successfully parses the version number of existing supported
2784 # versions that require the converter (MSVC 2010 and 2012).
2785 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2786 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
2787 cc_default="cl"
2788 else
2789 cc_default="c99wrap cl"
2790 fi
2791 ld_default="$source_path/compat/windows/mslink"
2792 nm_default="dumpbin -symbols"
2793 ar_default="lib"
2794 case "$arch" in
2795 arm*)
2796 as_default="armasm"
2797 ;;
2798 esac
2799 target_os_default="win32"
2800 # Use a relative path for TMPDIR. This makes sure all the
2801 # ffconf temp files are written with a relative path, avoiding
2802 # issues with msys/win32 path conversion for MSVC parameters
2803 # such as -Fo<file> or -out:<file>.
2804 TMPDIR=.
2805 ;;
2806 icl)
2807 cc_default="icl"
2808 ld_default="xilink"
2809 nm_default="dumpbin -symbols"
2810 ar_default="xilib"
2811 target_os_default="win32"
2812 TMPDIR=.
2813 ;;
2814 gcov)
2815 add_cflags -fprofile-arcs -ftest-coverage
2816 add_ldflags -fprofile-arcs -ftest-coverage
2817 ;;
2818 llvm-cov)
2819 add_cflags -fprofile-arcs -ftest-coverage
2820 add_ldflags --coverage
2821 ;;
2822 hardened)
2823 add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
2824 add_cflags -fno-strict-overflow -fstack-protector-all
2825 add_ldflags -Wl,-z,relro -Wl,-z,now
2826 ;;
2827 ?*)
2828 die "Unknown toolchain $toolchain"
2829 ;;
2830 esac
2831
2832 test -n "$cross_prefix" && enable cross_compile
2833
2834 if enabled cross_compile; then
2835 test -n "$arch" && test -n "$target_os" ||
2836 die "Must specify target arch and OS when cross-compiling"
2837 fi
2838
2839 ar_default="${cross_prefix}${ar_default}"
2840 cc_default="${cross_prefix}${cc_default}"
2841 occ_default="${cross_prefix}${occ_default}"
2842 nm_default="${cross_prefix}${nm_default}"
2843 pkg_config_default="${cross_prefix}${pkg_config_default}"
2844 ranlib="${cross_prefix}${ranlib}"
2845 strip="${cross_prefix}${strip}"
2846
2847 sysinclude_default="${sysroot}/usr/include"
2848
2849 set_default arch cc pkg_config sysinclude target_exec target_os
2850 enabled cross_compile || host_cc_default=$cc
2851 set_default host_cc
2852
2853 if ! $pkg_config --version >/dev/null 2>&1; then
2854 warn "$pkg_config not found, library detection may fail."
2855 pkg_config=false
2856 fi
2857
2858 exesuf() {
2859 case $1 in
2860 mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
2861 esac
2862 }
2863
2864 EXESUF=$(exesuf $target_os)
2865 HOSTEXESUF=$(exesuf $host_os)
2866
2867 # set temporary file name
2868 : ${TMPDIR:=$TEMPDIR}
2869 : ${TMPDIR:=$TMP}
2870 : ${TMPDIR:=/tmp}
2871
2872 if ! check_cmd mktemp -u XXXXXX; then
2873 # simple replacement for missing mktemp
2874 # NOT SAFE FOR GENERAL USE
2875 mktemp(){
2876 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
2877 }
2878 fi
2879
2880 tmpfile(){
2881 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2882 (set -C; exec > $tmp) 2>/dev/null ||
2883 die "Unable to create temporary file in $TMPDIR."
2884 append TMPFILES $tmp
2885 eval $1=$tmp
2886 }
2887
2888 trap 'rm -f -- $TMPFILES' EXIT
2889
2890 tmpfile TMPASM .asm
2891 tmpfile TMPC .c
2892 tmpfile TMPE $EXESUF
2893 tmpfile TMPH .h
2894 tmpfile TMPO .o
2895 tmpfile TMPS .S
2896 tmpfile TMPSH .sh
2897 tmpfile TMPV .ver
2898
2899 unset -f mktemp
2900
2901 chmod +x $TMPE
2902
2903 # make sure we can execute files in $TMPDIR
2904 cat > $TMPSH 2>> $logfile <<EOF
2905 #! /bin/sh
2906 EOF
2907 chmod +x $TMPSH >> $logfile 2>&1
2908 if ! $TMPSH >> $logfile 2>&1; then
2909 cat <<EOF
2910 Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2911 variable to another directory and make sure that it is not mounted noexec.
2912 EOF
2913 die "Sanity test failed."
2914 fi
2915
2916 armasm_flags(){
2917 for flag; do
2918 case $flag in
2919 # Filter out MSVC cl.exe options from cflags that shouldn't
2920 # be passed to gas-preprocessor
2921 -M[TD]*) ;;
2922 *) echo $flag ;;
2923 esac
2924 done
2925 }
2926
2927 ccc_flags(){
2928 for flag; do
2929 case $flag in
2930 -std=c99) echo -c99 ;;
2931 -mcpu=*) echo -arch ${flag#*=} ;;
2932 -mieee) echo -ieee ;;
2933 -O*|-fast) echo $flag ;;
2934 -fno-math-errno) echo -assume nomath_errno ;;
2935 -g) echo -g3 ;;
2936 -Wall) echo -msg_enable level2 ;;
2937 -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
2938 -Wl,*) echo $flag ;;
2939 -f*|-W*) ;;
2940 *) echo $flag ;;
2941 esac
2942 done
2943 }
2944
2945 cparser_flags(){
2946 for flag; do
2947 case $flag in
2948 -Wno-switch) echo -Wno-switch-enum ;;
2949 -Wno-format-zero-length) ;;
2950 -Wdisabled-optimization) ;;
2951 -Wno-pointer-sign) echo -Wno-other ;;
2952 *) echo $flag ;;
2953 esac
2954 done
2955 }
2956
2957 msvc_common_flags(){
2958 for flag; do
2959 case $flag in
2960 # In addition to specifying certain flags under the compiler
2961 # specific filters, they must be specified here as well or else the
2962 # generic catch all at the bottom will print the original flag.
2963 -Wall) ;;
2964 -std=c99) ;;
2965 # Common flags
2966 -fomit-frame-pointer) ;;
2967 -g) echo -Z7 ;;
2968 -fno-math-errno) ;;
2969 -fno-common) ;;
2970 -fno-signed-zeros) ;;
2971 -fPIC) ;;
2972 -mthumb) ;;
2973 -march=*) ;;
2974 -lz) echo zlib.lib ;;
2975 -lavifil32) echo vfw32.lib ;;
2976 -lavicap32) echo vfw32.lib user32.lib ;;
2977 -lx264) echo libx264.lib ;;
2978 -l*) echo ${flag#-l}.lib ;;
2979 -L*) echo -libpath:${flag#-L} ;;
2980 *) echo $flag ;;
2981 esac
2982 done
2983 }
2984
2985 msvc_flags(){
2986 msvc_common_flags "$@"
2987 for flag; do
2988 case $flag in
2989 -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
2990 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
2991 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
2992 -wd4273 -wd4554 -wd4701 ;;
2993 esac
2994 done
2995 }
2996
2997 icl_flags(){
2998 msvc_common_flags "$@"
2999 for flag; do
3000 case $flag in
3001 # Despite what Intel's documentation says -Wall, which is supported
3002 # on Windows, does enable remarks so disable them here.
3003 -Wall) echo $flag -Qdiag-disable:remark ;;
3004 -std=c99) echo -Qstd=c99 ;;
3005 esac
3006 done
3007 }
3008
3009 pgi_flags(){
3010 for flag; do
3011 case $flag in
3012 -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
3013 -fomit-frame-pointer) echo -Mnoframe ;;
3014 -g) echo -gopt ;;
3015 *) echo $flag ;;
3016 esac
3017 done
3018 }
3019
3020 suncc_flags(){
3021 for flag; do
3022 case $flag in
3023 -march=*|-mcpu=*)
3024 case "${flag#*=}" in
3025 native) echo -xtarget=native ;;
3026 v9|niagara) echo -xarch=sparc ;;
3027 ultrasparc) echo -xarch=sparcvis ;;
3028 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
3029 i586|pentium) echo -xchip=pentium ;;
3030 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
3031 pentium3*|c3-2) echo -xtarget=pentium3 ;;
3032 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
3033 pentium4*) echo -xtarget=pentium4 ;;
3034 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
3035 *-sse3) echo -xarch=sse3 ;;
3036 core2) echo -xarch=ssse3 -xchip=core2 ;;
3037 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
3038 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
3039 amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
3040 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
3041 k8|opteron|athlon64|athlon-fx)
3042 echo -xarch=sse2a ;;
3043 athlon*) echo -xarch=pentium_proa ;;
3044 esac
3045 ;;
3046 -std=c99) echo -xc99 ;;
3047 -fomit-frame-pointer) echo -xregs=frameptr ;;
3048 -fPIC) echo -KPIC -xcode=pic32 ;;
3049 -W*,*) echo $flag ;;
3050 -f*-*|-W*|-mimpure-text) ;;
3051 -shared) echo -G ;;
3052 *) echo $flag ;;
3053 esac
3054 done
3055 }
3056
3057 tms470_flags(){
3058 for flag; do
3059 case $flag in
3060 -march=*|-mcpu=*)
3061 case "${flag#*=}" in
3062 armv7-a|cortex-a*) echo -mv=7a8 ;;
3063 armv7-r|cortex-r*) echo -mv=7r4 ;;
3064 armv7-m|cortex-m*) echo -mv=7m3 ;;
3065 armv6*|arm11*) echo -mv=6 ;;
3066 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3067 echo -mv=5e ;;
3068 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
3069 esac
3070 ;;
3071 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
3072 -mfpu=vfp) echo --float_support=vfpv2 ;;
3073 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
3074 -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
3075 -msoft-float) echo --float_support=vfplib ;;
3076 -O[0-3]|-mf=*) echo $flag ;;
3077 -g) echo -g -mn ;;
3078 -pds=*) echo $flag ;;
3079 -D*|-I*) echo $flag ;;
3080 --gcc|--abi=*) echo $flag ;;
3081 -me) echo $flag ;;
3082 esac
3083 done
3084 }
3085
3086 probe_cc(){
3087 pfx=$1
3088 _cc=$2
3089
3090 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3091 unset _ld_o _ldflags _ld_lib _ld_path
3092 unset _depflags _DEPCMD _DEPFLAGS
3093 _flags_filter=echo
3094
3095 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3096 _type=llvm_gcc
3097 gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3098 _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
3099 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3100 _cflags_speed='-O3'
3101 _cflags_size='-Os'
3102 elif $_cc -v 2>&1 | grep -qi ^gcc; then
3103 _type=gcc
3104 gcc_version=$($_cc --version | head -n1)
3105 gcc_basever=$($_cc -dumpversion)
3106 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3107 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3108 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3109 if ! $_cc -dumpversion | grep -q '^2\.'; then
3110 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3111 fi
3112 _cflags_speed='-O3'
3113 _cflags_size='-Os'
3114 elif $_cc --version 2>/dev/null | grep -q ^icc; then
3115 _type=icc
3116 _ident=$($_cc --version | head -n1)
3117 _depflags='-MMD'
3118 _cflags_speed='-O3'
3119 _cflags_size='-Os'
3120 _cflags_noopt='-O1'
3121 elif $_cc -v 2>&1 | grep -q xlc; then
3122 _type=xlc
3123 _ident=$($_cc -qversion 2>/dev/null | head -n1)
3124 _cflags_speed='-O5'
3125 _cflags_size='-O5 -qcompact'
3126 elif $_cc -V 2>/dev/null | grep -q Compaq; then
3127 _type=ccc
3128 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3129 _DEPFLAGS='-M'
3130 _cflags_speed='-fast'
3131 _cflags_size='-O1'
3132 _flags_filter=ccc_flags
3133 elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
3134 test -d "$sysroot" || die "No valid sysroot specified."
3135 _type=armcc
3136 _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
3137 armcc_conf="$PWD/armcc.conf"
3138 $_cc --arm_linux_configure \
3139 --arm_linux_config_file="$armcc_conf" \
3140 --configure_sysroot="$sysroot" \
3141 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3142 die "Error creating armcc configuration file."
3143 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3144 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3145 as_default="${cross_prefix}gcc"
3146 _depflags='-MMD'
3147 _cflags_speed='-O3'
3148 _cflags_size='-Os'
3149 elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
3150 _type=tms470
3151 _ident=$($_cc -version | head -n1 | tr -s ' ')
3152 _flags='--gcc --abi=eabi -me'
3153 _cc_e='-ppl -fe=$@'
3154 _cc_o='-fe=$@'
3155 _depflags='-ppa -ppd=$(@:.o=.d)'
3156 _cflags_speed='-O3 -mf=5'
3157 _cflags_size='-O3 -mf=2'
3158 _flags_filter=tms470_flags
3159 elif $_cc -v 2>&1 | grep -q clang; then
3160 _type=clang
3161 _ident=$($_cc --version 2>/dev/null | head -n1)
3162 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3163 _cflags_speed='-O3'
3164 _cflags_size='-Os'
3165 elif $_cc -V 2>&1 | grep -q Sun; then
3166 _type=suncc
3167 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3168 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3169 _DEPFLAGS='-xM1 -xc99'
3170 _ldflags='-std=c99'
3171 _cflags_speed='-O5'
3172 _cflags_size='-O5 -xspace'
3173 _flags_filter=suncc_flags
3174 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3175 _type=pathscale
3176 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3177 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3178 _cflags_speed='-O2'
3179 _cflags_size='-Os'
3180 _flags_filter='filter_out -Wdisabled-optimization'
3181 elif $_cc -v 2>&1 | grep -q Open64; then
3182 _type=open64
3183 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3184 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3185 _cflags_speed='-O2'
3186 _cflags_size='-Os'
3187 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3188 elif $_cc -V 2>&1 | grep -q Portland; then
3189 _type=pgi
3190 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
3191 opt_common='-alias=ansi -Mdse -Mlre -Mpre'
3192 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3193 _cflags_size="-O2 -Munroll=c:1 $opt_common"
3194 _cflags_noopt="-O1"
3195 _flags_filter=pgi_flags
3196 elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3197 _type=armasm
3198 _ident=$($_cc | head -n1)
3199 # 4509: "This form of conditional instruction is deprecated"
3200 _flags="-nologo -ignore 4509"
3201 _flags_filter=armasm_flags
3202 elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
3203 _type=msvc
3204 _ident=$($_cc 2>&1 | head -n1)
3205 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3206 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3207 _cflags_speed="-O2"
3208 _cflags_size="-O1"
3209 if $_cc -nologo- 2>&1 | grep -q Linker; then
3210 _ld_o='-out:$@'
3211 else
3212 _ld_o='-Fe$@'
3213 fi
3214 _cc_o='-Fo$@'
3215 _cc_e='-P -Fi$@'
3216 _flags_filter=msvc_flags
3217 _ld_lib='lib%.a'
3218 _ld_path='-libpath:'
3219 _flags='-nologo'
3220 _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS'
3221 elif $_cc 2>&1 | grep -q Intel; then
3222 _type=icl
3223 _ident=$($_cc 2>&1 | head -n1)
3224 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3225 # Not only is O3 broken on 13.x+ but it is slower on all previous
3226 # versions (tested) as well.
3227 _cflags_speed="-O2"
3228 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3229 if $_cc 2>&1 | grep -q Linker; then
3230 _ld_o='-out:$@'
3231 else
3232 _ld_o='-Fe$@'
3233 fi
3234 _cc_o='-Fo$@'
3235 _cc_e='-P'
3236 _flags_filter=icl_flags
3237 _ld_lib='lib%.a'
3238 _ld_path='-libpath:'
3239 # -Qdiag-error to make icl error when seeing certain unknown arguments
3240 _flags='-nologo -Qdiag-error:4044,10157'
3241 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3242 # with MSVC which enables it by default.
3243 _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS'
3244 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3245 _type=cparser
3246 _ident=$($_cc --version | head -n1)
3247 _depflags='-MMD'
3248 _cflags_speed='-O4'
3249 _cflags_size='-O2'
3250 _flags_filter=cparser_flags
3251 fi
3252
3253 eval ${pfx}_type=\$_type
3254 eval ${pfx}_ident=\$_ident
3255 }
3256
3257 set_ccvars(){
3258 eval ${1}_C=\${_cc_c-\${${1}_C}}
3259 eval ${1}_E=\${_cc_e-\${${1}_E}}
3260 eval ${1}_O=\${_cc_o-\${${1}_O}}
3261
3262 if [ -n "$_depflags" ]; then
3263 eval ${1}_DEPFLAGS=\$_depflags
3264 else
3265 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3266 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3267 eval DEP${1}FLAGS=\$_flags
3268 fi
3269 }
3270
3271 probe_cc cc "$cc"
3272 cflags_filter=$_flags_filter
3273 cflags_speed=$_cflags_speed
3274 cflags_size=$_cflags_size
3275 cflags_noopt=$_cflags_noopt
3276 add_cflags $_flags $_cflags
3277 cc_ldflags=$_ldflags
3278 set_ccvars CC
3279
3280 probe_cc hostcc "$host_cc"
3281 host_cflags_filter=$_flags_filter
3282 add_host_cflags $_flags $_cflags
3283 set_ccvars HOSTCC
3284
3285 test -n "$cc_type" && enable $cc_type ||
3286 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3287
3288 : ${as_default:=$cc}
3289 : ${objcc_default:=$cc}
3290 : ${dep_cc_default:=$cc}
3291 : ${ld_default:=$cc}
3292 : ${host_ld_default:=$host_cc}
3293 set_default ar as objcc dep_cc ld host_ld
3294
3295 probe_cc as "$as"
3296 asflags_filter=$_flags_filter
3297 add_asflags $_flags $_cflags
3298 set_ccvars AS
3299
3300 probe_cc objcc "$objcc"
3301 objcflags_filter=$_flags_filter
3302 add_objcflags $_flags $_cflags
3303 set_ccvars OBJC
3304
3305 probe_cc ld "$ld"
3306 ldflags_filter=$_flags_filter
3307 add_ldflags $_flags $_ldflags
3308 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3309 LD_O=${_ld_o-$LD_O}
3310 LD_LIB=${_ld_lib-$LD_LIB}
3311 LD_PATH=${_ld_path-$LD_PATH}
3312
3313 probe_cc hostld "$host_ld"
3314 host_ldflags_filter=$_flags_filter
3315 add_host_ldflags $_flags $_ldflags
3316 HOSTLD_O=${_ld_o-$HOSTLD_O}
3317
3318 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3319 probe_cc depcc "$dep_cc"
3320 CCDEP=${_DEPCMD:-$DEPCMD}
3321 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3322 DEPCCFLAGS=$_flags
3323 fi
3324
3325 if $ar 2>&1 | grep -q Microsoft; then
3326 arflags="-nologo"
3327 ar_o='-out:$@'
3328 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3329 arflags="rq"
3330 ar_o='$@'
3331 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3332 arflags='-Xany -r -c'
3333 ar_o='$@'
3334 else
3335 arflags="rc"
3336 ar_o='$@'
3337 fi
3338
3339 add_cflags $extra_cflags
3340 add_objcflags $extra_objcflags
3341 add_asflags $extra_cflags
3342
3343 if test -n "$sysroot"; then
3344 case "$cc_type" in
3345 gcc|llvm_gcc|clang)
3346 add_cppflags --sysroot="$sysroot"
3347 add_ldflags --sysroot="$sysroot"
3348 ;;
3349 tms470)
3350 add_cppflags -I"$sysinclude"
3351 add_ldflags --sysroot="$sysroot"
3352 ;;
3353 esac
3354 fi
3355
3356 if test "$cpu" = host; then
3357 enabled cross_compile &&
3358 die "--cpu=host makes no sense when cross-compiling."
3359
3360 case "$cc_type" in
3361 gcc|llvm_gcc)
3362 check_native(){
3363 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3364 sed -n "/cc1.*$1=/{
3365 s/.*$1=\\([^ ]*\\).*/\\1/
3366 p
3367 q
3368 }" $TMPE
3369 }
3370 cpu=$(check_native -march || check_native -mcpu)
3371 ;;
3372 esac
3373
3374 test "${cpu:-host}" = host &&
3375 die "--cpu=host not supported with compiler $cc"
3376 fi
3377
3378 # Deal with common $arch aliases
3379 case "$arch" in
3380 aarch64|arm64)
3381 arch="aarch64"
3382 ;;
3383 arm*)
3384 arch="arm"
3385 ;;
3386 mips*|IP*)
3387 case "$arch" in
3388 *el)
3389 add_cppflags -EL
3390 add_ldflags -EL
3391 ;;
3392 *eb)
3393 add_cppflags -EB
3394 add_ldflags -EB
3395 ;;
3396 esac
3397 arch="mips"
3398 ;;
3399 parisc*|hppa*)
3400 arch="parisc"
3401 ;;
3402 "Power Macintosh"|ppc*|powerpc*)
3403 arch="ppc"
3404 ;;
3405 s390|s390x)
3406 arch="s390"
3407 ;;
3408 sh4|sh)
3409 arch="sh4"
3410 ;;
3411 sun4u|sparc*)
3412 arch="sparc"
3413 ;;
3414 tilegx|tile-gx)
3415 arch="tilegx"
3416 ;;
3417 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
3418 arch="x86"
3419 ;;
3420 esac
3421
3422 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3423 enable $arch
3424
3425 # Add processor-specific flags
3426 if enabled aarch64; then
3427
3428 case $cpu in
3429 armv*)
3430 cpuflags="-march=$cpu"
3431 ;;
3432 *)
3433 cpuflags="-mcpu=$cpu"
3434 ;;
3435 esac
3436
3437 elif enabled alpha; then
3438
3439 cpuflags="-mcpu=$cpu"
3440
3441 elif enabled arm; then
3442
3443 check_arm_arch() {
3444 check_cpp_condition stddef.h \
3445 "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3446 $cpuflags
3447 }
3448
3449 probe_arm_arch() {
3450 if check_arm_arch 4; then echo armv4
3451 elif check_arm_arch 4T; then echo armv4t
3452 elif check_arm_arch 5; then echo armv5
3453 elif check_arm_arch 5E; then echo armv5e
3454 elif check_arm_arch 5T; then echo armv5t
3455 elif check_arm_arch 5TE; then echo armv5te
3456 elif check_arm_arch 5TEJ; then echo armv5te
3457 elif check_arm_arch 6; then echo armv6
3458 elif check_arm_arch 6J; then echo armv6j
3459 elif check_arm_arch 6K; then echo armv6k
3460 elif check_arm_arch 6Z; then echo armv6z
3461 elif check_arm_arch 6ZK; then echo armv6zk
3462 elif check_arm_arch 6T2; then echo armv6t2
3463 elif check_arm_arch 7; then echo armv7
3464 elif check_arm_arch 7A 7_A; then echo armv7-a
3465 elif check_arm_arch 7S; then echo armv7-a
3466 elif check_arm_arch 7R 7_R; then echo armv7-r
3467 elif check_arm_arch 7M 7_M; then echo armv7-m
3468 elif check_arm_arch 7EM 7E_M; then echo armv7-m
3469 elif check_arm_arch 8A 8_A; then echo armv8-a
3470 fi
3471 }
3472
3473 [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3474
3475 case $cpu in
3476 armv*)
3477 cpuflags="-march=$cpu"
3478 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3479 ;;
3480 *)
3481 cpuflags="-mcpu=$cpu"
3482 case $cpu in
3483 cortex-a*) subarch=armv7a ;;
3484 cortex-r*) subarch=armv7r ;;
3485 cortex-m*) enable thumb; subarch=armv7m ;;
3486 arm11*) subarch=armv6 ;;
3487 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3488 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
3489 *) subarch=$(probe_arm_arch) ;;
3490 esac
3491 ;;
3492 esac
3493
3494 case "$subarch" in
3495 armv5t*) enable fast_clz ;;
3496 armv[6-8]*) enable fast_clz fast_unaligned ;;
3497 esac
3498
3499 elif enabled avr32; then
3500
3501 case $cpu in
3502 ap7[02]0[0-2])
3503 subarch="avr32_ap"
3504 cpuflags="-mpart=$cpu"
3505 ;;
3506 ap)
3507 subarch="avr32_ap"
3508 cpuflags="-march=$cpu"
3509 ;;
3510 uc3[ab]*)
3511 subarch="avr32_uc"
3512 cpuflags="-mcpu=$cpu"
3513 ;;
3514 uc)
3515 subarch="avr32_uc"
3516 cpuflags="-march=$cpu"
3517 ;;
3518 esac
3519
3520 elif enabled bfin; then
3521
3522 cpuflags="-mcpu=$cpu"
3523
3524 elif enabled mips; then
3525
3526 cpuflags="-march=$cpu"
3527
3528 elif enabled ppc; then
3529
3530 disable ldbrx
3531
3532 case $(tolower $cpu) in
3533 601|ppc601|powerpc601)
3534 cpuflags="-mcpu=601"
3535 disable altivec
3536 ;;
3537 603*|ppc603*|powerpc603*)
3538 cpuflags="-mcpu=603"
3539 disable altivec
3540 ;;
3541 604*|ppc604*|powerpc604*)
3542 cpuflags="-mcpu=604"
3543 disable altivec
3544 ;;
3545 g3|75*|ppc75*|powerpc75*)
3546 cpuflags="-mcpu=750"
3547 disable altivec
3548 ;;
3549 g4|745*|ppc745*|powerpc745*)
3550 cpuflags="-mcpu=7450"
3551 disable vsx
3552 ;;
3553 74*|ppc74*|powerpc74*)
3554 cpuflags="-mcpu=7400"
3555 disable vsx
3556 ;;
3557 g5|970|ppc970|powerpc970)
3558 cpuflags="-mcpu=970"
3559 disable vsx
3560 ;;
3561 power[3-6]*)
3562 cpuflags="-mcpu=$cpu"
3563 disable vsx
3564 ;;
3565 power[7-8]*)
3566 cpuflags="-mcpu=$cpu"
3567 enable ldbrx
3568 ;;
3569 cell)
3570 cpuflags="-mcpu=cell"
3571 enable ldbrx
3572 disable vsx
3573 ;;
3574 e500mc)
3575 cpuflags="-mcpu=e500mc"
3576 disable altivec
3577 ;;
3578 e500v2)
3579 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
3580 disable altivec
3581 disable dcbzl
3582 ;;
3583 e500)
3584 cpuflags="-mcpu=8540 -mhard-float"
3585 disable altivec
3586 disable dcbzl
3587 ;;
3588 esac
3589
3590 elif enabled sparc; then
3591
3592 case $cpu in
3593 cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
3594 cpuflags="-mcpu=$cpu"
3595 ;;
3596 ultrasparc*|niagara[234])
3597 cpuflags="-mcpu=$cpu"
3598 ;;
3599 esac
3600
3601 elif enabled x86; then
3602
3603 case $cpu in
3604 i[345]86|pentium)
3605 cpuflags="-march=$cpu"
3606 disable i686
3607 disable mmx
3608 ;;
3609 # targets that do NOT support nopl and conditional mov (cmov)
3610 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
3611 cpuflags="-march=$cpu"
3612 disable i686
3613 ;;
3614 # targets that do support nopl and conditional mov (cmov)
3615 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*)
3616 cpuflags="-march=$cpu"
3617 enable i686
3618 enable fast_cmov
3619 ;;
3620 # targets that do support conditional mov but on which it's slow
3621 pentium4|pentium4m|prescott|nocona)
3622 cpuflags="-march=$cpu"
3623 enable i686
3624 disable fast_cmov
3625 ;;
3626 esac
3627
3628 fi
3629
3630 if [ "$cpu" != generic ]; then
3631 add_cflags $cpuflags
3632 add_asflags $cpuflags
3633 test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
3634 fi
3635
3636 # compiler sanity check
3637 check_exec <<EOF
3638 int main(void){ return 0; }
3639 EOF
3640 if test "$?" != 0; then
3641 echo "$cc is unable to create an executable file."
3642 if test -z "$cross_prefix" && ! enabled cross_compile ; then
3643 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
3644 echo "Only do this if you know what cross compiling means."
3645 fi
3646 die "C compiler test failed."
3647 fi
3648
3649 add_cppflags -D_ISOC99_SOURCE
3650 check_cflags -std=c99
3651 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
3652 #include <stdlib.h>
3653 EOF
3654 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
3655 #include <stdlib.h>
3656 EOF
3657
3658 add_host_cppflags -D_ISOC99_SOURCE
3659 check_host_cflags -std=c99
3660 check_host_cflags -Wall
3661 check_host_cflags -O3
3662
3663 check_64bit(){
3664 arch32=$1
3665 arch64=$2
3666 expr=$3
3667 check_code cc "" "int test[2*($expr) - 1]" &&
3668 subarch=$arch64 || subarch=$arch32
3669 }
3670
3671 case "$arch" in
3672 aarch64|alpha|ia64)
3673 spic=$shared
3674 ;;
3675 mips)
3676 check_64bit mips mips64 '_MIPS_SIM > 1'
3677 spic=$shared
3678 ;;
3679 parisc)
3680 check_64bit parisc parisc64 'sizeof(void *) > 4'
3681 spic=$shared
3682 ;;
3683 ppc)
3684 check_64bit ppc ppc64 'sizeof(void *) > 4'
3685 spic=$shared
3686 ;;
3687 s390)
3688 check_64bit s390 s390x 'sizeof(void *) > 4'
3689 spic=$shared
3690 ;;
3691 sparc)
3692 check_64bit sparc sparc64 'sizeof(void *) > 4'
3693 spic=$shared
3694 ;;
3695 x86)
3696 check_64bit x86_32 x86_64 'sizeof(void *) > 4'
3697 if test "$subarch" = "x86_64"; then
3698 spic=$shared
3699 fi
3700 ;;
3701 esac
3702
3703 enable $subarch
3704 enabled spic && enable_weak pic
3705
3706 # OS specific
3707 case $target_os in
3708 aix)
3709 SHFLAGS=-shared
3710 add_cppflags '-I\$(SRC_PATH)/compat/aix'
3711 enabled shared && add_ldflags -Wl,-brtl
3712 ;;
3713 android)
3714 disable symver
3715 enable section_data_rel_ro
3716 SLIB_INSTALL_NAME='$(SLIBNAME)'
3717 SLIB_INSTALL_LINKS=
3718 SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
3719 ;;
3720 haiku)
3721 prefix_default="/boot/common"
3722 network_extralibs="-lnetwork"
3723 host_libs=
3724 ;;
3725 sunos)
3726 SHFLAGS='-shared -Wl,-h,$$(@F)'
3727 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
3728 network_extralibs="-lsocket -lnsl"
3729 # When using suncc to build, the Solaris linker will mark
3730 # an executable with each instruction set encountered by
3731 # the Solaris assembler. As our libraries contain their own
3732 # guards for processor-specific code, instead suppress
3733 # generation of the HWCAPS ELF section on Solaris x86 only.
3734 enabled_all suncc x86 &&
3735 echo "hwcap_1 = OVERRIDE;" > mapfile &&
3736 add_ldflags -Wl,-M,mapfile
3737 nm_default='nm -P -g'
3738 SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
3739 ;;
3740 netbsd)
3741 disable symver
3742 oss_indev_extralibs="-lossaudio"
3743 oss_outdev_extralibs="-lossaudio"
3744 ;;
3745 openbsd|bitrig)
3746 disable symver
3747 SHFLAGS='-shared'
3748 SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
3749 SLIB_INSTALL_LINKS=
3750 oss_indev_extralibs="-lossaudio"
3751 oss_outdev_extralibs="-lossaudio"
3752 ;;
3753 dragonfly)
3754 disable symver
3755 ;;
3756 freebsd)
3757 ;;
3758 bsd/os)
3759 add_extralibs -lpoll -lgnugetopt
3760 ;;
3761 darwin)
3762 enabled ppc && add_asflags -force_cpusubtype_ALL
3763 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
3764 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
3765 add_ldflags -Wl,-dynamic,-search_paths_first
3766 SLIBSUF=".dylib"
3767 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
3768 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
3769 objformat="macho"
3770 enabled x86_64 && objformat="macho64"
3771 enabled_any pic shared ||
3772 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
3773 check_header dispatch/dispatch.h &&
3774 add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
3775 ;;
3776 msys*)
3777 die "Native MSYS builds are discouraged, please use the MINGW environment."
3778 ;;
3779 mingw32*|mingw64*)
3780 if test $target_os = "mingw32ce"; then
3781 disable network
3782 else
3783 target_os=mingw32
3784 fi
3785 LIBTARGET=i386
3786 if enabled x86_64; then
3787 LIBTARGET="i386:x86-64"
3788 elif enabled arm; then
3789 LIBTARGET=arm-wince
3790 fi
3791 check_ldflags -Wl,--nxcompat
3792 check_ldflags -Wl,--dynamicbase
3793 shlibdir_default="$bindir_default"
3794 SLIBPREF=""
3795 SLIBSUF=".dll"
3796 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3797 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3798 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)'
3799 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3800 SLIB_INSTALL_LINKS=
3801 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3802 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3803 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'
3804 objformat="win32"
3805 dlltool="${cross_prefix}dlltool"
3806 ranlib=:
3807 enable dos_paths
3808 ;;
3809 win32|win64)
3810 disable symver
3811 if enabled shared; then
3812 # Link to the import library instead of the normal static library
3813 # for shared libs.
3814 LD_LIB='%.lib'
3815 # Cannot build both shared and static libs with MSVC or icl.
3816 disable static
3817 fi
3818 shlibdir_default="$bindir_default"
3819 SLIBPREF=""
3820 SLIBSUF=".dll"
3821 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3822 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3823 SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
3824 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3825 SLIB_INSTALL_LINKS=
3826 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3827 SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3828 SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
3829 objformat="win32"
3830 ranlib=:
3831 enable dos_paths
3832 ;;
3833 cygwin*)
3834 target_os=cygwin
3835 shlibdir_default="$bindir_default"
3836 SLIBPREF="cyg"
3837 SLIBSUF=".dll"
3838 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3839 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3840 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3841 SLIB_INSTALL_LINKS=
3842 SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
3843 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
3844 objformat="win32"
3845 enable dos_paths
3846 ;;
3847 *-dos|freedos|opendos)
3848 network_extralibs="-lsocket"
3849 objformat="coff"
3850 enable dos_paths
3851 add_cppflags -U__STRICT_ANSI__
3852 ;;
3853 linux)
3854 enable dv1394
3855 enable section_data_rel_ro
3856 ;;
3857 irix*)
3858 target_os=irix
3859 ranlib="echo ignoring ranlib"
3860 ;;
3861 os/2*)
3862 ln_s="cp -f"
3863 objformat="aout"
3864 add_cppflags -D_GNU_SOURCE
3865 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
3866 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
3867 LIBSUF="_s.a"
3868 SLIBPREF=""
3869 SLIBSUF=".dll"
3870 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3871 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
3872 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
3873 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
3874 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
3875 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
3876 emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
3877 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
3878 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
3879 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
3880 enable dos_paths
3881 ;;
3882 gnu/kfreebsd)
3883 add_cppflags -D_BSD_SOURCE
3884 ;;
3885 gnu)
3886 ;;
3887 qnx)
3888 add_cppflags -D_QNX_SOURCE
3889 network_extralibs="-lsocket"
3890 ;;
3891 symbian)
3892 SLIBSUF=".dll"
3893 enable dos_paths
3894 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
3895 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
3896 add_ldflags -Wl,--target1-abs,--no-undefined \
3897 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
3898 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
3899 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
3900 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
3901 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
3902 ;;
3903 osf1)
3904 add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
3905 ;;
3906 minix)
3907 ;;
3908 plan9)
3909 add_cppflags -D_C99_SNPRINTF_EXTENSION \
3910 -D_REENTRANT_SOURCE \
3911 -D_RESEARCH_SOURCE \
3912 -DFD_SETSIZE=96 \
3913 -DHAVE_SOCK_OPTS
3914 add_compat strtod.o strtod=avpriv_strtod
3915 network_extralibs='-lbsd'
3916 exeobjs=compat/plan9/main.o
3917 cp_f='cp'
3918 ;;
3919 none)
3920 ;;
3921 *)
3922 die "Unknown OS '$target_os'."
3923 ;;
3924 esac
3925
3926 # determine libc flavour
3927
3928 probe_libc(){
3929 pfx=$1
3930 pfx_no_=${pfx%_}
3931 # uclibc defines __GLIBC__, so it needs to be checked before glibc.
3932 if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
3933 eval ${pfx}libc_type=uclibc
3934 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3935 elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
3936 eval ${pfx}libc_type=glibc
3937 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3938 # MinGW headers can be installed on Cygwin, so check for newlib first.
3939 elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
3940 eval ${pfx}libc_type=newlib
3941 add_${pfx}cppflags -U__STRICT_ANSI__
3942 # MinGW64 is backwards compatible with MinGW32, so check for it first.
3943 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
3944 eval ${pfx}libc_type=mingw64
3945 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3946 eval test \$${pfx_no_}cc_type = "gcc" &&
3947 add_${pfx}cppflags -D__printf__=__gnu_printf__
3948 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
3949 check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
3950 eval ${pfx}libc_type=mingw32
3951 check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
3952 (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
3953 die "ERROR: MinGW32 runtime version must be >= 3.15."
3954 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3955 eval test \$${pfx_no_}cc_type = "gcc" &&
3956 add_${pfx}cppflags -D__printf__=__gnu_printf__
3957 elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
3958 eval ${pfx}libc_type=msvcrt
3959 if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
3960 if [ "$pfx" = host_ ]; then
3961 add_host_cppflags -Dsnprintf=_snprintf
3962 else
3963 add_compat strtod.o strtod=avpriv_strtod
3964 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
3965 _snprintf=avpriv_snprintf \
3966 vsnprintf=avpriv_vsnprintf
3967 fi
3968 fi
3969 # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
3970 # 0x601 by default unless something else is set by the user.
3971 # This can easily lead to us detecting functions only present
3972 # in such new versions and producing binaries requiring windows 7.0.
3973 # Therefore explicitly set the default to XP unless the user has
3974 # set something else on the command line.
3975 # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
3976 # family. For these cases, configure is free to use any functions
3977 # found in the SDK headers by default. (Alternatively, we could force
3978 # _WIN32_WINNT to 0x0602 in that case.)
3979 check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
3980 { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
3981 #ifdef WINAPI_FAMILY
3982 #include <winapifamily.h>
3983 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
3984 #error not desktop
3985 #endif
3986 #endif
3987 EOF
3988 elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
3989 eval ${pfx}libc_type=klibc
3990 elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
3991 eval ${pfx}libc_type=bionic
3992 elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
3993 eval ${pfx}libc_type=solaris
3994 add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
3995 else
3996 eval ${pfx}libc_type=default
3997 add_${pfx}cppflags -D_DEFAULT_SOURCE
3998 fi
3999 }
4000
4001 probe_libc
4002 test -n "$libc_type" && enable libc_$libc_type
4003 probe_libc host_
4004 test -n "$host_libc_type" && enable host_libc_$host_libc_type
4005
4006 case $libc_type in
4007 bionic)
4008 add_compat strtod.o strtod=avpriv_strtod
4009 ;;
4010 esac
4011
4012 # hacks for compiler/libc/os combinations
4013
4014 if enabled_all tms470 libc_glibc; then
4015 CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
4016 add_cppflags -D__USER_LABEL_PREFIX__=
4017 add_cppflags -D__builtin_memset=memset
4018 add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
4019 add_cflags -pds=48 # incompatible redefinition of macro
4020 fi
4021
4022 if enabled_all ccc libc_glibc; then
4023 add_ldflags -Wl,-z,now # calls to libots crash without this
4024 fi
4025
4026 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
4027 add_cppflags '-I\$(SRC_PATH)/compat/float'
4028
4029 esc(){
4030 echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
4031 }
4032
4033 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
4034
4035 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
4036
4037 set_default $PATHS_LIST
4038 set_default nm
4039
4040 # we need to build at least one lib type
4041 if ! enabled_any static shared; then
4042 cat <<EOF
4043 At least one library type must be built.
4044 Specify --enable-static to build the static libraries or --enable-shared to
4045 build the shared libraries as well. To only build the shared libraries specify
4046 --disable-static in addition to --enable-shared.
4047 EOF
4048 exit 1
4049 fi
4050
4051 die_license_disabled() {
4052 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
4053 }
4054
4055 die_license_disabled gpl libcdio
4056 die_license_disabled gpl libx264
4057 die_license_disabled gpl libx265
4058 die_license_disabled gpl libxavs
4059 die_license_disabled gpl libxvid
4060 die_license_disabled gpl x11grab
4061
4062 die_license_disabled nonfree cuda
4063 die_license_disabled nonfree libfaac
4064 die_license_disabled nonfree libfdk_aac
4065 die_license_disabled nonfree libnpp
4066 die_license_disabled nonfree nvenc
4067 die_license_disabled nonfree openssl
4068
4069 die_license_disabled version3 libopencore_amrnb
4070 die_license_disabled version3 libopencore_amrwb
4071 die_license_disabled version3 libvo_aacenc
4072 die_license_disabled version3 libvo_amrwbenc
4073
4074 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
4075
4076 disabled optimizations || check_cflags -fomit-frame-pointer
4077
4078 enable_weak_pic() {
4079 disabled pic && return
4080 enable pic
4081 add_cppflags -DPIC
4082 case "$target_os" in
4083 mingw*|cygwin*)
4084 ;;
4085 *)
4086 add_cflags -fPIC
4087 ;;
4088 esac
4089 add_asflags -fPIC
4090 }
4091
4092 enabled pic && enable_weak_pic
4093
4094 check_cc <<EOF || die "Symbol mangling check failed."
4095 int ff_extern;
4096 EOF
4097 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
4098 extern_prefix=${sym%%ff_extern*}
4099
4100 check_cc <<EOF && enable_weak inline_asm
4101 void foo(void) { __asm__ volatile ("" ::); }
4102 EOF
4103
4104 _restrict=
4105 for restrict_keyword in restrict __restrict__ __restrict; do
4106 check_cc <<EOF && _restrict=$restrict_keyword && break
4107 void foo(char * $restrict_keyword p);
4108 EOF
4109 done
4110
4111 check_cc <<EOF && enable pragma_deprecated
4112 void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
4113 EOF
4114
4115 check_cc <<EOF && enable attribute_packed
4116 struct { int x; } __attribute__((packed)) x;
4117 EOF
4118
4119 check_cc <<EOF && enable attribute_may_alias
4120 union { int x; } __attribute__((may_alias)) x;
4121 EOF
4122
4123 check_cc <<EOF || die "endian test failed"
4124 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
4125 EOF
4126 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
4127
4128 check_gas() {
4129 log "check_gas using '$as' as AS"
4130 # :vararg is used on aarch64, arm and ppc altivec
4131 check_as <<EOF || return 1
4132 .macro m n, y:vararg=0
4133 \n: .int \y
4134 .endm
4135 m x
4136 EOF
4137 # .altmacro is only used in arm asm
4138 ! enabled arm || check_as <<EOF || return 1
4139 .altmacro
4140 EOF
4141 enable gnu_as
4142 return 0
4143 }
4144
4145 if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
4146 nogas=:
4147 enabled_any arm aarch64 && nogas=die
4148 enabled_all ppc altivec && nogas=warn
4149 as_noop=-v
4150
4151 case $as_type in
4152 arm*) gaspp_as_type=armasm; as_noop=-h ;;
4153 gcc) gaspp_as_type=gas ;;
4154 *) gaspp_as_type=$as_type ;;
4155 esac
4156
4157 [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
4158
4159 check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
4160 gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
4161
4162 if ! check_gas ; then
4163 as=${gas:=$as}
4164 check_gas || \
4165 $nogas "GNU assembler not found, install/update gas-preprocessor"
4166 fi
4167
4168 check_as <<EOF && enable as_func
4169 .func test
4170 .endfunc
4171 EOF
4172 fi
4173
4174 check_inline_asm inline_asm_labels '"1:\n"'
4175
4176 if enabled aarch64; then
4177 enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
4178 # internal assembler in clang 3.3 does not support this instruction
4179 enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
4180 enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
4181
4182 map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
4183
4184 elif enabled alpha; then
4185
4186 check_cflags -mieee
4187
4188 elif enabled arm; then
4189
4190 enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
4191 check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
4192 enabled thumb && check_cflags -mthumb || check_cflags -marm
4193
4194 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
4195 enable vfp_args
4196 elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
4197 enable vfp_args
4198 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
4199 case "${cross_prefix:-$cc}" in
4200 *hardfloat*) enable vfp_args; fpabi=vfp ;;
4201 *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
4202 __asm__ (".eabi_attribute 28, 1");
4203 int main(void) { return 0; }
4204 EOF
4205 esac
4206 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
4207 fi
4208
4209 enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
4210 enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
4211 enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
4212 enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
4213 enabled vfp && check_insn vfp 'fadds s0, s0, s0'
4214 enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
4215
4216 [ $target_os = linux ] || [ $target_os = android ] ||
4217 map 'enabled_any ${v}_external ${v}_inline || disable $v' \
4218 $ARCH_EXT_LIST_ARM
4219
4220 check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
4221
4222 check_as <<EOF && enable as_dn_directive
4223 ra .dn d0.i16
4224 .unreq ra
4225 EOF
4226
4227 # llvm's integrated assembler supports .object_arch from llvm 3.5
4228 [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
4229 .object_arch armv4
4230 EOF
4231
4232 [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
4233
4234 elif enabled mips; then
4235
4236 check_inline_asm loongson '"dmult.g $1, $2, $3"'
4237
4238 # make sure that only an instruction set is enabled
4239 disable mips64r6 mips32r6 mips64r2 mips32r2 mips64r1 mips32r1
4240
4241 if enabled mips64; then
4242 check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
4243 check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
4244 check_inline_asm mips64r1 '"daddi $0, $0, 0"'
4245 else
4246 check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
4247 check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
4248 check_inline_asm mips32r1 '"addi $0, $0, 0"'
4249 fi
4250
4251 elif enabled parisc; then
4252
4253 if enabled gcc; then
4254 case $($cc -dumpversion) in
4255 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
4256 esac
4257 fi
4258
4259 elif enabled ppc; then
4260
4261 enable local_aligned_8 local_aligned_16
4262
4263 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
4264 check_inline_asm ibm_asm '"add 0, 0, 0"'
4265 check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
4266 check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
4267
4268 # AltiVec flags: The FSF version of GCC differs from the Apple version
4269 if enabled altivec; then
4270 check_cflags -maltivec -mabi=altivec &&
4271 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
4272 check_cflags -faltivec
4273
4274 # check if our compiler supports Motorola AltiVec C API
4275 check_cc <<EOF || disable altivec
4276 $inc_altivec_h
4277 int main(void) {
4278 vector signed int v1 = (vector signed int) { 0 };
4279 vector signed int v2 = (vector signed int) { 1 };
4280 v1 = vec_add(v1, v2);
4281 return 0;
4282 }
4283 EOF
4284
4285 enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
4286 fi
4287
4288 if enabled vsx; then
4289 check_cflags -mvsx &&
4290 check_builtin vec_vsx_ld "altivec.h" "__builtin_vec_vsx_ld" || disable vsx
4291 fi
4292
4293 if enabled power8; then
4294 check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
4295 fi
4296
4297 elif enabled x86; then
4298
4299 check_builtin rdtsc intrin.h "__rdtsc()"
4300 check_builtin mm_empty mmintrin.h "_mm_empty()"
4301
4302 enable local_aligned_8 local_aligned_16
4303
4304 # check whether EBP is available on x86
4305 # As 'i' is stored on the stack, this program will crash
4306 # if the base pointer is used to access it because the
4307 # base pointer is cleared in the inline assembly code.
4308 check_exec_crash <<EOF && enable ebp_available
4309 volatile int i=0;
4310 __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
4311 return i;
4312 EOF
4313
4314 # check whether EBX is available on x86
4315 check_inline_asm ebx_available '""::"b"(0)' &&
4316 check_inline_asm ebx_available '"":::"%ebx"'
4317
4318 # check whether xmm clobbers are supported
4319 check_inline_asm xmm_clobbers '"":::"%xmm0"'
4320
4321 # check whether binutils is new enough to compile SSSE3/MMXEXT
4322 enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
4323 enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
4324
4325 if ! disabled_any asm mmx yasm; then
4326 if check_cmd $yasmexe --version; then
4327 enabled x86_64 && yasm_extra="-m amd64"
4328 yasm_debug="-g dwarf2"
4329 elif check_cmd nasm -v; then
4330 yasmexe=nasm
4331 yasm_debug="-g -F dwarf"
4332 enabled x86_64 && test "$objformat" = elf && objformat=elf64
4333 fi
4334
4335 YASMFLAGS="-f $objformat $yasm_extra"
4336 enabled pic && append YASMFLAGS "-DPIC"
4337 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
4338 case "$objformat" in
4339 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
4340 esac
4341
4342 check_yasm "movbe ecx, [5]" && enable yasm ||
4343 die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
4344 check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
4345 check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
4346 check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
4347 check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
4348 check_yasm "CPU amdnop" || disable cpunop
4349 fi
4350
4351 case "$cpu" in
4352 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
4353 disable fast_clz
4354 ;;
4355 esac
4356
4357 fi
4358
4359 check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
4360
4361 check_ldflags -Wl,--as-needed
4362
4363 if check_func dlopen; then
4364 ldl=
4365 elif check_func dlopen -ldl; then
4366 ldl=-ldl
4367 fi
4368
4369 if ! disabled network; then
4370 check_func getaddrinfo $network_extralibs
4371 check_func inet_aton $network_extralibs
4372
4373 check_type netdb.h "struct addrinfo"
4374 check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
4375 check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
4376 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
4377 check_type poll.h "struct pollfd"
4378 check_type netinet/sctp.h "struct sctp_event_subscribe"
4379 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
4380 check_type netinet/in.h "struct sockaddr_in6"
4381 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
4382 check_type "sys/types.h sys/socket.h" socklen_t
4383
4384 # Prefer arpa/inet.h over winsock2
4385 if check_header arpa/inet.h ; then
4386 check_func closesocket
4387 elif check_header winsock2.h ; then
4388 check_func_headers winsock2.h closesocket -lws2 &&
4389 network_extralibs="-lws2" ||
4390 { check_func_headers winsock2.h closesocket -lws2_32 &&
4391 network_extralibs="-lws2_32"; } || disable winsock2_h network
4392 check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
4393
4394 check_type ws2tcpip.h socklen_t
4395 check_type ws2tcpip.h "struct addrinfo"
4396 check_type ws2tcpip.h "struct group_source_req"
4397 check_type ws2tcpip.h "struct ip_mreq_source"
4398 check_type ws2tcpip.h "struct ipv6_mreq"
4399 check_type winsock2.h "struct pollfd"
4400 check_struct winsock2.h "struct sockaddr" sa_len
4401 check_type ws2tcpip.h "struct sockaddr_in6"