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