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