configure: use AS_O setting in check_as
[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 show_help(){
58 cat <<EOF
59 Usage: configure [options]
60 Options: [defaults in brackets after descriptions]
61
62 Help options:
63 --help print this message
64 --list-decoders show all available decoders
65 --list-encoders show all available encoders
66 --list-hwaccels show all available hardware accelerators
67 --list-demuxers show all available demuxers
68 --list-muxers show all available muxers
69 --list-parsers show all available parsers
70 --list-protocols show all available protocols
71 --list-bsfs show all available bitstream filters
72 --list-indevs show all available input devices
73 --list-outdevs show all available output devices
74 --list-filters show all available filters
75
76 Standard options:
77 --logfile=FILE log tests and output to FILE [config.log]
78 --disable-logging do not log configure debug information
79 --prefix=PREFIX install in PREFIX [$prefix]
80 --bindir=DIR install binaries in DIR [PREFIX/bin]
81 --datadir=DIR install data files in DIR [PREFIX/share/avconv]
82 --libdir=DIR install libs in DIR [PREFIX/lib]
83 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
84 --incdir=DIR install includes in DIR [PREFIX/include]
85 --mandir=DIR install man page in DIR [PREFIX/share/man]
86
87 Licensing options:
88 --enable-gpl allow use of GPL code, the resulting libs
89 and binaries will be under GPL [no]
90 --enable-version3 upgrade (L)GPL to version 3 [no]
91 --enable-nonfree allow use of nonfree code, the resulting libs
92 and binaries will be unredistributable [no]
93
94 Configuration options:
95 --disable-static do not build static libraries [no]
96 --enable-shared build shared libraries [no]
97 --enable-small optimize for size instead of speed
98 --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
99 --enable-gray enable full grayscale support (slower color)
100 --disable-swscale-alpha disable alpha channel support in swscale
101
102 Component options:
103 --disable-doc do not build documentation
104 --disable-avconv disable avconv build
105 --disable-avplay disable avplay build
106 --disable-avprobe disable avprobe build
107 --disable-avserver disable avserver build
108 --disable-avdevice disable libavdevice build
109 --disable-avcodec disable libavcodec build
110 --disable-avformat disable libavformat build
111 --disable-swscale disable libswscale build
112 --disable-avfilter disable video filter support [no]
113 --disable-avresample disable libavresample build [no]
114 --disable-pthreads disable pthreads [auto]
115 --disable-w32threads disable Win32 threads [auto]
116 --enable-x11grab enable X11 grabbing [no]
117 --disable-network disable network support [no]
118 --disable-dct disable DCT code
119 --disable-dwt disable DWT code
120 --disable-lsp disable LSP code
121 --disable-mdct disable MDCT code
122 --disable-rdft disable RDFT code
123 --disable-fft disable FFT code
124 --enable-dxva2 enable DXVA2 code
125 --enable-vaapi enable VAAPI code
126 --enable-vda enable VDA code
127 --enable-vdpau enable VDPAU code
128
129 Individual component options:
130 --disable-everything disable all components listed below
131 --disable-encoder=NAME disable encoder NAME
132 --enable-encoder=NAME enable encoder NAME
133 --disable-encoders disable all encoders
134 --disable-decoder=NAME disable decoder NAME
135 --enable-decoder=NAME enable decoder NAME
136 --disable-decoders disable all decoders
137 --disable-hwaccel=NAME disable hwaccel NAME
138 --enable-hwaccel=NAME enable hwaccel NAME
139 --disable-hwaccels disable all hwaccels
140 --disable-muxer=NAME disable muxer NAME
141 --enable-muxer=NAME enable muxer NAME
142 --disable-muxers disable all muxers
143 --disable-demuxer=NAME disable demuxer NAME
144 --enable-demuxer=NAME enable demuxer NAME
145 --disable-demuxers disable all demuxers
146 --enable-parser=NAME enable parser NAME
147 --disable-parser=NAME disable parser NAME
148 --disable-parsers disable all parsers
149 --enable-bsf=NAME enable bitstream filter NAME
150 --disable-bsf=NAME disable bitstream filter NAME
151 --disable-bsfs disable all bitstream filters
152 --enable-protocol=NAME enable protocol NAME
153 --disable-protocol=NAME disable protocol NAME
154 --disable-protocols disable all protocols
155 --enable-indev=NAME enable input device NAME
156 --disable-indev=NAME disable input device NAME
157 --disable-indevs disable input devices
158 --enable-outdev=NAME enable output device NAME
159 --disable-outdev=NAME disable output device NAME
160 --disable-outdevs disable output devices
161 --disable-devices disable all devices
162 --enable-filter=NAME enable filter NAME
163 --disable-filter=NAME disable filter NAME
164 --disable-filters disable all filters
165
166 External library support:
167 --enable-avisynth enable reading of AVISynth script files [no]
168 --enable-bzlib enable bzlib [autodetect]
169 --enable-frei0r enable frei0r video filtering
170 --enable-gnutls enable gnutls [no]
171 --enable-libcdio enable audio CD grabbing with libcdio
172 --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
173 and libraw1394 [no]
174 --enable-libfaac enable AAC encoding via libfaac [no]
175 --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
176 --enable-libfreetype enable libfreetype [no]
177 --enable-libgsm enable GSM de/encoding via libgsm [no]
178 --enable-libilbc enable iLBC de/encoding via libilbc [no]
179 --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
180 --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
181 --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
182 --enable-libopencv enable video filtering via libopencv [no]
183 --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
184 --enable-libpulse enable Pulseaudio input via libpulse [no]
185 --enable-librtmp enable RTMP[E] support via librtmp [no]
186 --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
187 --enable-libspeex enable Speex de/encoding via libspeex [no]
188 --enable-libtheora enable Theora encoding via libtheora [no]
189 --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
190 --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
191 --enable-libvorbis enable Vorbis encoding via libvorbis [no]
192 --enable-libvpx enable VP8 de/encoding via libvpx [no]
193 --enable-libx264 enable H.264 encoding via x264 [no]
194 --enable-libxavs enable AVS encoding via xavs [no]
195 --enable-libxvid enable Xvid encoding via xvidcore,
196 native MPEG-4/Xvid encoder exists [no]
197 --enable-openssl enable openssl [no]
198 --enable-zlib enable zlib [autodetect]
199
200 Advanced options (experts only):
201 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
202 --enable-cross-compile assume a cross-compiler is used
203 --sysroot=PATH root of cross-build tree
204 --sysinclude=PATH location of cross-build system headers
205 --target-os=OS compiler targets OS [$target_os]
206 --target-exec=CMD command to run executables on target
207 --target-path=DIR path to view of build directory on target
208 --nm=NM use nm tool
209 --ar=AR use archive tool AR [$ar_default]
210 --as=AS use assembler AS [$as_default]
211 --cc=CC use C compiler CC [$cc_default]
212 --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
213 --ld=LD use linker LD
214 --host-cc=HOSTCC use host C compiler HOSTCC
215 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
216 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
217 --host-libs=HLIBS use libs HLIBS when linking for host
218 --host-os=OS compiler host OS [$target_os]
219 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
220 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
221 --extra-libs=ELIBS add ELIBS [$ELIBS]
222 --extra-version=STRING version string suffix []
223 --optflags=OPTFLAGS override optimization-related compiler flags
224 --build-suffix=SUFFIX library name suffix []
225 --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
226 --arch=ARCH select architecture [$arch]
227 --cpu=CPU select the minimum required CPU (affects
228 instruction selection, may crash on older CPUs)
229 --enable-pic build position-independent code
230 --enable-sram allow use of on-chip SRAM
231 --enable-thumb compile for Thumb instruction set
232 --disable-symver disable symbol versioning
233 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
234 --disable-safe-bitstream-reader
235 disable buffer boundary checking in bitreaders
236 (faster, but may crash)
237 --enable-memalign-hack emulate memalign, interferes with memory debuggers
238
239 Optimization options (experts only):
240 --disable-asm disable all assembler optimizations
241 --disable-altivec disable AltiVec optimizations
242 --disable-amd3dnow disable 3DNow! optimizations
243 --disable-amd3dnowext disable 3DNow! extended optimizations
244 --disable-mmx disable MMX optimizations
245 --disable-mmxext disable MMXEXT optimizations
246 --disable-sse disable SSE optimizations
247 --disable-ssse3 disable SSSE3 optimizations
248 --disable-avx disable AVX optimizations
249 --disable-fma4 disable FMA4 optimizations
250 --disable-armv5te disable armv5te optimizations
251 --disable-armv6 disable armv6 optimizations
252 --disable-armv6t2 disable armv6t2 optimizations
253 --disable-armvfp disable ARM VFP optimizations
254 --disable-mmi disable MMI optimizations
255 --disable-neon disable NEON optimizations
256 --disable-vis disable VIS optimizations
257 --disable-yasm disable use of yasm assembler
258
259 Developer options (useful when working on Libav itself):
260 --disable-debug disable debugging symbols
261 --enable-debug=LEVEL set the debug level [$debuglevel]
262 --disable-optimizations disable compiler optimizations
263 --enable-extra-warnings enable more compiler warnings
264 --samples=PATH location of test samples for FATE, if not set use
265 \$LIBAV_SAMPLES at make invocation time.
266 --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
267 should be used only for debugging purposes)
268 --enable-random randomly enable/disable components
269 --disable-random
270 --enable-random=LIST randomly enable/disable specific components or
271 --disable-random=LIST component groups. LIST is a comma-separated list
272 of NAME[:PROB] entries where NAME is a component
273 (group) and PROB the probability associated with
274 NAME (default 0.5).
275 --random-seed=VALUE seed value for --enable/disable-random
276
277 NOTE: Object files are built at the place where configure is launched.
278 EOF
279 exit 0
280 }
281
282 quotes='""'
283
284 log(){
285 echo "$@" >> $logfile
286 }
287
288 log_file(){
289 log BEGIN $1
290 pr -n -t $1 >> $logfile
291 log END $1
292 }
293
294 echolog(){
295 log "$@"
296 echo "$@"
297 }
298
299 warn(){
300 log "WARNING: $*"
301 WARNINGS="${WARNINGS}WARNING: $*\n"
302 }
303
304 die(){
305 echolog "$@"
306 cat <<EOF
307
308 If you think configure made a mistake, make sure you are using the latest
309 version from Git. If the latest version fails, report the problem to the
310 libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
311 EOF
312 if disabled logging; then
313 cat <<EOF
314 Rerun configure with logging enabled (do not use --disable-logging), and
315 include the log this produces with your report.
316 EOF
317 else
318 cat <<EOF
319 Include the log file "$logfile" produced by configure as this will help
320 solving the problem.
321 EOF
322 fi
323 exit 1
324 }
325
326 # Avoid locale weirdness, besides we really just want to translate ASCII.
327 toupper(){
328 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
329 }
330
331 tolower(){
332 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
333 }
334
335 c_escape(){
336 echo "$*" | sed 's/["\\]/\\\0/g'
337 }
338
339 sh_quote(){
340 v=$(echo "$1" | sed "s/'/'\\\\''/g")
341 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
342 echo "$v"
343 }
344
345 cleanws(){
346 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
347 }
348
349 filter(){
350 pat=$1
351 shift
352 for v; do
353 eval "case $v in $pat) echo $v ;; esac"
354 done
355 }
356
357 filter_out(){
358 pat=$1
359 shift
360 for v; do
361 eval "case $v in $pat) ;; *) echo $v ;; esac"
362 done
363 }
364
365 map(){
366 m=$1
367 shift
368 for v; do eval $m; done
369 }
370
371 set_all(){
372 value=$1
373 shift
374 for var in $*; do
375 eval $var=$value
376 done
377 }
378
379 set_weak(){
380 value=$1
381 shift
382 for var; do
383 eval : \${$var:=$value}
384 done
385 }
386
387 set_safe(){
388 var=$1
389 shift
390 eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
391 }
392
393 get_safe(){
394 eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
395 }
396
397 pushvar(){
398 for var in $*; do
399 eval level=\${${var}_level:=0}
400 eval ${var}_${level}="\$$var"
401 eval ${var}_level=$(($level+1))
402 done
403 }
404
405 popvar(){
406 for var in $*; do
407 eval level=\${${var}_level:-0}
408 test $level = 0 && continue
409 eval level=$(($level-1))
410 eval $var="\${${var}_${level}}"
411 eval ${var}_level=$level
412 eval unset ${var}_${level}
413 done
414 }
415
416 enable(){
417 set_all yes $*
418 }
419
420 disable(){
421 set_all no $*
422 }
423
424 enable_weak(){
425 set_weak yes $*
426 }
427
428 disable_weak(){
429 set_weak no $*
430 }
431
432 enable_safe(){
433 for var; do
434 enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
435 done
436 }
437
438 disable_safe(){
439 for var; do
440 disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
441 done
442 }
443
444 do_enable_deep(){
445 for var; do
446 enabled $var && continue
447 eval sel="\$${var}_select"
448 eval sgs="\$${var}_suggest"
449 pushvar var sgs
450 enable_deep $sel
451 popvar sgs
452 enable_deep_weak $sgs
453 popvar var
454 done
455 }
456
457 enable_deep(){
458 do_enable_deep $*
459 enable $*
460 }
461
462 enable_deep_weak(){
463 do_enable_deep $*
464 enable_weak $*
465 }
466
467 enabled(){
468 test "${1#!}" = "$1" && op== || op=!=
469 eval test "x\$${1#!}" $op "xyes"
470 }
471
472 disabled(){
473 test "${1#!}" = "$1" && op== || op=!=
474 eval test "x\$${1#!}" $op "xno"
475 }
476
477 enabled_all(){
478 for opt; do
479 enabled $opt || return 1
480 done
481 }
482
483 disabled_all(){
484 for opt; do
485 disabled $opt || return 1
486 done
487 }
488
489 enabled_any(){
490 for opt; do
491 enabled $opt && return 0
492 done
493 }
494
495 disabled_any(){
496 for opt; do
497 disabled $opt && return 0
498 done
499 return 1
500 }
501
502 set_default(){
503 for opt; do
504 eval : \${$opt:=\$${opt}_default}
505 done
506 }
507
508 is_in(){
509 value=$1
510 shift
511 for var in $*; do
512 [ $var = $value ] && return 0
513 done
514 return 1
515 }
516
517 check_deps(){
518 for cfg; do
519 cfg="${cfg#!}"
520 enabled ${cfg}_checking && die "Circular dependency for $cfg."
521 disabled ${cfg}_checking && continue
522 enable ${cfg}_checking
523
524 eval dep_all="\$${cfg}_deps"
525 eval dep_any="\$${cfg}_deps_any"
526 eval dep_sel="\$${cfg}_select"
527 eval dep_sgs="\$${cfg}_suggest"
528 eval dep_ifa="\$${cfg}_if"
529 eval dep_ifn="\$${cfg}_if_any"
530
531 pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
532 check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
533 popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
534
535 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
536 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
537 enabled_all $dep_all || disable $cfg
538 enabled_any $dep_any || disable $cfg
539 disabled_any $dep_sel && disable $cfg
540
541 if enabled $cfg; then
542 eval dep_extralibs="\$${cfg}_extralibs"
543 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
544 enable_deep $dep_sel
545 enable_deep_weak $dep_sgs
546 fi
547
548 disable ${cfg}_checking
549 done
550 }
551
552 print_config_h(){
553 enabled $1 && v=1 || v=0
554 echo "#define $2 $v"
555 }
556
557 print_config_mak(){
558 enabled $1 && v= || v=!
559 echo "$v$2=yes"
560 }
561
562 print_config_asm(){
563 enabled $1 && v=1 || v=0
564 echo "%define $2 $v"
565 }
566
567 print_config(){
568 pfx=$1
569 files=$2
570 shift 2
571 for cfg; do
572 ucname="$(toupper $cfg)"
573 for f in $files; do
574 "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
575 done
576 done
577 }
578
579 print_enabled(){
580 test "$1" = -n && end=" " && shift || end="\n"
581 suf=$1
582 shift
583 for v; do
584 enabled $v && printf "%s$end" ${v%$suf};
585 done
586 }
587
588 append(){
589 var=$1
590 shift
591 eval "$var=\"\$$var $*\""
592 }
593
594 prepend(){
595 var=$1
596 shift
597 eval "$var=\"$* \$$var\""
598 }
599
600 add_cppflags(){
601 append CPPFLAGS "$@"
602 }
603
604 add_cflags(){
605 append CFLAGS $($cflags_filter "$@")
606 }
607
608 add_asflags(){
609 append ASFLAGS $($asflags_filter "$@")
610 }
611
612 add_ldflags(){
613 append LDFLAGS $($ldflags_filter "$@")
614 }
615
616 add_extralibs(){
617 prepend extralibs $($ldflags_filter "$@")
618 }
619
620 add_host_cflags(){
621 append host_cflags $($host_cflags_filter "$@")
622 }
623
624 add_host_ldflags(){
625 append host_ldflags $($host_ldflags_filter "$@")
626 }
627
628 check_cmd(){
629 log "$@"
630 "$@" >> $logfile 2>&1
631 }
632
633 cc_o(){
634 eval printf '%s\\n' $CC_O
635 }
636
637 cc_e(){
638 eval printf '%s\\n' $CC_E
639 }
640
641 check_cc(){
642 log check_cc "$@"
643 cat > $TMPC
644 log_file $TMPC
645 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
646 }
647
648 check_cpp(){
649 log check_cpp "$@"
650 cat > $TMPC
651 log_file $TMPC
652 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
653 }
654
655 as_o(){
656 eval printf '%s\\n' $AS_O
657 }
658
659 check_as(){
660 log check_as "$@"
661 cat > $TMPC
662 log_file $TMPC
663 check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPC
664 }
665
666 check_inline_asm(){
667 log check_inline_asm "$@"
668 name="$1"
669 code="$2"
670 shift 2
671 disable $name
672 check_as "$@" <<EOF && enable $name
673 void foo(void){ __asm__ volatile($code); }
674 EOF
675 }
676
677 check_yasm(){
678 log check_yasm "$@"
679 echo "$1" > $TMPS
680 log_file $TMPS
681 shift 1
682 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
683 }
684
685 ld_o(){
686 eval printf '%s\\n' $LD_O
687 }
688
689 check_ld(){
690 log check_ld "$@"
691 flags=''
692 libs=''
693 for f; do
694 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
695 done
696 check_cc $($cflags_filter $flags) || return
697 flags=$($ldflags_filter $flags)
698 libs=$($ldflags_filter $libs)
699 check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
700 }
701
702 check_code(){
703 log check_code "$@"
704 check=$1
705 headers=$2
706 code=$3
707 shift 3
708 {
709 for hdr in $headers; do
710 echo "#include <$hdr>"
711 done
712 echo "int main(void) { $code; return 0; }"
713 } | check_$check "$@"
714 }
715
716 check_cppflags(){
717 log check_cppflags "$@"
718 check_cc "$@" <<EOF && append CPPFLAGS "$@"
719 int x;
720 EOF
721 }
722
723 check_cflags(){
724 log check_cflags "$@"
725 set -- $($cflags_filter "$@")
726 check_cc "$@" <<EOF && append CFLAGS "$@"
727 int x;
728 EOF
729 }
730
731 test_ldflags(){
732 log test_ldflags "$@"
733 check_ld "$@" <<EOF
734 int main(void){ return 0; }
735 EOF
736 }
737
738 check_ldflags(){
739 log check_ldflags "$@"
740 test_ldflags "$@" && add_ldflags "$@"
741 }
742
743 check_header(){
744 log check_header "$@"
745 header=$1
746 shift
747 disable_safe $header
748 check_cpp "$@" <<EOF && enable_safe $header
749 #include <$header>
750 int x;
751 EOF
752 }
753
754 check_func(){
755 log check_func "$@"
756 func=$1
757 shift
758 disable $func
759 check_ld "$@" <<EOF && enable $func
760 extern int $func();
761 int main(void){ $func(); }
762 EOF
763 }
764
765 check_mathfunc(){
766 log check_mathfunc "$@"
767 func=$1
768 shift
769 disable $func
770 check_ld "$@" <<EOF && enable $func
771 #include <math.h>
772 float foo(float f) { return $func(f); }
773 int main(void){ return 0; }
774 EOF
775 }
776
777 check_func_headers(){
778 log check_func_headers "$@"
779 headers=$1
780 funcs=$2
781 shift 2
782 {
783 for hdr in $headers; do
784 echo "#include <$hdr>"
785 done
786 for func in $funcs; do
787 echo "long check_$func(void) { return (long) $func; }"
788 done
789 echo "int main(void) { return 0; }"
790 } | check_ld "$@" && enable $funcs && enable_safe $headers
791 }
792
793 check_cpp_condition(){
794 log check_cpp_condition "$@"
795 header=$1
796 condition=$2
797 shift 2
798 check_cpp "$@" <<EOF
799 #include <$header>
800 #if !($condition)
801 #error "unsatisfied condition: $condition"
802 #endif
803 EOF
804 }
805
806 check_lib(){
807 log check_lib "$@"
808 header="$1"
809 func="$2"
810 shift 2
811 check_header $header && check_func $func "$@" && add_extralibs "$@"
812 }
813
814 check_lib2(){
815 log check_lib2 "$@"
816 headers="$1"
817 funcs="$2"
818 shift 2
819 check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
820 }
821
822 check_pkg_config(){
823 log check_pkg_config "$@"
824 pkg="$1"
825 headers="$2"
826 funcs="$3"
827 shift 3
828 $pkg_config --exists $pkg || return
829 pkg_cflags=$($pkg_config --cflags $pkg)
830 pkg_libs=$($pkg_config --libs $pkg)
831 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
832 set_safe ${pkg}_cflags $pkg_cflags &&
833 set_safe ${pkg}_libs $pkg_libs
834 }
835
836 check_exec(){
837 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
838 }
839
840 check_exec_crash(){
841 code=$(cat)
842
843 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
844 # are safe but may not be available everywhere. Thus we use
845 # raise(SIGTERM) instead. The check is run in a subshell so we
846 # can redirect the "Terminated" message from the shell. SIGBUS
847 # is not defined by standard C so it is used conditionally.
848
849 (check_exec "$@") >> $logfile 2>&1 <<EOF
850 #include <signal.h>
851 static void sighandler(int sig){
852 raise(SIGTERM);
853 }
854 int main(void){
855 signal(SIGILL, sighandler);
856 signal(SIGFPE, sighandler);
857 signal(SIGSEGV, sighandler);
858 #ifdef SIGBUS
859 signal(SIGBUS, sighandler);
860 #endif
861 { $code }
862 }
863 EOF
864 }
865
866 check_type(){
867 log check_type "$@"
868 headers=$1
869 type=$2
870 shift 2
871 disable_safe "$type"
872 check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
873 }
874
875 check_struct(){
876 log check_type "$@"
877 headers=$1
878 struct=$2
879 member=$3
880 shift 3
881 disable_safe "${struct}_${member}"
882 check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
883 enable_safe "${struct}_${member}"
884 }
885
886 require(){
887 name="$1"
888 header="$2"
889 func="$3"
890 shift 3
891 check_lib $header $func "$@" || die "ERROR: $name not found"
892 }
893
894 require2(){
895 name="$1"
896 headers="$2"
897 func="$3"
898 shift 3
899 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
900 }
901
902 require_pkg_config(){
903 pkg="$1"
904 check_pkg_config "$@" || die "ERROR: $pkg not found"
905 add_cflags $(get_safe ${pkg}_cflags)
906 add_extralibs $(get_safe ${pkg}_libs)
907 }
908
909 check_host_cc(){
910 log check_host_cc "$@"
911 cat > $TMPC
912 log_file $TMPC
913 check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
914 }
915
916 check_host_cflags(){
917 log check_host_cflags "$@"
918 set -- $($host_cflags_filter "$@")
919 check_host_cc "$@" <<EOF && append host_cflags "$@"
920 int x;
921 EOF
922 }
923
924 apply(){
925 file=$1
926 shift
927 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
928 }
929
930 cp_if_changed(){
931 cmp -s "$1" "$2" && echo "$2 is unchanged" && return
932 mkdir -p "$(dirname $2)"
933 cp -f "$1" "$2"
934 }
935
936 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
937 # system-dependent things.
938
939 COMPONENT_LIST="
940 bsfs
941 decoders
942 demuxers
943 encoders
944 filters
945 hwaccels
946 indevs
947 muxers
948 outdevs
949 parsers
950 protocols
951 "
952
953 PROGRAM_LIST="
954 avconv
955 avplay
956 avprobe
957 avserver
958 "
959
960 CONFIG_LIST="
961 $COMPONENT_LIST
962 $PROGRAM_LIST
963 avcodec
964 avdevice
965 avfilter
966 avformat
967 avresample
968 avisynth
969 bzlib
970 dct
971 doc
972 dwt
973 dxva2
974 fft
975 frei0r
976 gnutls
977 gpl
978 gray
979 hardcoded_tables
980 libcdio
981 libdc1394
982 libfaac
983 libfdk_aac
984 libfreetype
985 libgsm
986 libilbc
987 libmp3lame
988 libopencore_amrnb
989 libopencore_amrwb
990 libopencv
991 libopenjpeg
992 libpulse
993 librtmp
994 libschroedinger
995 libspeex
996 libtheora
997 libvo_aacenc
998 libvo_amrwbenc
999 libvorbis
1000 libvpx
1001 libx264
1002 libxavs
1003 libxvid
1004 lsp
1005 mdct
1006 memalign_hack
1007 network
1008 nonfree
1009 openssl
1010 pic
1011 rdft
1012 runtime_cpudetect
1013 safe_bitstream_reader
1014 shared
1015 small
1016 sram
1017 static
1018 swscale
1019 swscale_alpha
1020 thumb
1021 vaapi
1022 vda
1023 vdpau
1024 version3
1025 xmm_clobber_test
1026 x11grab
1027 zlib
1028 "
1029
1030 THREADS_LIST='
1031 pthreads
1032 w32threads
1033 '
1034
1035 ARCH_LIST='
1036 alpha
1037 arm
1038 avr32
1039 avr32_ap
1040 avr32_uc
1041 bfin
1042 ia64
1043 m68k
1044 mips
1045 mips64
1046 parisc
1047 ppc
1048 ppc64
1049 s390
1050 sh4
1051 sparc
1052 sparc64
1053 tomi
1054 x86
1055 x86_32
1056 x86_64
1057 '
1058
1059 ARCH_EXT_LIST='
1060 altivec
1061 amd3dnow
1062 amd3dnowext
1063 armv5te
1064 armv6
1065 armv6t2
1066 armvfp
1067 avx
1068 fma4
1069 mmi
1070 mmx
1071 mmxext
1072 neon
1073 ppc4xx
1074 sse
1075 ssse3
1076 vfpv3
1077 vis
1078 '
1079
1080 HAVE_LIST_PUB='
1081 bigendian
1082 fast_unaligned
1083 '
1084
1085 HAVE_LIST="
1086 $ARCH_EXT_LIST
1087 $HAVE_LIST_PUB
1088 $THREADS_LIST
1089 aligned_malloc
1090 aligned_stack
1091 alsa_asoundlib_h
1092 altivec_h
1093 arpa_inet_h
1094 asm_mod_q
1095 asm_mod_y
1096 attribute_may_alias
1097 attribute_packed
1098 cbrtf
1099 closesocket
1100 cmov
1101 cpuid
1102 cpunop
1103 dcbzl
1104 dev_bktr_ioctl_bt848_h
1105 dev_bktr_ioctl_meteor_h
1106 dev_ic_bt8xx_h
1107 dev_video_bktr_ioctl_bt848_h
1108 dev_video_meteor_ioctl_meteor_h
1109 dlfcn_h
1110 dlopen
1111 dos_paths
1112 dxva_h
1113 ebp_available
1114 ebx_available
1115 exp2
1116 exp2f
1117 fast_64bit
1118 fast_clz
1119 fast_cmov
1120 fcntl
1121 fork
1122 getaddrinfo
1123 gethrtime
1124 getopt
1125 GetProcessAffinityMask
1126 GetProcessMemoryInfo
1127 GetProcessTimes
1128 GetSystemTimeAsFileTime
1129 getrusage
1130 gettimeofday
1131 gnu_as
1132 ibm_asm
1133 inet_aton
1134 inline_asm
1135 io_h
1136 isatty
1137 isinf
1138 isnan
1139 jack_port_get_latency_range
1140 ldbrx
1141 libdc1394_1
1142 libdc1394_2
1143 llrint
1144 llrintf
1145 local_aligned_16
1146 local_aligned_8
1147 localtime_r
1148 log2
1149 log2f
1150 loongson
1151 lrint
1152 lrintf
1153 machine_ioctl_bt848_h
1154 machine_ioctl_meteor_h
1155 malloc_h
1156 MapViewOfFile
1157 memalign
1158 mkstemp
1159 mm_empty
1160 mmap
1161 nanosleep
1162 poll_h
1163 posix_memalign
1164 rdtsc
1165 rint
1166 round
1167 roundf
1168 rweflags
1169 sched_getaffinity
1170 sdl
1171 sdl_video_size
1172 setmode
1173 setrlimit
1174 Sleep
1175 sndio_h
1176 socklen_t
1177 soundcard_h
1178 strerror_r
1179 strptime
1180 strtok_r
1181 struct_addrinfo
1182 struct_group_source_req
1183 struct_ip_mreq_source
1184 struct_ipv6_mreq
1185 struct_pollfd
1186 struct_rusage_ru_maxrss
1187 struct_sockaddr_in6
1188 struct_sockaddr_sa_len
1189 struct_sockaddr_storage
1190 struct_v4l2_frmivalenum_discrete
1191 symver
1192 symver_asm_label
1193 symver_gnu_asm
1194 sysconf
1195 sysctl
1196 sys_mman_h
1197 sys_param_h
1198 sys_resource_h
1199 sys_select_h
1200 sys_soundcard_h
1201 sys_time_h
1202 sys_videoio_h
1203 threads
1204 trunc
1205 truncf
1206 unistd_h
1207 usleep
1208 vfp_args
1209 VirtualAlloc
1210 windows_h
1211 winsock2_h
1212 xform_asm
1213 xgetbv
1214 xmm_clobbers
1215 yasm
1216 "
1217
1218 # options emitted with CONFIG_ prefix but not available on command line
1219 CONFIG_EXTRA="
1220 aandcttables
1221 ac3dsp
1222 avutil
1223 error_resilience
1224 gcrypt
1225 golomb
1226 gplv3
1227 h264chroma
1228 h264dsp
1229 h264pred
1230 h264qpel
1231 huffman
1232 lgplv3
1233 lpc
1234 mpegaudiodsp
1235 mpegvideo
1236 mpegvideoenc
1237 nettle
1238 rangecoder
1239 rtpdec
1240 sinewin
1241 vp3dsp
1242 "
1243
1244 CMDLINE_SELECT="
1245 $ARCH_EXT_LIST
1246 $CONFIG_LIST
1247 $THREADS_LIST
1248 asm
1249 cross_compile
1250 debug
1251 extra_warnings
1252 logging
1253 optimizations
1254 symver
1255 yasm
1256 "
1257
1258 PATHS_LIST='
1259 bindir
1260 datadir
1261 incdir
1262 libdir
1263 mandir
1264 prefix
1265 shlibdir
1266 '
1267
1268 CMDLINE_SET="
1269 $PATHS_LIST
1270 ar
1271 arch
1272 as
1273 build_suffix
1274 cc
1275 cpu
1276 cross_prefix
1277 dep_cc
1278 extra_version
1279 host_cc
1280 host_cflags
1281 host_ldflags
1282 host_libs
1283 host_os
1284 ld
1285 logfile
1286 malloc_prefix
1287 nm
1288 optflags
1289 pkg_config
1290 random_seed
1291 samples
1292 sysinclude
1293 sysroot
1294 target_exec
1295 target_os
1296 target_path
1297 "
1298
1299 CMDLINE_APPEND="
1300 extra_cflags
1301 "
1302
1303 # code dependency declarations
1304
1305 # architecture extensions
1306
1307 armv5te_deps="arm"
1308 armv6_deps="arm"
1309 armv6t2_deps="arm"
1310 armvfp_deps="arm"
1311 neon_deps="arm"
1312 vfpv3_deps="armvfp"
1313
1314 mmi_deps="mips"
1315
1316 altivec_deps="ppc"
1317 ppc4xx_deps="ppc"
1318
1319 vis_deps="sparc"
1320
1321 x86_64_suggest="cmov fast_cmov"
1322 amd3dnow_deps="mmx"
1323 amd3dnowext_deps="amd3dnow"
1324 mmx_deps="x86"
1325 mmxext_deps="mmx"
1326 sse_deps="mmx"
1327 ssse3_deps="sse"
1328 avx_deps="ssse3"
1329 fma4_deps="avx"
1330
1331 aligned_stack_if_any="ppc x86"
1332 fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1333 fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
1334 fast_unaligned_if_any="armv6 ppc x86"
1335
1336 inline_asm_deps="!tms470"
1337 need_memalign="altivec neon sse"
1338
1339 symver_if_any="symver_asm_label symver_gnu_asm"
1340
1341 # subsystems
1342 dct_select="rdft"
1343 mdct_select="fft"
1344 rdft_select="fft"
1345 mpegaudiodsp_select="dct"
1346 mpegvideoenc_select="mpegvideo"
1347
1348 # decoders / encoders / hardware accelerators
1349 aac_decoder_select="mdct sinewin"
1350 aac_encoder_select="mdct sinewin"
1351 aac_latm_decoder_select="aac_decoder aac_latm_parser"
1352 ac3_decoder_select="mdct ac3dsp ac3_parser"
1353 ac3_encoder_select="mdct ac3dsp"
1354 ac3_fixed_encoder_select="mdct ac3dsp"
1355 alac_encoder_select="lpc"
1356 amrnb_decoder_select="lsp"
1357 amrwb_decoder_select="lsp"
1358 atrac1_decoder_select="mdct sinewin"
1359 atrac3_decoder_select="mdct"
1360 binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1361 binkaudio_rdft_decoder_select="mdct rdft sinewin"
1362 cavs_decoder_select="golomb mpegvideo"
1363 cook_decoder_select="mdct sinewin"
1364 cscd_decoder_suggest="zlib"
1365 dca_decoder_select="mdct"
1366 dnxhd_encoder_select="aandcttables mpegvideoenc"
1367 dxa_decoder_select="zlib"
1368 eac3_decoder_select="ac3_decoder"
1369 eac3_encoder_select="ac3_encoder"
1370 eamad_decoder_select="aandcttables error_resilience"
1371 eatgq_decoder_select="aandcttables"
1372 eatqi_decoder_select="aandcttables error_resilience mpegvideo"
1373 ffv1_decoder_select="golomb rangecoder"
1374 ffv1_encoder_select="rangecoder"
1375 flac_decoder_select="golomb"
1376 flac_encoder_select="golomb lpc"
1377 flashsv_decoder_select="zlib"
1378 flashsv_encoder_select="zlib"
1379 flashsv2_decoder_select="zlib"
1380 flv_decoder_select="h263_decoder"
1381 flv_encoder_select="h263_encoder"
1382 fraps_decoder_select="huffman"
1383 h261_decoder_select="error_resilience mpegvideo"
1384 h261_encoder_select="aandcttables mpegvideoenc"
1385 h263_decoder_select="error_resilience h263_parser mpegvideo"
1386 h263_encoder_select="aandcttables error_resilience mpegvideoenc"
1387 h263_vaapi_hwaccel_select="vaapi h263_decoder"
1388 h263i_decoder_select="h263_decoder"
1389 h263p_encoder_select="h263_encoder"
1390 h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
1391 h264_dxva2_hwaccel_deps="dxva2api_h"
1392 h264_dxva2_hwaccel_select="dxva2 h264_decoder"
1393 h264_vaapi_hwaccel_select="vaapi h264_decoder"
1394 h264_vda_hwaccel_select="vda h264_decoder"
1395 h264_vdpau_decoder_select="vdpau h264_decoder"
1396 iac_decoder_select="fft mdct sinewin"
1397 imc_decoder_select="fft mdct sinewin"
1398 jpegls_decoder_select="golomb"
1399 jpegls_encoder_select="golomb"
1400 ljpeg_encoder_select="aandcttables mpegvideoenc"
1401 loco_decoder_select="golomb"
1402 mdec_decoder_select="error_resilience mpegvideo"
1403 mjpeg_encoder_select="aandcttables mpegvideoenc"
1404 mlp_decoder_select="mlp_parser"
1405 mp1_decoder_select="mpegaudiodsp"
1406 mp1float_decoder_select="mpegaudiodsp"
1407 mp2_decoder_select="mpegaudiodsp"
1408 mp2float_decoder_select="mpegaudiodsp"
1409 mp3_decoder_select="mpegaudiodsp"
1410 mp3adu_decoder_select="mpegaudiodsp"
1411 mp3adufloat_decoder_select="mpegaudiodsp"
1412 mp3float_decoder_select="mpegaudiodsp"
1413 mp3on4_decoder_select="mpegaudiodsp"
1414 mp3on4float_decoder_select="mpegaudiodsp"
1415 mpc7_decoder_select="mpegaudiodsp"
1416 mpc8_decoder_select="mpegaudiodsp"
1417 mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1418 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1419 mpeg_xvmc_decoder_select="mpegvideo_decoder"
1420 mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1421 mpeg1video_decoder_select="error_resilience mpegvideo"
1422 mpeg1video_encoder_select="aandcttables error_resilience mpegvideoenc"
1423 mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1424 mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
1425 mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1426 mpeg2video_decoder_select="error_resilience mpegvideo"
1427 mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
1428 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1429 mpeg4_encoder_select="h263_encoder"
1430 mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1431 mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1432 msmpeg4v1_decoder_select="h263_decoder"
1433 msmpeg4v1_encoder_select="h263_encoder"
1434 msmpeg4v2_decoder_select="h263_decoder"
1435 msmpeg4v2_encoder_select="h263_encoder"
1436 msmpeg4v3_decoder_select="h263_decoder"
1437 msmpeg4v3_encoder_select="h263_encoder"
1438 nellymoser_decoder_select="mdct sinewin"
1439 nellymoser_encoder_select="mdct sinewin"
1440 png_decoder_select="zlib"
1441 png_encoder_select="zlib"
1442 qcelp_decoder_select="lsp"
1443 qdm2_decoder_select="mdct rdft mpegaudiodsp"
1444 ra_144_encoder_select="lpc"
1445 ralf_decoder_select="golomb"
1446 rv10_decoder_select="h263_decoder"
1447 rv10_encoder_select="h263_encoder"
1448 rv20_decoder_select="h263_decoder"
1449 rv20_encoder_select="h263_encoder"
1450 rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
1451 rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
1452 shorten_decoder_select="golomb"
1453 sipr_decoder_select="lsp"
1454 snow_decoder_select="dwt rangecoder"
1455 snow_encoder_select="aandcttables dwt error_resilience mpegvideoenc rangecoder"
1456 svq1_decoder_select="error_resilience mpegvideo"
1457 svq1_encoder_select="aandcttables error_resilience mpegvideoenc"
1458 svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
1459 svq3_decoder_suggest="zlib"
1460 theora_decoder_select="vp3_decoder"
1461 tiff_decoder_suggest="zlib"
1462 tiff_encoder_suggest="zlib"
1463 truehd_decoder_select="mlp_decoder"
1464 tscc_decoder_select="zlib"
1465 twinvq_decoder_select="mdct lsp sinewin"
1466 vc1_decoder_select="h263_decoder h264chroma h264qpel"
1467 vc1_dxva2_hwaccel_deps="dxva2api_h"
1468 vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
1469 vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1470 vc1_vdpau_decoder_select="vdpau vc1_decoder"
1471 vc1image_decoder_select="vc1_decoder"
1472 vorbis_decoder_select="mdct"
1473 vorbis_encoder_select="mdct"
1474 vp3_decoder_select="vp3dsp"
1475 vp5_decoder_select="vp3dsp"
1476 vp6_decoder_select="huffman vp3dsp"
1477 vp6a_decoder_select="vp6_decoder"
1478 vp6f_decoder_select="vp6_decoder"
1479 vp8_decoder_select="h264pred h264qpel"
1480 wmapro_decoder_select="mdct sinewin"
1481 wmav1_decoder_select="mdct sinewin"
1482 wmav1_encoder_select="mdct sinewin"
1483 wmav2_decoder_select="mdct sinewin"
1484 wmav2_encoder_select="mdct sinewin"
1485 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
1486 wmv1_decoder_select="h263_decoder"
1487 wmv1_encoder_select="h263_encoder"
1488 wmv2_decoder_select="h263_decoder"
1489 wmv2_encoder_select="h263_encoder"
1490 wmv3_decoder_select="vc1_decoder"
1491 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
1492 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1493 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1494 wmv3image_decoder_select="wmv3_decoder"
1495 zerocodec_decoder_select="zlib"
1496 zlib_decoder_select="zlib"
1497 zlib_encoder_select="zlib"
1498 zmbv_decoder_select="zlib"
1499 zmbv_encoder_select="zlib"
1500
1501 vaapi_deps="va_va_h"
1502 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
1503 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1504
1505 # parsers
1506 h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
1507 mpeg4video_parser_select="error_resilience mpegvideo"
1508 mpegvideo_parser_select="error_resilience mpegvideo"
1509 vc1_parser_select="error_resilience mpegvideo"
1510
1511 # external libraries
1512 libfaac_encoder_deps="libfaac"
1513 libfdk_aac_encoder_deps="libfdk_aac"
1514 libgsm_decoder_deps="libgsm"
1515 libgsm_encoder_deps="libgsm"
1516 libgsm_ms_decoder_deps="libgsm"
1517 libgsm_ms_encoder_deps="libgsm"
1518 libilbc_decoder_deps="libilbc"
1519 libilbc_encoder_deps="libilbc"
1520 libmp3lame_encoder_deps="libmp3lame"
1521 libopencore_amrnb_decoder_deps="libopencore_amrnb"
1522 libopencore_amrnb_encoder_deps="libopencore_amrnb"
1523 libopencore_amrwb_decoder_deps="libopencore_amrwb"
1524 libopenjpeg_decoder_deps="libopenjpeg"
1525 libopenjpeg_encoder_deps="libopenjpeg"
1526 libschroedinger_decoder_deps="libschroedinger"
1527 libschroedinger_encoder_deps="libschroedinger"
1528 libspeex_decoder_deps="libspeex"
1529 libspeex_encoder_deps="libspeex"
1530 libtheora_encoder_deps="libtheora"
1531 libvo_aacenc_encoder_deps="libvo_aacenc"
1532 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
1533 libvorbis_encoder_deps="libvorbis"
1534 libvpx_decoder_deps="libvpx"
1535 libvpx_encoder_deps="libvpx"
1536 libx264_encoder_deps="libx264"
1537 libxavs_encoder_deps="libxavs"
1538 libxvid_encoder_deps="libxvid"
1539
1540 # demuxers / muxers
1541 ac3_demuxer_select="ac3_parser"
1542 asf_stream_muxer_select="asf_muxer"
1543 avisynth_demuxer_deps="avisynth"
1544 dirac_demuxer_select="dirac_parser"
1545 eac3_demuxer_select="ac3_parser"
1546 flac_demuxer_select="flac_parser"
1547 ipod_muxer_select="mov_muxer"
1548 matroska_audio_muxer_select="matroska_muxer"
1549 matroska_demuxer_suggest="zlib bzlib"
1550 mov_demuxer_suggest="zlib"
1551 mp3_demuxer_select="mpegaudio_parser"
1552 mp4_muxer_select="mov_muxer"
1553 mpegts_muxer_select="adts_muxer latm_muxer mpegvideo"
1554 mpegtsraw_demuxer_select="mpegts_demuxer"
1555 mxf_d10_muxer_select="mxf_muxer"
1556 ogg_demuxer_select="golomb"
1557 psp_muxer_select="mov_muxer"
1558 rtp_demuxer_select="sdp_demuxer"
1559 rtp_muxer_select="mpegvideo"
1560 rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
1561 rtsp_demuxer_select="http_protocol rtpdec"
1562 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
1563 sap_demuxer_select="sdp_demuxer"
1564 sap_muxer_select="rtp_muxer rtp_protocol"
1565 sdp_demuxer_select="rtpdec"
1566 spdif_muxer_select="aac_parser"
1567 tg2_muxer_select="mov_muxer"
1568 tgp_muxer_select="mov_muxer"
1569 w64_demuxer_deps="wav_demuxer"
1570
1571 # indevs / outdevs
1572 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
1573 alsa_outdev_deps="alsa_asoundlib_h"
1574 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1575 dv1394_indev_deps="dv1394 dv_demuxer"
1576 fbdev_indev_deps="linux_fb_h"
1577 jack_indev_deps="jack_jack_h"
1578 libcdio_indev_deps="libcdio"
1579 libdc1394_indev_deps="libdc1394"
1580 oss_indev_deps_any="soundcard_h sys_soundcard_h"
1581 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
1582 pulse_indev_deps="libpulse"
1583 sndio_indev_deps="sndio_h"
1584 sndio_outdev_deps="sndio_h"
1585 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
1586 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
1587 vfwcap_indev_extralibs="-lavicap32"
1588 x11grab_indev_deps="x11grab XShmCreateImage"
1589
1590 # protocols
1591 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
1592 ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
1593 ffrtmpcrypt_protocol_select="tcp_protocol"
1594 ffrtmphttp_protocol_deps="!librtmp_protocol"
1595 ffrtmphttp_protocol_select="http_protocol"
1596 gopher_protocol_deps="network"
1597 httpproxy_protocol_deps="network"
1598 httpproxy_protocol_select="tcp_protocol"
1599 http_protocol_deps="network"
1600 http_protocol_select="tcp_protocol"
1601 https_protocol_select="tls_protocol"
1602 librtmp_protocol_deps="librtmp"
1603 librtmpe_protocol_deps="librtmp"
1604 librtmps_protocol_deps="librtmp"
1605 librtmpt_protocol_deps="librtmp"
1606 librtmpte_protocol_deps="librtmp"
1607 mmsh_protocol_select="http_protocol"
1608 mmst_protocol_deps="network"
1609 rtmp_protocol_deps="!librtmp_protocol"
1610 rtmp_protocol_select="tcp_protocol"
1611 rtmpe_protocol_select="ffrtmpcrypt_protocol"
1612 rtmps_protocol_deps="!librtmp_protocol"
1613 rtmps_protocol_select="tls_protocol"
1614 rtmpt_protocol_select="ffrtmphttp_protocol"
1615 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
1616 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
1617 rtp_protocol_select="udp_protocol"
1618 sctp_protocol_deps="network struct_sctp_event_subscribe"
1619 tcp_protocol_deps="network"
1620 tls_protocol_deps_any="openssl gnutls"
1621 tls_protocol_select="tcp_protocol"
1622 udp_protocol_deps="network"
1623
1624 # filters
1625 blackframe_filter_deps="gpl"
1626 boxblur_filter_deps="gpl"
1627 cropdetect_filter_deps="gpl"
1628 delogo_filter_deps="gpl"
1629 drawtext_filter_deps="libfreetype"
1630 frei0r_filter_deps="frei0r dlopen strtok_r"
1631 frei0r_filter_extralibs='$ldl'
1632 frei0r_src_filter_deps="frei0r dlopen strtok_r"
1633 frei0r_src_filter_extralibs='$ldl'
1634 hqdn3d_filter_deps="gpl"
1635 resample_filter_deps="avresample"
1636 ocv_filter_deps="libopencv"
1637 scale_filter_deps="swscale"
1638 yadif_filter_deps="gpl"
1639
1640 # libraries
1641 avdevice_deps="avcodec avformat"
1642 avformat_deps="avcodec"
1643
1644 # programs
1645 avconv_deps="avcodec avfilter avformat avresample swscale
1646 aformat_filter asyncts_filter
1647 format_filter fps_filter scale_filter setpts_filter"
1648 avplay_deps="avcodec avformat swscale sdl"
1649 avplay_select="rdft"
1650 avprobe_deps="avcodec avformat"
1651 avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
1652 avserver_extralibs='$ldl'
1653
1654 doc_deps="texi2html"
1655
1656 # tests
1657
1658 mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
1659 seek_lavf_mxf_d10_test_deps="mxf_d10_test"
1660
1661 test_deps(){
1662 suf1=$1
1663 suf2=$2
1664 shift 2
1665 for v; do
1666 dep=${v%=*}
1667 tests=${v#*=}
1668 for name in ${tests}; do
1669 append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
1670 done
1671 done
1672 }
1673
1674 test_deps _muxer _demuxer \
1675 aiff \
1676 pcm_alaw=alaw \
1677 asf \
1678 au \
1679 avi \
1680 dv=dv_fmt \
1681 ffm \
1682 flv=flv_fmt \
1683 gxf \
1684 matroska=mkv \
1685 mmf \
1686 mov \
1687 pcm_mulaw=mulaw \
1688 mxf="mxf mxf_d10" \
1689 nut \
1690 ogg \
1691 rawvideo=pixfmt \
1692 rm \
1693 swf \
1694 mpegts=ts \
1695 voc \
1696 wav \
1697 yuv4mpegpipe=yuv4mpeg \
1698
1699 # default parameters
1700
1701 logfile="config.log"
1702
1703 # installation paths
1704 prefix_default="/usr/local"
1705 bindir_default='${prefix}/bin'
1706 datadir_default='${prefix}/share/avconv'
1707 incdir_default='${prefix}/include'
1708 libdir_default='${prefix}/lib'
1709 mandir_default='${prefix}/share/man'
1710 shlibdir_default="$libdir_default"
1711
1712 # toolchain
1713 ar_default="ar"
1714 cc_default="gcc"
1715 host_cc_default="gcc"
1716 ln_s="ln -sf"
1717 nm_default="nm"
1718 objformat="elf"
1719 pkg_config_default=pkg-config
1720 ranlib="ranlib"
1721 yasmexe="yasm"
1722
1723 nm_opts='-g'
1724 nogas=":"
1725
1726 # machine
1727 arch_default=$(uname -m)
1728 cpu="generic"
1729
1730 # OS
1731 target_os_default=$(tolower $(uname -s))
1732 host_os=$target_os_default
1733
1734 # configurable options
1735 enable $PROGRAM_LIST
1736
1737 enable avcodec
1738 enable avdevice
1739 enable avfilter
1740 enable avformat
1741 enable avresample
1742 enable avutil
1743 enable swscale
1744
1745 enable asm
1746 enable debug
1747 enable doc
1748 enable network
1749 enable optimizations
1750 enable safe_bitstream_reader
1751 enable static
1752 enable swscale_alpha
1753
1754 # build settings
1755 SHFLAGS='-shared -Wl,-soname,$$(@F)'
1756 AVSERVERLDFLAGS=-Wl,-E
1757 LIBPREF="lib"
1758 LIBSUF=".a"
1759 FULLNAME='$(NAME)$(BUILDSUF)'
1760 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1761 SLIBPREF="lib"
1762 SLIBSUF=".so"
1763 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1764 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1765 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1766 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1767 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
1768 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
1769
1770 asflags_filter=echo
1771 cflags_filter=echo
1772 ldflags_filter=echo
1773
1774 AS_C='-c'
1775 AS_O='-o $@'
1776 CC_C='-c'
1777 CC_E='-E -o $@'
1778 CC_O='-o $@'
1779 LD_O='-o $@'
1780 HOSTCC_C='-c'
1781 HOSTCC_O='-o $@'
1782
1783 host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
1784 host_libs='-lm'
1785 host_cflags_filter=echo
1786 host_ldflags_filter=echo
1787
1788 target_path='$(CURDIR)'
1789
1790 # since the object filename is not given with the -MM flag, the compiler
1791 # is only able to print the basename, and we must add the path ourselves
1792 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
1793 DEPFLAGS='-MM'
1794
1795 # find source path
1796 if test -f configure; then
1797 source_path=.
1798 else
1799 source_path=$(cd $(dirname "$0"); pwd)
1800 echo "$source_path" | grep -q '[[:blank:]]' &&
1801 die "Out of tree builds are impossible with whitespace in source path."
1802 test -e "$source_path/config.h" &&
1803 die "Out of tree builds are impossible with config.h in source dir."
1804 fi
1805
1806 for v in "$@"; do
1807 r=${v#*=}
1808 l=${v%"$r"}
1809 r=$(sh_quote "$r")
1810 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
1811 done
1812
1813 find_things(){
1814 thing=$1
1815 pattern=$2
1816 file=$source_path/$3
1817 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1818 }
1819
1820 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1821 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
1822 HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
1823 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1824 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1825 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1826 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
1827 OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
1828 INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
1829 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1830 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
1831
1832 ALL_COMPONENTS="
1833 $BSF_LIST
1834 $DECODER_LIST
1835 $DEMUXER_LIST
1836 $ENCODER_LIST
1837 $FILTER_LIST
1838 $HWACCEL_LIST
1839 $INDEV_LIST
1840 $MUXER_LIST
1841 $OUTDEV_LIST
1842 $PARSER_LIST
1843 $PROTOCOL_LIST
1844 "
1845
1846 find_tests(){
1847 map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
1848 }
1849
1850 LAVF_TESTS=$(find_tests lavf)
1851 LAVFI_TESTS=$(find_tests lavfi)
1852 SEEK_TESTS=$(find_tests seek seek_)
1853
1854 ALL_TESTS="$LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
1855
1856 for n in $COMPONENT_LIST; do
1857 v=$(toupper ${n%s})_LIST
1858 eval enable \$$v
1859 eval ${n}_if_any="\$$v"
1860 done
1861
1862 enable $ARCH_EXT_LIST $ALL_TESTS
1863
1864 die_unknown(){
1865 echo "Unknown option \"$1\"."
1866 echo "See $0 --help for available options."
1867 exit 1
1868 }
1869
1870 show_list() {
1871 suffix=_$1
1872 shift
1873 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
1874 exit 0
1875 }
1876
1877 rand_list(){
1878 IFS=', '
1879 set -- $*
1880 unset IFS
1881 for thing; do
1882 comp=${thing%:*}
1883 prob=${thing#$comp}
1884 prob=${prob#:}
1885 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
1886 echo "prob ${prob:-0.5}"
1887 printf '%s\n' $comp
1888 done
1889 }
1890
1891 do_random(){
1892 action=$1
1893 shift
1894 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
1895 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
1896 }
1897
1898 for opt do
1899 optval="${opt#*=}"
1900 case "$opt" in
1901 --extra-ldflags=*) add_ldflags $optval
1902 ;;
1903 --extra-libs=*) add_extralibs $optval
1904 ;;
1905 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1906 ;;
1907 --enable-debug=*) debuglevel="$optval"
1908 ;;
1909 --disable-everything)
1910 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
1911 ;;
1912 --enable-random|--disable-random)
1913 action=${opt%%-random}
1914 do_random ${action#--} $COMPONENT_LIST
1915 ;;
1916 --enable-random=*|--disable-random=*)
1917 action=${opt%%-random=*}
1918 do_random ${action#--} $optval
1919 ;;
1920 --enable-*=*|--disable-*=*)
1921 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1922 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1923 eval list=\$$(toupper $thing)_LIST
1924 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1925 $action $(filter "$name" $list)
1926 ;;
1927 --enable-?*|--disable-?*)
1928 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1929 if is_in $option $COMPONENT_LIST; then
1930 test $action = disable && action=unset
1931 eval $action \$$(toupper ${option%s})_LIST
1932 elif is_in $option $CMDLINE_SELECT; then
1933 $action $option
1934 else
1935 die_unknown $opt
1936 fi
1937 ;;
1938 --list-*)
1939 NAME="${opt#--list-}"
1940 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1941 NAME=${NAME%s}
1942 eval show_list $NAME \$$(toupper $NAME)_LIST
1943 ;;
1944 --help|-h) show_help
1945 ;;
1946 *)
1947 optname="${opt%%=*}"
1948 optname="${optname#--}"
1949 optname=$(echo "$optname" | sed 's/-/_/g')
1950 if is_in $optname $CMDLINE_SET; then
1951 eval $optname='$optval'
1952 elif is_in $optname $CMDLINE_APPEND; then
1953 append $optname "$optval"
1954 else
1955 die_unknown $opt
1956 fi
1957 ;;
1958 esac
1959 done
1960
1961 disabled logging && logfile=/dev/null
1962
1963 echo "# $0 $LIBAV_CONFIGURATION" > $logfile
1964 set >> $logfile
1965
1966 test -n "$cross_prefix" && enable cross_compile
1967
1968 if enabled cross_compile; then
1969 test -n "$arch" && test -n "$target_os" ||
1970 die "Must specify target arch and OS when cross-compiling"
1971 fi
1972
1973 set_default arch target_os
1974
1975 ar_default="${cross_prefix}${ar_default}"
1976 cc_default="${cross_prefix}${cc_default}"
1977 nm_default="${cross_prefix}${nm_default}"
1978 pkg_config_default="${cross_prefix}${pkg_config_default}"
1979 ranlib="${cross_prefix}${ranlib}"
1980
1981 sysinclude_default="${sysroot}/usr/include"
1982
1983 set_default cc nm pkg_config sysinclude
1984 enabled cross_compile || host_cc_default=$cc
1985 set_default host_cc
1986
1987 if ! $pkg_config --version >/dev/null 2>&1; then
1988 warn "$pkg_config not found, library detection may fail."
1989 pkg_config=false
1990 fi
1991
1992 exesuf() {
1993 case $1 in
1994 mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
1995 esac
1996 }
1997
1998 EXESUF=$(exesuf $target_os)
1999 HOSTEXESUF=$(exesuf $host_os)
2000
2001 # set temporary file name
2002 : ${TMPDIR:=$TEMPDIR}
2003 : ${TMPDIR:=$TMP}
2004 : ${TMPDIR:=/tmp}
2005
2006 if ! check_cmd mktemp -u XXXXXX; then
2007 # simple replacement for missing mktemp
2008 # NOT SAFE FOR GENERAL USE
2009 mktemp(){
2010 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
2011 }
2012 fi
2013
2014 tmpfile(){
2015 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2016 (set -C; exec > $tmp) 2>/dev/null ||
2017 die "Unable to create temporary file in $TMPDIR."
2018 append TMPFILES $tmp
2019 eval $1=$tmp
2020 }
2021
2022 trap 'rm -f -- $TMPFILES' EXIT
2023
2024 tmpfile TMPASM .asm
2025 tmpfile TMPC .c
2026 tmpfile TMPE $EXESUF
2027 tmpfile TMPH .h
2028 tmpfile TMPO .o
2029 tmpfile TMPS .S
2030 tmpfile TMPSH .sh
2031 tmpfile TMPV .ver
2032
2033 unset -f mktemp
2034
2035 chmod +x $TMPE
2036
2037 # make sure we can execute files in $TMPDIR
2038 cat > $TMPSH 2>> $logfile <<EOF
2039 #! /bin/sh
2040 EOF
2041 chmod +x $TMPSH >> $logfile 2>&1
2042 if ! $TMPSH >> $logfile 2>&1; then
2043 cat <<EOF
2044 Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2045 variable to another directory and make sure that it is not mounted noexec.
2046 EOF
2047 die "Sanity test failed."
2048 fi
2049
2050 pgi_flags(){
2051 for flag; do
2052 case $flag in
2053 -fomit-frame-pointer) echo -Mnoframe ;;
2054 -g) echo -gopt ;;
2055 *) echo $flag ;;
2056 esac
2057 done
2058 }
2059
2060 suncc_flags(){
2061 for flag; do
2062 case $flag in
2063 -march=*|-mcpu=*)
2064 case "${flag#*=}" in
2065 native) echo -xtarget=native ;;
2066 v9|niagara) echo -xarch=sparc ;;
2067 ultrasparc) echo -xarch=sparcvis ;;
2068 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
2069 i586|pentium) echo -xchip=pentium ;;
2070 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
2071 pentium3*|c3-2) echo -xtarget=pentium3 ;;
2072 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
2073 pentium4*) echo -xtarget=pentium4 ;;
2074 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
2075 *-sse3) echo -xarch=sse3 ;;
2076 core2) echo -xarch=ssse3 -xchip=core2 ;;
2077 amdfam10|barcelona) echo -xarch=sse4_1 ;;
2078 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
2079 k8|opteron|athlon64|athlon-fx)
2080 echo -xarch=sse2a ;;
2081 athlon*) echo -xarch=pentium_proa ;;
2082 esac
2083 ;;
2084 -std=c99) echo -xc99 ;;
2085 -fomit-frame-pointer) echo -xregs=frameptr ;;
2086 -fPIC) echo -KPIC -xcode=pic32 ;;
2087 -W*,*) echo $flag ;;
2088 -f*-*|-W*) ;;
2089 *) echo $flag ;;
2090 esac
2091 done
2092 }
2093
2094 tms470_flags(){
2095 for flag; do
2096 case $flag in
2097 -march=*|-mcpu=*)
2098 case "${flag#*=}" in
2099 armv7-a|cortex-a*) echo -mv=7a8 ;;
2100 armv7-r|cortex-r*) echo -mv=7r4 ;;
2101 armv7-m|cortex-m*) echo -mv=7m3 ;;
2102 armv6*|arm11*) echo -mv=6 ;;
2103 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
2104 echo -mv=5e ;;
2105 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
2106 esac
2107 ;;
2108 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
2109 -mfpu=vfp) echo --float_support=vfpv2 ;;
2110 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
2111 -msoft-float) echo --float_support=vfplib ;;
2112 -O[0-3]|-mf=*) echo $flag ;;
2113 -g) echo -g -mn ;;
2114 -pds=*) echo $flag ;;
2115 -D*|-I*) echo $flag ;;
2116 --gcc|--abi=*) echo $flag ;;
2117 -me) echo $flag ;;
2118 esac
2119 done
2120 }
2121
2122 probe_cc(){
2123 pfx=$1
2124 _cc=$2
2125
2126 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags _ldflags
2127 unset _depflags _DEPCMD _DEPFLAGS
2128 _flags_filter=echo
2129
2130 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
2131 _type=llvm_gcc
2132 gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
2133 _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
2134 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2135 _cflags_speed='-O3'
2136 _cflags_size='-Os'
2137 elif $_cc -v 2>&1 | grep -qi ^gcc; then
2138 _type=gcc
2139 gcc_version=$($_cc --version | head -n1)
2140 gcc_basever=$($_cc -dumpversion)
2141 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
2142 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
2143 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
2144 if ! $_cc -dumpversion | grep -q '^2\.'; then
2145 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2146 fi
2147 _cflags_speed='-O3'
2148 _cflags_size='-Os'
2149 elif $_cc --version 2>/dev/null | grep -q Intel; then
2150 _type=icc
2151 _ident=$($_cc --version | head -n1)
2152 _depflags='-MMD'
2153 _cflags_speed='-O3'
2154 _cflags_size='-Os'
2155 _cflags_noopt='-O1'
2156 elif $_cc -v 2>&1 | grep -q xlc; then
2157 _type=xlc
2158 _ident=$($_cc -qversion 2>/dev/null | head -n1)
2159 _cflags_speed='-O5'
2160 _cflags_size='-O5 -qcompact'
2161 elif $_cc -V 2>/dev/null | grep -q Compaq; then
2162 _type=ccc
2163 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
2164 _DEPFLAGS='-M'
2165 debuglevel=3
2166 _ldflags='-Wl,-z,now' # calls to libots crash without this
2167 _cflags_speed='-fast'
2168 _cflags_size='-O1'
2169 elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
2170 test -d "$sysroot" || die "No valid sysroot specified."
2171 _type=armcc
2172 _ident=$($_cc --vsn | head -n1)
2173 armcc_conf="$PWD/armcc.conf"
2174 $_cc --arm_linux_configure \
2175 --arm_linux_config_file="$armcc_conf" \
2176 --configure_sysroot="$sysroot" \
2177 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
2178 die "Error creating armcc configuration file."
2179 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
2180 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
2181 as_default="${cross_prefix}gcc"
2182 _depflags='-MMD'
2183 _cflags_speed='-O3'
2184 _cflags_size='-Os'
2185 elif $_cc -version 2>/dev/null | grep -q TMS470; then
2186 _type=tms470
2187 _ident=$($_cc -version | head -n1 | tr -s ' ')
2188 _flags='--gcc --abi=eabi -me'
2189 _cflags='-D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__='
2190 _cc_e='-ppl -fe=$@'
2191 _cc_o='-fe=$@'
2192 as_default="${cross_prefix}gcc"
2193 ld_default="${cross_prefix}gcc"
2194 _depflags='-ppa -ppd=$(@:.o=.d)'
2195 _cflags_speed='-O3 -mf=5'
2196 _cflags_size='-O3 -mf=2'
2197 _flags_filter=tms470_flags
2198 elif $_cc -v 2>&1 | grep -q clang; then
2199 _type=clang
2200 _ident=$($_cc --version | head -n1)
2201 _depflags='-MMD'
2202 _cflags_speed='-O3'
2203 _cflags_size='-Os'
2204 elif $_cc -V 2>&1 | grep -q Sun; then
2205 _type=suncc
2206 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
2207 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
2208 _DEPFLAGS='-xM1 -xc99'
2209 _ldflags='-std=c99'
2210 _cflags_speed='-O5'
2211 _cflags_size='-O5 -xspace'
2212 _flags_filter=suncc_flags
2213 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
2214 _type=pathscale
2215 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
2216 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2217 _cflags_speed='-O2'
2218 _cflags_size='-Os'
2219 _flags_filter='filter_out -Wdisabled-optimization'
2220 elif $_cc -v 2>&1 | grep -q Open64; then
2221 _type=open64
2222 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
2223 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2224 _cflags_speed='-O2'
2225 _cflags_size='-Os'
2226 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
2227 elif $_cc -V 2>&1 | grep -q Portland; then
2228 _type=pgi
2229 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
2230 opt_common='-alias=ansi -Mlre -Mpre'
2231 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
2232 _cflags_size="-O2 -Munroll=c:1 $opt_common"
2233 _cflags_noopt="-O1"
2234 _flags_filter=pgi_flags
2235 fi
2236
2237 eval ${pfx}_type=\$_type
2238 eval ${pfx}_ident=\$_ident
2239 }
2240
2241 set_ccvars(){
2242 eval ${1}_C=\${_cc_c-\${${1}_C}}
2243 eval ${1}_E=\${_cc_e-\${${1}_E}}
2244 eval ${1}_O=\${_cc_o-\${${1}_O}}
2245
2246 if [ -n "$_depflags" ]; then
2247 eval ${1}_DEPFLAGS=\$_depflags
2248 else
2249 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
2250 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
2251 eval DEP${1}FLAGS=\$_flags
2252 fi
2253 }
2254
2255 probe_cc cc "$cc"
2256 cflags_filter=$_flags_filter
2257 cflags_speed=$_cflags_speed
2258 cflags_size=$_cflags_size
2259 cflags_noopt=$_cflags_noopt
2260 add_cflags $_flags $_cflags
2261 cc_ldflags=$_ldflags
2262 set_ccvars CC
2263
2264 probe_cc hostcc "$host_cc"
2265 host_cflags_filter=$_flags_filter
2266 host_ldflags_filter=$_flags_filter
2267 add_host_cflags $_flags $_cflags
2268 add_host_ldflags $_flags $_ldflags
2269 set_ccvars HOSTCC
2270
2271 test -n "$cc_type" && enable $cc_type ||
2272 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
2273
2274 : ${as_default:=$cc}
2275 : ${dep_cc_default:=$cc}
2276 : ${ld_default:=$cc}
2277 set_default ar as dep_cc ld
2278
2279 probe_cc as "$as"
2280 asflags_filter=$_flags_filter
2281 add_asflags $_flags $_cflags
2282 set_ccvars AS
2283
2284 probe_cc ld "$ld"
2285 ldflags_filter=$_flags_filter
2286 add_ldflags $_flags $_ldflags
2287 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
2288 LD_O=${_cc_o-$LD_O}
2289
2290 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
2291 probe_cc depcc "$dep_cc"
2292 CCDEP=${_DEPCMD:-$DEPCMD}
2293 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
2294 DEPCCFLAGS=$_flags
2295 fi
2296
2297 add_cflags $extra_cflags
2298 add_asflags $extra_cflags
2299
2300 if test -n "$sysroot"; then
2301 case "$cc_type" in
2302 gcc|llvm_gcc|clang)
2303 add_cppflags --sysroot="$sysroot"
2304 add_ldflags --sysroot="$sysroot"
2305 ;;
2306 tms470)
2307 add_cppflags -I"$sysinclude"
2308 add_ldflags --sysroot="$sysroot"
2309 ;;
2310 esac
2311 fi
2312
2313 if test "$cpu" = host; then
2314 enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
2315
2316 case "$cc_type" in
2317 gcc|llvm_gcc)
2318 check_native(){
2319 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
2320 sed -n "/cc1.*$1=/{
2321 s/.*$1=\\([^ ]*\\).*/\\1/
2322 p
2323 q
2324 }" $TMPE
2325 }
2326 cpu=$(check_native -march || check_native -mcpu)
2327 ;;
2328 esac
2329
2330 test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
2331 fi
2332
2333 # Deal with common $arch aliases
2334 case "$arch" in
2335 arm*)
2336 arch="arm"
2337 ;;
2338 mips|mipsel|IP*)
2339 arch="mips"
2340 ;;
2341 mips64*)
2342 arch="mips"
2343 subarch="mips64"
2344 ;;
2345 parisc|hppa)
2346 arch="parisc"
2347 ;;
2348 parisc64|hppa64)
2349 arch="parisc"
2350 subarch="parisc64"
2351 ;;
2352 "Power Macintosh"|ppc|powerpc)
2353 arch="ppc"
2354 ;;
2355 ppc64|powerpc64)
2356 arch="ppc"
2357 subarch="ppc64"
2358 ;;
2359 s390|s390x)
2360 arch="s390"
2361 ;;
2362 sh4|sh)
2363 arch="sh4"
2364 ;;
2365 sun4u|sparc64)
2366 arch="sparc"
2367 subarch="sparc64"
2368 ;;
2369 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
2370 arch="x86"
2371 ;;
2372 esac
2373
2374 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
2375 enable $arch
2376
2377 # Add processor-specific flags
2378 if test "$cpu" = generic; then
2379 : do nothing
2380 elif enabled ppc; then
2381
2382 case $(tolower $cpu) in
2383 601|ppc601|powerpc601)
2384 cpuflags="-mcpu=601"
2385 disable altivec
2386 ;;
2387 603*|ppc603*|powerpc603*)
2388 cpuflags="-mcpu=603"
2389 disable altivec
2390 ;;
2391 604*|ppc604*|powerpc604*)
2392 cpuflags="-mcpu=604"
2393 disable altivec
2394 ;;
2395 g3|75*|ppc75*|powerpc75*)
2396 cpuflags="-mcpu=750 -mpowerpc-gfxopt"
2397 disable altivec
2398 ;;
2399 g4|745*|ppc745*|powerpc745*)
2400 cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
2401 ;;
2402 74*|ppc74*|powerpc74*)
2403 cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
2404 ;;
2405 g5|970|ppc970|powerpc970)
2406 cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
2407 ;;
2408 power[3-7]*)
2409 cpuflags="-mcpu=$cpu -mpowerpc-gfxopt -mpowerpc64"
2410 ;;
2411 cell)
2412 cpuflags="-mcpu=cell"
2413 enable ldbrx
2414 ;;
2415 e500mc)
2416 cpuflags="-mcpu=e500mc"
2417 disable altivec
2418 ;;
2419 e500v2)
2420 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
2421 disable altivec
2422 ;;
2423 e500)
2424 cpuflags="-mcpu=8540 -mhard-float"
2425 disable altivec
2426 ;;
2427 esac
2428
2429 elif enabled x86; then
2430
2431 case $cpu in
2432 i[345]86|pentium)
2433 cpuflags="-march=$cpu"
2434 disable mmx
2435 ;;
2436 # targets that do NOT support conditional mov (cmov)
2437 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
2438 cpuflags="-march=$cpu"
2439 disable cmov
2440 ;;
2441 # targets that do support conditional mov (cmov)
2442 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
2443 cpuflags="-march=$cpu"
2444 enable cmov
2445 enable fast_cmov
2446 ;;
2447 # targets that do support conditional mov but on which it's slow
2448 pentium4|pentium4m|prescott|nocona)
2449 cpuflags="-march=$cpu"
2450 enable cmov
2451 disable fast_cmov
2452 ;;
2453 esac
2454
2455 elif enabled sparc; then
2456
2457 case $cpu in
2458 niagara)
2459 cpuflags="-mcpu=$cpu"
2460 disable vis
2461 ;;
2462 sparc64)
2463 cpuflags="-mcpu=v9"
2464 ;;
2465 esac
2466
2467 elif enabled arm; then
2468
2469 case $cpu in
2470 armv*)
2471 cpuflags="-march=$cpu"
2472 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
2473 ;;
2474 *)
2475 cpuflags="-mcpu=$cpu"
2476 case $cpu in
2477 cortex-a*) subarch=armv7a ;;
2478 cortex-r*) subarch=armv7r ;;
2479 cortex-m*) enable thumb; subarch=armv7m ;;
2480 arm11*) subarch=armv6 ;;
2481 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
2482 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
2483 esac
2484 ;;
2485 esac
2486
2487 elif enabled alpha; then
2488
2489 enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
2490
2491 elif enabled bfin; then
2492
2493 cpuflags="-mcpu=$cpu"
2494
2495 elif enabled mips; then
2496
2497 cpuflags="-march=$cpu"
2498
2499 elif enabled avr32; then
2500
2501 case $cpu in
2502 ap7[02]0[0-2])
2503 subarch="avr32_ap"
2504 cpuflags="-mpart=$cpu"
2505 ;;
2506 ap)
2507 subarch="avr32_ap"
2508 cpuflags="-march=$cpu"
2509 ;;
2510 uc3[ab]*)
2511 subarch="avr32_uc"
2512 cpuflags="-mcpu=$cpu"
2513 ;;
2514 uc)
2515 subarch="avr32_uc"
2516 cpuflags="-march=$cpu"
2517 ;;
2518 esac
2519
2520 fi
2521
2522 add_cflags $cpuflags
2523 add_asflags $cpuflags
2524
2525 # compiler sanity check
2526 check_exec <<EOF
2527 int main(void){ return 0; }
2528 EOF
2529 if test "$?" != 0; then
2530 echo "$cc is unable to create an executable file."
2531 if test -z "$cross_prefix" && ! enabled cross_compile ; then
2532 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
2533 echo "Only do this if you know what cross compiling means."
2534 fi
2535 die "C compiler test failed."
2536 fi
2537
2538 add_cppflags -D_ISOC99_SOURCE
2539 check_cflags -std=c99
2540 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
2541 #include <stdlib.h>
2542 EOF
2543 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
2544 #include <stdlib.h>
2545 EOF
2546
2547 check_host_cflags -std=c99
2548 check_host_cflags -Wall
2549
2550 case "$arch" in
2551 alpha|ia64|mips|parisc|sparc)
2552 spic=$shared
2553 ;;
2554 x86)
2555 subarch="x86_32"
2556 check_code cc "" "int test[(int)sizeof(char*) - 7]" && subarch="x86_64"
2557 if test "$subarch" = "x86_64"; then
2558 spic=$shared
2559 fi
2560 ;;
2561 esac
2562
2563 enable $subarch
2564 enabled spic && enable pic
2565
2566 # OS specific
2567 case $target_os in
2568 haiku)
2569 prefix_default="/boot/common"
2570 network_extralibs="-lnetwork"
2571 host_libs=
2572 ;;
2573 sunos)
2574 AVSERVERLDFLAGS=""
2575 SHFLAGS='-shared -Wl,-h,$$(@F)'
2576 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
2577 network_extralibs="-lsocket -lnsl"
2578 add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
2579 # When using suncc to build, the Solaris linker will mark
2580 # an executable with each instruction set encountered by
2581 # the Solaris assembler. As our libraries contain their own
2582 # guards for processor-specific code, instead suppress
2583 # generation of the HWCAPS ELF section on Solaris x86 only.
2584 enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
2585 nm_opts='-P -g'
2586 ;;
2587 netbsd)
2588 disable symver
2589 oss_indev_extralibs="-lossaudio"
2590 oss_outdev_extralibs="-lossaudio"
2591 ;;
2592 openbsd)
2593 # On OpenBSD 4.5. the compiler does not use PIC unless
2594 # explicitly using -fPIC. Libav builds fine without PIC,
2595 # however the generated executable will not do anything
2596 # (simply quits with exit-code 1, no crash, no output).
2597 # Thus explicitly enable PIC here.
2598 enable pic
2599 disable symver
2600 SHFLAGS='-shared'
2601 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBVERSION)'
2602 SLIB_INSTALL_LINKS=
2603 oss_indev_extralibs="-lossaudio"
2604 oss_outdev_extralibs="-lossaudio"
2605 ;;
2606 dragonfly)
2607 disable symver
2608 ;;
2609 freebsd)
2610 ;;
2611 bsd/os)
2612 add_extralibs -lpoll -lgnugetopt
2613 ;;
2614 darwin)
2615 gas="gas-preprocessor.pl $cc"
2616 enabled ppc && add_asflags -force_cpusubtype_ALL
2617 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
2618 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
2619 add_ldflags -Wl,-dynamic,-search_paths_first
2620 SLIBSUF=".dylib"
2621 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2622 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
2623 AVSERVERLDFLAGS=-Wl,-bind_at_load
2624 objformat="macho"
2625 enabled x86_64 && objformat="macho64"
2626 enabled_any pic shared ||
2627 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
2628 ;;
2629 mingw32*)
2630 if test $target_os = "mingw32ce"; then
2631 disable network
2632 else
2633 target_os=mingw32
2634 fi
2635 LIBTARGET=i386
2636 if enabled x86_64; then
2637 LIBTARGET="i386:x86-64"
2638 elif enabled arm; then
2639 LIBTARGET=arm-wince
2640 fi
2641 shlibdir_default="$bindir_default"
2642 SLIBPREF=""
2643 SLIBSUF=".dll"
2644 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2645 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2646 SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
2647 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2648 SLIB_INSTALL_LINKS=
2649 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
2650 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
2651 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
2652 objformat="win32"
2653 dlltool="${cross_prefix}dlltool"
2654 enable dos_paths
2655 check_cflags -fno-common
2656 check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
2657 || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
2658 die "ERROR: MinGW runtime version must be >= 3.15."
2659 add_cppflags -U__STRICT_ANSI__
2660 ;;
2661 cygwin*)
2662 target_os=cygwin
2663 shlibdir_default="$bindir_default"
2664 SLIBPREF="cyg"
2665 SLIBSUF=".dll"
2666 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2667 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2668 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2669 SLIB_INSTALL_LINKS=
2670 SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
2671 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
2672 objformat="win32"
2673 enable dos_paths
2674 check_cflags -fno-common
2675 add_cppflags -U__STRICT_ANSI__
2676 ;;
2677 *-dos|freedos|opendos)
2678 network_extralibs="-lsocket"
2679 objformat="coff"
2680 enable dos_paths
2681 add_cppflags -U__STRICT_ANSI__
2682 ;;
2683 linux)
2684 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2685 enable dv1394
2686 ;;
2687 irix*)
2688 target_os=irix
2689 ranlib="echo ignoring ranlib"
2690 ;;
2691 os/2*)
2692 ln_s="cp -f"
2693 objformat="aout"
2694 add_cppflags -D_GNU_SOURCE
2695 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
2696 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
2697 AVSERVERLDFLAGS=""
2698 LIBSUF="_s.a"
2699 SLIBPREF=""
2700 SLIBSUF=".dll"
2701 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2702 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
2703 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2704 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2705 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2706 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2707 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2708 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2709 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2710 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2711 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
2712 enable dos_paths
2713 ;;
2714 gnu/kfreebsd)
2715 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
2716 ;;
2717 gnu)
2718 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2719 ;;
2720 qnx)
2721 add_cppflags -D_QNX_SOURCE
2722 network_extralibs="-lsocket"
2723 ;;
2724 symbian)
2725 SLIBSUF=".dll"
2726 enable dos_paths
2727 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
2728 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
2729 add_ldflags -Wl,--target1-abs,--no-undefined \
2730 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
2731 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
2732 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
2733 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
2734 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
2735 ;;
2736 none)
2737 ;;
2738 *)
2739 die "Unknown OS '$target_os'."
2740 ;;
2741 esac
2742
2743 esc(){
2744 echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
2745 }
2746
2747 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
2748
2749 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
2750
2751 set_default $PATHS_LIST
2752
2753 # we need to build at least one lib type
2754 if ! enabled_any static shared; then
2755 cat <<EOF
2756 At least one library type must be built.
2757 Specify --enable-static to build the static libraries or --enable-shared to
2758 build the shared libraries as well. To only build the shared libraries specify
2759 --disable-static in addition to --enable-shared.
2760 EOF
2761 exit 1;
2762 fi
2763
2764 die_license_disabled() {
2765 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2766 }
2767
2768 die_license_disabled gpl libcdio
2769 die_license_disabled gpl libx264
2770 die_license_disabled gpl libxavs
2771 die_license_disabled gpl libxvid
2772 die_license_disabled gpl x11grab
2773
2774 die_license_disabled nonfree libfaac
2775 die_license_disabled nonfree libfdk_aac
2776 die_license_disabled nonfree openssl
2777
2778 die_license_disabled version3 libopencore_amrnb
2779 die_license_disabled version3 libopencore_amrwb
2780 die_license_disabled version3 libvo_aacenc
2781 die_license_disabled version3 libvo_amrwbenc
2782
2783 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2784
2785 disabled optimizations || check_cflags -fomit-frame-pointer
2786
2787 enable_pic() {
2788 enable pic
2789 add_cppflags -DPIC
2790 add_cflags -fPIC
2791 add_asflags -fPIC
2792 }
2793
2794 enabled pic && enable_pic
2795
2796 check_cc <<EOF || die "Symbol mangling check failed."
2797 int ff_extern;
2798 EOF
2799 sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
2800 extern_prefix=${sym%%ff_extern*}
2801
2802 check_cc <<EOF && enable inline_asm
2803 void foo(void) { __asm__ volatile ("" ::); }
2804 EOF
2805
2806 _restrict=
2807 for restrict_keyword in restrict __restrict__ __restrict; do
2808 check_cc <<EOF && _restrict=$restrict_keyword && break
2809 void foo(char * $restrict_keyword p);
2810 EOF
2811 done
2812
2813 check_cc <<EOF && enable attribute_packed
2814 struct { int x; } __attribute__((packed)) x;
2815 EOF
2816
2817 check_cc <<EOF && enable attribute_may_alias
2818 union { int x; } __attribute__((may_alias)) x;
2819 EOF
2820
2821 check_cc <<EOF || die "endian test failed"
2822 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2823 EOF
2824 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
2825
2826 if enabled alpha; then
2827
2828 check_cflags -mieee
2829
2830 elif enabled arm; then
2831
2832 enabled thumb && check_cflags -mthumb || check_cflags -marm
2833 nogas=die
2834
2835 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
2836 enable vfp_args
2837 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
2838 case "${cross_prefix:-$cc}" in
2839 *hardfloat*) enable vfp_args; fpabi=vfp ;;
2840 *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
2841 __asm__ (".eabi_attribute 28, 1");
2842 int main(void) { return 0; }
2843 EOF
2844 esac
2845 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
2846 fi
2847
2848 enabled armv5te && check_inline_asm armv5te '"qadd r0, r0, r0"'
2849 enabled armv6 && check_inline_asm armv6 '"sadd16 r0, r0, r0"'
2850 enabled armv6t2 && check_inline_asm armv6t2 '"movt r0, #0"'
2851 enabled armvfp && check_inline_asm armvfp '"fadds s0, s0, s0"'
2852 enabled neon && check_inline_asm neon '"vadd.i16 q0, q0, q0"'
2853 enabled vfpv3 && check_inline_asm vfpv3 '"vmov.f32 s0, #1.0"'
2854
2855 check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
2856 check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
2857
2858 enabled_all armv6t2 shared !pic && enable_pic
2859
2860 elif enabled mips; then
2861
2862 check_inline_asm loongson '"dmult.g $1, $2, $3"'
2863 enabled mmi && check_inline_asm mmi '"lq $2, 0($2)"'
2864
2865 elif enabled ppc; then
2866
2867 enable local_aligned_8 local_aligned_16
2868
2869 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
2870 check_inline_asm ibm_asm '"add 0, 0, 0"'
2871 check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
2872 check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2873
2874 # AltiVec flags: The FSF version of GCC differs from the Apple version
2875 if enabled altivec; then
2876 nogas=warn
2877 check_cflags -maltivec -mabi=altivec &&
2878 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2879 check_cflags -faltivec
2880
2881 # check if our compiler supports Motorola AltiVec C API
2882 check_cc <<EOF || disable altivec
2883 $inc_altivec_h
2884 int main(void) {
2885 vector signed int v1 = (vector signed int) { 0 };
2886 vector signed int v2 = (vector signed int) { 1 };
2887 v1 = vec_add(v1, v2);
2888 return 0;
2889 }
2890 EOF
2891
2892 enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
2893 fi
2894
2895 elif enabled sparc; then
2896
2897 enabled vis &&
2898 check_inline_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2899 add_cflags -mcpu=ultrasparc -mtune=ultrasparc
2900
2901 elif enabled x86; then
2902
2903 check_code ld immintrin.h "__xgetbv(0)" && enable xgetbv
2904 check_code ld intrin.h "int info[4]; __cpuid(info, 0)" && enable cpuid
2905 check_code ld intrin.h "__rdtsc()" && enable rdtsc
2906 check_code ld intrin.h "unsigned int x = __readeflags()" && enable rweflags
2907
2908 check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
2909
2910 enable local_aligned_8 local_aligned_16
2911
2912 # check whether EBP is available on x86
2913 # As 'i' is stored on the stack, this program will crash
2914 # if the base pointer is used to access it because the
2915 # base pointer is cleared in the inline assembly code.
2916 check_exec_crash <<EOF && enable ebp_available
2917 volatile int i=0;
2918 __asm__ volatile (
2919 "xorl %%ebp, %%ebp"
2920 ::: "%ebp");
2921 return i;
2922 EOF
2923
2924 # check whether EBX is available on x86
2925 check_inline_asm ebx_available '""::"b"(0)' &&
2926 check_inline_asm ebx_available '"":::"%ebx"'
2927
2928 # check whether xmm clobbers are supported
2929 check_inline_asm xmm_clobbers '"":::"%xmm0"'
2930
2931 # check whether binutils is new enough to compile SSSE3/MMXEXT
2932 enabled ssse3 && check_inline_asm ssse3 '"pabsw %xmm0, %xmm0"'
2933 enabled mmxext && check_inline_asm mmxext '"pmaxub %mm0, %mm1"'
2934
2935 if ! disabled_any asm mmx yasm; then
2936 if check_cmd $yasmexe --version; then
2937 enabled x86_64 && yasm_extra="-m amd64"
2938 yasm_debug="-g dwarf2"
2939 elif check_cmd nasm -v; then
2940 yasmexe=nasm
2941 yasm_debug="-g -F dwarf"
2942 enabled x86_64 && test "$objformat" = elf && objformat=elf64
2943 fi
2944
2945 YASMFLAGS="-f $objformat $yasm_extra"
2946 enabled pic && append YASMFLAGS "-DPIC"
2947 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
2948 case "$objformat" in
2949 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
2950 esac
2951
2952 check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
2953 die "yasm not found, use --disable-yasm for a crippled build"
2954 check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
2955 check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4
2956 check_yasm "CPU amdnop" && enable cpunop
2957 fi
2958
2959 case "$cpu" in
2960 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2961 disable fast_clz
2962 ;;
2963 esac
2964
2965 fi
2966
2967 if enabled asm; then
2968 as=${gas:=$as}
2969 check_inline_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
2970 $nogas "GNU assembler not found, install gas-preprocessor"
2971 fi
2972
2973 check_ldflags -Wl,--as-needed
2974
2975 if check_func dlopen; then
2976 ldl=
2977 elif check_func dlopen -ldl; then
2978 ldl=-ldl
2979 fi
2980
2981 if enabled network; then
2982 check_type "sys/types.h sys/socket.h" socklen_t
2983 check_type netdb.h "struct addrinfo"
2984 check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
2985 check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
2986 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
2987 check_type netinet/in.h "struct sockaddr_in6"
2988 check_type poll.h "struct pollfd"
2989 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2990 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2991 check_type netinet/sctp.h "struct sctp_event_subscribe"
2992 check_func getaddrinfo $network_extralibs
2993 # Prefer arpa/inet.h over winsock2
2994 if check_header arpa/inet.h ; then
2995 check_func closesocket
2996 elif check_header winsock2.h ; then
2997 check_func_headers winsock2.h closesocket -lws2 &&
2998 network_extralibs="-lws2" ||
2999 { check_func_headers winsock2.h closesocket -lws2_32 &&
3000 network_extralibs="-lws2_32"; }
3001 check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
3002 check_type ws2tcpip.h socklen_t
3003 check_type ws2tcpip.h "struct addrinfo"
3004 check_type ws2tcpip.h "struct group_source_req"
3005 check_type ws2tcpip.h "struct ip_mreq_source"
3006 check_type ws2tcpip.h "struct ipv6_mreq"
3007 check_type winsock2.h "struct pollfd"
3008 check_type ws2tcpip.h "struct sockaddr_in6"
3009 check_type ws2tcpip.h "struct sockaddr_storage"
3010 check_struct winsock2.h "struct sockaddr" sa_len
3011 else
3012 disable network
3013 fi
3014 fi
3015
3016 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
3017 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
3018
3019 check_func fcntl
3020 check_func fork
3021 check_func gethrtime
3022 check_func getopt
3023 check_func getrusage
3024 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
3025 check_func gettimeofday
3026 check_func inet_aton $network_extralibs
3027 check_func isatty
3028 check_func localtime_r
3029 check_func ${malloc_prefix}memalign && enable memalign
3030 check_func mkstemp
3031 check_func mmap
3032 check_func ${malloc_prefix}posix_memalign && enable posix_memalign
3033 check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
3034 check_func setrlimit
3035 check_func strerror_r
3036 check_func strptime
3037 check_func strtok_r
3038 check_func sched_getaffinity
3039 check_func sysconf
3040 check_func sysctl
3041 check_func usleep
3042 check_func_headers io.h setmode
3043 check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
3044 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
3045 check_func_headers windows.h GetProcessAffinityMask
3046 check_func_headers windows.h GetProcessTimes
3047 check_func_headers windows.h GetSystemTimeAsFileTime
3048 check_func_headers windows.h MapViewOfFile
3049 check_func_headers windows.h Sleep
3050 check_func_headers windows.h VirtualAlloc
3051
3052 check_header dlfcn.h
3053 check_header dxva.h
3054 check_header dxva2api.h
3055 check_header io.h
3056 check_header malloc.h
3057 check_header poll.h
3058 check_header sys/mman.h
3059 check_header sys/param.h
3060 check_header sys/resource.h
3061 check_header sys/select.h
3062 check_header sys/time.h
3063 check_header unistd.h
3064 check_header vdpau/vdpau.h
3065 check_header vdpau/vdpau_x11.h
3066 check_header windows.h
3067 check_header X11/extensions/XvMClib.h
3068
3069 disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
3070 disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
3071
3072 if ! disabled w32threads && ! enabled pthreads; then
3073 check_func _beginthreadex && enable w32threads
3074 fi
3075
3076 # check for some common methods of building with pthread support
3077 # do this before the optional library checks as some of them require pthreads
3078 if ! disabled pthreads && ! enabled w32threads; then
3079 enable pthreads
3080 if check_func pthread_create; then
3081 :
3082 elif check_func pthread_create -pthread; then
3083 add_cflags -pthread
3084 add_extralibs -pthread
3085 elif check_func pthread_create -pthreads; then
3086 add_cflags -pthreads
3087 add_extralibs -pthreads
3088 elif check_func pthread_create -lpthreadGC2; then
3089 add_extralibs -lpthreadGC2
3090 elif ! check_lib pthread.h pthread_create -lpthread; then
3091 disable pthreads
3092 fi
3093 fi
3094
3095 for thread in $THREADS_LIST; do
3096 if enabled $thread; then
3097 test -n "$thread_type" &&
3098 die "ERROR: Only one thread type must be selected." ||
3099 thread_type="$thread"
3100 fi
3101 done
3102
3103 check_lib math.h sin -lm && LIBM="-lm"
3104 enabled vaapi && require vaapi va/va.h vaInitialize -lva
3105
3106 check_mathfunc cbrtf
3107 check_mathfunc exp2
3108 check_mathfunc exp2f
3109 check_mathfunc isinf
3110 check_mathfunc isnan
3111 check_mathfunc llrint
3112 check_mathfunc llrintf
3113 check_mathfunc log2
3114 check_mathfunc log2f
3115 check_mathfunc lrint
3116 check_mathfunc lrintf
3117 check_mathfunc rint
3118 check_mathfunc round
3119 check_mathfunc roundf
3120 check_mathfunc trunc
3121 check_mathfunc truncf
3122
3123 # these are off by default, so fail if requested and not available
3124 enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
3125 enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
3126 enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
3127 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
3128 enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
3129 enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
3130 enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
3131 enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
3132 enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
3133 enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
3134 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
3135 enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
3136 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
3137 enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
3138 enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
3139 enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
3140 enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
3141 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
3142 enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
3143 enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
3144 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
3145 enabled libvpx && {
3146 enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
3147 die "ERROR: libvpx decoder version must be >=0.9.1"; }
3148 enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
3149 die "ERROR: libvpx encoder version must be >=0.9.1"; } }
3150 enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
3151 { check_cpp_condition x264.h "X264_BUILD >= 118" ||
3152 die "ERROR: libx264 version must be >= 0.118."; }
3153 enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
3154 enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
3155 enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
3156 check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
3157 check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
3158 die "ERROR: openssl not found"; }
3159
3160 if enabled gnutls; then
3161 { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
3162 { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
3163 fi
3164
3165 # libdc1394 check
3166 if enabled libdc1394; then
3167 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
3168 enable libdc1394_2; } ||
3169 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
3170 enable libdc1394_1; } ||
3171 die "ERROR: No version of libdc1394 found "
3172 fi
3173
3174 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
3175 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
3176 enable sdl &&
3177 check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
3178 fi
3179
3180 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
3181
3182 check_header linux/fb.h
3183 check_header linux/videodev2.h
3184 check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
3185
3186 check_header sys/videoio.h
3187
3188 check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
3189 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
3190 # w32api 3.12 had it defined wrong
3191 check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
3192
3193 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
3194 { check_header dev/bktr/ioctl_meteor.h &&
3195 check_header dev/bktr/ioctl_bt848.h; } ||
3196 { check_header machine/ioctl_meteor.h &&
3197 check_header machine/ioctl_bt848.h; } ||
3198 { check_header dev/video/meteor/ioctl_meteor.h &&
3199 check_header dev/video/bktr/ioctl_bt848.h; } ||
3200 check_header dev/ic/bt8xx.h
3201
3202 check_header sndio.h
3203 check_header sys/soundcard.h
3204 check_header soundcard.h
3205
3206 enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
3207
3208 enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
3209 check_func jack_port_get_latency_range -ljack
3210
3211 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
3212
3213 enabled libcdio &&
3214 check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
3215
3216 enabled x11grab &&
3217 require X11 X11/Xlib.h XOpenDisplay -lX11 &&
3218 require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
3219 require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
3220
3221 # check for VDA header
3222 if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
3223 enable vda && add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
3224 fi
3225
3226 if ! disabled vdpau && enabled vdpau_vdpau_h; then
3227 check_cpp_condition \
3228 vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
3229 { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
3230 disable vdpau; }
3231 fi
3232
3233 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
3234
3235 # add some useful compiler flags if supported
3236 check_cflags -Wdeclaration-after-statement
3237 check_cflags -Wall
3238 check_cflags -Wno-parentheses
3239 check_cflags -Wno-switch
3240 check_cflags -Wno-format-zero-length
3241 check_cflags -Wdisabled-optimization
3242 check_cflags -Wpointer-arith
3243 check_cflags -Wredundant-decls
3244 check_cflags -Wno-pointer-sign
3245 check_cflags -Wcast-qual
3246 check_cflags -Wwrite-strings
3247 check_cflags -Wtype-limits
3248 check_cflags -Wundef
3249 check_cflags -Wmissing-prototypes
3250 check_cflags -Wstrict-prototypes
3251 enabled extra_warnings && check_cflags -Winline
3252
3253 # add some linker flags
3254 check_ldflags -Wl,--warn-common
3255 check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
3256 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
3257
3258 enabled xmm_clobber_test &&
3259 check_ldflags -Wl,--wrap,avcodec_open2 \
3260 -Wl,--wrap,avcodec_decode_audio4 \
3261 -Wl,--wrap,avcodec_decode_video2 \
3262 -Wl,--wrap,avcodec_decode_subtitle2 \
3263 -Wl,--wrap,avcodec_encode_audio2 \
3264 -Wl,--wrap,avcodec_encode_video \
3265 -Wl,--wrap,avcodec_encode_subtitle \
3266 -Wl,--wrap,sws_scale ||
3267 disable xmm_clobber_test
3268
3269 echo "X{};" > $TMPV
3270 if test_ldflags -Wl,--version-script,$TMPV; then
3271 append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
3272 check_cc <<EOF && enable symver_asm_label
3273 void ff_foo(void) __asm__ ("av_foo@VERSION");
3274 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
3275 EOF
3276 check_cc <<EOF && enable symver_gnu_asm
3277 __asm__(".symver ff_foo,av_foo@VERSION");
3278 void ff_foo(void) {}
3279 EOF
3280 fi
3281
3282 if [ -n "$optflags" ]; then
3283 add_cflags $optflags
3284 elif enabled small; then
3285 add_cflags $cflags_size
3286 elif enabled optimizations; then
3287 add_cflags $cflags_speed
3288 else
3289 add_cflags $cflags_noopt
3290 fi
3291 check_cflags -fno-math-errno
3292 check_cflags -fno-signed-zeros
3293
3294 if enabled icc; then
3295 # Just warnings, no remarks
3296 check_cflags -w1
3297 # -wd: Disable following warnings
3298 # 144, 167, 556: -Wno-pointer-sign
3299 # 1292: attribute "foo" ignored
3300 # 1419: external declaration in primary source file
3301 # 10006: ignoring unknown option -fno-signed-zeros
3302 # 10148: ignoring unknown option -Wno-parentheses
3303 # 10156: ignoring option '-W'; no argument required
3304 check_cflags -wd144,167,556,1292,1419,10006,10148,10156
3305 # 11030: Warning unknown option --as-needed
3306 # 10156: ignoring option '-export'; no argument required
3307 check_ldflags -wd10156,11030
3308 # Allow to compile with optimizations
3309 check_ldflags -march=$cpu
3310 # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
3311 enable ebp_available
3312 if enabled x86_32; then
3313 icc_version=$($cc -dumpversion)
3314 test ${icc_version%%.*} -ge 11 &&
3315 check_cflags -falign-stack=maintain-16-byte ||
3316 disable aligned_stack
3317 fi
3318 elif enabled ccc; then
3319 # disable some annoying warnings
3320 add_cflags -msg_disable cvtu32to64
3321 add_cflags -msg_disable embedcomment
3322 add_cflags -msg_disable needconstext
3323 add_cflags -msg_disable nomainieee
3324 add_cflags -msg_disable ptrmismatch1
3325 add_cflags -msg_disable unreachcode
3326 elif enabled gcc; then
3327 check_cflags -fno-tree-vectorize
3328 check_cflags -Werror=implicit-function-declaration
3329 check_cflags -Werror=missing-prototypes
3330 check_cflags -Werror=declaration-after-statement
3331 elif enabled llvm_gcc; then
3332 check_cflags -mllvm -stack-alignment=16
3333 elif enabled clang; then
3334 check_cflags -mllvm -stack-alignment=16
3335 check_cflags -Qunused-arguments
3336 elif enabled armcc; then
3337 # 2523: use of inline assembler is deprecated
3338 add_cflags -W${armcc_opt},--diag_suppress=2523
3339 add_cflags -W${armcc_opt},--diag_suppress=1207
3340 add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
3341 add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
3342 add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
3343 add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
3344 elif enabled tms470; then
3345 add_cflags -pds=824 -pds=837
3346 elif enabled pathscale; then
3347 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
3348 fi
3349
3350 enabled_any $THREADS_LIST && enable threads
3351
3352 check_deps $CONFIG_LIST \
3353 $CONFIG_EXTRA \
3354 $HAVE_LIST \
3355 $ALL_COMPONENTS \
3356 $ALL_TESTS \
3357
3358 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
3359
3360 ! enabled_any memalign posix_memalign aligned_malloc &&
3361 enabled_any $need_memalign && enable memalign_hack
3362
3363 echo "install prefix $prefix"
3364 echo "source path $source_path"
3365 echo "C compiler $cc"
3366 echo "ARCH $arch ($cpu)"
3367 if test "$build_suffix" != ""; then
3368 echo "build suffix $build_suffix"
3369 fi
3370 if test "$extra_version" != ""; then
3371 echo "version string suffix $extra_version"
3372 fi
3373 echo "big-endian ${bigendian-no}"
3374 echo "runtime cpu detection ${runtime_cpudetect-no}"
3375 if enabled x86; then
3376 echo "${yasmexe} ${yasm-no}"
3377 echo "MMX enabled ${mmx-no}"
3378 echo "MMXEXT enabled ${mmxext-no}"
3379 echo "3DNow! enabled ${amd3dnow-no}"
3380 echo "3DNow! extended enabled ${amd3dnowext-no}"
3381 echo "SSE enabled ${sse-no}"
3382 echo "SSSE3 enabled ${ssse3-no}"
3383 echo "AVX enabled ${avx-no}"
3384 echo "FMA4 enabled ${fma4-no}"
3385 echo "CMOV enabled ${cmov-no}"
3386 echo "CMOV is fast ${fast_cmov-no}"
3387 echo "EBX available ${ebx_available-no}"
3388 echo "EBP available ${ebp_available-no}"
3389 fi
3390 if enabled arm; then
3391 echo "ARMv5TE enabled ${armv5te-no}"
3392 echo "ARMv6 enabled ${armv6-no}"
3393 echo "ARMv6T2 enabled ${armv6t2-no}"
3394 echo "ARM VFP enabled ${armvfp-no}"
3395 echo "NEON enabled ${neon-no}"
3396 fi
3397 if enabled mips; then
3398 echo "MMI enabled ${mmi-no}"
3399 fi
3400 if enabled ppc; then
3401 echo "AltiVec enabled ${altivec-no}"
3402 echo "PPC 4xx optimizations ${ppc4xx-no}"
3403 echo "dcbzl available ${dcbzl-no}"
3404 fi
3405 if enabled sparc; then
3406 echo "VIS enabled ${vis-no}"
3407 fi
3408 echo "debug symbols ${debug-no}"
3409 echo "optimize for size ${small-no}"
3410 echo "optimizations ${optimizations-no}"
3411 echo "static ${static-no}"
3412 echo "shared ${shared-no}"
3413 echo "new filter support ${avfilter-no}"
3414 echo "network support ${network-no}"
3415 echo "threading support ${thread_type-no}"
3416 echo "safe bitstream reader ${safe_bitstream_reader-no}"
3417 echo "SDL support ${sdl-no}"
3418 echo "libdxva2 enabled ${dxva2-no}"
3419 echo "libva enabled ${vaapi-no}"
3420 echo "libvdpau enabled ${vdpau-no}"
3421 echo "AVISynth enabled ${avisynth-no}"
3422 echo "frei0r enabled ${frei0r-no}"
3423 echo "gnutls enabled ${gnutls-no}"
3424 echo "libcdio support ${libcdio-no}"
3425 echo "libdc1394 support ${libdc1394-no}"
3426 echo "libfaac enabled ${libfaac-no}"
3427 echo "libfdk-aac enabled ${libfdk_aac-no}"
3428 echo "libgsm enabled ${libgsm-no}"
3429 echo "libilbc enabled ${libilbc-no}"
3430 echo "libmp3lame enabled ${libmp3lame-no}"
3431 echo "libopencore-amrnb support ${libopencore_amrnb-no}"
3432 echo "libopencore-amrwb support ${libopencore_amrwb-no}"
3433 echo "libopencv support ${libopencv-no}"
3434 echo "libopenjpeg enabled ${libopenjpeg-no}"
3435 echo "libpulse enabled ${libpulse-no}"
3436 echo "librtmp enabled ${librtmp-no}"
3437 echo "libschroedinger enabled ${libschroedinger-no}"
3438 echo "libspeex enabled ${libspeex-no}"
3439 echo "libtheora enabled ${libtheora-no}"
3440 echo "libvo-aacenc support ${libvo_aacenc-no}"
3441 echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
3442 echo "libvorbis enabled ${libvorbis-no}"
3443 echo "libvpx enabled ${libvpx-no}"
3444 echo "libx264 enabled ${libx264-no}"
3445 echo "libxavs enabled ${libxavs-no}"
3446 echo "libxvid enabled ${libxvid-no}"
3447 echo "openssl enabled ${openssl-no}"
3448 echo "zlib enabled ${zlib-no}"
3449 echo "bzlib enabled ${bzlib-no}"
3450 test -n "$random_seed" &&
3451 echo "random seed ${random_seed}"
3452 echo
3453
3454 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
3455 echo "Enabled ${type}s:"
3456 eval list=\$$(toupper $type)_LIST
3457 print_enabled '_*' $list | sort | pr -r -3 -t
3458 echo
3459 done
3460
3461 license="LGPL version 2.1 or later"
3462 if enabled nonfree; then
3463 license="nonfree and unredistributable"
3464 elif enabled gplv3; then
3465 license="GPL version 3 or later"
3466 elif enabled lgplv3; then
3467 license="LGPL version 3 or later"
3468 elif enabled gpl; then
3469 license="GPL version 2 or later"
3470 fi
3471
3472 echo "License: $license"
3473
3474 echo "Creating config.mak and config.h..."
3475
3476 test -e Makefile || $ln_s "$source_path/Makefile" .
3477
3478 config_files="$TMPH config.mak"
3479
3480 cat > config.mak <<EOF
3481 # Automatically generated by configure - do not modify!
3482 LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
3483 prefix=$prefix
3484 LIBDIR=\$(DESTDIR)$libdir
3485 SHLIBDIR=\$(DESTDIR)$shlibdir
3486 INCDIR=\$(DESTDIR)$incdir
3487 BINDIR=\$(DESTDIR)$bindir
3488 DATADIR=\$(DESTDIR)$datadir
3489 MANDIR=\$(DESTDIR)$mandir
3490 SRC_PATH=$source_path
3491 CC_IDENT=$cc_ident
3492 ARCH=$arch
3493 CC=$cc
3494 AS=$as
3495 LD=$ld
3496 DEPCC=$dep_cc
3497 DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
3498 DEPAS=$as
3499 DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
3500 YASM=$yasmexe
3501 DEPYASM=$yasmexe
3502 AR=$ar
3503 RANLIB=$ranlib
3504 LN_S=$ln_s
3505 CPPFLAGS=$CPPFLAGS
3506 CFLAGS=$CFLAGS
3507 ASFLAGS=$ASFLAGS
3508 AS_C=$AS_C
3509 AS_O=$AS_O
3510 CC_C=$CC_C
3511 CC_O=$CC_O
3512 LD_O=$LD_O
3513 DLLTOOL=$dlltool
3514 LDFLAGS=$LDFLAGS
3515 LDFLAGS-avserver=$AVSERVERLDFLAGS
3516 SHFLAGS=$SHFLAGS
3517 YASMFLAGS=$YASMFLAGS
3518 BUILDSUF=$build_suffix
3519 FULLNAME=$FULLNAME
3520 LIBPREF=$LIBPREF
3521 LIBSUF=$LIBSUF
3522 LIBNAME=$LIBNAME
3523 SLIBPREF=$SLIBPREF
3524 SLIBSUF=$SLIBSUF
3525 EXESUF=$EXESUF
3526 EXTRA_VERSION=$extra_version
3527 CCDEP=$CCDEP
3528 CCDEP_FLAGS=$CCDEP_FLAGS
3529 ASDEP=$ASDEP
3530 ASDEP_FLAGS=$ASDEP_FLAGS
3531 CC_DEPFLAGS=$CC_DEPFLAGS
3532 AS_DEPFLAGS=$AS_DEPFLAGS
3533 HOSTCC=$host_cc
3534 HOSTCFLAGS=$host_cflags
3535 HOSTEXESUF=$HOSTEXESUF
3536 HOSTLDFLAGS=$host_ldflags
3537 HOSTLIBS=$host_libs
3538 DEPHOSTCC=$host_cc
3539 DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
3540 HOSTCCDEP=$HOSTCCDEP
3541 HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
3542 HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
3543 HOSTCC_C=$HOSTCC_C
3544 HOSTCC_O=$HOSTCC_O
3545 TARGET_EXEC=$target_exec
3546 TARGET_PATH=$target_path
3547 LIBS-avplay=$sdl_libs
3548 CFLAGS-avplay=$sdl_cflags
3549 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
3550 EXTRALIBS=$extralibs
3551 INSTALL=install
3552 LIBTARGET=${LIBTARGET}
3553 SLIBNAME=${SLIBNAME}
3554 SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
3555 SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
3556 SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
3557 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
3558 SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
3559 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
3560 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
3561 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
3562 SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
3563 EOF
3564
3565 get_version(){
3566 lcname=$1
3567 name=$(toupper $lcname)
3568 file=$source_path/$lcname/version.h
3569 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
3570 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
3571 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
3572 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
3573 }
3574
3575 get_version libavcodec
3576 get_version libavdevice
3577 get_version libavfilter
3578 get_version libavformat
3579 get_version libavresample
3580 get_version libavutil
3581 get_version libswscale
3582
3583 cat > $TMPH <<EOF
3584 /* Automatically generated by configure - do not modify! */
3585 #ifndef LIBAV_CONFIG_H
3586 #define LIBAV_CONFIG_H
3587 #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
3588 #define LIBAV_LICENSE "$(c_escape $license)"
3589 #define AVCONV_DATADIR "$(eval c_escape $datadir)"
3590 #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
3591 #define restrict $_restrict
3592 #define EXTERN_PREFIX "${extern_prefix}"
3593 #define EXTERN_ASM ${extern_prefix}
3594 #define SLIBSUF "$SLIBSUF"
3595 EOF
3596
3597 test -n "$malloc_prefix" &&
3598 echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
3599
3600 if enabled yasm; then
3601 append config_files $TMPASM
3602 printf '' >$TMPASM
3603 fi
3604
3605 print_config ARCH_ "$config_files" $ARCH_LIST
3606 print_config HAVE_ "$config_files" $HAVE_LIST
3607 print_config CONFIG_ "$config_files" $CONFIG_LIST \
3608 $CONFIG_EXTRA \
3609 $ALL_COMPONENTS \
3610
3611 cat >>config.mak <<EOF
3612 LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
3613 LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
3614 SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
3615 EOF
3616
3617 echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
3618
3619 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
3620 cp_if_changed $TMPH config.h
3621 touch .config
3622
3623 enabled yasm && cp_if_changed $TMPASM config.asm
3624
3625 cat > $TMPH <<EOF
3626 /* Generated by ffconf */
3627 #ifndef AVUTIL_AVCONFIG_H
3628 #define AVUTIL_AVCONFIG_H
3629 EOF
3630
3631 print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
3632
3633 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
3634
3635 cp_if_changed $TMPH libavutil/avconfig.h
3636
3637 test -n "$WARNINGS" && printf "\n$WARNINGS"
3638
3639 # build pkg-config files
3640
3641 pkgconfig_generate(){
3642 name=$1
3643 shortname=${name#lib}${build_suffix}
3644 comment=$2
3645 version=$3
3646 libs=$4
3647 requires=$5
3648 enabled ${name#lib} || return 0
3649 mkdir -p $name
3650 cat <<EOF > $name/$name.pc
3651 prefix=$prefix
3652 exec_prefix=\${prefix}
3653 libdir=$libdir
3654 includedir=$incdir
3655
3656 Name: $name
3657 Description: $comment
3658 Version: $version
3659 Requires: $(enabled shared || echo $requires)
3660 Requires.private: $(enabled shared && echo $requires)
3661 Conflicts:
3662 Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
3663 Libs.private: $(enabled shared && echo $libs)
3664 Cflags: -I\${includedir}
3665 EOF
3666 cat <<EOF > $name/$name-uninstalled.pc
3667 prefix=
3668 exec_prefix=
3669 libdir=\${pcfiledir}
3670 includedir=${source_path}
3671
3672 Name: $name
3673 Description: $comment
3674 Version: $version
3675 Requires: $requires
3676 Conflicts:
3677 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
3678 Cflags: -I\${includedir}
3679 EOF
3680 }
3681
3682 pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
3683 pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil =