wok-6.x diff ffmpeg/stuff/configure @ rev 4642

Up: apr (1.3.9) security fix.
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Sat Dec 26 10:37:24 2009 +0100 (2009-12-26)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ffmpeg/stuff/configure	Sat Dec 26 10:37:24 2009 +0100
     1.3 @@ -0,0 +1,2595 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# FFmpeg configure script
     1.7 +#
     1.8 +# Copyright (c) 2000-2002 Fabrice Bellard
     1.9 +# Copyright (c) 2005-2008 Diego Biurrun
    1.10 +# Copyright (c) 2005-2008 Mans Rullgard
    1.11 +#
    1.12 +
    1.13 +# Prevent locale nonsense from breaking basic text processing.
    1.14 +LC_ALL=C
    1.15 +export LC_ALL
    1.16 +
    1.17 +# make sure we are running under a compatible shell
    1.18 +# try to make this part work with most shells
    1.19 +
    1.20 +try_exec(){
    1.21 +    echo "Trying shell $1"
    1.22 +    type "$1" > /dev/null 2>&1 && exec "$@"
    1.23 +}
    1.24 +
    1.25 +unset foo
    1.26 +(: ${foo%%bar}) 2> /dev/null
    1.27 +E1="$?"
    1.28 +
    1.29 +(: ${foo?}) 2> /dev/null
    1.30 +E2="$?"
    1.31 +
    1.32 +if test "$E1" != 0 || test "$E2" = 0; then
    1.33 +    echo "Broken shell detected.  Trying alternatives."
    1.34 +    export FF_CONF_EXEC
    1.35 +    if test "0$FF_CONF_EXEC" -lt 1; then
    1.36 +        FF_CONF_EXEC=1
    1.37 +        try_exec bash "$0" "$@"
    1.38 +    fi
    1.39 +    if test "0$FF_CONF_EXEC" -lt 2; then
    1.40 +        FF_CONF_EXEC=2
    1.41 +        try_exec ksh "$0" "$@"
    1.42 +    fi
    1.43 +    if test "0$FF_CONF_EXEC" -lt 3; then
    1.44 +        FF_CONF_EXEC=3
    1.45 +        try_exec /usr/xpg4/bin/sh "$0" "$@"
    1.46 +    fi
    1.47 +    echo "No compatible shell script interpreter found."
    1.48 +    echo "This configure script requires a POSIX-compatible shell"
    1.49 +    echo "such as bash or ksh."
    1.50 +    echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
    1.51 +    echo "Instead, install a working POSIX-compatible shell."
    1.52 +    echo "Disabling this configure test will create a broken FFmpeg."
    1.53 +    if test "$BASH_VERSION" = '2.04.0(1)-release'; then
    1.54 +        echo "This bash version ($BASH_VERSION) is broken on your platform."
    1.55 +        echo "Upgrade to a later version if available."
    1.56 +    fi
    1.57 +    exit 1
    1.58 +fi
    1.59 +
    1.60 +show_help(){
    1.61 +  echo "Usage: configure [options]"
    1.62 +  echo "Options: [defaults in brackets after descriptions]"
    1.63 +  echo
    1.64 +  echo "Standard options:"
    1.65 +  echo "  --help                   print this message"
    1.66 +  echo "  --logfile=FILE           log tests and output to FILE [config.err]"
    1.67 +  echo "  --disable-logging        do not log configure debug information"
    1.68 +  echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
    1.69 +  echo "  --bindir=DIR             install binaries in DIR [PREFIX/bin]"
    1.70 +  echo "  --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]"
    1.71 +  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
    1.72 +  echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
    1.73 +  echo "  --incdir=DIR             install includes in DIR [PREFIX/include]"
    1.74 +  echo "  --mandir=DIR             install man page in DIR [PREFIX/share/man]"
    1.75 +  echo
    1.76 +  echo "Configuration options:"
    1.77 +  echo "  --disable-static         do not build static libraries [no]"
    1.78 +  echo "  --enable-shared          build shared libraries [no]"
    1.79 +  echo "  --enable-gpl             allow use of GPL code, the resulting libs"
    1.80 +  echo "                           and binaries will be under GPL [no]"
    1.81 +  echo "  --enable-nonfree         allow use of nonfree code, the resulting libs"
    1.82 +  echo "                           and binaries will be unredistributable [no]"
    1.83 +  echo "  --disable-ffmpeg         disable ffmpeg build"
    1.84 +  echo "  --disable-ffplay         disable ffplay build"
    1.85 +  echo "  --disable-ffserver       disable ffserver build"
    1.86 +  echo "  --enable-postproc        enable GPLed postprocessing support [no]"
    1.87 +  echo "  --enable-avfilter        video filter support [no]"
    1.88 +  echo "  --enable-avfilter-lavf   video filters dependent on avformat [no]"
    1.89 +  echo "  --enable-beosthreads     use BeOS threads [no]"
    1.90 +  echo "  --enable-os2threads      use OS/2 threads [no]"
    1.91 +  echo "  --enable-pthreads        use pthreads [no]"
    1.92 +  echo "  --enable-w32threads      use Win32 threads [no]"
    1.93 +  echo "  --enable-x11grab         enable X11 grabbing [no]"
    1.94 +  echo "  --disable-network        disable network support [no]"
    1.95 +  echo "  --disable-ipv6           disable IPv6 support [no]"
    1.96 +  echo "  --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]"
    1.97 +  echo "  --enable-gray            enable full grayscale support (slower color)"
    1.98 +  echo "  --disable-swscale-alpha  disable alpha channel support in swscale"
    1.99 +  echo "  --disable-fastdiv        disable table-based division"
   1.100 +  echo "  --enable-small           optimize for size instead of speed"
   1.101 +  echo "  --disable-aandct         disable AAN DCT code"
   1.102 +  echo "  --disable-fft            disable FFT code"
   1.103 +  echo "  --disable-golomb         disable Golomb code"
   1.104 +  echo "  --disable-mdct           disable MDCT code"
   1.105 +  echo "  --disable-rdft           disable RDFT code"
   1.106 +  echo "  --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
   1.107 +  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
   1.108 +  echo "  --enable-beos-netserver  enable BeOS netserver"
   1.109 +  echo "  --disable-encoder=NAME   disable encoder NAME"
   1.110 +  echo "  --enable-encoder=NAME    enable encoder NAME"
   1.111 +  echo "  --disable-encoders       disable all encoders"
   1.112 +  echo "  --disable-decoder=NAME   disable decoder NAME"
   1.113 +  echo "  --enable-decoder=NAME    enable decoder NAME"
   1.114 +  echo "  --disable-decoders       disable all decoders"
   1.115 +  echo "  --disable-hwaccel=NAME   disable hwaccel NAME"
   1.116 +  echo "  --enable-hwaccel=NAME    enable hwaccel NAME"
   1.117 +  echo "  --disable-hwaccels       disable all hwaccels"
   1.118 +  echo "  --disable-muxer=NAME     disable muxer NAME"
   1.119 +  echo "  --enable-muxer=NAME      enable muxer NAME"
   1.120 +  echo "  --disable-muxers         disable all muxers"
   1.121 +  echo "  --disable-demuxer=NAME   disable demuxer NAME"
   1.122 +  echo "  --enable-demuxer=NAME    enable demuxer NAME"
   1.123 +  echo "  --disable-demuxers       disable all demuxers"
   1.124 +  echo "  --enable-parser=NAME     enable parser NAME"
   1.125 +  echo "  --disable-parser=NAME    disable parser NAME"
   1.126 +  echo "  --disable-parsers        disable all parsers"
   1.127 +  echo "  --enable-bsf=NAME        enable bitstream filter NAME"
   1.128 +  echo "  --disable-bsf=NAME       disable bitstream filter NAME"
   1.129 +  echo "  --disable-bsfs           disable all bitstream filters"
   1.130 +  echo "  --enable-protocol=NAME   enable protocol NAME"
   1.131 +  echo "  --disable-protocol=NAME  disable protocol NAME"
   1.132 +  echo "  --disable-protocols      disable all protocols"
   1.133 +  echo "  --disable-indevs         disable input devices"
   1.134 +  echo "  --disable-outdevs        disable output devices"
   1.135 +  echo "  --disable-devices        disable all devices"
   1.136 +  echo "  --enable-filter=NAME     enable filter NAME"
   1.137 +  echo "  --disable-filter=NAME    disable filter NAME"
   1.138 +  echo "  --disable-filters        disable all filters"
   1.139 +  echo "  --list-decoders          show all available decoders"
   1.140 +  echo "  --list-encoders          show all available encoders"
   1.141 +  echo "  --list-hwaccels          show all available hardware accelerators"
   1.142 +  echo "  --list-muxers            show all available muxers"
   1.143 +  echo "  --list-demuxers          show all available demuxers"
   1.144 +  echo "  --list-parsers           show all available parsers"
   1.145 +  echo "  --list-protocols         show all available protocols"
   1.146 +  echo "  --list-bsfs              show all available bitstream filters"
   1.147 +  echo "  --list-indevs            show all available input devices"
   1.148 +  echo "  --list-outdevs           show all available output devices"
   1.149 +  echo "  --list-filters           show all available filters"
   1.150 +  echo
   1.151 +  echo "External library support:"
   1.152 +  echo "  --enable-avisynth        enable reading of AVISynth script files [no]"
   1.153 +  echo "  --enable-bzlib           enable bzlib [autodetect]"
   1.154 +  echo "  --enable-libamr-nb       enable libamr-nb floating point audio codec [no]"
   1.155 +  echo "  --enable-libamr-wb       enable libamr-wb floating point audio codec [no]"
   1.156 +  echo "  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394"
   1.157 +  echo "                           and libraw1394 [no]"
   1.158 +  echo "  --enable-libdirac        enable Dirac support via libdirac [no]"
   1.159 +  echo "  --enable-libfaac         enable FAAC support via libfaac [no]"
   1.160 +  echo "  --enable-libfaad         enable FAAD support via libfaad [no]"
   1.161 +  echo "  --enable-libfaadbin      open libfaad.so.0 at runtime [no]"
   1.162 +  echo "  --enable-libgsm          enable GSM support via libgsm [no]"
   1.163 +  echo "  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]"
   1.164 +  echo "  --enable-libnut          enable NUT (de)muxing via libnut,"
   1.165 +  echo "                           native (de)muxer exists [no]"
   1.166 +  echo "  --enable-libopenjpeg     enable JPEG 2000 decoding via OpenJPEG [no]"
   1.167 +  echo "  --enable-libschroedinger enable Dirac support via libschroedinger [no]"
   1.168 +  echo "  --enable-libspeex        enable Speex decoding via libspeex [no]"
   1.169 +  echo "  --enable-libtheora       enable Theora encoding via libtheora [no]"
   1.170 +  echo "  --enable-libvorbis       enable Vorbis encoding via libvorbis,"
   1.171 +  echo "                           native implementation exists [no]"
   1.172 +  echo "  --enable-libx264         enable H.264 encoding via x264 [no]"
   1.173 +  echo "  --enable-libxvid         enable Xvid encoding via xvidcore,"
   1.174 +  echo "                           native MPEG-4/Xvid encoder exists [no]"
   1.175 +  echo "  --enable-mlib            enable Sun medialib [no]"
   1.176 +  echo "  --enable-zlib            enable zlib [autodetect]"
   1.177 +  echo ""
   1.178 +  echo "Advanced options (experts only):"
   1.179 +  echo "  --source-path=PATH       path to source code [$source_path]"
   1.180 +  echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
   1.181 +  echo "  --enable-cross-compile   assume a cross-compiler is used"
   1.182 +  echo "  --sysroot=PATH           root of cross-build tree"
   1.183 +  echo "  --sysinclude=PATH        location of cross-build system headers"
   1.184 +  echo "  --target-os=OS           compiler targets OS [$target_os]"
   1.185 +  echo "  --target-exec=CMD        command to run executables on target"
   1.186 +  echo "  --target-path=DIR        path to view of build directory on target"
   1.187 +  echo "  --nm=NM                  use nm tool"
   1.188 +  echo "  --as=AS                  use assembler AS [$as_default]"
   1.189 +  echo "  --cc=CC                  use C compiler CC [$cc_default]"
   1.190 +  echo "  --host-cc=HOSTCC         use host C compiler HOSTCC"
   1.191 +  echo "  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host"
   1.192 +  echo "  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host"
   1.193 +  echo "  --host-libs=HLIBS        use libs HLIBS when linking for host"
   1.194 +  echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
   1.195 +  echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
   1.196 +  echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
   1.197 +  echo "  --extra-version=STRING   version string suffix []"
   1.198 +  echo "  --build-suffix=SUFFIX    library name suffix []"
   1.199 +  echo "  --arch=ARCH              select architecture [$arch]"
   1.200 +  echo "  --cpu=CPU                select the minimum required CPU (affects"
   1.201 +  echo "                           instruction selection, may crash on older CPUs)"
   1.202 +  echo "  --enable-powerpc-perf    enable performance report on PPC"
   1.203 +  echo "                           (requires enabling PMC)"
   1.204 +  echo "  --disable-altivec        disable AltiVec optimizations"
   1.205 +  echo "  --disable-amd3dnow       disable 3DNow! optimizations"
   1.206 +  echo "  --disable-amd3dnowext    disable 3DNow! extended optimizations"
   1.207 +  echo "  --disable-mmx            disable MMX optimizations"
   1.208 +  echo "  --disable-mmx2           disable MMX2 optimizations"
   1.209 +  echo "  --disable-sse            disable SSE optimizations"
   1.210 +  echo "  --disable-ssse3          disable SSSE3 optimizations"
   1.211 +  echo "  --disable-armv5te        disable armv5te optimizations"
   1.212 +  echo "  --disable-armv6          disable armv6 optimizations"
   1.213 +  echo "  --disable-armv6t2        disable armv6t2 optimizations"
   1.214 +  echo "  --disable-armvfp         disable ARM VFP optimizations"
   1.215 +  echo "  --disable-iwmmxt         disable iwmmxt optimizations"
   1.216 +  echo "  --disable-mmi            disable MMI optimizations"
   1.217 +  echo "  --disable-neon           disable neon optimizations"
   1.218 +  echo "  --disable-vis            disable VIS optimizations"
   1.219 +  echo "  --disable-yasm           disable use of yasm assembler"
   1.220 +  echo
   1.221 +  echo "Developer options (useful when working on FFmpeg itself):"
   1.222 +  echo "  --disable-debug          disable debugging symbols"
   1.223 +  echo "  --enable-debug=LEVEL     set the debug level [$debuglevel]"
   1.224 +  echo "  --enable-gprof           enable profiling with gprof [$gprof]"
   1.225 +  echo "  --disable-optimizations  disable compiler optimizations"
   1.226 +  echo "  --enable-extra-warnings  enable more compiler warnings"
   1.227 +  echo "  --disable-stripping      disable stripping of executables and shared libraries"
   1.228 +  echo ""
   1.229 +  echo "NOTE: Object files are built at the place where configure is launched."
   1.230 +  exit 0
   1.231 +}
   1.232 +
   1.233 +log(){
   1.234 +    echo "$@" >> $logfile
   1.235 +}
   1.236 +
   1.237 +log_file(){
   1.238 +    log BEGIN $1
   1.239 +    cat $1 >> $logfile
   1.240 +    log END $1
   1.241 +}
   1.242 +
   1.243 +echolog(){
   1.244 +    log "$@"
   1.245 +    echo "$@"
   1.246 +}
   1.247 +
   1.248 +die(){
   1.249 +    echolog "$@"
   1.250 +    cat <<EOF
   1.251 +
   1.252 +If you think configure made a mistake, make sure you are using the latest
   1.253 +version from SVN.  If the latest version fails, report the problem to the
   1.254 +ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
   1.255 +EOF
   1.256 +    if disabled logging; then
   1.257 +        cat <<EOF
   1.258 +Rerun configure with logging enabled (do not use --disable-logging), and
   1.259 +include the log this produces with your report.
   1.260 +EOF
   1.261 +    else
   1.262 +cat <<EOF
   1.263 +Include the log file "$logfile" produced by configure as this will help
   1.264 +solving the problem.
   1.265 +EOF
   1.266 +    fi
   1.267 +    exit 1
   1.268 +}
   1.269 +
   1.270 +# Avoid locale weirdness, besides we really just want to translate ASCII.
   1.271 +toupper(){
   1.272 +    echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
   1.273 +}
   1.274 +
   1.275 +tolower(){
   1.276 +    echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
   1.277 +}
   1.278 +
   1.279 +c_escape(){
   1.280 +    echo "$*" | sed 's/["\\]/\\\0/g'
   1.281 +}
   1.282 +
   1.283 +set_all(){
   1.284 +    value=$1
   1.285 +    shift
   1.286 +    for var in $*; do
   1.287 +        eval $var=$value
   1.288 +    done
   1.289 +}
   1.290 +
   1.291 +set_weak(){
   1.292 +    value=$1
   1.293 +    shift
   1.294 +    for var; do
   1.295 +        eval : \${$var:=$value}
   1.296 +    done
   1.297 +}
   1.298 +
   1.299 +pushvar(){
   1.300 +    for var in $*; do
   1.301 +        eval level=\${${var}_level:=0}
   1.302 +        eval ${var}_${level}="\$$var"
   1.303 +        eval ${var}_level=$(($level+1))
   1.304 +    done
   1.305 +}
   1.306 +
   1.307 +popvar(){
   1.308 +    for var in $*; do
   1.309 +        eval level=\${${var}_level:-0}
   1.310 +        test $level = 0 && continue
   1.311 +        eval level=$(($level-1))
   1.312 +        eval $var="\${${var}_${level}}"
   1.313 +        eval ${var}_level=$level
   1.314 +        eval unset ${var}_${level}
   1.315 +    done
   1.316 +}
   1.317 +
   1.318 +enable(){
   1.319 +    set_all yes $*
   1.320 +}
   1.321 +
   1.322 +disable(){
   1.323 +    set_all no $*
   1.324 +}
   1.325 +
   1.326 +enable_weak(){
   1.327 +    set_weak yes $*
   1.328 +}
   1.329 +
   1.330 +disable_weak(){
   1.331 +    set_weak no $*
   1.332 +}
   1.333 +
   1.334 +enable_safe(){
   1.335 +    enable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
   1.336 +}
   1.337 +
   1.338 +disable_safe(){
   1.339 +    disable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
   1.340 +}
   1.341 +
   1.342 +do_enable_deep(){
   1.343 +    for var; do
   1.344 +        enabled $var && continue
   1.345 +        eval sel="\$${var}_select"
   1.346 +        eval sgs="\$${var}_suggest"
   1.347 +        pushvar var sgs
   1.348 +        enable_deep $sel
   1.349 +        popvar sgs
   1.350 +        enable_deep_weak $sgs
   1.351 +        popvar var
   1.352 +    done
   1.353 +}
   1.354 +
   1.355 +enable_deep(){
   1.356 +    do_enable_deep $*
   1.357 +    enable $*
   1.358 +}
   1.359 +
   1.360 +enable_deep_weak(){
   1.361 +    do_enable_deep $*
   1.362 +    enable_weak $*
   1.363 +}
   1.364 +
   1.365 +enabled(){
   1.366 +    test "${1#!}" = "$1" && op== || op=!=
   1.367 +    eval test "x\$${1#!}" $op "xyes"
   1.368 +}
   1.369 +
   1.370 +disabled(){
   1.371 +    test "${1#!}" = "$1" && op== || op=!=
   1.372 +    eval test "x\$${1#!}" $op "xno"
   1.373 +}
   1.374 +
   1.375 +enabled_all(){
   1.376 +    for opt; do
   1.377 +        enabled $opt || return 1
   1.378 +    done
   1.379 +}
   1.380 +
   1.381 +disabled_all(){
   1.382 +    for opt; do
   1.383 +        disabled $opt || return 1
   1.384 +    done
   1.385 +}
   1.386 +
   1.387 +enabled_any(){
   1.388 +    for opt; do
   1.389 +        enabled $opt && return 0
   1.390 +    done
   1.391 +}
   1.392 +
   1.393 +disabled_any(){
   1.394 +    for opt; do
   1.395 +        disabled $opt && return 0
   1.396 +    done
   1.397 +    return 1
   1.398 +}
   1.399 +
   1.400 +set_default(){
   1.401 +    for opt; do
   1.402 +        eval : \${$opt:=\$${opt}_default}
   1.403 +    done
   1.404 +}
   1.405 +
   1.406 +is_in(){
   1.407 +    value=$1
   1.408 +    shift
   1.409 +    for var in $*; do
   1.410 +        [ $var = $value ] && return 0
   1.411 +    done
   1.412 +    return 1
   1.413 +}
   1.414 +
   1.415 +check_deps(){
   1.416 +    for cfg; do
   1.417 +        cfg="${cfg#!}"
   1.418 +        enabled ${cfg}_checking && die "Circular dependency for $cfg."
   1.419 +        disabled ${cfg}_checking && continue
   1.420 +        enable ${cfg}_checking
   1.421 +
   1.422 +        eval dep_all="\$${cfg}_deps"
   1.423 +        eval dep_any="\$${cfg}_deps_any"
   1.424 +        eval dep_sel="\$${cfg}_select"
   1.425 +        eval dep_sgs="\$${cfg}_suggest"
   1.426 +
   1.427 +        pushvar cfg dep_all dep_any dep_sel dep_sgs
   1.428 +        check_deps $dep_all $dep_any $dep_sel $dep_sgs
   1.429 +        popvar cfg dep_all dep_any dep_sel dep_sgs
   1.430 +
   1.431 +        enabled_all  $dep_all || disable $cfg
   1.432 +        enabled_any  $dep_any || disable $cfg
   1.433 +        disabled_any $dep_sel && disable $cfg
   1.434 +
   1.435 +        if enabled $cfg; then
   1.436 +            eval dep_extralibs="\$${cfg}_extralibs"
   1.437 +            test -n "$dep_extralibs" && add_extralibs $dep_extralibs
   1.438 +            enable_deep $dep_sel
   1.439 +            enable_deep_weak $dep_sgs
   1.440 +        fi
   1.441 +
   1.442 +        disable ${cfg}_checking
   1.443 +    done
   1.444 +}
   1.445 +
   1.446 +print_config(){
   1.447 +    pfx=$1
   1.448 +    header=$2
   1.449 +    makefile=$3
   1.450 +    shift 3
   1.451 +    for cfg; do
   1.452 +        ucname="$(toupper $cfg)"
   1.453 +        if enabled $cfg; then
   1.454 +            echo "#define ${pfx}${ucname} 1" >> $header
   1.455 +            echo "${pfx}${ucname}=yes" >> $makefile
   1.456 +        else
   1.457 +            echo "#define ${pfx}${ucname} 0" >> $header
   1.458 +        fi
   1.459 +    done
   1.460 +}
   1.461 +
   1.462 +flags_saved(){
   1.463 +    (: ${SAVE_CFLAGS?}) 2> /dev/null
   1.464 +}
   1.465 +
   1.466 +save_flags(){
   1.467 +    flags_saved && return
   1.468 +    SAVE_CFLAGS="$CFLAGS"
   1.469 +    SAVE_LDFLAGS="$LDFLAGS"
   1.470 +    SAVE_extralibs="$extralibs"
   1.471 +}
   1.472 +
   1.473 +restore_flags(){
   1.474 +    flags_saved || return
   1.475 +    CFLAGS="$SAVE_CFLAGS"
   1.476 +    LDFLAGS="$SAVE_LDFLAGS"
   1.477 +    extralibs="$SAVE_extralibs"
   1.478 +    unset SAVE_CFLAGS
   1.479 +    unset SAVE_LDFLAGS
   1.480 +    unset SAVE_extralibs
   1.481 +}
   1.482 +
   1.483 +temp_cflags(){
   1.484 +    save_flags
   1.485 +    CFLAGS="$CFLAGS $*"
   1.486 +}
   1.487 +
   1.488 +temp_ldflags(){
   1.489 +    save_flags
   1.490 +    LDFLAGS="$LDFLAGS $*"
   1.491 +}
   1.492 +
   1.493 +temp_extralibs(){
   1.494 +    save_flags
   1.495 +    extralibs="$extralibs $*"
   1.496 +}
   1.497 +
   1.498 +append(){
   1.499 +    var=$1
   1.500 +    shift
   1.501 +    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
   1.502 +    eval "$var=\"\$$var $*\""
   1.503 +}
   1.504 +
   1.505 +add_cflags(){
   1.506 +    append CFLAGS "$@"
   1.507 +}
   1.508 +
   1.509 +add_ldflags(){
   1.510 +    append LDFLAGS "$@"
   1.511 +}
   1.512 +
   1.513 +add_extralibs(){
   1.514 +    append extralibs "$@"
   1.515 +}
   1.516 +
   1.517 +check_cmd(){
   1.518 +    log "$@"
   1.519 +    "$@" >> $logfile 2>&1
   1.520 +}
   1.521 +
   1.522 +check_cc(){
   1.523 +    log check_cc "$@"
   1.524 +    cat > $TMPC
   1.525 +    log_file $TMPC
   1.526 +    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
   1.527 +}
   1.528 +
   1.529 +check_cpp(){
   1.530 +    log check_cpp "$@"
   1.531 +    cat > $TMPC
   1.532 +    log_file $TMPC
   1.533 +    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
   1.534 +}
   1.535 +
   1.536 +check_as(){
   1.537 +    log check_as "$@"
   1.538 +    cat > $TMPC
   1.539 +    log_file $TMPC
   1.540 +    check_cmd $as $CFLAGS "$@" -c -o $TMPO $TMPC
   1.541 +}
   1.542 +
   1.543 +check_asm(){
   1.544 +    log check_asm "$@"
   1.545 +    name="$1"
   1.546 +    asm="$2"
   1.547 +    shift 2
   1.548 +    check_as "$@" <<EOF && enable $name || disable $name
   1.549 +void foo(void){ __asm__ volatile($asm); }
   1.550 +EOF
   1.551 +}
   1.552 +
   1.553 +check_yasm(){
   1.554 +    log check_yasm "$@"
   1.555 +    echo "$1" > $TMPS
   1.556 +    log_file $TMPS
   1.557 +    shift 1
   1.558 +    check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
   1.559 +}
   1.560 +
   1.561 +check_ld(){
   1.562 +    log check_ld "$@"
   1.563 +    check_cc || return
   1.564 +    flags=''
   1.565 +    libs=''
   1.566 +    for f; do
   1.567 +        test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
   1.568 +    done
   1.569 +    check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
   1.570 +}
   1.571 +
   1.572 +check_cflags(){
   1.573 +    log check_cflags "$@"
   1.574 +    check_cc "$@" <<EOF && add_cflags "$@"
   1.575 +int x;
   1.576 +EOF
   1.577 +}
   1.578 +
   1.579 +check_ldflags(){
   1.580 +    log check_ldflags "$@"
   1.581 +    check_ld "$@" <<EOF && add_ldflags "$@"
   1.582 +int main(void){ return 0; }
   1.583 +EOF
   1.584 +}
   1.585 +
   1.586 +check_header(){
   1.587 +    log check_header "$@"
   1.588 +    header=$1
   1.589 +    shift
   1.590 +    disable_safe $header
   1.591 +    check_cpp "$@" <<EOF && enable_safe $header
   1.592 +#include <$header>
   1.593 +int x;
   1.594 +EOF
   1.595 +}
   1.596 +
   1.597 +check_func(){
   1.598 +    log check_func "$@"
   1.599 +    func=$1
   1.600 +    shift
   1.601 +    disable $func
   1.602 +    check_ld "$@" <<EOF && enable $func
   1.603 +extern int $func();
   1.604 +int main(void){ $func(); }
   1.605 +EOF
   1.606 +}
   1.607 +
   1.608 +check_func_headers(){
   1.609 +    log check_func_headers "$@"
   1.610 +    headers=$1
   1.611 +    func=$2
   1.612 +    shift 2
   1.613 +    disable $func
   1.614 +    incs=""
   1.615 +    for hdr in $headers; do
   1.616 +        incs="$incs
   1.617 +#include <$hdr>"
   1.618 +    done
   1.619 +    check_ld "$@" <<EOF && enable $func && enable_safe $headers
   1.620 +$incs
   1.621 +int main(int argc, char **argv){
   1.622 +    (void) $func;
   1.623 +    return 0;
   1.624 +}
   1.625 +EOF
   1.626 +}
   1.627 +
   1.628 +check_cpp_condition(){
   1.629 +    log check_cpp_condition "$@"
   1.630 +    header=$1
   1.631 +    condition=$2
   1.632 +    check_cpp <<EOF
   1.633 +#include <$header>
   1.634 +#if !($condition)
   1.635 +#error "unsatisfied condition: $condition"
   1.636 +#endif
   1.637 +EOF
   1.638 +}
   1.639 +
   1.640 +check_lib(){
   1.641 +    log check_lib "$@"
   1.642 +    header="$1"
   1.643 +    func="$2"
   1.644 +    shift 2
   1.645 +    temp_extralibs "$@"
   1.646 +    check_header $header && check_func $func && add_extralibs "$@"
   1.647 +    err=$?
   1.648 +    restore_flags
   1.649 +    return $err
   1.650 +}
   1.651 +
   1.652 +check_lib2(){
   1.653 +    log check_lib2 "$@"
   1.654 +    headers="$1"
   1.655 +    func="$2"
   1.656 +    shift 2
   1.657 +    temp_extralibs "$@"
   1.658 +    check_func_headers "$headers" $func && add_extralibs "$@"
   1.659 +    err=$?
   1.660 +    restore_flags
   1.661 +    return $err
   1.662 +}
   1.663 +
   1.664 +check_exec(){
   1.665 +    check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
   1.666 +}
   1.667 +
   1.668 +check_exec_crash(){
   1.669 +    code=$(cat)
   1.670 +
   1.671 +    # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
   1.672 +    # are safe but may not be available everywhere.  Thus we use
   1.673 +    # raise(SIGTERM) instead.  The check is run in a subshell so we
   1.674 +    # can redirect the "Terminated" message from the shell.  SIGBUS
   1.675 +    # is not defined by standard C so it is used conditionally.
   1.676 +
   1.677 +    (check_exec "$@") >> $logfile 2>&1 <<EOF
   1.678 +#include <signal.h>
   1.679 +static void sighandler(int sig){
   1.680 +    raise(SIGTERM);
   1.681 +}
   1.682 +int main(void){
   1.683 +    signal(SIGILL, sighandler);
   1.684 +    signal(SIGFPE, sighandler);
   1.685 +    signal(SIGSEGV, sighandler);
   1.686 +#ifdef SIGBUS
   1.687 +    signal(SIGBUS, sighandler);
   1.688 +#endif
   1.689 +    { $code }
   1.690 +}
   1.691 +EOF
   1.692 +}
   1.693 +
   1.694 +check_type(){
   1.695 +    log check_type "$@"
   1.696 +    headers=$1
   1.697 +    type=$2
   1.698 +    shift 2
   1.699 +    disable $type
   1.700 +    incs=""
   1.701 +    for hdr in $headers; do
   1.702 +        incs="$incs
   1.703 +#include <$hdr>"
   1.704 +    done
   1.705 +    check_cc "$@" <<EOF && enable $type
   1.706 +$incs
   1.707 +$type v;
   1.708 +EOF
   1.709 +}
   1.710 +
   1.711 +require(){
   1.712 +    name="$1"
   1.713 +    header="$2"
   1.714 +    func="$3"
   1.715 +    shift 3
   1.716 +    check_lib $header $func "$@" || die "ERROR: $name not found"
   1.717 +}
   1.718 +
   1.719 +require2(){
   1.720 +    name="$1"
   1.721 +    headers="$2"
   1.722 +    func="$3"
   1.723 +    shift 3
   1.724 +    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
   1.725 +}
   1.726 +
   1.727 +check_foo_config(){
   1.728 +    cfg=$1
   1.729 +    pkg=$2
   1.730 +    header=$3
   1.731 +    func=$4
   1.732 +    shift 4
   1.733 +    disable $cfg
   1.734 +    check_cmd ${pkg}-config --version
   1.735 +    err=$?
   1.736 +    if test "$err" = 0; then
   1.737 +        temp_cflags $(${pkg}-config --cflags)
   1.738 +        temp_extralibs $(${pkg}-config --libs)
   1.739 +        check_lib "$@" $header $func && enable $cfg
   1.740 +    fi
   1.741 +    return $err
   1.742 +}
   1.743 +
   1.744 +apply(){
   1.745 +    file=$1
   1.746 +    shift
   1.747 +    "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
   1.748 +}
   1.749 +
   1.750 +# CONFIG_LIST contains configurable options, while HAVE_LIST is for
   1.751 +# system-dependent things.
   1.752 +
   1.753 +COMPONENT_LIST="
   1.754 +    bsfs
   1.755 +    decoders
   1.756 +    demuxers
   1.757 +    encoders
   1.758 +    filters
   1.759 +    hwaccels
   1.760 +    indevs
   1.761 +    muxers
   1.762 +    outdevs
   1.763 +    parsers
   1.764 +    protocols
   1.765 +"
   1.766 +
   1.767 +CONFIG_LIST="
   1.768 +    $COMPONENT_LIST
   1.769 +    aandct
   1.770 +    avfilter
   1.771 +    avfilter_lavf
   1.772 +    avisynth
   1.773 +    beos_netserver
   1.774 +    bzlib
   1.775 +    fastdiv
   1.776 +    ffmpeg
   1.777 +    ffplay
   1.778 +    ffserver
   1.779 +    fft
   1.780 +    golomb
   1.781 +    gpl
   1.782 +    gprof
   1.783 +    gray
   1.784 +    hardcoded_tables
   1.785 +    ipv6
   1.786 +    libamr_nb
   1.787 +    libamr_wb
   1.788 +    libdc1394
   1.789 +    libdirac
   1.790 +    libfaac
   1.791 +    libfaad
   1.792 +    libfaadbin
   1.793 +    libgsm
   1.794 +    libmp3lame
   1.795 +    libnut
   1.796 +    libopenjpeg
   1.797 +    libschroedinger
   1.798 +    libspeex
   1.799 +    libtheora
   1.800 +    libvorbis
   1.801 +    libx264
   1.802 +    libxvid
   1.803 +    mdct
   1.804 +    memalign_hack
   1.805 +    mlib
   1.806 +    mpegaudio_hp
   1.807 +    network
   1.808 +    nonfree
   1.809 +    postproc
   1.810 +    powerpc_perf
   1.811 +    rdft
   1.812 +    shared
   1.813 +    small
   1.814 +    static
   1.815 +    swscale_alpha
   1.816 +    x11grab
   1.817 +    zlib
   1.818 +"
   1.819 +
   1.820 +THREADS_LIST='
   1.821 +    beosthreads
   1.822 +    os2threads
   1.823 +    pthreads
   1.824 +    w32threads
   1.825 +'
   1.826 +
   1.827 +ARCH_LIST='
   1.828 +    alpha
   1.829 +    arm
   1.830 +    bfin
   1.831 +    ia64
   1.832 +    m68k
   1.833 +    mips
   1.834 +    parisc
   1.835 +    ppc
   1.836 +    s390
   1.837 +    sh4
   1.838 +    sparc
   1.839 +    sparc64
   1.840 +    x86
   1.841 +    x86_32
   1.842 +    x86_64
   1.843 +'
   1.844 +
   1.845 +ARCH_EXT_LIST='
   1.846 +    altivec
   1.847 +    amd3dnow
   1.848 +    amd3dnowext
   1.849 +    armv5te
   1.850 +    armv6
   1.851 +    armv6t2
   1.852 +    armvfp
   1.853 +    iwmmxt
   1.854 +    mmi
   1.855 +    mmx
   1.856 +    mmx2
   1.857 +    neon
   1.858 +    ppc4xx
   1.859 +    sse
   1.860 +    ssse3
   1.861 +    vis
   1.862 +'
   1.863 +
   1.864 +HAVE_LIST="
   1.865 +    $ARCH_EXT_LIST
   1.866 +    $THREADS_LIST
   1.867 +    alsa_asoundlib_h
   1.868 +    altivec_h
   1.869 +    arpa_inet_h
   1.870 +    bswap
   1.871 +    closesocket
   1.872 +    cmov
   1.873 +    conio_h
   1.874 +    dcbzl
   1.875 +    dev_bktr_ioctl_bt848_h
   1.876 +    dev_bktr_ioctl_meteor_h
   1.877 +    dev_ic_bt8xx_h
   1.878 +    dev_video_meteor_ioctl_meteor_h
   1.879 +    dev_video_bktr_ioctl_bt848_h
   1.880 +    dlfcn_h
   1.881 +    dlopen
   1.882 +    dos_paths
   1.883 +    ebp_available
   1.884 +    ebx_available
   1.885 +    fast_64bit
   1.886 +    fast_cmov
   1.887 +    fast_unaligned
   1.888 +    fork
   1.889 +    gethrtime
   1.890 +    GetProcessTimes
   1.891 +    getrusage
   1.892 +    inet_aton
   1.893 +    inline_asm
   1.894 +    libdc1394_1
   1.895 +    libdc1394_2
   1.896 +    llrint
   1.897 +    lrint
   1.898 +    lrintf
   1.899 +    machine_ioctl_bt848_h
   1.900 +    machine_ioctl_meteor_h
   1.901 +    malloc_h
   1.902 +    memalign
   1.903 +    mkstemp
   1.904 +    pld
   1.905 +    posix_memalign
   1.906 +    ppc64
   1.907 +    round
   1.908 +    roundf
   1.909 +    sdl
   1.910 +    sdl_video_size
   1.911 +    setmode
   1.912 +    socklen_t
   1.913 +    soundcard_h
   1.914 +    poll_h
   1.915 +    sys_mman_h
   1.916 +    sys_resource_h
   1.917 +    sys_select_h
   1.918 +    sys_soundcard_h
   1.919 +    sys_videoio_h
   1.920 +    ten_operands
   1.921 +    termios_h
   1.922 +    threads
   1.923 +    truncf
   1.924 +    VirtualAlloc
   1.925 +    winsock2_h
   1.926 +    yasm
   1.927 +"
   1.928 +
   1.929 +# options emitted with CONFIG_ prefix but not available on command line
   1.930 +CONFIG_EXTRA="
   1.931 +"
   1.932 +
   1.933 +CMDLINE_SELECT="
   1.934 +    $ARCH_EXT_LIST
   1.935 +    $CONFIG_LIST
   1.936 +    $THREADS_LIST
   1.937 +    cross_compile
   1.938 +    debug
   1.939 +    extra_warnings
   1.940 +    logging
   1.941 +    optimizations
   1.942 +    stripping
   1.943 +    yasm
   1.944 +"
   1.945 +
   1.946 +PATHS_LIST='
   1.947 +    bindir
   1.948 +    datadir
   1.949 +    incdir
   1.950 +    libdir
   1.951 +    mandir
   1.952 +    prefix
   1.953 +    shlibdir
   1.954 +'
   1.955 +
   1.956 +CMDLINE_SET="
   1.957 +    $PATHS_LIST
   1.958 +    arch
   1.959 +    as
   1.960 +    build_suffix
   1.961 +    cc
   1.962 +    cpu
   1.963 +    cross_prefix
   1.964 +    extra_version
   1.965 +    host_cc
   1.966 +    host_cflags
   1.967 +    host_ldflags
   1.968 +    host_libs
   1.969 +    host_os
   1.970 +    logfile
   1.971 +    nm
   1.972 +    source_path
   1.973 +    sysinclude
   1.974 +    sysroot
   1.975 +    target_exec
   1.976 +    target_os
   1.977 +    target_path
   1.978 +"
   1.979 +
   1.980 +# code dependency declarations
   1.981 +
   1.982 +# architecture extensions
   1.983 +altivec_deps="ppc"
   1.984 +amd3dnow_deps="mmx"
   1.985 +amd3dnowext_deps="amd3dnow"
   1.986 +armv5te_deps="arm"
   1.987 +armv6_deps="arm"
   1.988 +armv6t2_deps="arm"
   1.989 +armvfp_deps="arm"
   1.990 +iwmmxt_deps="arm"
   1.991 +mmi_deps="mips"
   1.992 +mmx_deps="x86"
   1.993 +mmx2_deps="mmx"
   1.994 +neon_deps="arm"
   1.995 +ppc4xx_deps="ppc"
   1.996 +sse_deps="mmx"
   1.997 +ssse3_deps="sse"
   1.998 +vis_deps="sparc"
   1.999 +
  1.1000 +# decoders / encoders / hardware accelerators
  1.1001 +aac_decoder_select="fft mdct"
  1.1002 +ac3_decoder_deps="gpl"
  1.1003 +ac3_decoder_select="fft mdct"
  1.1004 +atrac3_decoder_select="fft mdct"
  1.1005 +cavs_decoder_select="golomb"
  1.1006 +cook_decoder_select="fft mdct"
  1.1007 +cscd_decoder_suggest="zlib"
  1.1008 +dca_decoder_select="fft mdct"
  1.1009 +dnxhd_encoder_select="aandct"
  1.1010 +dxa_decoder_select="zlib"
  1.1011 +eac3_decoder_deps="gpl"
  1.1012 +eac3_decoder_select="fft mdct"
  1.1013 +eatgq_decoder_select="aandct"
  1.1014 +eatqi_decoder_select="aandct"
  1.1015 +ffv1_decoder_select="golomb"
  1.1016 +flac_decoder_select="golomb"
  1.1017 +flac_encoder_select="golomb"
  1.1018 +flashsv_decoder_select="zlib"
  1.1019 +flashsv_encoder_select="zlib"
  1.1020 +flv_encoder_select="aandct"
  1.1021 +h261_encoder_select="aandct"
  1.1022 +h263_encoder_select="aandct"
  1.1023 +h263_vaapi_hwaccel_deps="va_va_h"
  1.1024 +h263p_encoder_select="aandct"
  1.1025 +h264_decoder_select="golomb"
  1.1026 +h264_vaapi_hwaccel_deps="va_va_h"
  1.1027 +h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1.1028 +imc_decoder_select="fft mdct"
  1.1029 +jpegls_decoder_select="golomb"
  1.1030 +jpegls_encoder_select="golomb"
  1.1031 +ljpeg_encoder_select="aandct"
  1.1032 +loco_decoder_select="golomb"
  1.1033 +mjpeg_encoder_select="aandct"
  1.1034 +mpeg1video_encoder_select="aandct"
  1.1035 +mpeg2video_encoder_select="aandct"
  1.1036 +mpeg4_encoder_select="aandct"
  1.1037 +mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1.1038 +mpeg1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1.1039 +mpeg2_vaapi_hwaccel_deps="va_va_h"
  1.1040 +mpeg4_vaapi_hwaccel_deps="va_va_h"
  1.1041 +mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1.1042 +msmpeg4v1_encoder_select="aandct"
  1.1043 +msmpeg4v2_encoder_select="aandct"
  1.1044 +msmpeg4v3_encoder_select="aandct"
  1.1045 +nellymoser_decoder_select="fft mdct"
  1.1046 +nellymoser_encoder_select="fft mdct"
  1.1047 +png_decoder_select="zlib"
  1.1048 +png_encoder_select="zlib"
  1.1049 +qdm2_decoder_select="fft mdct rdft"
  1.1050 +rv10_encoder_select="aandct"
  1.1051 +rv20_encoder_select="aandct"
  1.1052 +rv30_decoder_select="golomb"
  1.1053 +rv40_decoder_select="golomb"
  1.1054 +shorten_decoder_select="golomb"
  1.1055 +sonic_decoder_select="golomb"
  1.1056 +sonic_encoder_select="golomb"
  1.1057 +sonic_ls_encoder_select="golomb"
  1.1058 +svq3_decoder_select="golomb"
  1.1059 +svq3_decoder_suggest="zlib"
  1.1060 +tiff_decoder_suggest="zlib"
  1.1061 +tiff_encoder_suggest="zlib"
  1.1062 +tscc_decoder_select="zlib"
  1.1063 +vc1_vaapi_hwaccel_deps="va_va_h"
  1.1064 +vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1.1065 +vorbis_decoder_select="fft mdct"
  1.1066 +vorbis_encoder_select="fft mdct"
  1.1067 +wmav1_decoder_select="fft mdct"
  1.1068 +wmav1_encoder_select="fft mdct"
  1.1069 +wmav2_decoder_select="fft mdct"
  1.1070 +wmav2_encoder_select="fft mdct"
  1.1071 +wmv1_encoder_select="aandct"
  1.1072 +wmv2_encoder_select="aandct"
  1.1073 +wmv3_vaapi_hwaccel_deps="va_va_h"
  1.1074 +wmv3_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1.1075 +zlib_decoder_select="zlib"
  1.1076 +zlib_encoder_select="zlib"
  1.1077 +zmbv_decoder_select="zlib"
  1.1078 +zmbv_encoder_select="zlib"
  1.1079 +
  1.1080 +# external libraries
  1.1081 +libamr_nb_decoder_deps="libamr_nb"
  1.1082 +libamr_nb_encoder_deps="libamr_nb"
  1.1083 +libamr_wb_decoder_deps="libamr_wb"
  1.1084 +libamr_wb_encoder_deps="libamr_wb"
  1.1085 +libdirac_decoder_deps="libdirac !libschroedinger"
  1.1086 +libdirac_encoder_deps="libdirac"
  1.1087 +libfaac_encoder_deps="libfaac"
  1.1088 +libfaad_decoder_deps="libfaad"
  1.1089 +libfaadbin_decoder_extralibs='$ldl'
  1.1090 +libgsm_decoder_deps="libgsm"
  1.1091 +libgsm_encoder_deps="libgsm"
  1.1092 +libgsm_ms_decoder_deps="libgsm"
  1.1093 +libgsm_ms_encoder_deps="libgsm"
  1.1094 +libmp3lame_encoder_deps="libmp3lame"
  1.1095 +libopenjpeg_decoder_deps="libopenjpeg"
  1.1096 +libschroedinger_decoder_deps="libschroedinger"
  1.1097 +libschroedinger_encoder_deps="libschroedinger"
  1.1098 +libspeex_decoder_deps="libspeex"
  1.1099 +libtheora_encoder_deps="libtheora"
  1.1100 +libvorbis_encoder_deps="libvorbis"
  1.1101 +libx264_encoder_deps="libx264"
  1.1102 +libxvid_encoder_deps="libxvid"
  1.1103 +
  1.1104 +# demuxers / muxers
  1.1105 +ac3_demuxer_deps="ac3_parser"
  1.1106 +alsa_demuxer_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1.1107 +alsa_demuxer_extralibs="-lasound"
  1.1108 +alsa_muxer_deps="alsa_asoundlib_h"
  1.1109 +alsa_muxer_extralibs="-lasound"
  1.1110 +audio_beos_demuxer_deps="audio_beos"
  1.1111 +audio_beos_demuxer_extralibs="-lmedia -lbe"
  1.1112 +audio_beos_muxer_deps="audio_beos"
  1.1113 +audio_beos_muxer_extralibs="-lmedia -lbe"
  1.1114 +avisynth_demuxer_deps="avisynth"
  1.1115 +bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1.1116 +dirac_demuxer_deps="dirac_parser"
  1.1117 +dv1394_demuxer_deps="dv1394 dv_demuxer"
  1.1118 +jack_demuxer_deps="jack_jack_h"
  1.1119 +jack_demuxer_extralibs="-ljack"
  1.1120 +libdc1394_demuxer_deps="libdc1394"
  1.1121 +libnut_demuxer_deps="libnut"
  1.1122 +libnut_muxer_deps="libnut"
  1.1123 +matroska_demuxer_suggest="zlib bzlib"
  1.1124 +mov_demuxer_suggest="zlib"
  1.1125 +mp3_demuxer_deps="mpegaudio_parser"
  1.1126 +oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  1.1127 +oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  1.1128 +redir_demuxer_deps="network"
  1.1129 +rtp_muxer_deps="network rtp_protocol"
  1.1130 +rtsp_demuxer_deps="sdp_demuxer"
  1.1131 +sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1.1132 +v4l_demuxer_deps="linux_videodev_h"
  1.1133 +v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
  1.1134 +vfwcap_demuxer_deps="capCreateCaptureWindow"
  1.1135 +vfwcap_demuxer_extralibs="-lvfw32"
  1.1136 +x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  1.1137 +x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  1.1138 +
  1.1139 +# protocols
  1.1140 +gopher_protocol_deps="network"
  1.1141 +http_protocol_deps="network"
  1.1142 +rtp_protocol_deps="udp_protocol"
  1.1143 +tcp_protocol_deps="network"
  1.1144 +udp_protocol_deps="network"
  1.1145 +
  1.1146 +# filters
  1.1147 +movie_filter_deps="avfilter_lavf"
  1.1148 +
  1.1149 +# programs
  1.1150 +ffplay_deps="sdl"
  1.1151 +ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  1.1152 +ffserver_extralibs='$ldl'
  1.1153 +
  1.1154 +
  1.1155 +# default parameters
  1.1156 +
  1.1157 +logfile="config.err"
  1.1158 +
  1.1159 +# installation paths
  1.1160 +prefix_default="/usr/local"
  1.1161 +bindir_default='${prefix}/bin'
  1.1162 +datadir_default='${prefix}/share/ffmpeg'
  1.1163 +incdir_default='${prefix}/include'
  1.1164 +libdir_default='${prefix}/lib'
  1.1165 +mandir_default='${prefix}/share/man'
  1.1166 +shlibdir_default="$libdir_default"
  1.1167 +
  1.1168 +# toolchain
  1.1169 +ar="ar"
  1.1170 +cc_default="gcc"
  1.1171 +host_cc_default="gcc"
  1.1172 +ln_s="ln -sf"
  1.1173 +nm_default="nm"
  1.1174 +objformat="elf"
  1.1175 +ranlib="ranlib"
  1.1176 +strip="strip"
  1.1177 +yasmexe="yasm"
  1.1178 +
  1.1179 +# machine
  1.1180 +arch=$(uname -m)
  1.1181 +cpu="generic"
  1.1182 +
  1.1183 +# OS
  1.1184 +target_os=$(tolower $(uname -s))
  1.1185 +host_os=$target_os
  1.1186 +
  1.1187 +# configurable options
  1.1188 +enable debug
  1.1189 +enable fastdiv
  1.1190 +enable ffmpeg
  1.1191 +enable ffplay
  1.1192 +enable ffserver
  1.1193 +enable ipv6
  1.1194 +enable mpegaudio_hp
  1.1195 +enable network
  1.1196 +enable optimizations
  1.1197 +enable protocols
  1.1198 +enable static
  1.1199 +enable stripping
  1.1200 +enable swscale_alpha
  1.1201 +
  1.1202 +# build settings
  1.1203 +add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1.1204 +SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1.1205 +FFSERVERLDFLAGS=-Wl,-E
  1.1206 +LIBPREF="lib"
  1.1207 +LIBSUF=".a"
  1.1208 +FULLNAME='$(NAME)$(BUILDSUF)'
  1.1209 +LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1.1210 +SLIBPREF="lib"
  1.1211 +SLIBSUF=".so"
  1.1212 +SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1.1213 +SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1.1214 +SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1.1215 +LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1.1216 +
  1.1217 +host_cflags='-O3 -g -Wall'
  1.1218 +host_libs='-lm'
  1.1219 +
  1.1220 +target_path='.'
  1.1221 +
  1.1222 +# gcc stupidly only outputs the basename of targets with -MM, but we need the
  1.1223 +# full relative path for objects in subdirectories for non-recursive Make.
  1.1224 +DEPEND_CMD='$(CC) $(CFLAGS) -MM $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
  1.1225 +
  1.1226 +# find source path
  1.1227 +source_path="$(dirname "$0")"
  1.1228 +enable source_path_used
  1.1229 +if test -z "$source_path" -o "$source_path" = "." ; then
  1.1230 +    source_path="$(pwd)"
  1.1231 +    disable source_path_used
  1.1232 +else
  1.1233 +    source_path="$(cd "$source_path"; pwd)"
  1.1234 +    echo "$source_path" | grep -q '[[:blank:]]' &&
  1.1235 +        die "Out of tree builds are impossible with whitespace in source path."
  1.1236 +    test -e "$source_path/config.h" &&
  1.1237 +        die "Out of tree builds are impossible with config.h in source dir."
  1.1238 +fi
  1.1239 +
  1.1240 +for v in "$@"; do
  1.1241 +    r="${v#*=}"
  1.1242 +    l="${v%$r}"
  1.1243 +    test "$r" = "${r#* }" || r="'$r'"
  1.1244 +    FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1.1245 +done
  1.1246 +
  1.1247 +find_things(){
  1.1248 +    thing=$1
  1.1249 +    pattern=$2
  1.1250 +    file=$source_path/$3
  1.1251 +    sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1.1252 +}
  1.1253 +
  1.1254 +ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
  1.1255 +DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
  1.1256 +HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
  1.1257 +PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
  1.1258 +BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
  1.1259 +MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
  1.1260 +DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
  1.1261 +OUTDEV_LIST=$(find_things   muxer    _MUX     libavdevice/alldevices.c)
  1.1262 +INDEV_LIST=$(find_things    demuxer  DEMUX    libavdevice/alldevices.c)
  1.1263 +PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1.1264 +FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
  1.1265 +
  1.1266 +enable $ARCH_EXT_LIST \
  1.1267 +       $DECODER_LIST \
  1.1268 +       $ENCODER_LIST \
  1.1269 +       $HWACCEL_LIST \
  1.1270 +       $PARSER_LIST \
  1.1271 +       $BSF_LIST \
  1.1272 +       $DEMUXER_LIST \
  1.1273 +       $MUXER_LIST \
  1.1274 +       $FILTER_LIST \
  1.1275 +       $PROTOCOL_LIST \
  1.1276 +       $INDEV_LIST \
  1.1277 +       $OUTDEV_LIST \
  1.1278 +
  1.1279 +die_unknown(){
  1.1280 +    echo "Unknown option \"$1\"."
  1.1281 +    echo "See $0 --help for available options."
  1.1282 +    exit 1
  1.1283 +}
  1.1284 +
  1.1285 +show_list() {
  1.1286 +    suffix=_$1
  1.1287 +    shift
  1.1288 +    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  1.1289 +    exit 0
  1.1290 +}
  1.1291 +
  1.1292 +for opt do
  1.1293 +    optval="${opt#*=}"
  1.1294 +    case "$opt" in
  1.1295 +    --extra-cflags=*) add_cflags $optval
  1.1296 +    ;;
  1.1297 +    --extra-ldflags=*) add_ldflags $optval
  1.1298 +    ;;
  1.1299 +    --extra-libs=*) add_extralibs $optval
  1.1300 +    ;;
  1.1301 +    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1.1302 +    ;;
  1.1303 +    --enable-debug=*) debuglevel="$optval"
  1.1304 +    ;;
  1.1305 +    --enable-*=*|--disable-*=*)
  1.1306 +    eval $(echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/')
  1.1307 +    case "$thing" in
  1.1308 +        encoder|decoder|hwaccel|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
  1.1309 +        *) die_unknown "$opt" ;;
  1.1310 +    esac
  1.1311 +    ;;
  1.1312 +    --enable-?*|--disable-?*)
  1.1313 +    eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1.1314 +    if is_in $option $COMPONENT_LIST; then
  1.1315 +        eval $action \$$(toupper ${option%s})_LIST
  1.1316 +    elif is_in $option $CMDLINE_SELECT; then
  1.1317 +        $action $option
  1.1318 +    else
  1.1319 +        die_unknown $opt
  1.1320 +    fi
  1.1321 +    ;;
  1.1322 +    --list-*)
  1.1323 +        NAME="${opt#--list-}"
  1.1324 +        is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1.1325 +        NAME=${NAME%s}
  1.1326 +        eval show_list $NAME \$$(toupper $NAME)_LIST
  1.1327 +    ;;
  1.1328 +    --help|-h) show_help
  1.1329 +    ;;
  1.1330 +    *)
  1.1331 +    optname="${opt%%=*}"
  1.1332 +    optname="${optname#--}"
  1.1333 +    optname=$(echo "$optname" | sed 's/-/_/g')
  1.1334 +    is_in $optname $CMDLINE_SET || die_unknown $opt
  1.1335 +    eval $optname='$optval'
  1.1336 +    ;;
  1.1337 +    esac
  1.1338 +done
  1.1339 +
  1.1340 +disabled logging && logfile=/dev/null
  1.1341 +
  1.1342 +echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1.1343 +set >> $logfile
  1.1344 +
  1.1345 +test -n "$cross_prefix" && enable cross_compile
  1.1346 +
  1.1347 +ar="${cross_prefix}${ar}"
  1.1348 +cc_default="${cross_prefix}${cc_default}"
  1.1349 +nm_default="${cross_prefix}${nm_default}"
  1.1350 +ranlib="${cross_prefix}${ranlib}"
  1.1351 +strip="${cross_prefix}${strip}"
  1.1352 +
  1.1353 +sysinclude_default="${sysroot}/usr/include"
  1.1354 +
  1.1355 +set_default cc nm sysinclude
  1.1356 +as_default=$cc
  1.1357 +enabled cross_compile || host_cc_default=$cc
  1.1358 +set_default host_cc
  1.1359 +
  1.1360 +exesuf() {
  1.1361 +    case $1 in
  1.1362 +        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1.1363 +    esac
  1.1364 +}
  1.1365 +
  1.1366 +EXESUF=$(exesuf $target_os)
  1.1367 +HOSTEXESUF=$(exesuf $host_os)
  1.1368 +
  1.1369 +# set temporary file name
  1.1370 +: ${TMPDIR:=$TEMPDIR}
  1.1371 +: ${TMPDIR:=$TMP}
  1.1372 +: ${TMPDIR:=/tmp}
  1.1373 +
  1.1374 +TMPC="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  1.1375 +TMPE="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
  1.1376 +TMPH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  1.1377 +TMPO="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  1.1378 +TMPS="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  1.1379 +TMPSH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
  1.1380 +
  1.1381 +# make sure we can execute files in $TMPDIR
  1.1382 +cat > $TMPSH 2>> $logfile <<EOF
  1.1383 +#! /bin/sh
  1.1384 +EOF
  1.1385 +chmod +x $TMPSH >> $logfile 2>&1
  1.1386 +if ! $TMPSH >> $logfile 2>&1; then
  1.1387 +    cat <<EOF
  1.1388 +Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
  1.1389 +variable to another directory and make sure that it is not mounted noexec.
  1.1390 +EOF
  1.1391 +    die "Sanity test failed."
  1.1392 +fi
  1.1393 +
  1.1394 +if   $cc --version 2>/dev/null | grep -qi gcc; then
  1.1395 +    cc_type=gcc
  1.1396 +elif $cc --version 2>/dev/null | grep -q Intel; then
  1.1397 +    cc_type=icc
  1.1398 +elif $cc -v 2>&1 | grep -q xlc; then
  1.1399 +    cc_type=xlc
  1.1400 +elif $cc -V 2>/dev/null | grep -q Compaq; then
  1.1401 +    cc_type=ccc
  1.1402 +    DEPEND_CMD='$(CC) $(CFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
  1.1403 +    debuglevel=3
  1.1404 +    add_ldflags -Wl,-z,now # calls to libots crash without this
  1.1405 +elif $cc --vsn 2>/dev/null | grep -q RVCT; then
  1.1406 +    test -d "$sysroot" || die "No valid sysroot specified."
  1.1407 +    cc_type=armcc
  1.1408 +    armcc_conf="$PWD/armcc.conf"
  1.1409 +    $cc --arm_linux_configure                 \
  1.1410 +        --arm_linux_config_file="$armcc_conf" \
  1.1411 +        --configure_sysroot="$sysroot"        \
  1.1412 +        --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1.1413 +        die "Error creating armcc configuration file."
  1.1414 +    cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1.1415 +    as_default="${cross_prefix}gcc"
  1.1416 +fi
  1.1417 +
  1.1418 +test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1.1419 +
  1.1420 +set_default as
  1.1421 +
  1.1422 +if test -n "$sysroot"; then
  1.1423 +    case "$cc_type" in
  1.1424 +        gcc)
  1.1425 +            add_cflags  --sysroot="$sysroot"
  1.1426 +            add_ldflags --sysroot="$sysroot"
  1.1427 +        ;;
  1.1428 +    esac
  1.1429 +fi
  1.1430 +
  1.1431 +# compiler sanity check
  1.1432 +check_exec <<EOF
  1.1433 +int main(void){ return 0; }
  1.1434 +EOF
  1.1435 +if test "$?" != 0; then
  1.1436 +    echo "$cc is unable to create an executable file."
  1.1437 +    if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1.1438 +        echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1.1439 +        echo "Only do this if you know what cross compiling means."
  1.1440 +    fi
  1.1441 +    die "C compiler test failed."
  1.1442 +fi
  1.1443 +
  1.1444 +check_cflags -std=c99
  1.1445 +check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cflags -D_FILE_OFFSET_BITS=64
  1.1446 +#include <stdlib.h>
  1.1447 +EOF
  1.1448 +check_cc -D_LARGEFILE_SOURCE <<EOF && add_cflags -D_LARGEFILE_SOURCE
  1.1449 +#include <stdlib.h>
  1.1450 +EOF
  1.1451 +
  1.1452 +case "$arch" in
  1.1453 +    alpha)
  1.1454 +        arch="alpha"
  1.1455 +        enable fast_64bit
  1.1456 +        check_cflags -mieee
  1.1457 +    ;;
  1.1458 +    arm|armv[4567]*l)
  1.1459 +        arch="arm"
  1.1460 +    ;;
  1.1461 +    avr32)
  1.1462 +    ;;
  1.1463 +    bfin)
  1.1464 +        arch="bfin"
  1.1465 +    ;;
  1.1466 +    ia64)
  1.1467 +        arch="ia64"
  1.1468 +        enable fast_64bit
  1.1469 +    ;;
  1.1470 +    m68k)
  1.1471 +        arch="m68k"
  1.1472 +    ;;
  1.1473 +    mips|mipsel|IP*)
  1.1474 +        arch="mips"
  1.1475 +    ;;
  1.1476 +    mips64)
  1.1477 +        arch="mips"
  1.1478 +        enable fast_64bit
  1.1479 +    ;;
  1.1480 +    parisc|hppa)
  1.1481 +        arch="parisc"
  1.1482 +    ;;
  1.1483 +    parisc64|hppa64)
  1.1484 +        arch="parisc"
  1.1485 +        enable fast_64bit
  1.1486 +    ;;
  1.1487 +    "Power Macintosh"|ppc|powerpc)
  1.1488 +        arch="ppc"
  1.1489 +        enable fast_unaligned
  1.1490 +    ;;
  1.1491 +    ppc64)
  1.1492 +        arch="ppc"
  1.1493 +        enable fast_64bit
  1.1494 +        enable fast_unaligned
  1.1495 +    ;;
  1.1496 +    s390|s390x)
  1.1497 +        arch="s390"
  1.1498 +    ;;
  1.1499 +    sh4|sh)
  1.1500 +        arch="sh4"
  1.1501 +    ;;
  1.1502 +    sparc)
  1.1503 +        arch="sparc"
  1.1504 +    ;;
  1.1505 +    sun4u|sparc64)
  1.1506 +        arch="sparc"
  1.1507 +        subarch="sparc64"
  1.1508 +        enable fast_64bit
  1.1509 +    ;;
  1.1510 +    i386|i486|i586|i686|i86pc|BePC)
  1.1511 +        arch="x86"
  1.1512 +        subarch="x86_32"
  1.1513 +        enable fast_unaligned
  1.1514 +    ;;
  1.1515 +    x86_64|amd64)
  1.1516 +        arch="x86"
  1.1517 +        subarch="x86_32"
  1.1518 +        enable cmov
  1.1519 +        enable fast_cmov
  1.1520 +        enable fast_unaligned
  1.1521 +        check_cc <<EOF && enable fast_64bit && subarch="x86_64"
  1.1522 +        int test[sizeof(char*) - 7];
  1.1523 +EOF
  1.1524 +    ;;
  1.1525 +    *)
  1.1526 +        arch="unknown"
  1.1527 +    ;;
  1.1528 +esac
  1.1529 +
  1.1530 +enable $arch $subarch
  1.1531 +
  1.1532 +# OS specific
  1.1533 +case $target_os in
  1.1534 +    beos|haiku|zeta)
  1.1535 +        prefix_default="$HOME/config"
  1.1536 +        # helps building libavcodec
  1.1537 +        add_cflags -DPIC -fomit-frame-pointer
  1.1538 +        # 3 gcc releases known for BeOS, each with ugly bugs
  1.1539 +        gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1.1540 +        case "$gcc_version" in
  1.1541 +          2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1.1542 +            disable mmx
  1.1543 +            ;;
  1.1544 +          *20010315*) echo "BeBits gcc"
  1.1545 +            add_cflags -fno-expensive-optimizations
  1.1546 +            ;;
  1.1547 +        esac
  1.1548 +        SHFLAGS=-nostart
  1.1549 +        # enable BeOS things
  1.1550 +        enable audio_beos
  1.1551 +        # no need for libm, but the inet stuff
  1.1552 +        # Check for BONE
  1.1553 +        # XXX: actually should check for NOT net_server
  1.1554 +        if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1.1555 +            network_extralibs="-lbind -lsocket"
  1.1556 +        else
  1.1557 +            enable beos_netserver
  1.1558 +            network_extralibs="-lnet"
  1.1559 +        fi ;;
  1.1560 +    sunos)
  1.1561 +        FFSERVERLDFLAGS=""
  1.1562 +        SHFLAGS='-shared -Wl,-h,$$(@F)'
  1.1563 +        network_extralibs="-lsocket -lnsl"
  1.1564 +        add_cflags -D__EXTENSIONS__
  1.1565 +        ;;
  1.1566 +    netbsd)
  1.1567 +        oss_demuxer_extralibs="-lossaudio"
  1.1568 +        oss_muxer_extralibs="-lossaudio"
  1.1569 +        ;;
  1.1570 +    openbsd)
  1.1571 +        disable need_memalign
  1.1572 +        LIBOBJFLAGS='$(PIC)'
  1.1573 +        SHFLAGS='-shared'
  1.1574 +        oss_demuxer_extralibs="-lossaudio"
  1.1575 +        oss_muxer_extralibs="-lossaudio"
  1.1576 +        ;;
  1.1577 +    freebsd)
  1.1578 +        disable need_memalign
  1.1579 +        ;;
  1.1580 +    bsd/os)
  1.1581 +        osextralibs="-lpoll -lgnugetopt"
  1.1582 +        strip="strip -d"
  1.1583 +        ;;
  1.1584 +    darwin)
  1.1585 +        disable need_memalign
  1.1586 +        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1.1587 +        strip="strip -x"
  1.1588 +        FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1.1589 +        SLIBSUF=".dylib"
  1.1590 +        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1.1591 +        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1.1592 +        FFSERVERLDFLAGS=-Wl,-bind_at_load
  1.1593 +        objformat="macho"
  1.1594 +        enabled x86_64 && objformat="macho64"
  1.1595 +        ;;
  1.1596 +    mingw32*)
  1.1597 +        target_os=mingw32
  1.1598 +        LIBTARGET=i386
  1.1599 +        if enabled x86_64; then
  1.1600 +            disable need_memalign
  1.1601 +            LIBTARGET=x64
  1.1602 +        fi
  1.1603 +        shlibdir_default="$bindir_default"
  1.1604 +        disable ffserver
  1.1605 +        SLIBPREF=""
  1.1606 +        SLIBSUF=".dll"
  1.1607 +        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1.1608 +        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1.1609 +        SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1.1610 +        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1.1611 +            install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1.1612 +        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1.1613 +        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'
  1.1614 +        objformat="win32"
  1.1615 +        enable dos_paths
  1.1616 +        if ! enabled x86_64; then
  1.1617 +            check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1.1618 +                die "ERROR: MinGW runtime version must be >= 3.15."
  1.1619 +            enabled_any avisynth vfwcap_demuxer &&
  1.1620 +                { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  1.1621 +                  die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.13 or later."; }
  1.1622 +            fi
  1.1623 +        ;;
  1.1624 +    cygwin*)
  1.1625 +        target_os=cygwin
  1.1626 +        shlibdir_default="$bindir_default"
  1.1627 +        SLIBPREF="cyg"
  1.1628 +        SLIBSUF=".dll"
  1.1629 +        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1.1630 +        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1.1631 +        SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1.1632 +        objformat="win32"
  1.1633 +        enable dos_paths
  1.1634 +        ;;
  1.1635 +    *-dos|freedos|opendos)
  1.1636 +        disable ffplay ffserver
  1.1637 +        disable $INDEV_LIST $OUTDEV_LIST
  1.1638 +        network_extralibs="-lsocket"
  1.1639 +        objformat="coff"
  1.1640 +        enable dos_paths
  1.1641 +        ;;
  1.1642 +    linux)
  1.1643 +        enable dv1394
  1.1644 +        ;;
  1.1645 +    irix*)
  1.1646 +        target_os=irix
  1.1647 +        ranlib="echo ignoring ranlib"
  1.1648 +        ;;
  1.1649 +    os/2*)
  1.1650 +        strip="lxlite"
  1.1651 +        ln_s="cp -f"
  1.1652 +        FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1.1653 +        SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1.1654 +        FFSERVERLDFLAGS=""
  1.1655 +        LIBSUF="_s.a"
  1.1656 +        SLIBPREF=""
  1.1657 +        SLIBSUF=".dll"
  1.1658 +        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1.1659 +        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1.1660 +        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1.1661 +          echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1.1662 +          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1.1663 +          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1.1664 +          echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1.1665 +          emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1.1666 +        SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1.1667 +          emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1.1668 +        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1.1669 +        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1.1670 +        enable dos_paths
  1.1671 +        ;;
  1.1672 +
  1.1673 +    *)
  1.1674 +        die "Unknown OS '$target_os'."
  1.1675 +        ;;
  1.1676 +esac
  1.1677 +
  1.1678 +set_default $PATHS_LIST
  1.1679 +
  1.1680 +add_extralibs $osextralibs
  1.1681 +
  1.1682 +# Combine FFLDFLAGS and the LDFLAGS environment variable.
  1.1683 +LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1.1684 +
  1.1685 +# we need to build at least one lib type
  1.1686 +if ! enabled_any static shared; then
  1.1687 +    cat <<EOF
  1.1688 +At least one library type must be built.
  1.1689 +Specify --enable-static to build the static libraries or --enable-shared to
  1.1690 +build the shared libraries as well. To only build the shared libraries specify
  1.1691 +--disable-static in addition to --enable-shared.
  1.1692 +EOF
  1.1693 +    exit 1;
  1.1694 +fi
  1.1695 +
  1.1696 +disabled static && LIBNAME=""
  1.1697 +
  1.1698 +if enabled_any libfaad libfaadbin ; then
  1.1699 +    if check_header faad.h; then
  1.1700 +        check_cc <<EOF
  1.1701 +#include <faad.h>
  1.1702 +#ifndef FAAD2_VERSION
  1.1703 +ok faad1
  1.1704 +#endif
  1.1705 +int main(void) { return 0; }
  1.1706 +EOF
  1.1707 +        test $? = 0 && enable libfaad2
  1.1708 +    else
  1.1709 +        die "FAAD test failed."
  1.1710 +    fi
  1.1711 +fi
  1.1712 +
  1.1713 +
  1.1714 +if ! enabled gpl; then
  1.1715 +    die_gpl_disabled(){
  1.1716 +        name=$1
  1.1717 +        shift
  1.1718 +        enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1.1719 +    }
  1.1720 +    die_gpl_disabled "The Postprocessing code" postproc
  1.1721 +    die_gpl_disabled "libx264"                 libx264
  1.1722 +    die_gpl_disabled "libxvidcore"             libxvid
  1.1723 +    die_gpl_disabled "FAAD2"                   libfaad2
  1.1724 +    die_gpl_disabled "The X11 grabber"         x11grab
  1.1725 +fi
  1.1726 +
  1.1727 +if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1.1728 +    die "libamr is nonfree and --enable-nonfree is not specified."
  1.1729 +fi
  1.1730 +
  1.1731 +check_deps $ARCH_EXT_LIST
  1.1732 +
  1.1733 +test -z "$need_memalign" && need_memalign="$mmx"
  1.1734 +
  1.1735 +#Darwin CC versions
  1.1736 +if test $target_os = darwin; then
  1.1737 +    if enabled xlc; then
  1.1738 +        add_cflags -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto
  1.1739 +    else
  1.1740 +        add_cflags -pipe
  1.1741 +        check_cflags -force_cpusubtype_ALL
  1.1742 +        check_cflags -Wno-sign-compare
  1.1743 +        enabled shared || check_cflags -mdynamic-no-pic
  1.1744 +    fi
  1.1745 +fi
  1.1746 +
  1.1747 +disabled optimizations || check_cflags -fomit-frame-pointer
  1.1748 +
  1.1749 +# Add processor-specific flags
  1.1750 +if test $cpu != "generic"; then
  1.1751 +    warn_altivec(){
  1.1752 +        $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1.1753 +    }
  1.1754 +    case $cpu in
  1.1755 +        601|ppc601|PowerPC601)
  1.1756 +            add_cflags -mcpu=601
  1.1757 +            warn_altivec enabled PPC601
  1.1758 +        ;;
  1.1759 +        603*|ppc603*|PowerPC603*)
  1.1760 +            add_cflags -mcpu=603
  1.1761 +            warn_altivec enabled PPC603
  1.1762 +        ;;
  1.1763 +        604*|ppc604*|PowerPC604*)
  1.1764 +            add_cflags -mcpu=604
  1.1765 +            warn_altivec enabled PPC604
  1.1766 +        ;;
  1.1767 +        G3|g3|75*|ppc75*|PowerPC75*)
  1.1768 +            add_cflags -mcpu=750 -mpowerpc-gfxopt
  1.1769 +            warn_altivec enabled PPC75x
  1.1770 +        ;;
  1.1771 +        G4|g4|745*|ppc745*|PowerPC745*)
  1.1772 +            add_cflags -mcpu=7450 -mpowerpc-gfxopt
  1.1773 +            warn_altivec disabled PPC745x
  1.1774 +        ;;
  1.1775 +        74*|ppc74*|PowerPC74*)
  1.1776 +            add_cflags -mcpu=7400 -mpowerpc-gfxopt
  1.1777 +            warn_altivec disabled PPC74xx
  1.1778 +        ;;
  1.1779 +        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1.1780 +            add_cflags -mcpu=970 -mpowerpc-gfxopt -mpowerpc64
  1.1781 +            warn_altivec disabled PPC970
  1.1782 +            enable ppc64
  1.1783 +        ;;
  1.1784 +        Cell|CELL|cell)
  1.1785 +            add_cflags -mcpu=cell
  1.1786 +            warn_altivec disabled Cell
  1.1787 +            enable ppc64
  1.1788 +        ;;
  1.1789 +        # targets that do NOT support conditional mov (cmov)
  1.1790 +        i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1.1791 +            add_cflags -march=$cpu
  1.1792 +            disable cmov
  1.1793 +        ;;
  1.1794 +        # targets that do support conditional mov (cmov)
  1.1795 +        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1.1796 +            add_cflags -march=$cpu
  1.1797 +            enable cmov
  1.1798 +            enable fast_cmov
  1.1799 +        ;;
  1.1800 +        # targets that do support conditional mov but on which it's slow
  1.1801 +        pentium4|pentium4m|prescott|nocona)
  1.1802 +            add_cflags -march=$cpu
  1.1803 +            enable cmov
  1.1804 +            disable fast_cmov
  1.1805 +        ;;
  1.1806 +        sparc64)
  1.1807 +            add_cflags -mcpu=v9
  1.1808 +        ;;
  1.1809 +        arm11*|cortex*)
  1.1810 +            add_cflags -mcpu=$cpu
  1.1811 +            enable fast_unaligned
  1.1812 +        ;;
  1.1813 +        armv*)
  1.1814 +            add_cflags -march=$cpu
  1.1815 +        ;;
  1.1816 +        arm*)
  1.1817 +            add_cflags -mcpu=$cpu
  1.1818 +        ;;
  1.1819 +        ev4|ev45|ev5|ev56|pca56|ev6|ev67)
  1.1820 +            enabled ccc && add_cflags -arch $cpu || add_cflags -mcpu=$cpu
  1.1821 +        ;;
  1.1822 +        *)
  1.1823 +            echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1.1824 +        ;;
  1.1825 +    esac
  1.1826 +fi
  1.1827 +
  1.1828 +check_cc <<EOF || die "Symbol mangling check failed."
  1.1829 +int ff_extern;
  1.1830 +EOF
  1.1831 +sym=$($nm -P -g $TMPO | grep ff_extern)
  1.1832 +extern_prefix=${sym%%ff_extern*}
  1.1833 +
  1.1834 +check_cc <<EOF && enable inline_asm
  1.1835 +void foo(void) { __asm__ volatile ("" ::); }
  1.1836 +EOF
  1.1837 +
  1.1838 +if enabled x86; then
  1.1839 +    # check whether EBP is available on x86
  1.1840 +    # As 'i' is stored on the stack, this program will crash
  1.1841 +    # if the base pointer is used to access it because the
  1.1842 +    # base pointer is cleared in the inline assembly code.
  1.1843 +    check_exec_crash <<EOF && enable ebp_available
  1.1844 +    volatile int i=0;
  1.1845 +    __asm__ volatile (
  1.1846 +        "xorl %%ebp, %%ebp"
  1.1847 +    ::: "%ebp");
  1.1848 +    return i;
  1.1849 +EOF
  1.1850 +
  1.1851 +    # check wether EBX is available on x86
  1.1852 +    check_asm ebx_available '"":::"%ebx"'
  1.1853 +
  1.1854 +    # check whether more than 10 operands are supported
  1.1855 +    check_cc <<EOF && enable ten_operands
  1.1856 +int main(void) {
  1.1857 +    int x=0;
  1.1858 +    __asm__ volatile(
  1.1859 +        ""
  1.1860 +        :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  1.1861 +    );
  1.1862 +    return 0;
  1.1863 +}
  1.1864 +EOF
  1.1865 +
  1.1866 +    # check whether binutils is new enough to compile SSSE3/MMX2
  1.1867 +    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1.1868 +    enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
  1.1869 +
  1.1870 +    check_asm bswap '"bswap %%eax" ::: "%eax"'
  1.1871 +
  1.1872 +    YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  1.1873 +    enabled     x86_64        && append YASMFLAGS "-m amd64"
  1.1874 +    enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1.1875 +    case "$objformat" in
  1.1876 +        elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1.1877 +        macho64)              append YASMFLAGS "-DPIC -DPREFIX" ;;
  1.1878 +        *)                    append YASMFLAGS "-DPREFIX"  ;;
  1.1879 +    esac
  1.1880 +    disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  1.1881 +fi
  1.1882 +
  1.1883 +# check for assembler specific support
  1.1884 +
  1.1885 +enabled ppc && check_asm dcbzl '"dcbzl 0, 1"'
  1.1886 +enabled ppc && check_asm ppc4xx '"maclhw r10, r11, r12"'
  1.1887 +
  1.1888 +# check for SIMD availability
  1.1889 +
  1.1890 +# AltiVec flags: The FSF version of GCC differs from the Apple version
  1.1891 +if enabled altivec; then
  1.1892 +    check_cflags -maltivec -mabi=altivec &&
  1.1893 +        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1.1894 +        check_cflags -faltivec
  1.1895 +
  1.1896 +    # check if our compiler supports Motorola AltiVec C API
  1.1897 +    check_cc <<EOF || disable altivec
  1.1898 +$inc_altivec_h
  1.1899 +int main(void) {
  1.1900 +    vector signed int v1, v2, v3;
  1.1901 +    v1 = vec_add(v2,v3);
  1.1902 +    return 0;
  1.1903 +}
  1.1904 +EOF
  1.1905 +
  1.1906 +    # check if our compiler supports braces for vector declarations
  1.1907 +    check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1.1908 +$inc_altivec_h
  1.1909 +int main (void) { (vector int) {1}; return 0; }
  1.1910 +EOF
  1.1911 +fi
  1.1912 +
  1.1913 +# We have to check if pld is a nop and disable it.
  1.1914 +enabled arm     && check_asm pld     '"pld [r0]"'
  1.1915 +enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1.1916 +enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
  1.1917 +enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  1.1918 +enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
  1.1919 +enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
  1.1920 +enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
  1.1921 +enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
  1.1922 +enabled vis     && check_asm vis     '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1.1923 +
  1.1924 +enabled vis && add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  1.1925 +
  1.1926 +# ---
  1.1927 +# big/little-endian test
  1.1928 +check_cc <<EOF || die "endian test failed"
  1.1929 +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1.1930 +EOF
  1.1931 +od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1.1932 +
  1.1933 +# ---
  1.1934 +# check availability of some header files
  1.1935 +
  1.1936 +if check_func dlopen; then
  1.1937 +    ldl=
  1.1938 +elif check_func dlopen -ldl; then
  1.1939 +    ldl=-ldl
  1.1940 +fi
  1.1941 +
  1.1942 +# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  1.1943 +check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  1.1944 +
  1.1945 +check_func  fork
  1.1946 +check_func  gethrtime
  1.1947 +check_func  getrusage
  1.1948 +check_func  inet_aton $network_extralibs
  1.1949 +check_func  memalign
  1.1950 +check_func  mkstemp
  1.1951 +check_func  posix_memalign
  1.1952 +check_func_headers io.h setmode
  1.1953 +check_func_headers windows.h GetProcessTimes
  1.1954 +check_func_headers windows.h VirtualAlloc
  1.1955 +
  1.1956 +check_header conio.h
  1.1957 +check_header dlfcn.h
  1.1958 +check_header malloc.h
  1.1959 +check_header poll.h
  1.1960 +check_header sys/mman.h
  1.1961 +check_header sys/resource.h
  1.1962 +check_header sys/select.h
  1.1963 +check_header termios.h
  1.1964 +check_header vdpau/vdpau.h
  1.1965 +check_header vdpau/vdpau_x11.h
  1.1966 +check_header X11/extensions/XvMClib.h
  1.1967 +
  1.1968 +if ! enabled_any memalign memalign_hack posix_memalign && enabled need_memalign ; then
  1.1969 +    die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  1.1970 +fi
  1.1971 +
  1.1972 +disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
  1.1973 +disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1.1974 +
  1.1975 +# check for some common methods of building with pthread support
  1.1976 +# do this before the optional library checks as some of them require pthreads
  1.1977 +if enabled pthreads; then
  1.1978 +    if check_func pthread_create; then
  1.1979 +        :
  1.1980 +    elif check_func pthread_create -pthread; then
  1.1981 +        add_cflags -pthread
  1.1982 +        add_extralibs -pthread
  1.1983 +    elif check_func pthread_create -pthreads; then
  1.1984 +        add_cflags -pthreads
  1.1985 +        add_extralibs -pthreads
  1.1986 +    elif check_func pthread_create -lpthreadGC2; then
  1.1987 +        add_extralibs -lpthreadGC2
  1.1988 +    elif ! check_lib pthread.h pthread_create -lpthread; then
  1.1989 +        die "ERROR: can't find pthreads library"
  1.1990 +    fi
  1.1991 +fi
  1.1992 +
  1.1993 +for thread in $THREADS_LIST; do
  1.1994 +    if enabled $thread; then
  1.1995 +        test -n "$thread_type" &&
  1.1996 +            die "ERROR: Only one thread type must be selected." ||
  1.1997 +            thread_type="$thread"
  1.1998 +    fi
  1.1999 +done
  1.2000 +
  1.2001 +check_lib math.h sin -lm
  1.2002 +check_lib va/va.h vaInitialize -lva
  1.2003 +
  1.2004 +# test for C99 functions in math.h
  1.2005 +for func in llrint lrint lrintf round roundf truncf; do
  1.2006 +    check_exec <<EOF && enable $func || disable $func
  1.2007 +#include <math.h>
  1.2008 +int main(void) { return ($func(3.999f) > 0)?0:1; }
  1.2009 +EOF
  1.2010 +done
  1.2011 +
  1.2012 +# these are off by default, so fail if requested and not available
  1.2013 +enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1.2014 +enabled libamr_nb  && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1.2015 +enabled libamr_wb  && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1.2016 +enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
  1.2017 +                      require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
  1.2018 +                      require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1.2019 +enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1.2020 +enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
  1.2021 +enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
  1.2022 +enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
  1.2023 +enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
  1.2024 +enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  1.2025 +enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  1.2026 +                           require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1.2027 +enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
  1.2028 +enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
  1.2029 +enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1.2030 +enabled libx264    && require  libx264 x264.h x264_encoder_open -lx264 -lm &&
  1.2031 +                      { check_cpp_condition x264.h "X264_BUILD >= 65" ||
  1.2032 +                        die "ERROR: libx264 version must be >= 0.65."; }
  1.2033 +enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
  1.2034 +enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1.2035 +
  1.2036 +# libdc1394 check
  1.2037 +if enabled libdc1394; then
  1.2038 +    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1.2039 +        enable libdc1394_2; } ||
  1.2040 +    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1.2041 +        enable libdc1394_1; } ||
  1.2042 +    die "ERROR: No version of libdc1394 found "
  1.2043 +fi
  1.2044 +
  1.2045 +
  1.2046 +_restrict=
  1.2047 +for restrict_keyword in restrict __restrict__ __restrict; do
  1.2048 +    check_cc <<EOF && _restrict=$restrict_keyword && break
  1.2049 +void foo(char * $restrict_keyword p);
  1.2050 +EOF
  1.2051 +done
  1.2052 +
  1.2053 +##########################################
  1.2054 +# SDL check
  1.2055 +
  1.2056 +disable sdl_too_old
  1.2057 +disable sdl
  1.2058 +SDL_CONFIG="${cross_prefix}sdl-config"
  1.2059 +if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1.2060 +    sdl_cflags=$("${SDL_CONFIG}" --cflags)
  1.2061 +    temp_cflags $sdl_cflags
  1.2062 +    temp_extralibs $("${SDL_CONFIG}" --libs)
  1.2063 +    if check_lib2 SDL.h SDL_Init; then
  1.2064 +        _sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
  1.2065 +        if test "$_sdlversion" -lt 121 ; then
  1.2066 +            enable sdl_too_old
  1.2067 +        else
  1.2068 +            enable sdl
  1.2069 +            check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1.2070 +#include <SDL.h>
  1.2071 +int main(int argc, char **argv){
  1.2072 +    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1.2073 +    int w = vi->current_w;
  1.2074 +    return 0;
  1.2075 +}
  1.2076 +EOF
  1.2077 +        fi
  1.2078 +    fi
  1.2079 +    restore_flags
  1.2080 +fi
  1.2081 +
  1.2082 +texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1.2083 +
  1.2084 +##########################################
  1.2085 +# Network check
  1.2086 +
  1.2087 +if enabled network; then
  1.2088 +    check_type "sys/types.h sys/socket.h" socklen_t
  1.2089 +    # Prefer arpa/inet.h over winsock2
  1.2090 +    if check_header arpa/inet.h ; then
  1.2091 +        check_func closesocket
  1.2092 +    elif check_header winsock2.h ; then
  1.2093 +        network_extralibs="-lws2_32"
  1.2094 +        check_type ws2tcpip.h socklen_t
  1.2095 +        check_func_headers winsock2.h closesocket
  1.2096 +    fi
  1.2097 +fi
  1.2098 +
  1.2099 +##########################################
  1.2100 +# IPv6 check
  1.2101 +
  1.2102 +enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1.2103 +#include <sys/types.h>
  1.2104 +#include <sys/socket.h>
  1.2105 +#include <netinet/in.h>
  1.2106 +#include <netdb.h>
  1.2107 +int main(void) {
  1.2108 +    struct sockaddr_storage saddr;
  1.2109 +    struct ipv6_mreq mreq6;
  1.2110 +    getaddrinfo(0,0,0,0);
  1.2111 +    getnameinfo(0,0,0,0,0,0,0);
  1.2112 +    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1.2113 +}
  1.2114 +EOF
  1.2115 +
  1.2116 +check_header linux/videodev.h
  1.2117 +check_header linux/videodev2.h
  1.2118 +check_header sys/videoio.h
  1.2119 +
  1.2120 +check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1.2121 +
  1.2122 +# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1.2123 +{ check_header dev/bktr/ioctl_meteor.h &&
  1.2124 +  check_header dev/bktr/ioctl_bt848.h; } ||
  1.2125 +{ check_header machine/ioctl_meteor.h &&
  1.2126 +  check_header machine/ioctl_bt848.h; } ||
  1.2127 +{ check_header dev/video/meteor/ioctl_meteor.h &&
  1.2128 +  check_header dev/video/bktr/ioctl_bt848.h; } ||
  1.2129 +check_header dev/ic/bt8xx.h
  1.2130 +
  1.2131 +check_header sys/soundcard.h
  1.2132 +check_header soundcard.h
  1.2133 +
  1.2134 +check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  1.2135 +
  1.2136 +check_lib2 jack/jack.h jack_client_open -ljack
  1.2137 +
  1.2138 +# deal with the X11 frame grabber
  1.2139 +enabled x11grab                         &&
  1.2140 +check_header X11/Xlib.h                 &&
  1.2141 +check_header X11/extensions/XShm.h      &&
  1.2142 +check_func XOpenDisplay -lX11           &&
  1.2143 +check_func XShmCreateImage -lX11 -lXext
  1.2144 +
  1.2145 +enabled debug && add_cflags -g"$debuglevel"
  1.2146 +
  1.2147 +# add some useful compiler flags if supported
  1.2148 +check_cflags -Wdeclaration-after-statement
  1.2149 +check_cflags -Wall
  1.2150 +check_cflags -Wno-switch
  1.2151 +check_cflags -Wdisabled-optimization
  1.2152 +check_cflags -Wpointer-arith
  1.2153 +check_cflags -Wredundant-decls
  1.2154 +check_cflags -Wno-pointer-sign
  1.2155 +check_cflags -Wcast-qual
  1.2156 +check_cflags -Wwrite-strings
  1.2157 +check_cflags -Wtype-limits
  1.2158 +check_cflags -Wundef
  1.2159 +enabled extra_warnings && check_cflags -Winline
  1.2160 +
  1.2161 +# add some linker flags
  1.2162 +check_ldflags -Wl,--warn-common
  1.2163 +check_ldflags -Wl,--as-needed
  1.2164 +check_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'
  1.2165 +check_ldflags -Wl,-Bsymbolic
  1.2166 +
  1.2167 +if enabled small; then
  1.2168 +    check_cflags -Os            # not all compilers support -Os
  1.2169 +    optimizations="small"
  1.2170 +elif enabled optimizations; then
  1.2171 +    if enabled xlc; then
  1.2172 +        add_cflags  -O5
  1.2173 +        add_ldflags -O5
  1.2174 +    elif enabled ccc; then
  1.2175 +        add_cflags -fast
  1.2176 +    else
  1.2177 +        add_cflags -O3
  1.2178 +    fi
  1.2179 +fi
  1.2180 +check_cflags -fno-math-errno
  1.2181 +check_cflags -fno-signed-zeros
  1.2182 +
  1.2183 +# add some flags for Intel C Compiler
  1.2184 +if enabled icc; then
  1.2185 +    # Just warnings, no remarks
  1.2186 +    check_cflags -w1
  1.2187 +    # -wd: Disable following warnings
  1.2188 +    # 144, 167, 556: -Wno-pointer-sign
  1.2189 +    # 10006: ignoring unknown option -fno-signed-zeros
  1.2190 +    # 10156: ignoring option '-W'; no argument required
  1.2191 +    check_cflags -wd144,167,556,10006,10156
  1.2192 +    # 11030: Warning unknown option --as-needed
  1.2193 +    # 10156: ignoring option '-export'; no argument required
  1.2194 +    check_ldflags -wd10156,11030
  1.2195 +    # Allow to compile with optimizations
  1.2196 +    check_ldflags -march=$cpu
  1.2197 +    # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  1.2198 +    enable ebp_available
  1.2199 +elif enabled ccc; then
  1.2200 +    # disable some annoying warnings
  1.2201 +    add_cflags -msg_disable cvtu32to64
  1.2202 +    add_cflags -msg_disable embedcomment
  1.2203 +    add_cflags -msg_disable needconstext
  1.2204 +    add_cflags -msg_disable nomainieee
  1.2205 +    add_cflags -msg_disable ptrmismatch1
  1.2206 +    add_cflags -msg_disable unreachcode
  1.2207 +fi
  1.2208 +
  1.2209 +# PIC flags for shared library objects where they are needed
  1.2210 +if enabled shared; then
  1.2211 +    # LIBOBJFLAGS may have already been set in the OS configuration
  1.2212 +    if test -z "$LIBOBJFLAGS" ; then
  1.2213 +        case "${subarch-$arch}" in
  1.2214 +            x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  1.2215 +        esac
  1.2216 +    fi
  1.2217 +fi
  1.2218 +
  1.2219 +if enabled gprof; then
  1.2220 +    add_cflags  -p
  1.2221 +    add_ldflags -p
  1.2222 +fi
  1.2223 +
  1.2224 +# Find out if the .align argument is a power of two or not.
  1.2225 +check_asm asmalign_pot '".align 3"'
  1.2226 +
  1.2227 +enabled_any $DECODER_LIST      && enable decoders
  1.2228 +enabled_any $ENCODER_LIST      && enable encoders
  1.2229 +enabled_any $HWACCEL_LIST      && enable hwaccels
  1.2230 +enabled_any $BSF_LIST          && enable bsfs
  1.2231 +enabled_any $DEMUXER_LIST      && enable demuxers
  1.2232 +enabled_any $MUXER_LIST        && enable muxers
  1.2233 +enabled_any $FILTER_LIST       && enable filters
  1.2234 +enabled_any $INDEV_LIST        && enable demuxers
  1.2235 +enabled_any $OUTDEV_LIST       && enable muxers
  1.2236 +enabled_any $PROTOCOL_LIST     && enable protocols
  1.2237 +
  1.2238 +enabled_any $THREADS_LIST      && enable threads
  1.2239 +
  1.2240 +check_deps $CONFIG_LIST       \
  1.2241 +           $CONFIG_EXTRA      \
  1.2242 +           $HAVE_LIST         \
  1.2243 +           $DECODER_LIST      \
  1.2244 +           $ENCODER_LIST      \
  1.2245 +           $HWACCEL_LIST      \
  1.2246 +           $PARSER_LIST       \
  1.2247 +           $BSF_LIST          \
  1.2248 +           $DEMUXER_LIST      \
  1.2249 +           $MUXER_LIST        \
  1.2250 +           $FILTER_LIST       \
  1.2251 +           $INDEV_LIST        \
  1.2252 +           $OUTDEV_LIST       \
  1.2253 +           $PROTOCOL_LIST     \
  1.2254 +
  1.2255 +echo "install prefix            $prefix"
  1.2256 +echo "source path               $source_path"
  1.2257 +echo "C compiler                $cc"
  1.2258 +echo ".align is power-of-two    $asmalign_pot"
  1.2259 +echo "ARCH                      $arch ($cpu)"
  1.2260 +if test "$build_suffix" != ""; then
  1.2261 +    echo "build suffix              $build_suffix"
  1.2262 +fi
  1.2263 +if test "$extra_version" != ""; then
  1.2264 +    echo "version string suffix     $extra_version"
  1.2265 +fi
  1.2266 +echo "big-endian                ${bigendian-no}"
  1.2267 +if enabled x86; then
  1.2268 +    echo "yasm                      ${yasm-no}"
  1.2269 +    echo "MMX enabled               ${mmx-no}"
  1.2270 +    echo "MMX2 enabled              ${mmx2-no}"
  1.2271 +    echo "3DNow! enabled            ${amd3dnow-no}"
  1.2272 +    echo "3DNow! extended enabled   ${amd3dnowext-no}"
  1.2273 +    echo "SSE enabled               ${sse-no}"
  1.2274 +    echo "SSSE3 enabled             ${ssse3-no}"
  1.2275 +    echo "CMOV enabled              ${cmov-no}"
  1.2276 +    echo "CMOV is fast              ${fast_cmov-no}"
  1.2277 +    echo "EBX available             ${ebx_available-no}"
  1.2278 +    echo "EBP available             ${ebp_available-no}"
  1.2279 +    echo "10 operands supported     ${ten_operands-no}"
  1.2280 +fi
  1.2281 +if enabled arm; then
  1.2282 +    echo "ARMv5TE enabled           ${armv5te-no}"
  1.2283 +    echo "ARMv6 enabled             ${armv6-no}"
  1.2284 +    echo "ARMv6T2 enabled           ${armv6t2-no}"
  1.2285 +    echo "ARM VFP enabled           ${armvfp-no}"
  1.2286 +    echo "IWMMXT enabled            ${iwmmxt-no}"
  1.2287 +    echo "NEON enabled              ${neon-no}"
  1.2288 +fi
  1.2289 +if enabled mips; then
  1.2290 +    echo "MMI enabled               ${mmi-no}"
  1.2291 +fi
  1.2292 +if enabled ppc; then
  1.2293 +    echo "AltiVec enabled           ${altivec-no}"
  1.2294 +    echo "PPC 4xx optimizations     ${ppc4xx-no}"
  1.2295 +    echo "dcbzl available           ${dcbzl-no}"
  1.2296 +    echo "performance report        ${powerpc_perf-no}"
  1.2297 +fi
  1.2298 +if enabled sparc; then
  1.2299 +    echo "VIS enabled               ${vis-no}"
  1.2300 +fi
  1.2301 +echo "gprof enabled             ${gprof-no}"
  1.2302 +echo "debug symbols             ${debug-no}"
  1.2303 +echo "strip symbols             ${stripping-no}"
  1.2304 +echo "optimizations             ${optimizations-no}"
  1.2305 +echo "static                    ${static-no}"
  1.2306 +echo "shared                    ${shared-no}"
  1.2307 +echo "postprocessing support    ${postproc-no}"
  1.2308 +echo "new filter support        ${avfilter-no}"
  1.2309 +echo "filters using lavformat   ${avfilter_lavf-no}"
  1.2310 +echo "network support           ${network-no}"
  1.2311 +if enabled network; then
  1.2312 +    echo "IPv6 support              ${ipv6-no}"
  1.2313 +fi
  1.2314 +echo "threading support         ${thread_type-no}"
  1.2315 +echo "SDL support               ${sdl-no}"
  1.2316 +if enabled sdl_too_old; then
  1.2317 +    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1.2318 +fi
  1.2319 +echo "Sun medialib support      ${mlib-no}"
  1.2320 +echo "AVISynth enabled          ${avisynth-no}"
  1.2321 +echo "libamr-nb support         ${libamr_nb-no}"
  1.2322 +echo "libamr-wb support         ${libamr_wb-no}"
  1.2323 +echo "libdc1394 support         ${libdc1394-no}"
  1.2324 +echo "libdirac enabled          ${libdirac-no}"
  1.2325 +echo "libfaac enabled           ${libfaac-no}"
  1.2326 +echo "libfaad enabled           ${libfaad-no}"
  1.2327 +echo "libfaad dlopened          ${libfaadbin-no}"
  1.2328 +echo "libgsm enabled            ${libgsm-no}"
  1.2329 +echo "libmp3lame enabled        ${libmp3lame-no}"
  1.2330 +echo "libnut enabled            ${libnut-no}"
  1.2331 +echo "libopenjpeg enabled       ${libopenjpeg-no}"
  1.2332 +echo "libschroedinger enabled   ${libschroedinger-no}"
  1.2333 +echo "libspeex enabled          ${libspeex-no}"
  1.2334 +echo "libtheora enabled         ${libtheora-no}"
  1.2335 +echo "libvorbis enabled         ${libvorbis-no}"
  1.2336 +echo "libx264 enabled           ${libx264-no}"
  1.2337 +echo "libxvid enabled           ${libxvid-no}"
  1.2338 +echo "zlib enabled              ${zlib-no}"
  1.2339 +echo "bzlib enabled             ${bzlib-no}"
  1.2340 +echo
  1.2341 +
  1.2342 +for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  1.2343 +    echo "Enabled ${type}s:"
  1.2344 +    eval list=\$$(toupper $type)_LIST
  1.2345 +    for part in $list; do
  1.2346 +        enabled $part && echo ${part%_*}
  1.2347 +    done | sort | cat
  1.2348 +    echo
  1.2349 +done
  1.2350 +
  1.2351 +license="LGPL"
  1.2352 +if enabled nonfree; then
  1.2353 +    license="unredistributable"
  1.2354 +elif enabled gpl; then
  1.2355 +    license="GPL"
  1.2356 +fi
  1.2357 +
  1.2358 +echo "License: $license"
  1.2359 +
  1.2360 +echo "Creating config.mak and config.h..."
  1.2361 +
  1.2362 +echo "# Automatically generated by configure - do not modify!" > config.mak
  1.2363 +echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1.2364 +echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1.2365 +echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1.2366 +echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1.2367 +echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
  1.2368 +
  1.2369 +echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  1.2370 +echo "prefix=$prefix" >> config.mak
  1.2371 +echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1.2372 +echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1.2373 +echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1.2374 +echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1.2375 +echo "DATADIR=\$(DESTDIR)$datadir" >> config.mak
  1.2376 +echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1.2377 +echo "SRC_PATH=\"$source_path\"" >> config.mak
  1.2378 +echo "SRC_PATH_BARE=$source_path" >> config.mak
  1.2379 +echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  1.2380 +echo "CC=$cc" >> config.mak
  1.2381 +echo "AS=$as" >> config.mak
  1.2382 +echo "YASM=$yasmexe" >> config.mak
  1.2383 +echo "AR=$ar" >> config.mak
  1.2384 +echo "RANLIB=$ranlib" >> config.mak
  1.2385 +echo "LN_S=$ln_s" >> config.mak
  1.2386 +enabled stripping &&
  1.2387 +    echo "STRIP=$strip" >> config.mak ||
  1.2388 +    echo "STRIP=echo ignoring strip" >> config.mak
  1.2389 +
  1.2390 +echo "OPTFLAGS=$CFLAGS" >> config.mak
  1.2391 +echo "LDFLAGS=$LDFLAGS" >> config.mak
  1.2392 +echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1.2393 +echo "SHFLAGS=$SHFLAGS" >> config.mak
  1.2394 +echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  1.2395 +echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1.2396 +echo "BUILD_STATIC=$static" >> config.mak
  1.2397 +echo "BUILDSUF=$build_suffix" >> config.mak
  1.2398 +echo "FULLNAME=$FULLNAME" >> config.mak
  1.2399 +echo "LIBPREF=$LIBPREF" >> config.mak
  1.2400 +echo "LIBSUF=$LIBSUF" >> config.mak
  1.2401 +echo "LIBNAME=$LIBNAME" >> config.mak
  1.2402 +echo "SLIBPREF=$SLIBPREF" >> config.mak
  1.2403 +echo "SLIBSUF=$SLIBSUF" >> config.mak
  1.2404 +echo "EXESUF=$EXESUF" >> config.mak
  1.2405 +echo "EXTRA_VERSION=$extra_version" >> config.mak
  1.2406 +echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  1.2407 +echo "HOSTCC=$host_cc" >> config.mak
  1.2408 +echo "HOSTCFLAGS=$host_cflags" >> config.mak
  1.2409 +echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
  1.2410 +echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
  1.2411 +echo "HOSTLIBS=$host_libs" >> config.mak
  1.2412 +echo "TARGET_EXEC=$target_exec" >> config.mak
  1.2413 +echo "TARGET_PATH=$target_path" >> config.mak
  1.2414 +
  1.2415 +if enabled bigendian; then
  1.2416 +    echo "WORDS_BIGENDIAN=yes" >> config.mak
  1.2417 +    echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1.2418 +fi
  1.2419 +
  1.2420 +if enabled sdl; then
  1.2421 +    echo "SDL_LIBS=$("${SDL_CONFIG}" --libs)" >> config.mak
  1.2422 +    echo "SDL_CFLAGS=$("${SDL_CONFIG}" --cflags)" >> config.mak
  1.2423 +fi
  1.2424 +if enabled texi2html; then
  1.2425 +    echo "BUILD_DOC=yes" >> config.mak
  1.2426 +fi
  1.2427 +
  1.2428 +get_version(){
  1.2429 +    name=$1
  1.2430 +    file=$source_path/$2
  1.2431 +    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  1.2432 +    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  1.2433 +    lcname=$(tolower $name)
  1.2434 +    eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  1.2435 +    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  1.2436 +}
  1.2437 +
  1.2438 +get_version LIBSWSCALE  libswscale/swscale.h
  1.2439 +get_version LIBPOSTPROC libpostproc/postprocess.h
  1.2440 +get_version LIBAVCODEC  libavcodec/avcodec.h
  1.2441 +get_version LIBAVDEVICE libavdevice/avdevice.h
  1.2442 +get_version LIBAVFORMAT libavformat/avformat.h
  1.2443 +get_version LIBAVUTIL   libavutil/avutil.h
  1.2444 +get_version LIBAVFILTER libavfilter/avfilter.h
  1.2445 +
  1.2446 +if enabled shared; then
  1.2447 +    echo "BUILD_SHARED=yes" >> config.mak
  1.2448 +    echo "PIC=-fPIC -DPIC" >> config.mak
  1.2449 +    echo "LIBTARGET=${LIBTARGET}" >> config.mak
  1.2450 +    echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1.2451 +    echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1.2452 +    echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1.2453 +    echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  1.2454 +    echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1.2455 +    echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  1.2456 +    echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  1.2457 +fi
  1.2458 +echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1.2459 +echo "EXTRALIBS=$extralibs" >> config.mak
  1.2460 +
  1.2461 +echo "ARCH=$arch" >> config.mak
  1.2462 +
  1.2463 +print_config ARCH_   $TMPH config.mak $ARCH_LIST
  1.2464 +print_config HAVE_   $TMPH config.mak $HAVE_LIST
  1.2465 +print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
  1.2466 +                                      $CONFIG_EXTRA      \
  1.2467 +                                      $DECODER_LIST      \
  1.2468 +                                      $ENCODER_LIST      \
  1.2469 +                                      $HWACCEL_LIST      \
  1.2470 +                                      $PARSER_LIST       \
  1.2471 +                                      $BSF_LIST          \
  1.2472 +                                      $DEMUXER_LIST      \
  1.2473 +                                      $MUXER_LIST        \
  1.2474 +                                      $FILTER_LIST       \
  1.2475 +                                      $PROTOCOL_LIST     \
  1.2476 +                                      $INDEV_LIST        \
  1.2477 +                                      $OUTDEV_LIST       \
  1.2478 +
  1.2479 +echo "#define restrict $_restrict" >> $TMPH
  1.2480 +
  1.2481 +if enabled small; then
  1.2482 +    echo "#define av_always_inline"  >> $TMPH
  1.2483 +fi
  1.2484 +
  1.2485 +
  1.2486 +# Apparently it's not possible to portably echo a backslash.
  1.2487 +enabled asmalign_pot &&
  1.2488 +    printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  1.2489 +    printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
  1.2490 +
  1.2491 +echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  1.2492 +
  1.2493 +echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  1.2494 +
  1.2495 +# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  1.2496 +cmp -s $TMPH config.h &&
  1.2497 +    echo "config.h is unchanged" ||
  1.2498 +    mv -f $TMPH config.h
  1.2499 +
  1.2500 +# build tree in object directory if source path is different from current one
  1.2501 +if enabled source_path_used; then
  1.2502 +    DIRS="\
  1.2503 +        doc               \
  1.2504 +        libavcodec        \
  1.2505 +        libavcodec/alpha  \
  1.2506 +        libavcodec/arm    \
  1.2507 +        libavcodec/bfin   \
  1.2508 +        libavcodec/mlib   \
  1.2509 +        libavcodec/ppc    \
  1.2510 +        libavcodec/sh4    \
  1.2511 +        libavcodec/sparc  \
  1.2512 +        libavcodec/x86    \
  1.2513 +        libavdevice       \
  1.2514 +        libavfilter       \
  1.2515 +        libavformat       \
  1.2516 +        libavutil         \
  1.2517 +        libpostproc       \
  1.2518 +        libswscale        \
  1.2519 +        libswscale/bfin   \
  1.2520 +        libswscale/mlib   \
  1.2521 +        libswscale/ppc    \
  1.2522 +        libswscale/sparc  \
  1.2523 +        libswscale/x86    \
  1.2524 +        tests             \
  1.2525 +        tools             \
  1.2526 +        "
  1.2527 +    FILES="\
  1.2528 +        Makefile             \
  1.2529 +        common.mak           \
  1.2530 +        subdir.mak           \
  1.2531 +        doc/texi2pod.pl      \
  1.2532 +        libavcodec/Makefile  \
  1.2533 +        libavdevice/Makefile \
  1.2534 +        libavfilter/Makefile \
  1.2535 +        libavformat/Makefile \
  1.2536 +        libavutil/Makefile   \
  1.2537 +        libpostproc/Makefile \
  1.2538 +        libswscale/Makefile  \
  1.2539 +        "
  1.2540 +    for dir in $DIRS ; do
  1.2541 +        mkdir -p $dir
  1.2542 +    done
  1.2543 +    for f in $FILES ; do
  1.2544 +        $ln_s "$source_path/$f" $f
  1.2545 +    done
  1.2546 +fi
  1.2547 +
  1.2548 +
  1.2549 +# build pkg-config files
  1.2550 +
  1.2551 +pkgconfig_generate(){
  1.2552 +name=$1
  1.2553 +shortname=${name#lib}${build_suffix}
  1.2554 +comment=$2
  1.2555 +version=$3
  1.2556 +libs=$4
  1.2557 +requires=$5
  1.2558 +cat <<EOF > $name/$name.pc
  1.2559 +prefix=$prefix
  1.2560 +exec_prefix=\${prefix}
  1.2561 +libdir=$libdir
  1.2562 +includedir=$incdir
  1.2563 +
  1.2564 +Name: $name
  1.2565 +Description: $comment
  1.2566 +Version: $version
  1.2567 +Requires: $(disabled shared && echo $requires)
  1.2568 +Requires.private: $(enabled shared && echo $requires)
  1.2569 +Conflicts:
  1.2570 +Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  1.2571 +Libs.private: $(enabled shared && echo $libs)
  1.2572 +Cflags: -I\${includedir}
  1.2573 +EOF
  1.2574 +cat <<EOF > $name/$name-uninstalled.pc
  1.2575 +prefix=
  1.2576 +exec_prefix=
  1.2577 +libdir=\${pcfiledir}
  1.2578 +includedir=${source_path}
  1.2579 +
  1.2580 +Name: $name
  1.2581 +Description: $comment
  1.2582 +Version: $version
  1.2583 +Requires: $requires
  1.2584 +Conflicts:
  1.2585 +Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  1.2586 +Cflags: -I\${includedir}
  1.2587 +EOF
  1.2588 +}
  1.2589 +
  1.2590 +pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  1.2591 +pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  1.2592 +pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  1.2593 +pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  1.2594 +enabled avfilter &&
  1.2595 +    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  1.2596 +enabled postproc &&
  1.2597 +    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  1.2598 +pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"