set keyframe flag at a more central place instead of in every demuxer for containers...
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305 4#
cf9d24ad
DC
5
6if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
7cat << EOF
8
9Usage: configure [options]
10Options: [defaults in brackets after descriptions]
11
12EOF
13echo "Standard options:"
14echo " --help print this message"
15echo " --prefix=PREFIX install in PREFIX [$prefix]"
16echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
17echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
18echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
19echo " --enable-faad enable faad support via libfaad [default=no]"
20echo " --enable-faadbin build faad support with runtime linking [default=no]"
21echo " --enable-faac enable faac support via libfaac [default=no]"
1ddadfa9 22echo " --enable-xvid enable xvid support via xvidcore [default=no]"
cf9d24ad
DC
23echo " --enable-mingw32 enable mingw32 native/cross windows compile"
24echo " --enable-a52 enable GPL'ed A52 support [default=no]"
25echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
23c99253 26echo " --enable-dts enable GPL'ed DTS support [default=no]"
cf9d24ad
DC
27echo " --enable-pp enable GPL'ed post processing support [default=no]"
28echo " --enable-shared-pp use libpostproc.so [default=no]"
29echo " --enable-shared build shared libraries [default=no]"
30echo " --enable-amr_nb enable amr_nb float audio codec"
31echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
64cba748 32echo " --enable-amr_wb enable amr_wb float audio codec"
cf9d24ad 33echo " --enable-sunmlib use Sun medialib [default=no]"
9c3d33d6 34echo " --enable-pthreads use pthreads [default=no]"
b2e3c528 35echo " --enable-gpl allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
cf9d24ad
DC
36echo ""
37echo "Advanced options (experts only):"
38echo " --source-path=PATH path of source code [$source_path]"
39echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
40echo " --cc=CC use C compiler CC [$cc]"
41echo " --make=MAKE use specified make [$make]"
42echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
43echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
44echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
45echo " --cpu=CPU force cpu to CPU [$cpu]"
46echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
47echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
48echo " --disable-mmx disable mmx usage"
49echo " --disable-altivec disable AltiVec usage"
50echo " --disable-audio-oss disable OSS audio support [default=no]"
51echo " --disable-audio-beos disable BeOS audio support [default=no]"
52echo " --disable-v4l disable video4linux grabbing [default=no]"
53echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
54echo " --disable-network disable network support [default=no]"
55echo " --disable-zlib disable zlib [default=no]"
56echo " --disable-simple_idct disable simple IDCT routines [default=no]"
57echo " --disable-vhook disable video hooking support"
58echo " --enable-gprof enable profiling with gprof [$gprof]"
59echo " --disable-debug disable debugging symbols"
60echo " --disable-opts disable compiler optimizations"
61echo " --disable-mpegaudio-hp faster (but less accurate)"
62echo " mpegaudio decoding [default=no]"
63echo " --disable-ffserver disable ffserver build"
64echo " --disable-ffplay disable ffplay build"
65echo " --disable-risky disables patent encumbered codecs"
66echo " --enable-small optimize for size instead of speed"
da9b170c 67echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
65d1bea2 68echo " --disable-strip disable stripping of executables and shared libraries"
cf9d24ad
DC
69echo ""
70echo "NOTE: The object files are build at the place where configure is launched"
71exit 1
72fi
73
0f3cb305 74# set temporary file name
57514323 75if test ! -z "$TMPDIR" ; then
0f3cb305 76 TMPDIR1="${TMPDIR}"
57514323 77elif test ! -z "$TEMPDIR" ; then
0f3cb305 78 TMPDIR1="${TEMPDIR}"
3d204385 79else
0f3cb305 80 TMPDIR1="/tmp"
3d204385
NK
81fi
82
0f3cb305
FB
83TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
84TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 85TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
86TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
87TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
88
de6d9b64
FB
89# default parameters
90prefix="/usr/local"
23a65308 91mandir=""
951bf3e6 92bindir=""
0f3cb305 93cross_prefix=""
de6d9b64
FB
94cc="gcc"
95ar="ar"
be7109c1 96ranlib="ranlib"
4a908fbc 97make="make"
0f3cb305 98strip="strip"
de6d9b64 99cpu=`uname -m`
a4adb608 100tune="generic"
e45a2872 101powerpc_perf="no"
0f3cb305 102mmx="default"
ab6c65f6 103altivec="default"
d46aba26 104mmi="default"
de6d9b64 105case "$cpu" in
ef0bc4c9 106 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 107 cpu="x86"
de6d9b64 108 ;;
053dea12
AJ
109 x86_64)
110 if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
111 -z "`echo $CFLAGS | grep -- -m32`" ]; then
112 cpu="x86_64"
113 else
114 cpu="x86"
115 fi
116 ;;
93caefc7
AB
117 # armv4l is a subset of armv5tel
118 armv4l|armv5tel)
6ed7422a 119 cpu="armv4l"
6ed7422a 120 ;;
91d1f1a4
NK
121 alpha)
122 cpu="alpha"
91d1f1a4 123 ;;
a43bd1d7 124 "Power Macintosh"|ppc)
90cee0c3
MN
125 cpu="powerpc"
126 ;;
d46aba26
LS
127 mips)
128 cpu="mips"
129 ;;
bb476ff3 130 sun4u|sparc64)
a7beab73
RS
131 cpu="sparc64"
132 ;;
bb476ff3
JM
133 sparc)
134 cpu="sparc"
135 ;;
bdb2e37c
AB
136 sh4)
137 cpu="sh4"
138 ;;
de6d9b64 139 *)
0f3cb305 140 cpu="unknown"
de6d9b64
FB
141 ;;
142esac
143gprof="no"
5cbcf02c
FB
144v4l="yes"
145audio_oss="yes"
dfdfa47c 146audio_beos="no"
8aa3ee32 147dv1394="yes"
5cbcf02c 148network="yes"
0147f198 149zlib="yes"
a6741398 150mp3lame="no"
81e0d0b4 151vorbis="no"
0fc50e58
ZK
152faad="no"
153faadbin="no"
29d48296 154faac="no"
1ddadfa9 155xvid="no"
ba9261e5 156a52="no"
57514323 157a52bin="no"
23c99253 158dts="no"
ba9261e5 159pp="no"
bba9b16c 160shared_pp="no"
732d9245 161mingw32="no"
3f027ca7 162cygwin="no"
f3ec2d46 163os2="no"
83286d2a 164lshared="no"
cddf3f45
GM
165optimize="yes"
166debug="yes"
65d1bea2 167dostrip="yes"
ef0bc4c9 168extralibs="-lm"
c02dbee1 169simpleidct="yes"
0f3cb305 170bigendian="no"
7f965c1c 171inttypes="yes"
b5c950c4 172emu_fast_int="no"
a8721c09 173vhook="default"
adbc0510
PG
174dlfcn="no"
175dlopen="no"
1eb2212e 176mpegaudio_hp="yes"
e1707f52 177SHFLAGS=-shared
26b35efb 178netserver="no"
4baca069 179need_inet_aton="no"
8154d2e0 180ffserver="yes"
a86b921c 181ffplay="yes"
4baca069
PG
182LDFLAGS=-Wl,--warn-common
183FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
184LIBPREF="lib"
185LIBSUF=".a"
186SLIBPREF="lib"
187SLIBSUF=".so"
951bf3e6 188EXESUF=""
1d0d55da 189risky="yes"
891f64b3 190amr_nb="no"
d663a1fd 191amr_wb="no"
bc634f6f 192amr_nb_fixed="no"
f80f7964 193sunmlib="no"
9c3d33d6 194pthreads="no"
b2e3c528 195gpl="no"
da9b170c 196memalignhack="no"
ef0bc4c9
FR
197
198# OS specific
199targetos=`uname -s`
200case $targetos in
201BeOS)
202prefix="/boot/home/config"
203# helps building libavcodec
cddf3f45 204CFLAGS="-DPIC -fomit-frame-pointer"
31ba0b4d 205# 3 gcc releases known for BeOS, each with ugly bugs
b2924696 206gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
31ba0b4d
FR
207case "$gcc_version" in
2082.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
209mmx="no"
210;;
211*20010315*) echo "BeBits gcc"
212CFLAGS="$CFLAGS -fno-expensive-optimizations"
213;;
214esac
e1707f52
MN
215SHFLAGS=-nostart
216# disable linux things
217audio_oss="no"
5cbcf02c 218v4l="no"
8aa3ee32 219dv1394="no"
dfdfa47c
FR
220# enable beos things
221audio_beos="yes"
ef0bc4c9
FR
222# no need for libm, but the inet stuff
223# Check for BONE
224if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
225extralibs="-lbind -lsocket"
226else
26b35efb 227netserver="yes"
4baca069 228need_inet_aton="yes"
26b35efb 229extralibs="-lnet"
ef0bc4c9 230fi ;;
4baca069
PG
231SunOS)
232v4l="no"
233audio_oss="no"
8aa3ee32 234dv1394="no"
4baca069
PG
235make="gmake"
236LDFLAGS=""
237FFSLDFLAGS=""
238need_inet_aton="yes"
239extralibs="$extralibs -lsocket -lnsl"
240;;
9c938e77
PG
241FreeBSD)
242v4l="no"
243audio_oss="yes"
8aa3ee32 244dv1394="no"
9c938e77 245make="gmake"
12043e1d
SS
246CFLAGS="-pthread"
247LDFLAGS="$LDFLAGS -export-dynamic -pthread"
9c938e77 248;;
4a908fbc 249BSD/OS)
5cbcf02c 250v4l="no"
6063bce7 251audio_oss="yes"
8aa3ee32 252dv1394="no"
4a908fbc
AB
253extralibs="-lpoll -lgnugetopt -lm"
254make="gmake"
255;;
90cee0c3 256Darwin)
a43bd1d7 257cc="cc"
90cee0c3
MN
258v4l="no"
259audio_oss="no"
8aa3ee32 260dv1394="no"
d3b15036 261ffserver="no"
a43bd1d7 262SHFLAGS="-dynamiclib"
90cee0c3 263extralibs=""
a43bd1d7 264darwin="yes"
47930f09 265strip="strip -x"
4850b2d2 266LDFLAGS="-Wl,-d"
4baca069 267FFSLDFLAGS=-Wl,-bind_at_load
90cee0c3 268;;
732d9245 269MINGW32*)
951bf3e6
FB
270# Note: the rest of the mingw32 config is done afterwards as mingw32
271# can be forced on command line for linux cross compilation
732d9245
BE
272mingw32="yes"
273;;
3f027ca7
FB
274CYGWIN*)
275v4l="no"
276audio_oss="yes"
8aa3ee32 277dv1394="no"
3f027ca7
FB
278extralibs=""
279cygwin="yes"
280test -f /usr/include/inttypes.h || \
281test -f /usr/local/include/inttypes.h || \
282echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
24689bce 283 "/usr/local/include/inttypes.h !!!"
3f027ca7 284;;
b55e4ef4 285Linux)
4baca069 286LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 287;;
99614dd4
MB
288IRIX*)
289ranlib="echo ignoring ranlib"
290v4l="no"
291audio_oss="no"
292make="gmake"
293;;
f3ec2d46
SG
294OS/2)
295TMPE=$TMPE".exe"
69db4e10
SG
296ar="emxomfar -p64"
297ranlib="echo ignoring ranlib"
298strip="echo ignoring strip"
cddf3f45 299CFLAGS="-Zomf"
69db4e10 300LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
301SHFLAGS=""
302FFSLDFLAGS=""
303LIBPREF=""
304LIBSUF=".lib"
305SLIBPREF=""
306SLIBSUF=".dll"
951bf3e6 307EXESUF=".exe"
f3ec2d46
SG
308extralibs=""
309v4l="no"
310audio_oss="no"
8aa3ee32 311dv1394="no"
f3ec2d46
SG
312network="no"
313ffserver="no"
314os2="yes"
315;;
ef0bc4c9
FR
316*) ;;
317esac
de6d9b64 318
6852ac95
RD
319# From mplayer configure. We need TARGET_OS available
320# to the Makefile, so it can distinguish between flavors
321# of AltiVec on PowerPC
322TARGET_OS=`( uname -s ) 2>&1`
323 case "$TARGET_OS" in
324 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
325 ;;
326 IRIX*)
327 TARGET_OS=IRIX
328 ;;
329 HP-UX*)
330 TARGET_OS=HP-UX
331 ;;
332 [cC][yY][gG][wW][iI][nN]*)
333 TARGET_OS=CYGWIN
334 ;;
335 *)
336 TARGET_OS="$TARGET_OS-UNKNOWN"
337 ;;
338 esac
339
0f3cb305
FB
340# find source path
341# XXX: we assume an absolute path is given when launching configure,
342# except in './configure' case.
586bc755 343source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
344source_path_used="yes"
345if test -z "$source_path" -o "$source_path" = "." ; then
346 source_path=`pwd`
347 source_path_used="no"
de6d9b64
FB
348fi
349
f255e0ab
MB
350FFMPEG_CONFIGURATION=" "
351for opt do
352 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
353done
354
de6d9b64
FB
355for opt do
356 case "$opt" in
357 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
358 ;;
23a65308
FB
359 --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
360 ;;
0f3cb305
FB
361 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
362 ;;
363 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
364 ;;
de6d9b64
FB
365 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
366 ;;
4a908fbc
AB
367 --make=*) make=`echo $opt | cut -d '=' -f 2`
368 ;;
0f3cb305
FB
369 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
370 ;;
371 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
372 ;;
373 --extra-libs=*) extralibs=${opt#--extra-libs=}
374 ;;
de6d9b64
FB
375 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
376 ;;
a4adb608
MN
377 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
378 ;;
e45a2872
RD
379 --powerpc-perf-enable) powerpc_perf="yes"
380 ;;
de6d9b64
FB
381 --disable-mmx) mmx="no"
382 ;;
ab6c65f6
BF
383 --disable-altivec) altivec="no"
384 ;;
de6d9b64
FB
385 --enable-gprof) gprof="yes"
386 ;;
5cbcf02c
FB
387 --disable-v4l) v4l="no"
388 ;;
389 --disable-audio-oss) audio_oss="no"
390 ;;
dfdfa47c
FR
391 --disable-audio-beos) audio_beos="no"
392 ;;
8aa3ee32
MK
393 --disable-dv1394) dv1394="no"
394 ;;
ffc0ef96 395 --disable-network) network="no"; ffserver="no"
5cbcf02c 396 ;;
0147f198
FR
397 --disable-zlib) zlib="no"
398 ;;
ba9261e5 399 --enable-a52) a52="yes"
6ed7422a 400 ;;
9c938e77 401 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 402 ;;
23c99253
MN
403 --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
404 ;;
ba9261e5 405 --enable-pp) pp="yes"
bba9b16c
MN
406 ;;
407 --enable-shared-pp) shared_pp="yes"
408 ;;
a6741398
J
409 --enable-mp3lame) mp3lame="yes"
410 ;;
81e0d0b4
MH
411 --enable-vorbis) vorbis="yes"
412 ;;
445ad18d
ZK
413 --enable-faad) faad="yes"
414 ;;
415 --enable-faadbin) faadbin="yes"
416 ;;
29d48296
MN
417 --enable-faac) faac="yes"
418 ;;
1ddadfa9
AT
419 --enable-xvid) xvid="yes"
420 ;;
68892110
PG
421 --disable-vhook) vhook="no"
422 ;;
c02dbee1 423 --disable-simple_idct) simpleidct="no"
045ed63f 424 ;;
732d9245
BE
425 --enable-mingw32) mingw32="yes"
426 ;;
83286d2a 427 --enable-shared) lshared="yes"
0319c531 428 ;;
cddf3f45
GM
429 --disable-debug) debug="no"
430 ;;
431 --disable-opts) optimize="no"
432 ;;
1eb2212e
FB
433 --disable-mpegaudio-hp) mpegaudio_hp="no"
434 ;;
8154d2e0
FB
435 --disable-ffserver) ffserver="no"
436 ;;
a86b921c
FB
437 --disable-ffplay) ffplay="no"
438 ;;
1d0d55da
MN
439 --disable-risky) risky="no"
440 ;;
cddf3f45 441 --enable-small) optimize="small"
553a6284 442 ;;
891f64b3 443 --enable-amr_nb) amr_nb="yes"
444 ;;
bc634f6f
ZK
445 --enable-amr_nb-fixed) amr_nb_fixed="yes"
446 ;;
64cba748
MN
447 --enable-amr_wb) amr_wb="yes"
448 ;;
f80f7964
RS
449 --enable-sunmlib) sunmlib="yes"
450 ;;
9c3d33d6
MN
451 --enable-pthreads) pthreads="yes"
452 ;;
b2e3c528
MN
453 --enable-gpl) gpl="yes"
454 ;;
da9b170c
MN
455 --enable-memalign-hack) memalignhack="yes"
456 ;;
65d1bea2
MB
457 --disable-strip) dostrip="no"
458 ;;
de6d9b64
FB
459 esac
460done
461
b2e3c528
MN
462if test "$gpl" != "yes"; then
463 if test "$pp" != "no" -o "$shared_pp" != "no"; then
464 echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
465 fail="yes"
466 fi
467
468 if test "$a52" != "no" -o "$a52bin" != "no"; then
469 echo "liba52 is under GPL and --enable-gpl is not specified"
470 fail="yes"
471 fi
23c99253 472
1ddadfa9
AT
473 if test "$xvid" != "no"; then
474 echo "libxvidcore is under GPL and --enable-gpl is not specified"
475 fail="yes"
476 fi
477
23c99253
MN
478 if test "$dts" != "no"; then
479 echo "libdts is under GPL and --enable-gpl is not specified"
480 fail="yes"
481 fi
b2e3c528
MN
482
483 if test "$faad" != "no" -o "$faadbin" != "no"; then
484 cat > $TMPC << EOF
485 #include <faad.h>
486 int main( void ) { return 0; }
487EOF
488
489 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
490 cat > $TMPC << EOF
491 #include <faad.h>
492 #ifndef FAAD2_VERSION
493 ok faad1
494 #endif
495 int main( void ) { return 0; }
496EOF
497 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
498 echo "faad2 is under GPL and --enable-gpl is not specified"
499 fail="yes"
500 fi
501 else
502 faad="no"
503 faadbin="no"
504 echo "faad test failed"
505 fi
506 fi
507
508
a18b5183 509 if test "$fail" = "yes"; then
b2e3c528
MN
510 exit 1
511 fi
512fi
513
0f3cb305
FB
514# compute mmx state
515if test $mmx = "default"; then
053dea12 516 if test $cpu = "x86" -o $cpu = "x86_64"; then
0f3cb305
FB
517 mmx="yes"
518 else
519 mmx="no"
520 fi
521fi
522
cf9d24ad 523#Darwin CC versions
75388c74 524needmdynamicnopic="no"
cf9d24ad 525if test $targetos = Darwin; then
b2924696 526 if test -n "`$cc -v 2>&1 | grep xlc`"; then
747a0554 527 CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
cf9d24ad 528 else
b2924696 529 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
cf9d24ad
DC
530 case "$gcc_version" in
531 *2.95*)
747a0554 532 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
cf9d24ad 533 ;;
75388c74 534 *3.*)
747a0554 535 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
75388c74
MN
536 if test "$lshared" = no; then
537 needmdynamicnopic="yes"
538 fi
cf9d24ad
DC
539 ;;
540 *)
747a0554 541 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
75388c74
MN
542 if test "$lshared" = no; then
543 needmdynamicnopic="yes"
544 fi
cf9d24ad
DC
545 ;;
546 esac
547 fi
548fi
549
ab6c65f6
BF
550# Can only do AltiVec on PowerPC
551if test $altivec = "default"; then
552 if test $cpu = "powerpc"; then
553 altivec="yes"
554 else
555 altivec="no"
556 fi
557fi
558
a4adb608
MN
559# Add processor-specific flags
560TUNECPU="generic"
9007f514 561POWERPCMODE="32bits"
a4adb608
MN
562if test $tune != "generic"; then
563 case $tune in
564 601|ppc601|PowerPC601)
565 CFLAGS="$CFLAGS -mcpu=601"
566 if test $altivec = "yes"; then
567 echo "WARNING: tuning for PPC601 but altivec enabled !";
568 fi
569 TUNECPU=ppc601
570 ;;
571 603*|ppc603*|PowerPC603*)
572 CFLAGS="$CFLAGS -mcpu=603"
573 if test $altivec = "yes"; then
574 echo "WARNING: tuning for PPC603 but altivec enabled !";
575 fi
576 TUNECPU=ppc603
577 ;;
578 604*|ppc604*|PowerPC604*)
579 CFLAGS="$CFLAGS -mcpu=604"
580 if test $altivec = "yes"; then
581 echo "WARNING: tuning for PPC604 but altivec enabled !";
582 fi
583 TUNECPU=ppc604
584 ;;
8d6625b6 585 G3|g3|75*|ppc75*|PowerPC75*)
fe0f2a97 586 CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
a4adb608
MN
587 if test $altivec = "yes"; then
588 echo "WARNING: tuning for PPC75x but altivec enabled !";
589 fi
590 TUNECPU=ppc750
591 ;;
8d6625b6 592 G4|g4|745*|ppc745*|PowerPC745*)
fe0f2a97 593 CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
3efd4952
RD
594 if test $altivec = "no"; then
595 echo "WARNING: tuning for PPC745x but altivec disabled !";
596 fi
597 TUNECPU=ppc7450
598 ;;
599 74*|ppc74*|PowerPC74*)
fe0f2a97 600 CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
a4adb608
MN
601 if test $altivec = "no"; then
602 echo "WARNING: tuning for PPC74xx but altivec disabled !";
603 fi
e45a2872 604 TUNECPU=ppc7400
a4adb608 605 ;;
8d6625b6 606 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
9007f514 607 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
a4adb608
MN
608 if test $altivec = "no"; then
609 echo "WARNING: tuning for PPC970 but altivec disabled !";
610 fi
611 TUNECPU=ppc970
9007f514 612 POWERPCMODE="64bits"
a4adb608
MN
613 ;;
614 *)
615 echo "WARNING: unknown CPU "$tune", ignored"
616 ;;
617 esac
618fi
619
cf9d24ad 620# AltiVec flags: The FSF version of GCC differs from the Apple version
b6e52719
MD
621if test $cpu = "powerpc"; then
622 if test $altivec = "yes"; then
b2924696 623 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
b6e52719
MD
624 CFLAGS="$CFLAGS -faltivec"
625 else
626 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
627 fi
628 fi
629fi
630
a9a07762
MN
631# See if we have <altivec.h>
632cat > $TMPC << EOF
633#include <altivec.h>
634int main( void ) { return 0; }
635EOF
636
637_altivec_h="no"
b6e52719 638if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
a9a07762
MN
639_altivec_h="yes"
640fi
641
ab6c65f6
BF
642# See does our compiler support Motorola AltiVec C API
643if test $altivec = "yes"; then
a9a07762 644if test $_altivec_h = "yes"; then
ab6c65f6 645cat > $TMPC << EOF
a9a07762 646#include <altivec.h>
ab6c65f6
BF
647int main(void) {
648 vector signed int v1, v2, v3;
649 v1 = vec_add(v2,v3);
650 return 0;
651}
652EOF
a9a07762
MN
653else
654cat > $TMPC << EOF
655int main(void) {
656 vector signed int v1, v2, v3;
657 v1 = vec_add(v2,v3);
658 return 0;
659}
660EOF
661fi
b6e52719 662$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
ab6c65f6
BF
663fi
664
d46aba26
LS
665# Can only do mmi on mips
666if test $mmi = "default"; then
667 if test $cpu = "mips"; then
668 mmi="yes"
669 else
670 mmi="no"
671 fi
672fi
673
674# See does our compiler support mmi
675if test $mmi = "yes"; then
676cat > $TMPC << EOF
677int main(void) {
678 __asm__ ("lq \$2, 0(\$2)");
679 return 0;
680}
681EOF
f3ec2d46 682$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
683fi
684
732d9245 685if test "$mingw32" = "yes" ; then
732d9245
BE
686 v4l="no"
687 audio_oss="no"
8aa3ee32 688 dv1394="no"
951bf3e6 689 ffserver="no"
732d9245 690 network="no"
951bf3e6
FB
691 LIBPREF=""
692 LIBSUF=".lib"
693 SLIBPREF=""
694 SLIBSUF=".dll"
695 EXESUF=".exe"
696 prefix="/c/Program Files/FFmpeg"
697 bindir="$prefix"
732d9245
BE
698fi
699
0f3cb305
FB
700cc="${cross_prefix}${cc}"
701ar="${cross_prefix}${ar}"
be7109c1 702ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
703strip="${cross_prefix}${strip}"
704
487a54d7
FB
705if test -z "$cross_prefix" ; then
706
3d204385 707# ---
a3999908
MN
708# big/little endian test
709cat > $TMPC << EOF
710#include <inttypes.h>
711int main(int argc, char ** argv){
712 volatile uint32_t i=0x01234567;
713 return (*((uint8_t*)(&i))) == 0x67;
714}
715EOF
716
f3ec2d46
SG
717if $cc -o $TMPE $TMPC 2>/dev/null ; then
718$TMPE && bigendian="yes"
a3999908
MN
719else
720echo big/little test failed
721fi
722
487a54d7
FB
723else
724
725# if cross compiling, cannot launch a program, so make a static guess
726if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
727 bigendian="yes"
728fi
729
730fi
731
a3999908 732# ---
7f965c1c
CF
733# *inttypes.h* test
734cat > $TMPC << EOF
735#include <inttypes.h>
736int main(int argc, char ** argv){
737 return 0;
738}
739EOF
740
741$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
742
743# ---
b5c950c4
MN
744# *int_fast* test
745cat > $TMPC << EOF
746#include <inttypes.h>
747int main(int argc, char ** argv){
748 volatile uint_fast64_t i=0x01234567;
749 return 0;
750}
751EOF
752
753$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
754
755# ---
3d204385
NK
756# check availability of some header files
757
758cat > $TMPC << EOF
759#include <malloc.h>
760int main( void ) { return 0; }
761EOF
762
763_memalign=no
764_malloc_h=no
f3ec2d46 765if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
766_malloc_h=yes
767_memalign=yes
768# check for memalign - atmos
769cat > $TMPC << EOF
770#include <malloc.h>
771int main ( void ) {
772char *string = NULL;
773string = memalign(64, sizeof(char));
774return 0;
775}
776EOF
f3ec2d46 777$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
778fi
779
8bf5d58f
MN
780if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
781 echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
782 exit 1
783fi
784
68892110 785cat > $TMPC << EOF
5e4639e2
GM
786#include <time.h>
787int main( void ) { localtime_r(NULL, NULL); }
788EOF
789
790localtime_r=no
791if $cc -o $TMPE $TMPC 2> /dev/null ; then
792 localtime_r=yes
793fi
794
0147f198
FR
795if test "$zlib" = "yes"; then
796# check for zlib - mmu_man
797cat > $TMPC << EOF
798#include <zlib.h>
799int main ( void ) {
800if (zlibVersion() != ZLIB_VERSION)
801 puts("zlib version differs !!!");
802 return 1;
803return 0;
804}
805EOF
16806499 806$cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
f3ec2d46 807# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
808# XXX: more tests needed - runtime test
809fi
810if test "$zlib" = "yes"; then
811extralibs="$extralibs -lz"
812fi
813
95e2ce4a
MN
814# test for lrintf in math.h
815cat > $TMPC << EOF
816#define _ISOC9X_SOURCE 1
817#include <math.h>
818int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
819EOF
820
821have_lrintf="no"
f3ec2d46 822if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 823 have_lrintf="yes"
c2b9685e
MN
824 # allanc@chickenandporn.com: cannot execute cross-compiled
825 # code on the host. Only execute if not cross-compiling.
826 if test -z "$cross_prefix" ; then
827 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
828 fi
95e2ce4a
MN
829fi
830
c13e1abd
FH
831_restrict=
832for restrict_keyword in restrict __restrict__ __restrict; do
833 echo "void foo(char * $restrict_keyword p);" > $TMPC
834 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
835 _restrict=$restrict_keyword
836 break;
837 fi
838done
839
52b41d7f
FB
840# test gcc version to see if vector builtins can be used
841# currently only used on i386 for MMX builtins
842cat > $TMPC << EOF
053dea12 843#include <xmmintrin.h>
52b41d7f
FB
844int main(void) {
845#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
846return 0;
847#else
848#error no vector builtins
849#endif
850}
851EOF
852
853builtin_vector=no
854if $cc -o $TMPO $TMPC 2> /dev/null ; then
855 builtin_vector=yes
a8721c09
FB
856fi
857
858# dlopen/dlfcn.h probing
859
860cat > $TMPC << EOF
861#include <dlfcn.h>
862int main( void ) { return (int) dlopen("foo", 0); }
863EOF
864
865ldl=-ldl
866
cf9d24ad 867if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
868dlfcn=yes
869dlopen=yes
870fi
871
cf9d24ad 872if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
873dlfcn=yes
874dlopen=yes
875ldl=""
876fi
877
878cat > $TMPC << EOF
879int main( void ) { return (int) dlopen("foo", 0); }
880EOF
881
cf9d24ad 882if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
883dlopen=yes
884fi
885
cf9d24ad 886if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
887dlopen=yes
888ldl=""
889fi
890
891if test "$vhook" = "default" ; then
892 vhook="$dlopen"
893fi
894
a86b921c
FB
895##########################################
896# imlib probe
897
a8721c09
FB
898cat > $TMPC << EOF
899#include <X11/Xlib.h>
900#include <Imlib2.h>
901int main( void ) { return (int) imlib_load_font("foo"); }
902EOF
903
904imlib2=no
7802d373 905if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
a8721c09 906imlib2=yes
52b41d7f
FB
907fi
908
a86b921c
FB
909##########################################
910# freetype probe
911
04511d53
PG
912cat > $TMPC << EOF
913#include <ft2build.h>
914int main( void ) { return (int) FT_Init_FreeType(0); }
915EOF
916
917freetype2=no
69db4e10 918if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
e2a3cd59 919 if (freetype-config --version) >/dev/null 2>&1 ; then
cf9d24ad 920 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
dee076fc 921 freetype2=yes
04511d53 922 fi
dee076fc 923 fi
04511d53
PG
924fi
925
a86b921c
FB
926##########################################
927# SDL probe
928
929cat > $TMPC << EOF
930#include <SDL.h>
31319a8c 931#undef main /* We don't want SDL to override our main() */
a86b921c
FB
932int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
933EOF
934
935sdl_too_old=no
936sdl=no
e2a3cd59 937if (sdl-config --version) >/dev/null 2>&1 ; then
cf9d24ad 938if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
a86b921c
FB
939_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
940if test "$_sdlversion" -lt 121 ; then
941sdl_too_old=yes
942else
943sdl=yes
944fi
945fi
c3f6b472 946fi
a86b921c 947
146ea952
NB
948##########################################
949# texi2html probe
950
951texi2html=no
e2a3cd59 952if (texi2html -version) >/dev/null 2>&1; then
146ea952
NB
953texi2html=yes
954fi
955
b2924696 956case "`$cc -v 2>&1 | grep version`" in
cf9d24ad
DC
957 *gcc*)
958 CFLAGS="-Wall $CFLAGS"
959 ;;
960 *)
961 ;;
962esac
963
94a3401e
FB
964if test "$sdl" = "no" ; then
965 ffplay=no
966fi
967
cddf3f45 968if test "$debug" = "yes"; then
7906085f 969 CFLAGS="-g $CFLAGS"
cddf3f45
GM
970fi
971
972if test "$optimize" = "small"; then
98ca7790 973# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
974 CFLAGS="$CFLAGS -Os"
975fi
976
cddf3f45 977if test "$optimize" = "yes"; then
b2924696 978 if test -n "`$cc -v 2>&1 | grep xlc`"; then
cf9d24ad
DC
979 CFLAGS="$CFLAGS -O5"
980 LDFLAGS="$LDFLAGS -O5"
981 else
7906085f 982 CFLAGS="-O3 $CFLAGS"
cf9d24ad 983 fi
cddf3f45
GM
984fi
985
951bf3e6
FB
986if test x"$bindir" = x""; then
987bindir="${prefix}/bin"
988fi
989
23a65308
FB
990if test x"$mandir" = x""; then
991mandir="${prefix}/man"
992fi
993
de6d9b64 994echo "Install prefix $prefix"
0f3cb305 995echo "Source path $source_path"
de6d9b64 996echo "C compiler $cc"
4a908fbc 997echo "make $make"
a4adb608 998echo "CPU $cpu ($tune)"
0f3cb305 999echo "Big Endian $bigendian"
7f965c1c 1000echo "inttypes.h $inttypes"
b5c950c4 1001echo "broken inttypes.h $emu_fast_int"
053dea12 1002if test $cpu = "x86" -o $cpu = "x86_64"; then
de6d9b64 1003echo "MMX enabled $mmx"
52b41d7f 1004echo "Vector Builtins $builtin_vector"
e41e8342
FB
1005fi
1006if test $cpu = "mips"; then
d46aba26 1007echo "MMI enabled $mmi"
e41e8342
FB
1008fi
1009if test $cpu = "powerpc"; then
ab6c65f6 1010echo "AltiVec enabled $altivec"
e41e8342 1011fi
de6d9b64 1012echo "gprof enabled $gprof"
0147f198 1013echo "zlib enabled $zlib"
a6741398 1014echo "mp3lame enabled $mp3lame"
81e0d0b4 1015echo "vorbis enabled $vorbis"
445ad18d
ZK
1016echo "faad enabled $faad"
1017echo "faadbin enabled $faadbin"
29d48296 1018echo "faac enabled $faac"
1ddadfa9 1019echo "xvid enabled $xvid"
5cbcf02c 1020echo "a52 support $a52"
57514323 1021echo "a52 dlopened $a52bin"
23c99253 1022echo "dts support $dts"
bba9b16c 1023echo "pp support $pp"
cddf3f45 1024echo "debug symbols $debug"
65d1bea2 1025echo "strip symbols $dostrip"
cddf3f45 1026echo "optimize $optimize"
bba9b16c 1027echo "shared pp $shared_pp"
47930f09 1028echo "Video hooking $vhook"
a86b921c
FB
1029echo "SDL support $sdl"
1030if test $sdl_too_old = "yes"; then
1031echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1032fi
1d0d55da 1033echo "risky / patent encumbered codecs $risky"
68892110
PG
1034
1035if test "$vhook" = "yes" ; then
47930f09 1036echo "Imlib2 support $imlib2"
04511d53 1037echo "freetype support $freetype2"
68892110 1038fi
f80f7964 1039echo "Sun medialib support" $sunmlib
9c3d33d6 1040echo "pthreads support" $pthreads
bc634f6f
ZK
1041echo "AMR-NB float support" $amr_nb
1042echo "AMR-NB fixed support" $amr_nb_fixed
d663a1fd 1043echo "AMR-WB float support" $amr_wb
b2e3c528
MN
1044if test "$gpl" = "no" ; then
1045echo "License: LGPL"
1046else
1047echo "License: GPL"
1048fi
de6d9b64 1049
980fc7b8 1050echo "Creating config.mak and config.h"
de6d9b64 1051
f255e0ab
MB
1052date >> config.log
1053echo " $0 $FFMPEG_CONFIGURATION" >> config.log
980fc7b8 1054echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 1055echo "/* Automatically generated by configure - do not modify */" > $TMPH
f255e0ab 1056echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
de6d9b64 1057
980fc7b8 1058echo "prefix=$prefix" >> config.mak
951bf3e6 1059echo "bindir=$bindir" >> config.mak
23a65308 1060echo "mandir=$mandir" >> config.mak
4a908fbc 1061echo "MAKE=$make" >> config.mak
980fc7b8
FB
1062echo "CC=$cc" >> config.mak
1063echo "AR=$ar" >> config.mak
be7109c1 1064echo "RANLIB=$ranlib" >> config.mak
65d1bea2 1065if test "$dostrip" = "yes" ; then
0f3cb305 1066echo "STRIP=$strip" >> config.mak
65d1bea2
MB
1067echo "INSTALLSTRIP=-s" >> config.mak
1068else
1069echo "STRIP=echo ignoring strip" >> config.mak
1070echo "INSTALLSTRIP=" >> config.mak
1071fi
75388c74
MN
1072
1073# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
1074# shared modules on OS/X (vhook/Makefile).
1075SHCFLAGS=$CFLAGS
1076if test "$needmdynamicnopic" = yes; then
1077 CFLAGS="$CFLAGS -mdynamic-no-pic"
1078fi
1079
a9b3f630 1080echo "OPTFLAGS=$CFLAGS" >> config.mak
75388c74 1081echo "SHCFLAGS=$SHCFLAGS">>config.mak
0f3cb305 1082echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 1083echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 1084echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
1085echo "LIBPREF=$LIBPREF" >> config.mak
1086echo "LIBSUF=$LIBSUF" >> config.mak
1087echo "SLIBPREF=$SLIBPREF" >> config.mak
1088echo "SLIBSUF=$SLIBSUF" >> config.mak
951bf3e6 1089echo "EXESUF=$EXESUF" >> config.mak
6852ac95 1090echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 1091if test "$cpu" = "x86" ; then
980fc7b8 1092 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 1093 echo "#define ARCH_X86 1" >> $TMPH
053dea12
AJ
1094elif test "$cpu" = "x86_64" ; then
1095 echo "TARGET_ARCH_X86_64=yes" >> config.mak
1096 echo "#define ARCH_X86_64 1" >> $TMPH
0f3cb305 1097elif test "$cpu" = "armv4l" ; then
6ed7422a 1098 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 1099 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 1100elif test "$cpu" = "alpha" ; then
91d1f1a4 1101 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 1102 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
1103elif test "$cpu" = "sparc64" ; then
1104 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1105 echo "#define ARCH_SPARC64 1" >> $TMPH
bb476ff3
JM
1106 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1107 echo "#define ARCH_SPARC 1" >> $TMPH
1108elif test "$cpu" = "sparc" ; then
1109 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1110 echo "#define ARCH_SPARC 1" >> $TMPH
0f3cb305
FB
1111elif test "$cpu" = "powerpc" ; then
1112 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1113 echo "#define ARCH_POWERPC 1" >> $TMPH
9007f514
RD
1114 if test $POWERPCMODE = "32bits"; then
1115 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1116 else
1117 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1118 fi
e45a2872
RD
1119 if test "$powerpc_perf" = "yes"; then
1120 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1121 fi
d46aba26
LS
1122elif test "$cpu" = "mips" ; then
1123 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1124 echo "#define ARCH_MIPS 1" >> $TMPH
bdb2e37c
AB
1125elif test "$cpu" = "sh4" ; then
1126 echo "TARGET_ARCH_SH4=yes" >> config.mak
1127 echo "#define ARCH_SH4 1" >> $TMPH
1128fi
a4adb608 1129echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
1130if test "$bigendian" = "yes" ; then
1131 echo "WORDS_BIGENDIAN=yes" >> config.mak
1132 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 1133fi
d2a9bddd
MN
1134if test "$inttypes" != "yes" ; then
1135 echo "#define EMULATE_INTTYPES 1" >> $TMPH
7f965c1c 1136fi
b5c950c4 1137if test "$emu_fast_int" = "yes" ; then
19d053c5 1138 echo "#define EMULATE_FAST_INT 1" >> $TMPH
b5c950c4 1139fi
57514323 1140if test "$mmx" = "yes" ; then
980fc7b8 1141 echo "TARGET_MMX=yes" >> config.mak
045ed63f 1142 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 1143 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 1144fi
52b41d7f
FB
1145if test "$builtin_vector" = "yes" ; then
1146 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1147 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1148fi
d46aba26
LS
1149if test "$mmi" = "yes" ; then
1150 echo "TARGET_MMI=yes" >> config.mak
1151 echo "#define HAVE_MMI 1" >> $TMPH
1152fi
ab6c65f6
BF
1153if test "$altivec" = "yes" ; then
1154 echo "TARGET_ALTIVEC=yes" >> config.mak
1155 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
1156 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1157 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
1158 if test "$_altivec_h" = "yes" ; then
1159 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1160 else
e67e14d5 1161 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 1162 fi
ab6c65f6 1163fi
57514323 1164if test "$gprof" = "yes" ; then
980fc7b8 1165 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 1166 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 1167fi
5e4639e2
GM
1168if test "$localtime_r" = "yes" ; then
1169 echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
5e4639e2 1170fi
68892110
PG
1171if test "$imlib2" = "yes" ; then
1172 echo "HAVE_IMLIB2=yes" >> config.mak
1173fi
04511d53
PG
1174if test "$freetype2" = "yes" ; then
1175 echo "HAVE_FREETYPE2=yes" >> config.mak
1176fi
f80f7964
RS
1177if test "$sunmlib" = "yes" ; then
1178 echo "HAVE_MLIB=yes" >> config.mak
1179 echo "#define HAVE_MLIB 1" >> $TMPH
1180 extralibs="$extralibs -lmlib"
1181fi
9c3d33d6
MN
1182if test "$pthreads" = "yes" ; then
1183 echo "HAVE_PTHREADS=yes" >> config.mak
1184 echo "#define HAVE_PTHREADS 1" >> $TMPH
0abd6916 1185 if test $targetos != FreeBSD; then
12043e1d
SS
1186 extralibs="$extralibs -lpthread"
1187 fi
9c3d33d6 1188fi
a86b921c
FB
1189if test "$sdl" = "yes" ; then
1190 echo "CONFIG_SDL=yes" >> config.mak
1191 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1192 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1193fi
146ea952
NB
1194if test "$texi2html" = "yes"; then
1195 echo "BUILD_DOC=yes" >> config.mak
1196fi
95e2ce4a
MN
1197if test "$have_lrintf" = "yes" ; then
1198 echo "#define HAVE_LRINTF 1" >> $TMPH
1199fi
68892110
PG
1200if test "$vhook" = "yes" ; then
1201 echo "BUILD_VHOOK=yes" >> config.mak
1202 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 1203 extralibs="$extralibs $ldl"
68892110 1204fi
57514323 1205if test "$lshared" = "yes" ; then
0319c531 1206 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 1207 echo "PIC=-fPIC" >> config.mak
0319c531 1208fi
ef0bc4c9 1209echo "EXTRALIBS=$extralibs" >> config.mak
258207b7
FB
1210version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1211 cut -d '"' -f 2`
1212echo "VERSION=$version" >>config.mak
d771bcae 1213# if you do not want to use encoders, disable that.
045ed63f 1214echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
1215echo "CONFIG_ENCODERS=yes" >> config.mak
1216
1217# if you do not want to use decoders, disable that.
045ed63f 1218echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
1219echo "CONFIG_DECODERS=yes" >> config.mak
1220
5cbcf02c
FB
1221# AC3
1222if test "$a52" = "yes" ; then
1223 echo "#define CONFIG_AC3 1" >> $TMPH
1224 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 1225
5cbcf02c
FB
1226 if test "$a52bin" = "yes" ; then
1227 echo "#define CONFIG_A52BIN 1" >> $TMPH
1228 echo "CONFIG_A52BIN=yes" >> config.mak
1229 fi
1230fi
1231
23c99253
MN
1232# DTS
1233if test "$dts" = "yes" ; then
1234 echo "#define CONFIG_DTS 1" >> $TMPH
1235 echo "CONFIG_DTS=yes" >> config.mak
1236fi
1237
bba9b16c
MN
1238# PP
1239if test "$pp" = "yes" ; then
1240 echo "#define CONFIG_PP 1" >> $TMPH
1241 echo "CONFIG_PP=yes" >> config.mak
1242
1243 if test "$shared_pp" = "yes" ; then
1244 echo "#define SHARED_PP 1" >> $TMPH
1245 echo "SHARED_PP=yes" >> config.mak
1246 fi
1247fi
1248
1eb2212e
FB
1249# mpeg audio high precision mode
1250if test "$mpegaudio_hp" = "yes" ; then
1251 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1252fi
1253
5cbcf02c
FB
1254if test "$v4l" = "yes" ; then
1255 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1256 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1257fi
1258
8aa3ee32
MK
1259if test "$dv1394" = "yes" ; then
1260 echo "#define CONFIG_DV1394 1" >> $TMPH
1261 echo "CONFIG_DV1394=yes" >> config.mak
1262fi
1263
adbc0510
PG
1264if test "$dlopen" = "yes" ; then
1265 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1266fi
1267
1268if test "$dlfcn" = "yes" ; then
1269 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1270fi
1271
5cbcf02c
FB
1272if test "$audio_oss" = "yes" ; then
1273 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1274 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
1275fi
1276
dfdfa47c
FR
1277if test "$audio_beos" = "yes" ; then
1278 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1279 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1280fi
1281
5cbcf02c
FB
1282if test "$network" = "yes" ; then
1283 echo "#define CONFIG_NETWORK 1" >> $TMPH
1284 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 1285fi
daf8e955 1286
0147f198
FR
1287if test "$zlib" = "yes" ; then
1288 echo "#define CONFIG_ZLIB 1" >> $TMPH
1289 echo "CONFIG_ZLIB=yes" >> config.mak
1290fi
1291
57514323 1292if test "$mp3lame" = "yes" ; then
045ed63f 1293 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
1294 echo "CONFIG_MP3LAME=yes" >> config.mak
1295fi
1296
81e0d0b4
MH
1297if test "$vorbis" = "yes" ; then
1298 echo "#define CONFIG_VORBIS 1" >> $TMPH
1299 echo "CONFIG_VORBIS=yes" >> config.mak
1300fi
1301
0fc50e58
ZK
1302if test "$faad" = "yes" ; then
1303 echo "#define CONFIG_FAAD 1" >> $TMPH
1304 echo "CONFIG_FAAD=yes" >> config.mak
1305fi
1306
1307if test "$faadbin" = "yes" ; then
1308 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1309 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1310fi
1311
29d48296
MN
1312if test "$faac" = "yes" ; then
1313 echo "#define CONFIG_FAAC 1" >> $TMPH
1314 echo "CONFIG_FAAC=yes" >> config.mak
1315fi
1316
1ddadfa9
AT
1317if test "$xvid" = "yes" ; then
1318 echo "#define CONFIG_XVID 1" >> $TMPH
1319 echo "CONFIG_XVID=yes" >> config.mak
1320fi
1321
732d9245
BE
1322if test "$mingw32" = "yes" ; then
1323 echo "#define CONFIG_WIN32 1" >> $TMPH
1324 echo "CONFIG_WIN32=yes" >> config.mak
16806499
MN
1325 echo "HAVE_W32THREADS=yes" >> config.mak
1326 echo "#define HAVE_W32THREADS 1" >> $TMPH
7eea5766 1327 echo "#ifndef __MINGW32__" >> $TMPH
732d9245 1328 echo "#define __MINGW32__ 1" >> $TMPH
7eea5766 1329 echo "#endif" >> $TMPH
3f027ca7
FB
1330fi
1331
f3ec2d46
SG
1332if test "$os2" = "yes" ; then
1333 echo "#define CONFIG_OS2 1" >> $TMPH
1334 echo "CONFIG_OS2=yes" >> config.mak
1335fi
1336
6e023978
RS
1337if test "$TARGET_OS" = "SunOS" ; then
1338 echo "#define CONFIG_SUNOS 1" >> $TMPH
1339fi
1340
90cee0c3
MN
1341if test "$darwin" = "yes"; then
1342 echo "#define CONFIG_DARWIN 1" >> $TMPH
1343 echo "CONFIG_DARWIN=yes" >> config.mak
1344fi
1345
57514323 1346if test "$_malloc_h" = "yes" ; then
045ed63f 1347 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1348else
045ed63f 1349 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1350fi
1351
57514323 1352if test "$_memalign" = "yes" ; then
045ed63f
ZK
1353 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1354else
1355 echo "#undef HAVE_MEMALIGN" >> $TMPH
1356fi
1357
da9b170c
MN
1358if test "$memalignhack" = "yes" ; then
1359 echo "#define MEMALIGN_HACK 1" >> $TMPH
1360fi
1361
1362
26b35efb
FR
1363if test "$netserver" = "yes" ; then
1364 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1365 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1366fi
1367
4baca069
PG
1368if test "$need_inet_aton" = "yes" ; then
1369 echo "NEED_INET_ATON=yes" >> config.mak
1370fi
1371
57514323 1372if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1373 echo "#define SIMPLE_IDCT 1" >> $TMPH
1374fi
1375
8154d2e0
FB
1376if test "$ffserver" = "yes" ; then
1377 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1378 echo "CONFIG_FFSERVER=yes" >> config.mak
1379fi
1380
a86b921c
FB
1381if test "$ffplay" = "yes" ; then
1382 echo "CONFIG_FFPLAY=yes" >> config.mak
1383fi
1384
1d0d55da
MN
1385if test "$risky" = "yes" ; then
1386 echo "#define CONFIG_RISKY 1" >> $TMPH
1387 echo "CONFIG_RISKY=yes" >> config.mak
1388fi
1389
b2e3c528
MN
1390if test "$gpl" = "yes" ; then
1391 echo "#define CONFIG_GPL 1" >> $TMPH
1392 echo "CONFIG_GPL=yes" >> config.mak
1393fi
1394
c13e1abd
FH
1395echo "#define restrict $_restrict" >> $TMPH
1396
bb801c97
MN
1397if test "$optimize" = "small"; then
1398 echo "#define always_inline" >> $TMPH
1399fi
1400
0f3cb305
FB
1401# build tree in object directory if source path is different from current one
1402if test "$source_path_used" = "yes" ; then
a382b927 1403 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
5f6b58de
MR
1404 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1405 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
1406 for dir in $DIRS ; do
1407 mkdir -p $dir
1408 done
1409 for f in $FILES ; do
1410 ln -sf $source_path/$f $f
1411 done
1412fi
1413echo "SRC_PATH=$source_path" >> config.mak
1414
d663a1fd
MN
1415if test "$amr_wb" = "yes" ; then
1416 echo "#define AMR_WB 1" >> $TMPH
1417 echo "AMR_WB=yes" >> config.mak
1418 echo
1419 echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1420 echo "V5.1.0 from "
1421 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1422 echo "and extracted the source to libavcodec/amrwb_float"
1423 echo
1424fi
1425
891f64b3 1426if test "$amr_nb" = "yes" ; then
1427 echo "#define AMR_NB 1" >> $TMPH
1428 echo "AMR_NB=yes" >> config.mak
1429 echo
bc634f6f
ZK
1430if test "$amr_nb_fixed" = "yes" ; then
1431 echo "AMR_NB_FIXED=yes" >> config.mak
1432 echo "#define AMR_NB_FIXED 1" >> $TMPH
1433 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1434 echo "REL-5 version 5.1.0 from "
184582de 1435 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
891f64b3 1436 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1437 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1438 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1439 echo
1440else
1441 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1442 echo "REL-5 V5.1.0 from "
184582de 1443 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
bc634f6f 1444 echo "and extracted the source to libavcodec/amr_float"
821e46f4 1445 echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
891f64b3 1446 echo
1447fi
1448
bc634f6f
ZK
1449fi
1450
a7c02e25 1451diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
1452if test $? -ne 0 ; then
1453 mv -f $TMPH config.h
3d204385 1454else
045ed63f 1455 echo "config.h is unchanged"
3d204385
NK
1456fi
1457
f3ec2d46 1458rm -f $TMPO $TMPC $TMPE $TMPS $TMPH