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