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