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