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