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