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