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