1#!/bin/sh 2# 3# FFmpeg 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. 11LC_ALL=C 12export LC_ALL 13 14# make sure we are running under a compatible shell 15# try to make this part work with most shells 16 17try_exec(){ 18 echo "Trying shell $1" 19 type "$1" > /dev/null 2>&1 && exec "$@" 20} 21 22unset foo 23(: ${foo%%bar}) 2> /dev/null 24E1="$?" 25 26(: ${foo?}) 2> /dev/null 27E2="$?" 28 29if 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 FFMPEG, 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 FFmpeg." 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 55fi 56 57show_help(){ 58 echo "Usage: configure [options]" 59 echo "Options: [defaults in brackets after descriptions]" 60 echo 61 echo "Standard options:" 62 echo " --help print this message" 63 echo " --logfile=FILE log tests and output to FILE [config.err]" 64 echo " --disable-logging do not log configure debug information" 65 echo " --prefix=PREFIX install in PREFIX [$prefix]" 66 echo " --bindir=DIR install binaries in DIR [PREFIX/bin]" 67 echo " --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]" 68 echo " --libdir=DIR install libs in DIR [PREFIX/lib]" 69 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]" 70 echo " --incdir=DIR install includes in DIR [PREFIX/include]" 71 echo " --mandir=DIR install man page in DIR [PREFIX/share/man]" 72 echo 73 echo "Configuration options:" 74 echo " --disable-static do not build static libraries [no]" 75 echo " --enable-shared build shared libraries [no]" 76 echo " --enable-gpl allow use of GPL code, the resulting libs" 77 echo " and binaries will be under GPL [no]" 78 echo " --enable-version3 upgrade (L)GPL to version 3 [no]" 79 echo " --enable-nonfree allow use of nonfree code, the resulting libs" 80 echo " and binaries will be unredistributable [no]" 81 echo " --disable-ffmpeg disable ffmpeg build" 82 echo " --disable-ffplay disable ffplay build" 83 echo " --disable-ffserver disable ffserver build" 84 echo " --enable-postproc enable GPLed postprocessing support [no]" 85 echo " --enable-swscale enable GPLed software scaler support [no]" 86 echo " --enable-avfilter video filter support (replaces vhook) [no]" 87 echo " --enable-avfilter-lavf video filters dependent on avformat [no]" 88 echo " --disable-vhook disable video hooking support" 89 echo " --enable-beosthreads use BeOS threads [no]" 90 echo " --enable-os2threads use OS/2 threads [no]" 91 echo " --enable-pthreads use pthreads [no]" 92 echo " --enable-w32threads use Win32 threads [no]" 93 echo " --enable-x11grab enable X11 grabbing [no]" 94 echo " --enable-vdpau enable VDPAU support [no]" 95 echo " --disable-network disable network support [no]" 96 echo " --disable-ipv6 disable IPv6 support [no]" 97 echo " --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]" 98 echo " --enable-gray enable full grayscale support (slower color)" 99 echo " --enable-fastdiv enable table-based division" 100 echo " --enable-small optimize for size instead of speed" 101 echo " --disable-aandct disable AAN DCT code" 102 echo " --disable-fft disable FFT code" 103 echo " --disable-golomb disable Golomb code" 104 echo " --disable-mdct disable MDCT code" 105 echo " --disable-rdft disable RDFT code" 106 echo " --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)" 107 echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation" 108 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers" 109 echo " --enable-beos-netserver enable BeOS netserver" 110 echo " --disable-encoder=NAME disable encoder NAME" 111 echo " --enable-encoder=NAME enable encoder NAME" 112 echo " --disable-encoders disable all encoders" 113 echo " --disable-decoder=NAME disable decoder NAME" 114 echo " --enable-decoder=NAME enable decoder NAME" 115 echo " --disable-decoders disable all decoders" 116 echo " --disable-muxer=NAME disable muxer NAME" 117 echo " --enable-muxer=NAME enable muxer NAME" 118 echo " --disable-muxers disable all muxers" 119 echo " --disable-demuxer=NAME disable demuxer NAME" 120 echo " --enable-demuxer=NAME enable demuxer NAME" 121 echo " --disable-demuxers disable all demuxers" 122 echo " --enable-parser=NAME enable parser NAME" 123 echo " --disable-parser=NAME disable parser NAME" 124 echo " --disable-parsers disable all parsers" 125 echo " --enable-bsf=NAME enable bitstream filter NAME" 126 echo " --disable-bsf=NAME disable bitstream filter NAME" 127 echo " --disable-bsfs disable all bitstream filters" 128 echo " --enable-protocol=NAME enable protocol NAME" 129 echo " --disable-protocol=NAME disable protocol NAME" 130 echo " --disable-protocols disable all protocols" 131 echo " --disable-indevs disable input devices" 132 echo " --disable-outdevs disable output devices" 133 echo " --disable-devices disable all devices" 134 echo " --enable-filter=NAME enable filter NAME" 135 echo " --disable-filter=NAME disable filter NAME" 136 echo " --disable-filters disable all filters" 137 echo " --list-decoders show all available decoders" 138 echo " --list-encoders show all available encoders" 139 echo " --list-muxers show all available muxers" 140 echo " --list-demuxers show all available demuxers" 141 echo " --list-parsers show all available parsers" 142 echo " --list-protocols show all available protocols" 143 echo " --list-bsfs show all available bitstream filters" 144 echo " --list-indevs show all available input devices" 145 echo " --list-outdevs show all available output devices" 146 echo " --list-filters show all available filters" 147 echo 148 echo "External library support:" 149 echo " --enable-avisynth enable reading of AVISynth script files [no]" 150 echo " --enable-bzlib enable bzlib [autodetect]" 151 echo " --enable-libamr-nb enable libamr-nb floating point audio codec [no]" 152 echo " --enable-libamr-wb enable libamr-wb floating point audio codec [no]" 153 echo " --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]" 154 echo " --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]" 155 echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394" 156 echo " and libraw1394 [no]" 157 echo " --enable-libdirac enable Dirac support via libdirac [no]" 158 echo " --enable-libfaac enable FAAC support via libfaac [no]" 159 echo " --enable-libfaad enable FAAD support via libfaad [no]" 160 echo " --enable-libfaadbin open libfaad.so.0 at runtime [no]" 161 echo " --enable-libgsm enable GSM support via libgsm [no]" 162 echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [no]" 163 echo " --enable-libnut enable NUT (de)muxing via libnut," 164 echo " native (de)muxer exists [no]" 165 echo " --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]" 166 echo " --enable-libschroedinger enable Dirac support via libschroedinger [no]" 167 echo " --enable-libspeex enable Speex decoding via libspeex [no]" 168 echo " --enable-libtheora enable Theora encoding via libtheora [no]" 169 echo " --enable-libvorbis enable Vorbis encoding via libvorbis," 170 echo " native implementation exists [no]" 171 echo " --enable-libx264 enable H.264 encoding via x264 [no]" 172 echo " --enable-libxvid enable Xvid encoding via xvidcore," 173 echo " native MPEG-4/Xvid encoder exists [no]" 174 echo " --enable-mlib enable Sun medialib [no]" 175 echo " --enable-zlib enable zlib [autodetect]" 176 echo "" 177 echo "Advanced options (experts only):" 178 echo " --source-path=PATH path to source code [$source_path]" 179 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]" 180 echo " --enable-cross-compile assume a cross-compiler is used" 181 echo " --sysroot=PATH root of cross-build tree" 182 echo " --sysinclude=PATH location of cross-build system headers" 183 echo " --target-os=OS compiler targets OS [$target_os]" 184 echo " --target-exec=CMD command to run executables on target" 185 echo " --target-path=DIR path to view of build directory on target" 186 echo " --nm=NM use nm tool" 187 echo " --cc=CC use C compiler CC [$cc_default]" 188 echo " --host-cc=HOSTCC use host C compiler HOSTCC" 189 echo " --host-cflags=HCFLAGS use HCFLAGS when compiling for host" 190 echo " --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host" 191 echo " --host-libs=HLIBS use libs HLIBS when linking for host" 192 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]" 193 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]" 194 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]" 195 echo " --extra-version=STRING version string suffix []" 196 echo " --build-suffix=SUFFIX library name suffix []" 197 echo " --arch=ARCH select architecture [$arch]" 198 echo " --cpu=CPU select the minimum required CPU (affects" 199 echo " instruction selection, may crash on older CPUs)" 200 echo " --enable-powerpc-perf enable performance report on PPC" 201 echo " (requires enabling PMC)" 202 echo " --disable-altivec disable AltiVec optimizations" 203 echo " --disable-amd3dnow disable 3DNow! optimizations" 204 echo " --disable-amd3dnowext disable 3DNow! extended optimizations" 205 echo " --disable-mmx disable MMX optimizations" 206 echo " --disable-mmx2 disable MMX2 optimizations" 207 echo " --disable-sse disable SSE optimizations" 208 echo " --disable-ssse3 disable SSSE3 optimizations" 209 echo " --disable-armv5te disable armv5te optimizations" 210 echo " --disable-armv6 disable armv6 optimizations" 211 echo " --disable-armv6t2 disable armv6t2 optimizations" 212 echo " --disable-armvfp disable ARM VFP optimizations" 213 echo " --disable-iwmmxt disable iwmmxt optimizations" 214 echo " --disable-mmi disable MMI optimizations" 215 echo " --disable-neon disable neon optimizations" 216 echo " --disable-vis disable VIS optimizations" 217 echo " --disable-yasm disable use of yasm assembler" 218 echo 219 echo "Developer options (useful when working on FFmpeg itself):" 220 echo " --disable-debug disable debugging symbols" 221 echo " --enable-debug=LEVEL set the debug level [$debuglevel]" 222 echo " --enable-gprof enable profiling with gprof [$gprof]" 223 echo " --disable-optimizations disable compiler optimizations" 224 echo " --enable-extra-warnings enable more compiler warnings" 225 echo " --disable-stripping disable stripping of executables and shared libraries" 226 echo "" 227 echo "NOTE: Object files are built at the place where configure is launched." 228 exit 0 229} 230 231log(){ 232 echo "$@" >> $logfile 233} 234 235log_file(){ 236 log BEGIN $1 237 pr -n -t $1 >> $logfile 238 log END $1 239} 240 241echolog(){ 242 log "$@" 243 echo "$@" 244} 245 246die(){ 247 echolog "$@" 248 cat <<EOF 249If you think configure made a mistake, make sure you are using the latest 250version from SVN. If the latest version fails, report the problem to the 251ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. 252EOF 253 if disabled logging; then 254 cat <<EOF 255Rerun configure with logging enabled (do not use --disable-logging), and 256include the log this produces with your report. 257EOF 258 else 259cat <<EOF 260Include the log file "$logfile" produced by configure as this will help 261solving the problem. 262EOF 263 fi 264 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH 265 exit 1 266} 267 268# Avoid locale weirdness, besides we really just want to translate ASCII. 269toupper(){ 270 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 271} 272 273tolower(){ 274 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 275} 276 277c_escape(){ 278 echo "$*" | sed 's/["\\]/\\\0/g' 279} 280 281set_all(){ 282 value=$1 283 shift 284 for var in $*; do 285 eval $var=$value 286 done 287} 288 289set_weak(){ 290 value=$1 291 shift 292 for var; do 293 eval : \${$var:=$value} 294 done 295} 296 297pushvar(){ 298 for var in $*; do 299 eval level=\${${var}_level:=0} 300 eval ${var}_${level}="\$$var" 301 eval ${var}_level=$(($level+1)) 302 done 303} 304 305popvar(){ 306 for var in $*; do 307 eval level=\${${var}_level:-0} 308 test $level = 0 && continue 309 eval level=$(($level-1)) 310 eval $var="\${${var}_${level}}" 311 eval ${var}_level=$level 312 eval unset ${var}_${level} 313 done 314} 315 316enable(){ 317 set_all yes $* 318} 319 320disable(){ 321 set_all no $* 322} 323 324enable_weak(){ 325 set_weak yes $* 326} 327 328disable_weak(){ 329 set_weak no $* 330} 331 332enable_safe(){ 333 enable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g') 334} 335 336disable_safe(){ 337 disable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g') 338} 339 340do_enable_deep(){ 341 for var; do 342 enabled $var && continue 343 eval sel="\$${var}_select" 344 eval sgs="\$${var}_suggest" 345 pushvar var sgs 346 enable_deep $sel 347 popvar sgs 348 enable_deep_weak $sgs 349 popvar var 350 done 351} 352 353enable_deep(){ 354 do_enable_deep $* 355 enable $* 356} 357 358enable_deep_weak(){ 359 do_enable_deep $* 360 enable_weak $* 361} 362 363enabled(){ 364 test "${1#!}" = "$1" && op== || op=!= 365 eval test "x\$${1#!}" $op "xyes" 366} 367 368disabled(){ 369 test "${1#!}" = "$1" && op== || op=!= 370 eval test "x\$${1#!}" $op "xno" 371} 372 373enabled_all(){ 374 for opt; do 375 enabled $opt || return 1 376 done 377} 378 379disabled_all(){ 380 for opt; do 381 disabled $opt || return 1 382 done 383} 384 385enabled_any(){ 386 for opt; do 387 enabled $opt && return 0 388 done 389} 390 391disabled_any(){ 392 for opt; do 393 disabled $opt && return 0 394 done 395 return 1 396} 397 398set_default(){ 399 for opt; do 400 eval : \${$opt:=\$${opt}_default} 401 done 402} 403 404is_in(){ 405 value=$1 406 shift 407 for var in $*; do 408 [ $var = $value ] && return 0 409 done 410 return 1 411} 412 413check_deps(){ 414 for cfg; do 415 cfg="${cfg#!}" 416 enabled ${cfg}_checking && die "Circular dependency for $cfg." 417 disabled ${cfg}_checking && continue 418 enable ${cfg}_checking 419 420 eval dep_all="\$${cfg}_deps" 421 eval dep_any="\$${cfg}_deps_any" 422 eval dep_sel="\$${cfg}_select" 423 eval dep_sgs="\$${cfg}_suggest" 424 425 pushvar cfg dep_all dep_any dep_sel dep_sgs 426 check_deps $dep_all $dep_any $dep_sel $dep_sgs 427 popvar cfg dep_all dep_any dep_sel dep_sgs 428 429 enabled_all $dep_all || disable $cfg 430 enabled_any $dep_any || disable $cfg 431 disabled_any $dep_sel && disable $cfg 432 433 if enabled $cfg; then 434 eval dep_extralibs="\$${cfg}_extralibs" 435 test -n "$dep_extralibs" && add_extralibs $dep_extralibs 436 enable_deep $dep_sel 437 enable_deep_weak $dep_sgs 438 fi 439 440 disable ${cfg}_checking 441 done 442} 443 444print_config(){ 445 pfx=$1 446 header=$2 447 makefile=$3 448 shift 3 449 for cfg; do 450 ucname="`toupper $cfg`" 451 if enabled $cfg; then 452 echo "#define ${pfx}${ucname} 1" >> $header 453 echo "${pfx}${ucname}=yes" >> $makefile 454 else 455 echo "#define ${pfx}${ucname} 0" >> $header 456 fi 457 done 458} 459 460flags_saved(){ 461 (: ${SAVE_CFLAGS?}) 2> /dev/null 462} 463 464save_flags(){ 465 flags_saved && return 466 SAVE_CFLAGS="$CFLAGS" 467 SAVE_LDFLAGS="$LDFLAGS" 468 SAVE_extralibs="$extralibs" 469} 470 471restore_flags(){ 472 flags_saved || return 473 CFLAGS="$SAVE_CFLAGS" 474 LDFLAGS="$SAVE_LDFLAGS" 475 extralibs="$SAVE_extralibs" 476 unset SAVE_CFLAGS 477 unset SAVE_LDFLAGS 478 unset SAVE_extralibs 479} 480 481temp_cflags(){ 482 save_flags 483 CFLAGS="$CFLAGS $*" 484} 485 486temp_ldflags(){ 487 save_flags 488 LDFLAGS="$LDFLAGS $*" 489} 490 491temp_extralibs(){ 492 save_flags 493 extralibs="$extralibs $*" 494} 495 496append(){ 497 var=$1 498 shift 499 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\"" 500 eval "$var=\"\$$var $*\"" 501} 502 503add_cflags(){ 504 append CFLAGS "$@" 505} 506 507add_ldflags(){ 508 append LDFLAGS "$@" 509} 510 511add_extralibs(){ 512 append extralibs "$@" 513} 514 515check_cmd(){ 516 log "$@" 517 "$@" >> $logfile 2>&1 518} 519 520check_cc(){ 521 log check_cc "$@" 522 cat > $TMPC 523 log_file $TMPC 524 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC 525} 526 527check_cpp(){ 528 log check_cpp "$@" 529 cat > $TMPC 530 log_file $TMPC 531 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC 532} 533 534check_asm(){ 535 log check_asm "$@" 536 name="$1" 537 asm="$2" 538 shift 2 539 check_cc "$@" <<EOF && enable $name || disable $name 540void foo(void){ __asm__ volatile($asm); } 541EOF 542} 543 544check_yasm(){ 545 log check_yasm "$@" 546 echo "$1" > $TMPS 547 log_file $TMPS 548 shift 1 549 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS 550} 551 552check_ld(){ 553 log check_ld "$@" 554 check_cc || return 555 flags='' 556 libs='' 557 for f; do 558 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" 559 done 560 check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs 561} 562 563check_cflags(){ 564 log check_cflags "$@" 565 check_cc "$@" <<EOF && add_cflags "$@" 566int x; 567EOF 568} 569 570test_ldflags(){ 571 log test_ldflags "$@" 572 check_ld "$@" <<EOF 573int main(void){ return 0; } 574EOF 575} 576 577check_ldflags(){ 578 log check_ldflags "$@" 579 test_ldflags "$@" && add_ldflags "$@" 580} 581 582check_header(){ 583 log check_header "$@" 584 header=$1 585 shift 586 disable_safe $header 587 check_cpp "$@" <<EOF && enable_safe $header 588#include <$header> 589int x; 590EOF 591} 592 593check_func(){ 594 log check_func "$@" 595 func=$1 596 shift 597 disable $func 598 check_ld "$@" <<EOF && enable $func 599extern int $func(); 600int main(void){ $func(); } 601EOF 602} 603 604check_func_headers(){ 605 log check_func_headers "$@" 606 headers=$1 607 func=$2 608 shift 2 609 disable $func 610 incs="" 611 for hdr in $headers; do 612 incs="$incs 613#include <$hdr>" 614 done 615 check_ld "$@" <<EOF && enable $func && enable_safe $headers 616$incs 617int main(int argc, char **argv){ 618 (void) $func; 619 return 0; 620} 621EOF 622} 623 624check_cpp_condition(){ 625 log check_cpp_condition "$@" 626 header=$1 627 condition=$2 628 check_cpp <<EOF 629#include <$header> 630#if !($condition) 631#error "unsatisfied condition: $condition" 632#endif 633EOF 634} 635 636check_lib(){ 637 log check_lib "$@" 638 header="$1" 639 func="$2" 640 shift 2 641 temp_extralibs "$@" 642 check_header $header && check_func $func && add_extralibs "$@" 643 err=$? 644 restore_flags 645 return $err 646} 647 648check_lib2(){ 649 log check_lib2 "$@" 650 headers="$1" 651 func="$2" 652 shift 2 653 temp_extralibs "$@" 654 check_func_headers "$headers" $func && add_extralibs "$@" 655 err=$? 656 restore_flags 657 return $err 658} 659 660check_exec(){ 661 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } 662} 663 664check_exec_crash(){ 665 code=`cat` 666 667 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) 668 # are safe but may not be available everywhere. Thus we use 669 # raise(SIGTERM) instead. The check is run in a subshell so we 670 # can redirect the "Terminated" message from the shell. SIGBUS 671 # is not defined by standard C so it is used conditionally. 672 673 (check_exec "$@") >> $logfile 2>&1 <<EOF 674#include <signal.h> 675static void sighandler(int sig){ 676 raise(SIGTERM); 677} 678int main(void){ 679 signal(SIGILL, sighandler); 680 signal(SIGFPE, sighandler); 681 signal(SIGSEGV, sighandler); 682#ifdef SIGBUS 683 signal(SIGBUS, sighandler); 684#endif 685 { $code } 686} 687EOF 688} 689 690check_type(){ 691 log check_type "$@" 692 headers=$1 693 type=$2 694 shift 2 695 disable $type 696 incs="" 697 for hdr in $headers; do 698 incs="$incs 699#include <$hdr>" 700 done 701 check_cc "$@" <<EOF && enable $type 702$incs 703$type v; 704EOF 705} 706 707require(){ 708 name="$1" 709 header="$2" 710 func="$3" 711 shift 3 712 check_lib $header $func "$@" || die "ERROR: $name not found" 713} 714 715require2(){ 716 name="$1" 717 headers="$2" 718 func="$3" 719 shift 3 720 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" 721} 722 723check_foo_config(){ 724 cfg=$1 725 pkg=$2 726 header=$3 727 func=$4 728 shift 4 729 disable $cfg 730 check_cmd ${pkg}-config --version 731 err=$? 732 if test "$err" = 0; then 733 temp_cflags `${pkg}-config --cflags` 734 temp_extralibs `${pkg}-config --libs` 735 check_lib "$@" $header $func && enable $cfg 736 fi 737 return $err 738} 739 740apply(){ 741 file=$1 742 shift 743 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp" 744} 745 746# CONFIG_LIST contains configurable options, while HAVE_LIST is for 747# system-dependent things. 748 749COMPONENT_LIST=" 750 bsfs 751 decoders 752 demuxers 753 encoders 754 filters 755 indevs 756 muxers 757 outdevs 758 parsers 759 protocols 760" 761 762CONFIG_LIST=" 763 $COMPONENT_LIST 764 aandct 765 avfilter 766 avfilter_lavf 767 avisynth 768 beos_netserver 769 bzlib 770 fastdiv 771 ffmpeg 772 ffplay 773 ffserver 774 fft 775 golomb 776 gpl 777 gprof 778 gray 779 hardcoded_tables 780 ipv6 781 libamr_nb 782 libamr_wb 783 libdc1394 784 libdirac 785 libfaac 786 libfaad 787 libfaadbin 788 libgsm 789 libmp3lame 790 libnut 791 libopencore_amrnb 792 libopencore_amrwb 793 libopenjpeg 794 libschroedinger 795 libspeex 796 libtheora 797 libvorbis 798 libx264 799 libxvid 800 mdct 801 memalign_hack 802 mlib 803 mpegaudio_hp 804 network 805 nonfree 806 postproc 807 powerpc_perf 808 rdft 809 runtime_cpudetect 810 shared 811 small 812 static 813 swscale 814 vdpau 815 vhook 816 version3 817 x11grab 818 zlib 819" 820 821THREADS_LIST=' 822 beosthreads 823 os2threads 824 pthreads 825 w32threads 826' 827 828ARCH_LIST=' 829 alpha 830 arm 831 bfin 832 ia64 833 m68k 834 mips 835 parisc 836 ppc 837 s390 838 sh4 839 sparc 840 sparc64 841 x86 842 x86_32 843 x86_64 844' 845 846ARCH_EXT_LIST=' 847 altivec 848 amd3dnow 849 amd3dnowext 850 armv5te 851 armv6 852 armv6t2 853 armvfp 854 iwmmxt 855 mmi 856 mmx 857 mmx2 858 neon 859 ppc4xx 860 sse 861 ssse3 862 vis 863' 864 865HAVE_LIST=" 866 $ARCH_EXT_LIST 867 $THREADS_LIST 868 alsa_asoundlib_h 869 altivec_h 870 arpa_inet_h 871 bswap 872 closesocket 873 cmov 874 conio_h 875 dcbzl 876 dev_bktr_ioctl_bt848_h 877 dev_bktr_ioctl_meteor_h 878 dev_ic_bt8xx_h 879 dev_video_meteor_ioctl_meteor_h 880 dev_video_bktr_ioctl_bt848_h 881 dlfcn_h 882 dlopen 883 dos_paths 884 ebp_available 885 ebx_available 886 fast_64bit 887 fast_cmov 888 fast_unaligned 889 fork 890 freetype2 891 gethrtime 892 GetProcessTimes 893 getrusage 894 imlib2 895 inet_aton 896 inline_asm 897 libdc1394_1 898 libdc1394_2 899 llrint 900 lrint 901 lrintf 902 machine_ioctl_bt848_h 903 machine_ioctl_meteor_h 904 malloc_h 905 memalign 906 mkstemp 907 pld 908 posix_memalign 909 ppc64 910 round 911 roundf 912 sdl 913 sdl_video_size 914 setmode 915 socklen_t 916 soundcard_h 917 poll_h 918 sys_mman_h 919 sys_resource_h 920 sys_select_h 921 sys_soundcard_h 922 sys_videoio_h 923 ten_operands 924 termios_h 925 threads 926 truncf 927 winsock2_h 928 yasm 929" 930 931# options emitted with CONFIG_ prefix but not available on command line 932CONFIG_EXTRA=" 933 gplv3 934 lgplv3 935 oldscaler 936" 937 938CMDLINE_SELECT=" 939 $ARCH_EXT_LIST 940 $CONFIG_LIST 941 $THREADS_LIST 942 cross_compile 943 debug 944 extra_warnings 945 logging 946 optimizations 947 stripping 948 yasm 949" 950 951PATHS_LIST=' 952 bindir 953 datadir 954 incdir 955 libdir 956 mandir 957 prefix 958 shlibdir 959' 960 961CMDLINE_SET=" 962 $PATHS_LIST 963 arch 964 build_suffix 965 cc 966 cpu 967 cross_prefix 968 extra_version 969 host_cc 970 host_cflags 971 host_ldflags 972 host_libs 973 logfile 974 nm 975 source_path 976 sysinclude 977 sysroot 978 target_exec 979 target_os 980 target_path 981" 982 983# code dependency declarations 984 985# architecture extensions 986altivec_deps="ppc" 987amd3dnow_deps="mmx" 988amd3dnowext_deps="amd3dnow" 989armv5te_deps="arm" 990armv6_deps="arm" 991armv6t2_deps="arm" 992armvfp_deps="arm" 993iwmmxt_deps="arm" 994mmi_deps="mips" 995mmx_deps="x86" 996mmx2_deps="mmx" 997neon_deps="arm" 998ppc4xx_deps="ppc" 999sse_deps="mmx" 1000ssse3_deps="sse" 1001vis_deps="sparc" 1002 1003# common features 1004oldscaler_deps="!swscale" 1005 1006# decoders / encoders 1007aac_decoder_select="fft mdct" 1008ac3_decoder_select="fft mdct" 1009atrac3_decoder_select="fft mdct" 1010cavs_decoder_select="golomb" 1011cook_decoder_select="fft mdct" 1012cscd_decoder_suggest="zlib" 1013dca_decoder_select="fft mdct" 1014dnxhd_encoder_select="aandct" 1015dxa_decoder_select="zlib" 1016eac3_decoder_select="fft mdct" 1017eatgq_decoder_select="aandct" 1018eatqi_decoder_select="aandct" 1019ffv1_decoder_select="golomb" 1020flac_decoder_select="golomb" 1021flac_encoder_select="golomb" 1022flashsv_decoder_select="zlib" 1023flashsv_encoder_select="zlib" 1024flv_encoder_select="aandct" 1025h261_encoder_select="aandct" 1026h263_encoder_select="aandct" 1027h263p_encoder_select="aandct" 1028h264_decoder_select="golomb" 1029h264_vdpau_decoder_deps="vdpau" 1030imc_decoder_select="fft mdct" 1031jpegls_decoder_select="golomb" 1032jpegls_encoder_select="golomb" 1033ljpeg_encoder_select="aandct" 1034loco_decoder_select="golomb" 1035mjpeg_encoder_select="aandct" 1036mpeg1video_encoder_select="aandct" 1037mpeg2video_encoder_select="aandct" 1038mpeg4_encoder_select="aandct" 1039mpeg_vdpau_decoder_deps="vdpau" 1040mpeg1_vdpau_decoder_deps="vdpau" 1041mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" 1042msmpeg4v1_encoder_select="aandct" 1043msmpeg4v2_encoder_select="aandct" 1044msmpeg4v3_encoder_select="aandct" 1045nellymoser_decoder_select="fft mdct" 1046nellymoser_encoder_select="fft mdct" 1047png_decoder_select="zlib" 1048png_encoder_select="zlib" 1049qdm2_decoder_select="fft mdct rdft" 1050rv10_encoder_select="aandct" 1051rv20_encoder_select="aandct" 1052rv30_decoder_select="golomb" 1053rv40_decoder_select="golomb" 1054shorten_decoder_select="golomb" 1055sonic_decoder_select="golomb" 1056sonic_encoder_select="golomb" 1057sonic_ls_encoder_select="golomb" 1058svq3_decoder_select="golomb" 1059svq3_decoder_suggest="zlib" 1060tiff_decoder_suggest="zlib" 1061tiff_encoder_suggest="zlib" 1062tscc_decoder_select="zlib" 1063vc1_vdpau_decoder_deps="vdpau" 1064vorbis_decoder_select="fft mdct" 1065vorbis_encoder_select="fft mdct" 1066wmav1_decoder_select="fft mdct" 1067wmav1_encoder_select="fft mdct" 1068wmav2_decoder_select="fft mdct" 1069wmav2_encoder_select="fft mdct" 1070wmv1_encoder_select="aandct" 1071wmv2_encoder_select="aandct" 1072wmv3_vdpau_decoder_deps="vdpau" 1073zlib_decoder_select="zlib" 1074zlib_encoder_select="zlib" 1075zmbv_decoder_select="zlib" 1076zmbv_encoder_select="zlib" 1077 1078# external libraries 1079libamr_nb_decoder_deps="libamr_nb" 1080libamr_nb_encoder_deps="libamr_nb" 1081libamr_wb_decoder_deps="libamr_wb" 1082libamr_wb_encoder_deps="libamr_wb" 1083libdirac_decoder_deps="libdirac !libschroedinger" 1084libdirac_encoder_deps="libdirac" 1085libfaac_encoder_deps="libfaac" 1086libfaad_decoder_deps="libfaad" 1087libfaadbin_decoder_extralibs='$ldl' 1088libgsm_decoder_deps="libgsm" 1089libgsm_encoder_deps="libgsm" 1090libgsm_ms_decoder_deps="libgsm" 1091libgsm_ms_encoder_deps="libgsm" 1092libmp3lame_encoder_deps="libmp3lame" 1093libopencore_amrnb_decoder_deps="libopencore_amrnb" 1094libopencore_amrnb_encoder_deps="libopencore_amrnb" 1095libopencore_amrwb_decoder_deps="libopencore_amrwb" 1096libopenjpeg_decoder_deps="libopenjpeg" 1097libschroedinger_decoder_deps="libschroedinger" 1098libschroedinger_encoder_deps="libschroedinger" 1099libspeex_decoder_deps="libspeex" 1100libtheora_encoder_deps="libtheora" 1101libvorbis_encoder_deps="libvorbis" 1102libx264_encoder_deps="libx264" 1103libxvid_encoder_deps="libxvid" 1104mpeg4aac_decoder_deps="libfaad" 1105vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" 1106 1107# demuxers / muxers 1108ac3_demuxer_deps="ac3_parser" 1109alsa_demuxer_deps="alsa_asoundlib_h snd_pcm_htimestamp" 1110alsa_demuxer_extralibs="-lasound" 1111alsa_muxer_deps="alsa_asoundlib_h" 1112alsa_muxer_extralibs="-lasound" 1113audio_beos_demuxer_deps="audio_beos" 1114audio_beos_demuxer_extralibs="-lmedia -lbe" 1115audio_beos_muxer_deps="audio_beos" 1116audio_beos_muxer_extralibs="-lmedia -lbe" 1117avisynth_demuxer_deps="avisynth" 1118bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" 1119dirac_demuxer_deps="dirac_parser" 1120dv1394_demuxer_deps="dv1394 dv_demuxer" 1121libdc1394_demuxer_deps="libdc1394" 1122libnut_demuxer_deps="libnut" 1123libnut_muxer_deps="libnut" 1124matroska_demuxer_suggest="zlib bzlib" 1125mov_demuxer_suggest="zlib" 1126mp3_demuxer_deps="mpegaudio_parser" 1127oss_demuxer_deps_any="soundcard_h sys_soundcard_h" 1128oss_muxer_deps_any="soundcard_h sys_soundcard_h" 1129redir_demuxer_deps="network" 1130rtp_muxer_deps="network rtp_protocol" 1131rtsp_demuxer_deps="sdp_demuxer" 1132sdp_demuxer_deps="rtp_protocol mpegts_demuxer" 1133v4l_demuxer_deps="linux_videodev_h" 1134v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h" 1135vfwcap_demuxer_deps="capCreateCaptureWindow" 1136vfwcap_demuxer_extralibs="-lvfw32" 1137x11_grab_device_demuxer_deps="x11grab XShmCreateImage" 1138x11_grab_device_demuxer_extralibs="-lX11 -lXext" 1139 1140# protocols 1141gopher_protocol_deps="network" 1142http_protocol_deps="network" 1143rtp_protocol_deps="udp_protocol" 1144tcp_protocol_deps="network" 1145udp_protocol_deps="network" 1146 1147# filters 1148movie_filter_deps="avfilter_lavf" 1149 1150# programs 1151ffplay_deps="sdl" 1152ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer" 1153ffserver_extralibs='$ldl' 1154vhook_extralibs='$ldl' 1155 1156 1157# default parameters 1158 1159logfile="config.err" 1160 1161# installation paths 1162prefix_default="/usr/local" 1163bindir_default='${prefix}/bin' 1164datadir_default='${prefix}/share/ffmpeg' 1165incdir_default='${prefix}/include' 1166libdir_default='${prefix}/lib' 1167mandir_default='${prefix}/share/man' 1168shlibdir_default="$libdir_default" 1169 1170# toolchain 1171ar="ar" 1172cc_default="gcc" 1173host_cc_default="gcc" 1174ln_s="ln -sf" 1175nm_default="nm" 1176objformat="elf" 1177ranlib="ranlib" 1178strip="strip" 1179yasmexe="yasm" 1180 1181# machine 1182arch=`uname -m` 1183cpu="generic" 1184 1185# OS 1186target_os=$(tolower $(uname -s)) 1187 1188# configurable options 1189enable debug 1190enable ffmpeg 1191enable ffplay 1192enable ffserver 1193enable ipv6 1194enable mpegaudio_hp 1195enable network 1196enable oldscaler 1197enable optimizations 1198enable protocols 1199enable static 1200enable stripping 1201vhook="default" 1202 1203# build settings 1204add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 1205SHFLAGS='-shared -Wl,-soname,$$(@F)' 1206VHOOKSHFLAGS='-shared -Wl,-soname,$$(@F)' 1207FFSERVERLDFLAGS=-Wl,-E 1208LIBPREF="lib" 1209LIBSUF=".a" 1210FULLNAME='$(NAME)$(BUILDSUF)' 1211LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)' 1212SLIBPREF="lib" 1213SLIBSUF=".so" 1214SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)' 1215SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)' 1216SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' 1217LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"' 1218 1219host_cflags='-O3 -g -Wall' 1220host_libs='-lm' 1221 1222target_path='.' 1223 1224# gcc stupidly only outputs the basename of targets with -MM, but we need the 1225# full relative path for objects in subdirectories for non-recursive Make. 1226DEPEND_CMD='$(CC) $(CFLAGS) -MM $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"' 1227 1228# find source path 1229source_path="`dirname \"$0\"`" 1230enable source_path_used 1231if test -z "$source_path" -o "$source_path" = "." ; then 1232 source_path="`pwd`" 1233 disable source_path_used 1234else 1235 source_path="`cd \"$source_path\"; pwd`" 1236 echo "$source_path" | grep -q '[[:blank:]]' && 1237 die "Out of tree builds are impossible with whitespace in source path." 1238fi 1239 1240FFMPEG_CONFIGURATION="$@" 1241 1242find_things(){ 1243 thing=$1 1244 pattern=$2 1245 file=$source_path/$3 1246 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" 1247} 1248 1249ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c) 1250DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c) 1251PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c) 1252BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c) 1253MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c) 1254DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c) 1255OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c) 1256INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c) 1257PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c) 1258FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c) 1259 1260enable $ARCH_EXT_LIST \ 1261 $DECODER_LIST \ 1262 $ENCODER_LIST \ 1263 $PARSER_LIST \ 1264 $BSF_LIST \ 1265 $DEMUXER_LIST \ 1266 $MUXER_LIST \ 1267 $FILTER_LIST \ 1268 $PROTOCOL_LIST \ 1269 $INDEV_LIST \ 1270 $OUTDEV_LIST \ 1271 1272die_unknown(){ 1273 echo "Unknown option \"$1\"." 1274 echo "See $0 --help for available options." 1275 exit 1 1276} 1277 1278show_list() { 1279 suffix=_$1 1280 shift 1281 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort 1282 exit 0 1283} 1284 1285for opt do 1286 optval="${opt#*=}" 1287 case "$opt" in 1288 --extra-cflags=*) add_cflags $optval 1289 ;; 1290 --extra-ldflags=*) add_ldflags $optval 1291 ;; 1292 --extra-libs=*) add_extralibs $optval 1293 ;; 1294 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST 1295 ;; 1296 --enable-debug=*) debuglevel="$optval" 1297 ;; 1298 --enable-*=*|--disable-*=*) 1299 eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'` 1300 case "$thing" in 1301 encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;; 1302 *) die_unknown "$opt" ;; 1303 esac 1304 ;; 1305 --enable-?*|--disable-?*) 1306 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` 1307 if is_in $option $COMPONENT_LIST; then 1308 eval $action \$$(toupper ${option%s})_LIST 1309 elif is_in $option $CMDLINE_SELECT; then 1310 $action $option 1311 else 1312 die_unknown $opt 1313 fi 1314 ;; 1315 --list-*) 1316 NAME="${opt#--list-}" 1317 is_in $NAME $COMPONENT_LIST || die_unknown $opt 1318 NAME=${NAME%s} 1319 eval show_list $NAME \$$(toupper $NAME)_LIST 1320 ;; 1321 --help|-h) show_help 1322 ;; 1323 *) 1324 optname="${opt%%=*}" 1325 optname="${optname#--}" 1326 optname=$(echo "$optname" | sed 's/-/_/g') 1327 is_in $optname $CMDLINE_SET || die_unknown $opt 1328 eval $optname='$optval' 1329 ;; 1330 esac 1331done 1332 1333disabled logging && logfile=/dev/null 1334 1335echo "# $0 $@" > $logfile 1336set >> $logfile 1337 1338test -n "$cross_prefix" && enable cross_compile 1339 1340ar="${cross_prefix}${ar}" 1341cc_default="${cross_prefix}${cc_default}" 1342nm_default="${cross_prefix}${nm_default}" 1343ranlib="${cross_prefix}${ranlib}" 1344strip="${cross_prefix}${strip}" 1345 1346sysinclude_default="${sysroot}/usr/include" 1347 1348set_default cc nm sysinclude 1349enabled cross_compile || host_cc_default=$cc 1350set_default host_cc 1351 1352case $target_os in 1353 mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) EXESUF=.exe ;; 1354esac 1355 1356# set temporary file name 1357: ${TMPDIR:=$TEMPDIR} 1358: ${TMPDIR:=$TMP} 1359: ${TMPDIR:=/tmp} 1360 1361TMPC="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c" 1362TMPE="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}" 1363TMPH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h" 1364TMPO="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o" 1365TMPS="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S" 1366TMPV="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.ver" 1367TMPSH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh" 1368 1369# make sure we can execute files in $TMPDIR 1370cat > $TMPSH 2>> $logfile <<EOF 1371#! /bin/sh 1372EOF 1373chmod +x $TMPSH >> $logfile 2>&1 1374if ! $TMPSH >> $logfile 2>&1; then 1375 cat <<EOF 1376Unable to create and execute files in $TMPDIR. Set the TMPDIR environment 1377variable to another directory and make sure that it is not mounted noexec. 1378EOF 1379 die "Sanity test failed." 1380fi 1381rm $TMPSH 1382 1383if $cc --version 2>/dev/null | grep -qi gcc; then 1384 cc_type=gcc 1385elif $cc --version 2>/dev/null | grep -q Intel; then 1386 cc_type=icc 1387elif $cc -v 2>&1 | grep -q xlc; then 1388 cc_type=xlc 1389elif $cc -V 2>/dev/null | grep -q Compaq; then 1390 cc_type=ccc 1391 DEPEND_CMD='$(CC) $(CFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"' 1392 add_ldflags -Wl,-z,now # calls to libots crash without this 1393fi 1394 1395test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc" 1396 1397if test -n "$sysroot"; then 1398 case "$cc_type" in 1399 gcc) 1400 add_cflags --sysroot="$sysroot" 1401 add_ldflags --sysroot="$sysroot" 1402 ;; 1403 esac 1404fi 1405 1406# compiler sanity check 1407check_exec <<EOF 1408int main(void){ return 0; } 1409EOF 1410if test "$?" != 0; then 1411 echo "$cc is unable to create an executable file." 1412 if test -z "$cross_prefix" && ! enabled cross_compile ; then 1413 echo "If $cc is a cross-compiler, use the --enable-cross-compile option." 1414 echo "Only do this if you know what cross compiling means." 1415 fi 1416 die "C compiler test failed." 1417fi 1418 1419check_cflags -std=c99 1420 1421case "$arch" in 1422 alpha) 1423 arch="alpha" 1424 enable fast_64bit 1425 check_cflags -mieee 1426 ;; 1427 arm|armv[4567]*l) 1428 arch="arm" 1429 ;; 1430 avr32) 1431 ;; 1432 bfin) 1433 arch="bfin" 1434 ;; 1435 ia64) 1436 arch="ia64" 1437 enable fast_64bit 1438 ;; 1439 m68k) 1440 arch="m68k" 1441 ;; 1442 mips|mipsel|IP*) 1443 arch="mips" 1444 ;; 1445 mips64) 1446 arch="mips" 1447 enable fast_64bit 1448 ;; 1449 parisc|hppa) 1450 arch="parisc" 1451 ;; 1452 parisc64|hppa64) 1453 arch="parisc" 1454 enable fast_64bit 1455 ;; 1456 "Power Macintosh"|ppc|powerpc) 1457 arch="ppc" 1458 enable fast_unaligned 1459 ;; 1460 ppc64) 1461 arch="ppc" 1462 enable fast_64bit 1463 enable fast_unaligned 1464 ;; 1465 s390|s390x) 1466 arch="s390" 1467 ;; 1468 sh4|sh) 1469 arch="sh4" 1470 ;; 1471 sparc) 1472 arch="sparc" 1473 ;; 1474 sun4u|sparc64) 1475 arch="sparc" 1476 subarch="sparc64" 1477 enable fast_64bit 1478 ;; 1479 i386|i486|i586|i686|i86pc|BePC) 1480 arch="x86" 1481 subarch="x86_32" 1482 enable fast_unaligned 1483 ;; 1484 x86_64|amd64) 1485 arch="x86" 1486 subarch="x86_32" 1487 enable cmov 1488 enable fast_cmov 1489 enable fast_unaligned 1490 check_cc <<EOF && enable fast_64bit && subarch="x86_64" 1491 int test[sizeof(char*) - 7]; 1492EOF 1493 ;; 1494 *) 1495 arch="unknown" 1496 ;; 1497esac 1498 1499enable $arch $subarch 1500 1501# OS specific 1502case $target_os in 1503 beos|haiku|zeta) 1504 prefix_default="$HOME/config" 1505 # helps building libavcodec 1506 add_cflags -DPIC -fomit-frame-pointer 1507 # 3 gcc releases known for BeOS, each with ugly bugs 1508 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" 1509 case "$gcc_version" in 1510 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc" 1511 disable mmx 1512 ;; 1513 *20010315*) echo "BeBits gcc" 1514 add_cflags -fno-expensive-optimizations 1515 ;; 1516 esac 1517 SHFLAGS=-nostart 1518 # enable BeOS things 1519 enable audio_beos 1520 # no need for libm, but the inet stuff 1521 # Check for BONE 1522 # XXX: actually should check for NOT net_server 1523 if echo $BEINCLUDES | grep -q 'headers/be/bone'; then 1524 network_extralibs="-lbind -lsocket" 1525 else 1526 enable beos_netserver 1527 network_extralibs="-lnet" 1528 fi ;; 1529 sunos) 1530 FFSERVERLDFLAGS="" 1531 SHFLAGS='-shared -Wl,-h,$$(@F)' 1532 network_extralibs="-lsocket -lnsl" 1533 add_cflags -D__EXTENSIONS__ 1534 ;; 1535 netbsd) 1536 oss_demuxer_extralibs="-lossaudio" 1537 oss_muxer_extralibs="-lossaudio" 1538 ;; 1539 openbsd) 1540 disable need_memalign 1541 LIBOBJFLAGS='$(PIC)' 1542 SHFLAGS='-shared' 1543 oss_demuxer_extralibs="-lossaudio" 1544 oss_muxer_extralibs="-lossaudio" 1545 ;; 1546 freebsd) 1547 disable need_memalign 1548 ;; 1549 bsd/os) 1550 osextralibs="-lpoll -lgnugetopt" 1551 strip="strip -d" 1552 ;; 1553 darwin) 1554 disable need_memalign 1555 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress' 1556 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)' 1557 strip="strip -x" 1558 FFLDFLAGS="-Wl,-dynamic,-search_paths_first" 1559 SLIBSUF=".dylib" 1560 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' 1561 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' 1562 FFSERVERLDFLAGS=-Wl,-bind_at_load 1563 objformat="macho" 1564 enabled x86_64 && objformat="macho64" 1565 ;; 1566 mingw32*) 1567 target_os=mingw32 1568 LIBTARGET=i386 1569 if enabled x86_64; then 1570 disable need_memalign 1571 LIBTARGET=x64 1572 fi 1573 shlibdir_default="$bindir_default" 1574 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil' 1575 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)' 1576 if enabled swscale; then 1577 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale" 1578 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)" 1579 fi 1580 disable ffserver 1581 SLIBPREF="" 1582 SLIBSUF=".dll" 1583 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' 1584 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' 1585 SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)' 1586 SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \ 1587 install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"' 1588 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"' 1589 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base' 1590 objformat="win32" 1591 enable dos_paths 1592 check_cflags -fno-common 1593 if ! enabled x86_64; then 1594 check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" || 1595 die "ERROR: MinGW runtime version must be >= 3.15." 1596 enabled_any avisynth vfwcap_demuxer && 1597 { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" || 1598 die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.13 or later."; } 1599 fi 1600 ;; 1601 cygwin*) 1602 target_os=cygwin 1603 shlibdir_default="$bindir_default" 1604 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil' 1605 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)' 1606 if enabled swscale; then 1607 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale" 1608 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)" 1609 fi 1610 SLIBPREF="cyg" 1611 SLIBSUF=".dll" 1612 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' 1613 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' 1614 SHFLAGS='-shared -Wl,--enable-auto-image-base' 1615 objformat="win32" 1616 enable dos_paths 1617 check_cflags -fno-common 1618 ;; 1619 *-dos|freedos|opendos) 1620 disable ffplay ffserver vhook 1621 disable $INDEV_LIST $OUTDEV_LIST 1622 network_extralibs="-lsocket" 1623 objformat="coff" 1624 enable dos_paths 1625 ;; 1626 linux) 1627 enable dv1394 1628 ;; 1629 irix*) 1630 target_os=irix 1631 ranlib="echo ignoring ranlib" 1632 ;; 1633 os/2*) 1634 strip="lxlite" 1635 ln_s="cp -f" 1636 FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap" 1637 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' 1638 FFSERVERLDFLAGS="" 1639 LIBSUF="_s.a" 1640 SLIBPREF="" 1641 SLIBSUF=".dll" 1642 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' 1643 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)' 1644 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \ 1645 echo PROTMODE >> $(SUBDIR)$(NAME).def; \ 1646 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \ 1647 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \ 1648 echo EXPORTS >> $(SUBDIR)$(NAME).def; \ 1649 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def' 1650 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \ 1651 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;' 1652 SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"' 1653 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib' 1654 disable vhook 1655 enable dos_paths 1656 ;; 1657 interix) 1658 disable vhook 1659 ;; 1660 gnu/kfreebsd) 1661 ;; 1662 1663 *) 1664 die "Unknown OS '$target_os'." 1665 ;; 1666esac 1667 1668set_default $PATHS_LIST 1669 1670add_extralibs $osextralibs 1671 1672# Combine FFLDFLAGS and the LDFLAGS environment variable. 1673LDFLAGS="$FFLDFLAGS $LDFLAGS" 1674 1675# we need to build at least one lib type 1676if ! enabled_any static shared; then 1677 cat <<EOF 1678At least one library type must be built. 1679Specify --enable-static to build the static libraries or --enable-shared to 1680build the shared libraries as well. To only build the shared libraries specify 1681--disable-static in addition to --enable-shared. 1682EOF 1683 exit 1; 1684fi 1685 1686disabled static && LIBNAME="" 1687 1688if enabled_any libfaad libfaadbin ; then 1689 if check_header faad.h; then 1690 check_cc <<EOF 1691#include <faad.h> 1692#ifndef FAAD2_VERSION 1693ok faad1 1694#endif 1695int main(void) { return 0; } 1696EOF 1697 test $? = 0 && enable libfaad2 1698 else 1699 die "FAAD test failed." 1700 fi 1701fi 1702 1703 1704die_license_disabled() { 1705 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } 1706} 1707 1708die_license_disabled gpl libfaad2 1709die_license_disabled gpl libx264 1710die_license_disabled gpl libxvid 1711die_license_disabled gpl postproc 1712die_license_disabled gpl x11grab 1713 1714die_license_disabled nonfree libamr_nb 1715die_license_disabled nonfree libamr_wb 1716die_license_disabled nonfree libfaac 1717 1718die_license_disabled version3 libopencore_amrnb 1719die_license_disabled version3 libopencore_amrwb 1720 1721enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } 1722 1723check_deps $ARCH_EXT_LIST 1724 1725test -z "$need_memalign" && need_memalign="$mmx" 1726 1727#Darwin CC versions 1728if test $target_os = darwin; then 1729 if enabled xlc; then 1730 add_cflags -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto 1731 else 1732 add_cflags -pipe 1733 check_cflags -force_cpusubtype_ALL 1734 check_cflags -Wno-sign-compare 1735 enabled shared || check_cflags -mdynamic-no-pic 1736 fi 1737fi 1738 1739disabled optimizations || check_cflags -fomit-frame-pointer 1740 1741# Add processor-specific flags 1742if test $cpu != "generic"; then 1743 warn_altivec(){ 1744 $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1."; 1745 } 1746 case $cpu in 1747 601|ppc601|PowerPC601) 1748 add_cflags -mcpu=601 1749 warn_altivec enabled PPC601 1750 ;; 1751 603*|ppc603*|PowerPC603*) 1752 add_cflags -mcpu=603 1753 warn_altivec enabled PPC603 1754 ;; 1755 604*|ppc604*|PowerPC604*) 1756 add_cflags -mcpu=604 1757 warn_altivec enabled PPC604 1758 ;; 1759 G3|g3|75*|ppc75*|PowerPC75*) 1760 add_cflags -mcpu=750 -mpowerpc-gfxopt 1761 warn_altivec enabled PPC75x 1762 ;; 1763 G4|g4|745*|ppc745*|PowerPC745*) 1764 add_cflags -mcpu=7450 -mpowerpc-gfxopt 1765 warn_altivec disabled PPC745x 1766 ;; 1767 74*|ppc74*|PowerPC74*) 1768 add_cflags -mcpu=7400 -mpowerpc-gfxopt 1769 warn_altivec disabled PPC74xx 1770 ;; 1771 G5|g5|970|ppc970|PowerPC970|power4*|Power4*) 1772 add_cflags -mcpu=970 -mpowerpc-gfxopt -mpowerpc64 1773 warn_altivec disabled PPC970 1774 enable ppc64 1775 ;; 1776 Cell|CELL|cell) 1777 add_cflags -mcpu=cell 1778 warn_altivec disabled Cell 1779 enable ppc64 1780 ;; 1781 # targets that do NOT support conditional mov (cmov) 1782 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3) 1783 add_cflags -march=$cpu 1784 disable cmov 1785 ;; 1786 # targets that do support conditional mov (cmov) 1787 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2) 1788 add_cflags -march=$cpu 1789 enable cmov 1790 enable fast_cmov 1791 ;; 1792 # targets that do support conditional mov but on which it's slow 1793 pentium4|pentium4m|prescott|nocona) 1794 add_cflags -march=$cpu 1795 enable cmov 1796 disable fast_cmov 1797 ;; 1798 sparc64) 1799 add_cflags -mcpu=v9 1800 ;; 1801 arm11*|cortex*) 1802 add_cflags -mcpu=$cpu 1803 enable fast_unaligned 1804 ;; 1805 armv*) 1806 add_cflags -march=$cpu 1807 ;; 1808 arm*) 1809 add_cflags -mcpu=$cpu 1810 ;; 1811 ev4|ev45|ev5|ev56|pca56|ev6|ev67) 1812 enabled ccc && add_cflags -arch $cpu || add_cflags -mcpu=$cpu 1813 ;; 1814 *) 1815 echo "WARNING: Unknown CPU \"$cpu\", ignored." 1816 ;; 1817 esac 1818fi 1819 1820check_cc <<EOF || die "Symbol mangling check failed." 1821int ff_extern; 1822EOF 1823sym=$($nm -P -g $TMPO | grep ff_extern) 1824extern_prefix=${sym%%ff_extern*} 1825 1826check_asm inline_asm '""' 1827 1828if enabled x86; then 1829 # check whether EBP is available on x86 1830 # As 'i' is stored on the stack, this program will crash 1831 # if the base pointer is used to access it because the 1832 # base pointer is cleared in the inline assembly code. 1833 check_exec_crash <<EOF && enable ebp_available 1834 volatile int i=0; 1835 __asm__ volatile ( 1836 "xorl %%ebp, %%ebp" 1837 ::: "%ebp"); 1838 return i; 1839EOF 1840 1841 # check wether EBX is available on x86 1842 check_asm ebx_available '"":::"%ebx"' 1843 1844 # check whether more than 10 operands are supported 1845 check_cc <<EOF && enable ten_operands 1846int main(void) { 1847 int x=0; 1848 __asm__ volatile( 1849 "" 1850 :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x) 1851 ); 1852 return 0; 1853} 1854EOF 1855 1856 # check whether binutils is new enough to compile SSSE3/MMX2 1857 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"' 1858 enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"' 1859 1860 check_asm bswap '"bswap %%eax" ::: "%eax"' 1861 1862 YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)" 1863 enabled x86_64 && append YASMFLAGS "-m amd64" 1864 enabled_all x86_64 shared && append YASMFLAGS "-DPIC" 1865 case "$objformat" in 1866 elf) enabled debug && append YASMFLAGS "-g dwarf2" ;; 1867 macho64) append YASMFLAGS "-DPIC -DPREFIX" ;; 1868 *) append YASMFLAGS "-DPREFIX" ;; 1869 esac 1870 disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; } 1871fi 1872 1873# check for assembler specific support 1874 1875enabled ppc && check_asm dcbzl '"dcbzl 0, 1"' 1876enabled ppc && check_asm ppc4xx '"maclhw r10, r11, r12"' 1877 1878# check for SIMD availability 1879 1880# AltiVec flags: The FSF version of GCC differs from the Apple version 1881if enabled altivec; then 1882 check_cflags -maltivec -mabi=altivec && 1883 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } || 1884 check_cflags -faltivec 1885 1886 # check if our compiler supports Motorola AltiVec C API 1887 check_cc <<EOF || disable altivec 1888$inc_altivec_h 1889int main(void) { 1890 vector signed int v1, v2, v3; 1891 v1 = vec_add(v2,v3); 1892 return 0; 1893} 1894EOF 1895 1896 # check if our compiler supports braces for vector declarations 1897 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations." 1898$inc_altivec_h 1899int main (void) { (vector int) {1}; return 0; } 1900EOF 1901fi 1902 1903# We have to check if pld is a nop and disable it. 1904enabled arm && check_asm pld '"pld [r0]"' 1905enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"' 1906enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"' 1907enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"' 1908enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"' 1909enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"' 1910enabled mmi && check_asm mmi '"lq $2, 0($2)"' 1911enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"' 1912enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc 1913 1914enabled vis && add_cflags -mcpu=ultrasparc -mtune=ultrasparc 1915 1916# --- 1917# big/little-endian test 1918check_cc <<EOF || die "endian test failed" 1919unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; 1920EOF 1921od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian 1922 1923# --- 1924# check availability of some header files 1925 1926if check_func dlopen; then 1927 ldl= 1928elif check_func dlopen -ldl; then 1929 ldl=-ldl 1930fi 1931 1932# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that 1933check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; } 1934 1935check_func fork 1936check_func gethrtime 1937check_func getrusage 1938check_func inet_aton $network_extralibs 1939check_func memalign 1940check_func mkstemp 1941check_func posix_memalign 1942check_func_headers io.h setmode 1943check_func_headers windows.h GetProcessTimes 1944 1945check_header conio.h 1946check_header dlfcn.h 1947check_header malloc.h 1948check_header poll.h 1949check_header sys/mman.h 1950check_header sys/resource.h 1951check_header sys/select.h 1952check_header termios.h 1953check_header vdpau/vdpau.h 1954check_header vdpau/vdpau_x11.h 1955check_header X11/extensions/XvMClib.h 1956 1957if ! enabled_any memalign memalign_hack posix_memalign && enabled need_memalign ; then 1958 die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack." 1959fi 1960 1961disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib 1962disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib 1963 1964# check for some common methods of building with pthread support 1965# do this before the optional library checks as some of them require pthreads 1966if enabled pthreads; then 1967 if check_func pthread_create; then 1968 : 1969 elif check_func pthread_create -pthread; then 1970 add_cflags -pthread 1971 add_extralibs -pthread 1972 elif check_func pthread_create -pthreads; then 1973 add_cflags -pthreads 1974 add_extralibs -pthreads 1975 elif check_func pthread_create -lpthreadGC2; then 1976 add_extralibs -lpthreadGC2 1977 elif ! check_lib pthread.h pthread_create -lpthread; then 1978 die "ERROR: can't find pthreads library" 1979 fi 1980fi 1981 1982for thread in $THREADS_LIST; do 1983 if enabled $thread; then 1984 test -n "$thread_type" && 1985 die "ERROR: Only one thread type must be selected." || 1986 thread_type="$thread" 1987 fi 1988done 1989 1990check_lib math.h sin -lm 1991 1992# test for C99 functions in math.h 1993for func in llrint lrint lrintf round roundf truncf; do 1994 check_exec <<EOF && enable $func || disable $func 1995#include <math.h> 1996int main(void) { return ($func(3.999f) > 0)?0:1; } 1997EOF 1998done 1999 2000# these are off by default, so fail if requested and not available 2001enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32 2002enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm 2003enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm 2004enabled libdirac && add_cflags $(pkg-config --cflags dirac) && 2005 require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder && 2006 require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder 2007enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac 2008enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad 2009enabled libgsm && require libgsm gsm.h gsm_create -lgsm 2010enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm 2011enabled libnut && require libnut libnut.h nut_demuxer_init -lnut 2012enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm 2013enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm 2014enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg 2015enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) && 2016 require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0) 2017enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex 2018enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg 2019enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg 2020enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm && 2021 { check_cpp_condition x264.h "X264_BUILD >= 65" || 2022 die "ERROR: libx264 version must be >= 0.65."; } 2023enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore 2024enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib 2025 2026# libdc1394 check 2027if enabled libdc1394; then 2028 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 && 2029 enable libdc1394_2; } || 2030 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 && 2031 enable libdc1394_1; } || 2032 die "ERROR: No version of libdc1394 found " 2033fi 2034 2035 2036_restrict= 2037for restrict_keyword in restrict __restrict__ __restrict; do 2038 check_cc <<EOF && _restrict=$restrict_keyword && break 2039void foo(char * $restrict_keyword p); 2040EOF 2041done 2042 2043test "$vhook" = "default" && vhook="$dlopen" 2044 2045if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then 2046 disable vhook 2047 echo 2048 echo "At the moment vhooks don't work on Cygwin or MinGW static builds." 2049 echo "Patches welcome." 2050 echo 2051fi 2052 2053if enabled vhook; then 2054 check_ldflags -rdynamic 2055 check_ldflags -export-dynamic 2056fi 2057 2058check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font 2059check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType 2060 2061########################################## 2062# SDL check 2063 2064disable sdl_too_old 2065disable sdl 2066SDL_CONFIG="${cross_prefix}sdl-config" 2067if "${SDL_CONFIG}" --version > /dev/null 2>&1; then 2068 sdl_cflags=`"${SDL_CONFIG}" --cflags` 2069 temp_cflags $sdl_cflags 2070 temp_extralibs `"${SDL_CONFIG}" --libs` 2071 if check_lib2 SDL.h SDL_Init; then 2072 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'` 2073 if test "$_sdlversion" -lt 121 ; then 2074 enable sdl_too_old 2075 else 2076 enable sdl 2077 check_cc $sdl_cflags <<EOF && enable sdl_video_size 2078#include <SDL.h> 2079int main(int argc, char **argv){ 2080 const SDL_VideoInfo *vi = SDL_GetVideoInfo(); 2081 int w = vi->current_w; 2082 return 0; 2083} 2084EOF 2085 fi 2086 fi 2087 restore_flags 2088fi 2089 2090texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html 2091 2092########################################## 2093# Network check 2094 2095if enabled network; then 2096 check_type "sys/types.h sys/socket.h" socklen_t 2097 # Prefer arpa/inet.h over winsock2 2098 if check_header arpa/inet.h ; then 2099 check_func closesocket 2100 elif check_header winsock2.h ; then 2101 network_extralibs="-lws2_32" 2102 check_type ws2tcpip.h socklen_t 2103 check_func_headers winsock2.h closesocket 2104 fi 2105fi 2106 2107########################################## 2108# IPv6 check 2109 2110enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6 2111#include <sys/types.h> 2112#include <sys/socket.h> 2113#include <netinet/in.h> 2114#include <netdb.h> 2115int main(void) { 2116 struct sockaddr_storage saddr; 2117 struct ipv6_mreq mreq6; 2118 getaddrinfo(0,0,0,0); 2119 getnameinfo(0,0,0,0,0,0,0); 2120 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0); 2121} 2122EOF 2123 2124check_header linux/videodev.h 2125check_header linux/videodev2.h 2126check_header sys/videoio.h 2127 2128check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32 2129 2130# check for ioctl_meteor.h, ioctl_bt848.h and alternatives 2131{ check_header dev/bktr/ioctl_meteor.h && 2132 check_header dev/bktr/ioctl_bt848.h; } || 2133{ check_header machine/ioctl_meteor.h && 2134 check_header machine/ioctl_bt848.h; } || 2135{ check_header dev/video/meteor/ioctl_meteor.h && 2136 check_header dev/video/bktr/ioctl_bt848.h; } || 2137check_header dev/ic/bt8xx.h 2138 2139check_header sys/soundcard.h 2140check_header soundcard.h 2141 2142check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound 2143 2144# deal with the X11 frame grabber 2145enabled x11grab && 2146check_header X11/Xlib.h && 2147check_header X11/extensions/XShm.h && 2148check_func XOpenDisplay -lX11 && 2149check_func XShmCreateImage -lX11 -lXext 2150 2151enabled debug && add_cflags -g"$debuglevel" 2152 2153# add some useful compiler flags if supported 2154check_cflags -Wdeclaration-after-statement 2155check_cflags -Wall 2156check_cflags -Wno-switch 2157check_cflags -Wdisabled-optimization 2158check_cflags -Wpointer-arith 2159check_cflags -Wredundant-decls 2160check_cflags -Wno-pointer-sign 2161check_cflags -Wcast-qual 2162check_cflags -Wwrite-strings 2163check_cflags -Wtype-limits 2164check_cflags -Wundef 2165enabled extra_warnings && check_cflags -Winline 2166 2167# add some linker flags 2168check_ldflags -Wl,--warn-common 2169check_ldflags -Wl,--as-needed 2170check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' 2171check_ldflags -Wl,-Bsymbolic 2172 2173echo "X{};" > $TMPV 2174test_ldflags -Wl,--version-script,$TMPV && 2175 append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver' 2176 2177if enabled small; then 2178 check_cflags -Os # not all compilers support -Os 2179 optimizations="small" 2180elif enabled optimizations; then 2181 if enabled xlc; then 2182 add_cflags -O5 2183 add_ldflags -O5 2184 elif enabled ccc; then 2185 add_cflags -fast 2186 else 2187 add_cflags -O3 2188 fi 2189fi 2190check_cflags -fno-math-errno 2191check_cflags -fno-signed-zeros 2192 2193# add some flags for Intel C Compiler 2194if enabled icc; then 2195 # Just warnings, no remarks 2196 check_cflags -w1 2197 # -wd: Disable following warnings 2198 # 144, 167, 556: -Wno-pointer-sign 2199 # 10006: ignoring unknown option -fno-signed-zeros 2200 # 10156: ignoring option '-W'; no argument required 2201 check_cflags -wd144,167,556,10006,10156 2202 # 11030: Warning unknown option --as-needed 2203 # 10156: ignoring option '-export'; no argument required 2204 check_ldflags -wd10156,11030 2205 # Allow to compile with optimizations 2206 check_ldflags -march=$cpu 2207elif enabled ccc; then 2208 # disable some annoying warnings 2209 add_cflags -msg_disable cvtu32to64 2210 add_cflags -msg_disable embedcomment 2211 add_cflags -msg_disable needconstext 2212 add_cflags -msg_disable nomainieee 2213 add_cflags -msg_disable ptrmismatch1 2214 add_cflags -msg_disable unreachcode 2215fi 2216 2217# PIC flags for shared library objects where they are needed 2218if enabled shared; then 2219 # LIBOBJFLAGS may have already been set in the OS configuration 2220 if test -z "$LIBOBJFLAGS" ; then 2221 case "${subarch-$arch}" in 2222 x86_64|ia64|alpha|sparc*|ppc|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;; 2223 esac 2224 fi 2225fi 2226 2227if enabled gprof; then 2228 add_cflags -p 2229 add_ldflags -p 2230fi 2231 2232VHOOKCFLAGS="-fPIC" 2233 2234# Find out if the .align argument is a power of two or not. 2235check_asm asmalign_pot '".align 3"' 2236 2237enabled_any $DECODER_LIST && enable decoders 2238enabled_any $ENCODER_LIST && enable encoders 2239enabled_any $BSF_LIST && enable bsfs 2240enabled_any $DEMUXER_LIST && enable demuxers 2241enabled_any $MUXER_LIST && enable muxers 2242enabled_any $FILTER_LIST && enable filters 2243enabled_any $INDEV_LIST && enable demuxers 2244enabled_any $OUTDEV_LIST && enable muxers 2245enabled_any $PROTOCOL_LIST && enable protocols 2246 2247enabled_any $THREADS_LIST && enable threads 2248 2249check_deps $CONFIG_LIST \ 2250 $CONFIG_EXTRA \ 2251 $HAVE_LIST \ 2252 $DECODER_LIST \ 2253 $ENCODER_LIST \ 2254 $PARSER_LIST \ 2255 $BSF_LIST \ 2256 $DEMUXER_LIST \ 2257 $MUXER_LIST \ 2258 $FILTER_LIST \ 2259 $INDEV_LIST \ 2260 $OUTDEV_LIST \ 2261 $PROTOCOL_LIST \ 2262 2263echo "install prefix $prefix" 2264echo "source path $source_path" 2265echo "C compiler $cc" 2266echo ".align is power-of-two $asmalign_pot" 2267echo "ARCH $arch ($cpu)" 2268if test "$build_suffix" != ""; then 2269 echo "build suffix $build_suffix" 2270fi 2271if test "$extra_version" != ""; then 2272 echo "version string suffix $extra_version" 2273fi 2274echo "big-endian ${bigendian-no}" 2275echo "runtime cpu detection ${runtime_cpudetect-no}" 2276if enabled x86; then 2277 echo "yasm ${yasm-no}" 2278 echo "MMX enabled ${mmx-no}" 2279 echo "MMX2 enabled ${mmx2-no}" 2280 echo "3DNow! enabled ${amd3dnow-no}" 2281 echo "3DNow! extended enabled ${amd3dnowext-no}" 2282 echo "SSE enabled ${sse-no}" 2283 echo "SSSE3 enabled ${ssse3-no}" 2284 echo "CMOV enabled ${cmov-no}" 2285 echo "CMOV is fast ${fast_cmov-no}" 2286 echo "EBX available ${ebx_available-no}" 2287 echo "EBP available ${ebp_available-no}" 2288 echo "10 operands supported ${ten_operands-no}" 2289fi 2290if enabled arm; then 2291 echo "ARMv5TE enabled ${armv5te-no}" 2292 echo "ARMv6 enabled ${armv6-no}" 2293 echo "ARMv6T2 enabled ${armv6t2-no}" 2294 echo "ARM VFP enabled ${armvfp-no}" 2295 echo "IWMMXT enabled ${iwmmxt-no}" 2296 echo "NEON enabled ${neon-no}" 2297fi 2298if enabled mips; then 2299 echo "MMI enabled ${mmi-no}" 2300fi 2301if enabled ppc; then 2302 echo "AltiVec enabled ${altivec-no}" 2303 echo "PPC 4xx optimizations ${ppc4xx-no}" 2304 echo "dcbzl available ${dcbzl-no}" 2305 echo "performance report ${powerpc_perf-no}" 2306fi 2307if enabled sparc; then 2308 echo "VIS enabled ${vis-no}" 2309fi 2310echo "gprof enabled ${gprof-no}" 2311echo "debug symbols ${debug-no}" 2312echo "strip symbols ${stripping-no}" 2313echo "optimizations ${optimizations-no}" 2314echo "static ${static-no}" 2315echo "shared ${shared-no}" 2316echo "postprocessing support ${postproc-no}" 2317echo "software scaler enabled ${swscale-no}" 2318echo "new filter support ${avfilter-no}" 2319echo "filters using lavformat ${avfilter_lavf-no}" 2320echo "video hooking ${vhook-no}" 2321if enabled vhook; then 2322 echo "Imlib2 support ${imlib2-no}" 2323 echo "FreeType support ${freetype2-no}" 2324fi 2325echo "network support ${network-no}" 2326if enabled network; then 2327 echo "IPv6 support ${ipv6-no}" 2328fi 2329echo "threading support ${thread_type-no}" 2330echo "SDL support ${sdl-no}" 2331if enabled sdl_too_old; then 2332 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support." 2333fi 2334echo "Sun medialib support ${mlib-no}" 2335echo "AVISynth enabled ${avisynth-no}" 2336echo "libamr-nb support ${libamr_nb-no}" 2337echo "libamr-wb support ${libamr_wb-no}" 2338echo "libdc1394 support ${libdc1394-no}" 2339echo "libdirac enabled ${libdirac-no}" 2340echo "libfaac enabled ${libfaac-no}" 2341echo "libfaad enabled ${libfaad-no}" 2342echo "libfaad dlopened ${libfaadbin-no}" 2343echo "libgsm enabled ${libgsm-no}" 2344echo "libmp3lame enabled ${libmp3lame-no}" 2345echo "libnut enabled ${libnut-no}" 2346echo "libopencore-amrnb support ${libopencore_amrnb-no}" 2347echo "libopencore-amrwb support ${libopencore_amrwb-no}" 2348echo "libopenjpeg enabled ${libopenjpeg-no}" 2349echo "libschroedinger enabled ${libschroedinger-no}" 2350echo "libspeex enabled ${libspeex-no}" 2351echo "libtheora enabled ${libtheora-no}" 2352echo "libvorbis enabled ${libvorbis-no}" 2353echo "libx264 enabled ${libx264-no}" 2354echo "libxvid enabled ${libxvid-no}" 2355echo "vdpau enabled ${vdpau-no}" 2356echo "zlib enabled ${zlib-no}" 2357echo "bzlib enabled ${bzlib-no}" 2358echo 2359 2360for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do 2361 echo "Enabled ${type}s:" 2362 eval list=\$$(toupper $type)_LIST 2363 for part in $list; do 2364 enabled $part && echo ${part%_*} 2365 done | sort | pr -3 -t 2366 echo 2367done 2368 2369license="LGPL version 2.1 or later" 2370if enabled nonfree; then 2371 license="nonfree and unredistributable" 2372elif enabled gplv3; then 2373 license="GPL version 3 or later" 2374elif enabled lgplv3; then 2375 license="LGPL version 3 or later" 2376elif enabled gpl; then 2377 license="GPL version 2 or later" 2378fi 2379 2380echo "License: $license" 2381 2382echo "Creating config.mak and config.h..." 2383 2384echo "# Automatically generated by configure - do not modify!" > config.mak 2385echo "/* Automatically generated by configure - do not modify! */" > $TMPH 2386echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH 2387echo "#define FFMPEG_CONFIG_H" >> $TMPH 2388echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH 2389echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH 2390 2391echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak 2392echo "prefix=$prefix" >> config.mak 2393echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak 2394echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak 2395echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak 2396echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak 2397echo "DATADIR=\$(DESTDIR)$datadir" >> config.mak 2398echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak 2399echo "CC=$cc" >> config.mak 2400echo "YASM=$yasmexe" >> config.mak 2401echo "AR=$ar" >> config.mak 2402echo "RANLIB=$ranlib" >> config.mak 2403echo "LN_S=$ln_s" >> config.mak 2404enabled stripping && 2405 echo "STRIP=$strip" >> config.mak || 2406 echo "STRIP=echo ignoring strip" >> config.mak 2407 2408echo "OPTFLAGS=$CFLAGS" >> config.mak 2409echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak 2410echo "LDFLAGS=$LDFLAGS" >> config.mak 2411echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak 2412echo "SHFLAGS=$SHFLAGS" >> config.mak 2413echo "YASMFLAGS=$YASMFLAGS" >> config.mak 2414echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak 2415echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak 2416echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak 2417echo "BUILD_STATIC=$static" >> config.mak 2418echo "BUILDSUF=$build_suffix" >> config.mak 2419echo "FULLNAME=$FULLNAME" >> config.mak 2420echo "LIBPREF=$LIBPREF" >> config.mak 2421echo "LIBSUF=$LIBSUF" >> config.mak 2422echo "LIBNAME=$LIBNAME" >> config.mak 2423echo "SLIBPREF=$SLIBPREF" >> config.mak 2424echo "SLIBSUF=$SLIBSUF" >> config.mak 2425echo "EXESUF=$EXESUF" >> config.mak 2426echo "EXTRA_VERSION=$extra_version" >> config.mak 2427echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak 2428echo "HOSTCC=$host_cc" >> config.mak 2429echo "HOSTCFLAGS=$host_cflags" >> config.mak 2430echo "HOSTLDFLAGS=$host_ldflags" >> config.mak 2431echo "HOSTLIBS=$host_libs" >> config.mak 2432echo "TARGET_EXEC=$target_exec" >> config.mak 2433echo "TARGET_PATH=$target_path" >> config.mak 2434 2435if enabled bigendian; then 2436 echo "WORDS_BIGENDIAN=yes" >> config.mak 2437 echo "#define WORDS_BIGENDIAN 1" >> $TMPH 2438fi 2439 2440if enabled sdl; then 2441 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak 2442 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak 2443fi 2444if enabled texi2html; then 2445 echo "BUILD_DOC=yes" >> config.mak 2446fi 2447 2448get_version(){ 2449 name=$1 2450 file=$source_path/$2 2451 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }') 2452 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO 2453 lcname=$(tolower $name) 2454 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak 2455 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak 2456} 2457 2458get_version LIBSWSCALE libswscale/swscale.h 2459get_version LIBPOSTPROC libpostproc/postprocess.h 2460get_version LIBAVCODEC libavcodec/avcodec.h 2461get_version LIBAVDEVICE libavdevice/avdevice.h 2462get_version LIBAVFORMAT libavformat/avformat.h 2463get_version LIBAVUTIL libavutil/avutil.h 2464get_version LIBAVFILTER libavfilter/avfilter.h 2465 2466if enabled shared; then 2467 echo "BUILD_SHARED=yes" >> config.mak 2468 echo "PIC=-fPIC -DPIC" >> config.mak 2469 echo "LIBTARGET=${LIBTARGET}" >> config.mak 2470 echo "SLIBNAME=${SLIBNAME}" >> config.mak 2471 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak 2472 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak 2473 echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak 2474 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak 2475 echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak 2476 echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak 2477fi 2478echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak 2479echo "EXTRALIBS=$extralibs" >> config.mak 2480 2481echo "ARCH=$arch" >> config.mak 2482 2483print_config ARCH_ $TMPH config.mak $ARCH_LIST 2484print_config HAVE_ $TMPH config.mak $HAVE_LIST 2485print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \ 2486 $CONFIG_EXTRA \ 2487 $DECODER_LIST \ 2488 $ENCODER_LIST \ 2489 $PARSER_LIST \ 2490 $BSF_LIST \ 2491 $DEMUXER_LIST \ 2492 $MUXER_LIST \ 2493 $FILTER_LIST \ 2494 $PROTOCOL_LIST \ 2495 $INDEV_LIST \ 2496 $OUTDEV_LIST \ 2497 2498echo "#define restrict $_restrict" >> $TMPH 2499 2500if enabled small; then 2501 echo "#define av_always_inline" >> $TMPH 2502fi 2503 2504echo "SRC_PATH=\"$source_path\"" >> config.mak 2505echo "SRC_PATH_BARE=$source_path" >> config.mak 2506echo "BUILD_ROOT=\"$PWD\"" >> config.mak 2507 2508# Apparently it's not possible to portably echo a backslash. 2509enabled asmalign_pot && 2510 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH || 2511 printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH 2512 2513echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH 2514 2515echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH 2516 2517# Do not overwrite an unchanged config.h to avoid superfluous rebuilds. 2518cmp -s $TMPH config.h && 2519 echo "config.h is unchanged" || 2520 mv -f $TMPH config.h 2521 2522rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH 2523 2524# build tree in object directory if source path is different from current one 2525if enabled source_path_used; then 2526 DIRS="\ 2527 doc \ 2528 libavcodec \ 2529 libavcodec/alpha \ 2530 libavcodec/arm \ 2531 libavcodec/bfin \ 2532 libavcodec/mlib \ 2533 libavcodec/ppc \ 2534 libavcodec/sh4 \ 2535 libavcodec/sparc \ 2536 libavcodec/x86 \ 2537 libavdevice \ 2538 libavfilter \ 2539 libavformat \ 2540 libavutil \ 2541 libpostproc \ 2542 libswscale \ 2543 tests \ 2544 tools \ 2545 vhook \ 2546 " 2547 FILES="\ 2548 Makefile \ 2549 common.mak \ 2550 subdir.mak \ 2551 doc/texi2pod.pl \ 2552 libavcodec/Makefile \ 2553 libavdevice/Makefile \ 2554 libavfilter/Makefile \ 2555 libavformat/Makefile \ 2556 libavutil/Makefile \ 2557 libpostproc/Makefile \ 2558 libswscale/Makefile \ 2559 " 2560 for dir in $DIRS ; do 2561 mkdir -p $dir 2562 done 2563 for f in $FILES ; do 2564 $ln_s "$source_path/$f" $f 2565 done 2566fi 2567 2568 2569# build pkg-config files 2570 2571pkgconfig_generate(){ 2572name=$1 2573shortname=${name#lib}${build_suffix} 2574comment=$2 2575version=$3 2576libs=$4 2577requires=$5 2578cat <<EOF > $name/$name.pc 2579prefix=$prefix 2580exec_prefix=\${prefix} 2581libdir=$libdir 2582includedir=$incdir 2583 2584Name: $name 2585Description: $comment 2586Version: $version 2587Requires: $(disabled shared && echo $requires) 2588Requires.private: $(enabled shared && echo $requires) 2589Conflicts: 2590Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs) 2591Libs.private: $(enabled shared && echo $libs) 2592Cflags: -I\${includedir} 2593EOF 2594cat <<EOF > $name/$name-uninstalled.pc 2595prefix= 2596exec_prefix= 2597libdir=\${pcfiledir} 2598includedir=${source_path} 2599 2600Name: $name 2601Description: $comment 2602Version: $version 2603Requires: $requires 2604Conflicts: 2605Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs 2606Cflags: -I\${includedir} 2607EOF 2608} 2609 2610pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" 2611pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION" 2612pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION" 2613pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION" 2614enabled avfilter && 2615 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION" 2616enabled postproc && 2617 pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" 2618if enabled swscale; then 2619 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" 2620else 2621 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavcodec = $LIBAVCODEC_VERSION" 2622 apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/ 2623fi 2624