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