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