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