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