wok-4.x annotate ffmpeg/stuff/configure @ rev 11940

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