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