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