NuppelVideo/MythTVVideo support, including rtjpeg decoder
[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]"
1d67a1d4 17echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
29799f8b
DB
18echo " --mandir=DIR install man page in DIR [PREFIX/man]"
19echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]"
20echo " --enable-libogg enable Ogg support via libogg [default=no]"
21echo " --enable-vorbis enable Vorbis support via libvorbis [default=no]"
22echo " --enable-theora enable Theora support via libtheora [default=no]"
23echo " --enable-faad enable FAAD support via libfaad [default=no]"
24echo " --enable-faadbin build FAAD support with runtime linking [default=no]"
25echo " --enable-faac enable FAAC support via libfaac [default=no]"
26echo " --enable-libgsm enable GSM support via libgsm [default=no]"
27echo " --enable-xvid enable XviD support via xvidcore [default=no]"
6662ec29 28echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
29799f8b 29echo " --enable-mingw32 enable MinGW native/cross Windows compile"
ac44871c 30echo " --enable-mingwce enable MinGW native/cross WinCE compile"
29799f8b 31echo " --enable-a52 enable GPLed A52 support [default=no]"
cf9d24ad 32echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
29799f8b
DB
33echo " --enable-dts enable GPLed DTS support [default=no]"
34echo " --enable-pp enable GPLed postprocessing support [default=no]"
320d060a
DB
35echo " --enable-static build static libraries [default=yes]"
36echo " --disable-static do not build static libraries [default=no]"
cf9d24ad 37echo " --enable-shared build shared libraries [default=no]"
320d060a 38echo " --disable-shared do not build shared libraries [default=yes]"
cf9d24ad
DC
39echo " --enable-amr_nb enable amr_nb float audio codec"
40echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
64cba748 41echo " --enable-amr_wb enable amr_wb float audio codec"
29799f8b 42echo " --enable-amr_if2 enable amr_wb IF2 audio codec"
cf9d24ad 43echo " --enable-sunmlib use Sun medialib [default=no]"
9c3d33d6 44echo " --enable-pthreads use pthreads [default=no]"
29799f8b
DB
45echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
46echo " and libraw1394 [default=no]"
47echo " --enable-gpl allow use of GPL code, the resulting libav*"
48echo " and ffmpeg will be under GPL [default=no]"
cf9d24ad
DC
49echo ""
50echo "Advanced options (experts only):"
29799f8b
DB
51echo " --source-path=PATH path to source code [$source_path]"
52echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
cf9d24ad
DC
53echo " --cc=CC use C compiler CC [$cc]"
54echo " --make=MAKE use specified make [$make]"
55echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
56echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
57echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
eb94aca9 58echo " --build-suffix=SUFFIX suffix for application specific build []"
cf9d24ad 59echo " --cpu=CPU force cpu to CPU [$cpu]"
29799f8b
DB
60echo " --tune=CPU tune code for a particular CPU"
61echo " (may fail or perform badly on other CPUs)"
62echo " --powerpc-perf-enable enable performance report on PPC"
63echo " (requires enabling PMC)"
64echo " --disable-mmx disable MMX usage"
eba9ae3c 65echo " --disable-iwmmxt disable iwmmxt usage"
cf9d24ad
DC
66echo " --disable-altivec disable AltiVec usage"
67echo " --disable-audio-oss disable OSS audio support [default=no]"
68echo " --disable-audio-beos disable BeOS audio support [default=no]"
69echo " --disable-v4l disable video4linux grabbing [default=no]"
0a7b514f 70echo " --disable-v4l2 disable video4linux2 grabbing [default=no]"
6beefa40 71echo " --disable-bktr disable bktr video grabbing [default=no]"
cf9d24ad
DC
72echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
73echo " --disable-network disable network support [default=no]"
74echo " --disable-zlib disable zlib [default=no]"
e0f80bd7 75echo " --disable-lzo disable lzo [default=no]"
cf9d24ad
DC
76echo " --disable-simple_idct disable simple IDCT routines [default=no]"
77echo " --disable-vhook disable video hooking support"
78echo " --enable-gprof enable profiling with gprof [$gprof]"
79echo " --disable-debug disable debugging symbols"
80echo " --disable-opts disable compiler optimizations"
81echo " --disable-mpegaudio-hp faster (but less accurate)"
29799f8b 82echo " MPEG audio decoding [default=no]"
04f46ced 83echo " --disable-protocols disable I/O protocols support [default=no]"
cf9d24ad
DC
84echo " --disable-ffserver disable ffserver build"
85echo " --disable-ffplay disable ffplay build"
cf9d24ad 86echo " --enable-small optimize for size instead of speed"
da9b170c 87echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
65d1bea2 88echo " --disable-strip disable stripping of executables and shared libraries"
f593b273
DB
89echo " --disable-encoder=NAME disables encoder NAME"
90echo " --enable-encoder=NAME enables encoder NAME"
91echo " --disable-decoder=NAME disables decoder NAME"
92echo " --enable-decoder=NAME enables decoder NAME"
009cf97d 93echo " --disable-encoders disables all encoders"
b4cad537 94echo " --disable-decoders disables all decoders"
a9e35095
DB
95echo " --disable-muxers disables all muxers"
96echo " --disable-demuxers disables all demuxers"
cf9d24ad 97echo ""
29799f8b 98echo "NOTE: Object files are built at the place where configure is launched."
cf9d24ad
DC
99exit 1
100fi
101
0f3cb305 102# set temporary file name
57514323 103if test ! -z "$TMPDIR" ; then
0f3cb305 104 TMPDIR1="${TMPDIR}"
57514323 105elif test ! -z "$TEMPDIR" ; then
0f3cb305 106 TMPDIR1="${TEMPDIR}"
3d204385 107else
0f3cb305 108 TMPDIR1="/tmp"
3d204385
NK
109fi
110
0f3cb305
FB
111TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
112TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 113TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
114TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
115TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
116
de6d9b64
FB
117# default parameters
118prefix="/usr/local"
cc973ecb 119libdir=""
1d67a1d4 120incdir=""
23a65308 121mandir=""
951bf3e6 122bindir=""
0f3cb305 123cross_prefix=""
de6d9b64
FB
124cc="gcc"
125ar="ar"
be7109c1 126ranlib="ranlib"
4a908fbc 127make="make"
0f3cb305 128strip="strip"
de6d9b64 129cpu=`uname -m`
a4adb608 130tune="generic"
e45a2872 131powerpc_perf="no"
0f3cb305 132mmx="default"
eba9ae3c 133iwmmxt="default"
ab6c65f6 134altivec="default"
d46aba26 135mmi="default"
de6d9b64 136case "$cpu" in
ef0bc4c9 137 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 138 cpu="x86"
de6d9b64 139 ;;
7bf9648e
JM
140 x86_64|amd64)
141 cpu="x86"
142 canon_arch="`cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
143 if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
144 if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
145 cpu="x86_64"
146 fi
053dea12
AJ
147 fi
148 ;;
93caefc7
AB
149 # armv4l is a subset of armv5tel
150 armv4l|armv5tel)
6ed7422a 151 cpu="armv4l"
6ed7422a 152 ;;
91d1f1a4
NK
153 alpha)
154 cpu="alpha"
91d1f1a4 155 ;;
90448512 156 "Power Macintosh"|ppc|powerpc)
90cee0c3
MN
157 cpu="powerpc"
158 ;;
67860b26 159 mips|mipsel)
d46aba26
LS
160 cpu="mips"
161 ;;
bb476ff3 162 sun4u|sparc64)
a7beab73
RS
163 cpu="sparc64"
164 ;;
bb476ff3
JM
165 sparc)
166 cpu="sparc"
167 ;;
bdb2e37c
AB
168 sh4)
169 cpu="sh4"
170 ;;
67860b26
SH
171 parisc|parisc64)
172 cpu="parisc"
173 ;;
174 s390|s390x)
175 cpu="s390"
176 ;;
177 m68k)
178 cpu="m68k"
179 ;;
180 ia64)
181 cpu="ia64"
182 ;;
de6d9b64 183 *)
0f3cb305 184 cpu="unknown"
de6d9b64
FB
185 ;;
186esac
187gprof="no"
5cbcf02c 188v4l="yes"
0a7b514f 189v4l2="yes"
6beefa40 190bktr="no"
5cbcf02c 191audio_oss="yes"
dfdfa47c 192audio_beos="no"
8aa3ee32 193dv1394="yes"
f02be79d 194dc1394="no"
5cbcf02c 195network="yes"
0147f198 196zlib="yes"
e0f80bd7 197lzo="yes"
bb4c2140 198libgsm="no"
a6741398 199mp3lame="no"
9146ca37 200libogg="no"
81e0d0b4 201vorbis="no"
5c5dea3f 202theora="no"
0fc50e58
ZK
203faad="no"
204faadbin="no"
29d48296 205faac="no"
1ddadfa9 206xvid="no"
6662ec29 207x264="no"
ba9261e5 208a52="no"
57514323 209a52bin="no"
23c99253 210dts="no"
ba9261e5 211pp="no"
732d9245 212mingw32="no"
ac44871c 213mingwce="no"
3f027ca7 214cygwin="no"
f3ec2d46 215os2="no"
320d060a 216lstatic="yes"
83286d2a 217lshared="no"
cddf3f45
GM
218optimize="yes"
219debug="yes"
65d1bea2 220dostrip="yes"
da186ae2 221installstrip="-s"
ef0bc4c9 222extralibs="-lm"
c02dbee1 223simpleidct="yes"
0f3cb305 224bigendian="no"
7f965c1c 225inttypes="yes"
b5c950c4 226emu_fast_int="no"
a8721c09 227vhook="default"
adbc0510
PG
228dlfcn="no"
229dlopen="no"
1eb2212e 230mpegaudio_hp="yes"
f3b60109 231SHFLAGS='-shared -Wl,-soname,$@.$(LIBMAJOR)'
26b35efb 232netserver="no"
4baca069 233need_inet_aton="no"
04f46ced 234protocols="yes"
8154d2e0 235ffserver="yes"
a86b921c 236ffplay="yes"
80581e98 237LIBOBJFLAGS=""
4baca069
PG
238LDFLAGS=-Wl,--warn-common
239FFSLDFLAGS=-Wl,-E
f39e56a8 240LDCONFIG="ldconfig"
f3ec2d46
SG
241LIBPREF="lib"
242LIBSUF=".a"
4bdd05e7 243LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
f3ec2d46
SG
244SLIBPREF="lib"
245SLIBSUF=".so"
4bdd05e7 246SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
f3b60109
DB
247SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)'
248SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBMAJOR)'
951bf3e6 249EXESUF=""
eb94aca9 250BUILDSUF=""
891f64b3 251amr_nb="no"
d663a1fd 252amr_wb="no"
bc634f6f 253amr_nb_fixed="no"
2a515c08 254amr_if2="no"
f80f7964 255sunmlib="no"
9c3d33d6 256pthreads="no"
b2e3c528 257gpl="no"
da9b170c 258memalignhack="no"
a9e35095
DB
259muxers="yes"
260demuxers="yes"
ef0bc4c9
FR
261
262# OS specific
263targetos=`uname -s`
264case $targetos in
265BeOS)
266prefix="/boot/home/config"
267# helps building libavcodec
cddf3f45 268CFLAGS="-DPIC -fomit-frame-pointer"
31ba0b4d 269# 3 gcc releases known for BeOS, each with ugly bugs
b2924696 270gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
31ba0b4d
FR
271case "$gcc_version" in
2722.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
273mmx="no"
274;;
275*20010315*) echo "BeBits gcc"
276CFLAGS="$CFLAGS -fno-expensive-optimizations"
277;;
278esac
e1707f52 279SHFLAGS=-nostart
29799f8b 280# disable Linux things
e1707f52 281audio_oss="no"
5cbcf02c 282v4l="no"
0a7b514f 283v4l2="no"
8aa3ee32 284dv1394="no"
29799f8b 285# enable BeOS things
dfdfa47c 286audio_beos="yes"
ef0bc4c9
FR
287# no need for libm, but the inet stuff
288# Check for BONE
289if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
290extralibs="-lbind -lsocket"
291else
26b35efb 292netserver="yes"
4baca069 293need_inet_aton="yes"
26b35efb 294extralibs="-lnet"
ef0bc4c9 295fi ;;
4baca069
PG
296SunOS)
297v4l="no"
0a7b514f 298v4l2="no"
4baca069 299audio_oss="no"
8aa3ee32 300dv1394="no"
4baca069
PG
301make="gmake"
302LDFLAGS=""
303FFSLDFLAGS=""
304need_inet_aton="yes"
305extralibs="$extralibs -lsocket -lnsl"
306;;
b7aa4a59
SS
307NetBSD)
308v4l="no"
0a7b514f 309v4l2="no"
6beefa40 310bktr="yes"
b7aa4a59
SS
311audio_oss="yes"
312dv1394="no"
313make="gmake"
314LDFLAGS="$LDFLAGS -export-dynamic"
315case `uname -r` in
51587548 3162.*) extralibs="$extralibs -lossaudio"
b7aa4a59
SS
317;;
318esac
319;;
8c802695
JM
320OpenBSD)
321v4l="no"
0a7b514f 322v4l2="no"
6beefa40 323bktr="yes"
8c802695
JM
324audio_oss="yes"
325dv1394="no"
326make="gmake"
80581e98 327LIBOBJFLAGS="\$(PIC)"
8c802695 328LDFLAGS="$LDFLAGS -export-dynamic -pthread"
f39e56a8 329LDCONFIG="ldconfig -m \$(libdir)"
8c802695
JM
330extralibs="$extralibs -lossaudio"
331;;
9c938e77
PG
332FreeBSD)
333v4l="no"
0a7b514f 334v4l2="no"
6beefa40 335bktr="yes"
9c938e77 336audio_oss="yes"
8aa3ee32 337dv1394="no"
9c938e77 338make="gmake"
12043e1d
SS
339CFLAGS="-pthread"
340LDFLAGS="$LDFLAGS -export-dynamic -pthread"
9c938e77 341;;
4a908fbc 342BSD/OS)
5cbcf02c 343v4l="no"
0a7b514f 344v4l2="no"
6beefa40 345bktr="yes"
6063bce7 346audio_oss="yes"
8aa3ee32 347dv1394="no"
4a908fbc
AB
348extralibs="-lpoll -lgnugetopt -lm"
349make="gmake"
1db68540
SS
350strip="strip -d"
351installstrip=""
4a908fbc 352;;
90cee0c3 353Darwin)
a43bd1d7 354cc="cc"
90cee0c3 355v4l="no"
0a7b514f 356v4l2="no"
90cee0c3 357audio_oss="no"
8aa3ee32 358dv1394="no"
fb3d46da 359SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
90cee0c3 360extralibs=""
a43bd1d7 361darwin="yes"
47930f09 362strip="strip -x"
da186ae2 363installstrip=""
4e159595
DB
364LDFLAGS="-Wl,-dynamic,-search_paths_first"
365SLIBSUF=".dylib"
f3b60109
DB
366SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
367SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
4baca069 368FFSLDFLAGS=-Wl,-bind_at_load
90cee0c3 369;;
732d9245 370MINGW32*)
951bf3e6 371# Note: the rest of the mingw32 config is done afterwards as mingw32
29799f8b 372# can be forced on the command line for Linux cross compilation.
732d9245
BE
373mingw32="yes"
374;;
3f027ca7
FB
375CYGWIN*)
376v4l="no"
0a7b514f 377v4l2="no"
3f027ca7 378audio_oss="yes"
8aa3ee32 379dv1394="no"
50827fcf 380vhook="no"
3f027ca7
FB
381extralibs=""
382cygwin="yes"
487c2fad 383EXESUF=".exe"
3f027ca7 384;;
b55e4ef4 385Linux)
4baca069 386LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 387;;
99614dd4
MB
388IRIX*)
389ranlib="echo ignoring ranlib"
390v4l="no"
0a7b514f 391v4l2="no"
99614dd4
MB
392audio_oss="no"
393make="gmake"
394;;
f3ec2d46
SG
395OS/2)
396TMPE=$TMPE".exe"
3ca4b654 397ar="emxomfar -p128"
69db4e10
SG
398ranlib="echo ignoring ranlib"
399strip="echo ignoring strip"
cddf3f45 400CFLAGS="-Zomf"
69db4e10 401LDFLAGS="-Zomf -Zstack 16384 -s"
3ca4b654 402SHFLAGS="-Zdll -Zomf"
f3ec2d46
SG
403FFSLDFLAGS=""
404LIBPREF=""
405LIBSUF=".lib"
406SLIBPREF=""
407SLIBSUF=".dll"
951bf3e6 408EXESUF=".exe"
f3ec2d46 409extralibs=""
c99dd233 410pkg_requires=""
f3ec2d46 411v4l="no"
0a7b514f 412v4l2="no"
f3ec2d46 413audio_oss="no"
8aa3ee32 414dv1394="no"
f3ec2d46 415ffserver="no"
3ca4b654 416vhook="no"
f3ec2d46 417os2="yes"
3ca4b654 418
f3ec2d46 419;;
ef0bc4c9
FR
420*) ;;
421esac
de6d9b64 422
29799f8b 423# From MPlayer configure. We need TARGET_OS available
6852ac95 424# to the Makefile, so it can distinguish between flavors
29799f8b 425# of AltiVec on PowerPC.
6852ac95
RD
426TARGET_OS=`( uname -s ) 2>&1`
427 case "$TARGET_OS" in
90448512 428 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
6852ac95
RD
429 ;;
430 IRIX*)
431 TARGET_OS=IRIX
432 ;;
433 HP-UX*)
434 TARGET_OS=HP-UX
435 ;;
436 [cC][yY][gG][wW][iI][nN]*)
437 TARGET_OS=CYGWIN
438 ;;
439 *)
440 TARGET_OS="$TARGET_OS-UNKNOWN"
441 ;;
442 esac
443
0f3cb305 444# find source path
6942d002 445source_path="`dirname $0`"
0f3cb305
FB
446source_path_used="yes"
447if test -z "$source_path" -o "$source_path" = "." ; then
448 source_path=`pwd`
449 source_path_used="no"
e7a4dafb
MR
450else
451 source_path="`cd \"$source_path\"; pwd`"
de6d9b64
FB
452fi
453
f255e0ab
MB
454FFMPEG_CONFIGURATION=" "
455for opt do
456 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
457done
458
24a9ad7e 459CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
009cf97d 460
de6d9b64
FB
461for opt do
462 case "$opt" in
eba9ae3c 463 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
de6d9b64 464 ;;
eba9ae3c 465 --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
cc973ecb 466 ;;
1d67a1d4
DB
467 --incdir=*) incdir=`echo $opt | cut -d '=' -f 2`;
468 ;;
23a65308
FB
469 --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
470 ;;
0f3cb305
FB
471 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
472 ;;
473 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
474 ;;
eba9ae3c 475 --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
de6d9b64 476 ;;
4a908fbc
AB
477 --make=*) make=`echo $opt | cut -d '=' -f 2`
478 ;;
f4e2c4b1 479 --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
0f3cb305 480 ;;
f4e2c4b1 481 --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
0f3cb305
FB
482 ;;
483 --extra-libs=*) extralibs=${opt#--extra-libs=}
484 ;;
eb94aca9
CY
485 --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
486 ;;
de6d9b64
FB
487 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
488 ;;
a4adb608
MN
489 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
490 ;;
e45a2872
RD
491 --powerpc-perf-enable) powerpc_perf="yes"
492 ;;
de6d9b64
FB
493 --disable-mmx) mmx="no"
494 ;;
eba9ae3c
GB
495 --disable-iwmmxt) iwmmxt="no"
496 ;;
ab6c65f6
BF
497 --disable-altivec) altivec="no"
498 ;;
de6d9b64
FB
499 --enable-gprof) gprof="yes"
500 ;;
5cbcf02c
FB
501 --disable-v4l) v4l="no"
502 ;;
0a7b514f
LA
503 --disable-v4l2) v4l2="no"
504 ;;
6beefa40
MN
505 --disable-bktr) bktr="no"
506 ;;
5cbcf02c
FB
507 --disable-audio-oss) audio_oss="no"
508 ;;
dfdfa47c
FR
509 --disable-audio-beos) audio_beos="no"
510 ;;
8aa3ee32
MK
511 --disable-dv1394) dv1394="no"
512 ;;
ffc0ef96 513 --disable-network) network="no"; ffserver="no"
5cbcf02c 514 ;;
0147f198
FR
515 --disable-zlib) zlib="no"
516 ;;
e0f80bd7
RD
517 --disable-lzo) lzo="no"
518 ;;
ba9261e5 519 --enable-a52) a52="yes"
6ed7422a 520 ;;
bfd2edeb 521 --enable-a52bin) a52bin="yes"
57514323 522 ;;
c99dd233 523 --enable-dts) dts="yes"
524 extralibs="$extralibs -ldts"
23c99253 525 ;;
ba9261e5 526 --enable-pp) pp="yes"
bba9b16c 527 ;;
bb4c2140 528 --enable-libgsm) libgsm="yes"
c99dd233 529 extralibs="$extralibs -lgsm"
bb4c2140 530 ;;
c99dd233 531 --enable-mp3lame) mp3lame="yes"
532 extralibs="$extralibs -lmp3lame"
a6741398 533 ;;
9146ca37 534 --enable-libogg) libogg="yes"
c99dd233 535 extralibs="$extralibs -logg"
536 pkg_requires="$pkg_requires ogg >= 1.1"
5c5dea3f 537 ;;
81e0d0b4 538 --enable-vorbis) vorbis="yes"
c99dd233 539 extralibs="$extralibs -lvorbis -lvorbisenc"
540 pkg_requires="$pkg_requires vorbis vorbisenc"
81e0d0b4 541 ;;
5c5dea3f 542 --enable-theora) theora="yes"
c99dd233 543 extralibs="$extralibs -ltheora"
544 pkg_requires="$pkg_requires theora"
5c5dea3f 545 ;;
445ad18d 546 --enable-faad) faad="yes"
c99dd233 547 extralibs="$extralibs -lfaad"
445ad18d
ZK
548 ;;
549 --enable-faadbin) faadbin="yes"
550 ;;
c99dd233 551 --enable-faac) faac="yes"
552 extralibs="$extralibs -lfaac"
29d48296 553 ;;
1ddadfa9 554 --enable-xvid) xvid="yes"
c99dd233 555 extralibs="$extralibs -lxvidcore"
1ddadfa9 556 ;;
c99dd233 557 --enable-x264) x264="yes"
558 extralibs="$extralibs -lx264"
6662ec29 559 ;;
f02be79d 560 --enable-dc1394) dc1394="yes"
c99dd233 561 extralibs="$extralibs -ldc1394_control -lraw1394"
562 pkg_requires="$pkg_requires libraw1394"
f02be79d 563 ;;
68892110
PG
564 --disable-vhook) vhook="no"
565 ;;
c02dbee1 566 --disable-simple_idct) simpleidct="no"
045ed63f 567 ;;
732d9245
BE
568 --enable-mingw32) mingw32="yes"
569 ;;
ac44871c
GB
570 --enable-mingwce) mingwce="yes"
571 ;;
320d060a
DB
572 --enable-static) lstatic="yes"
573 ;;
574 --disable-static) lstatic="no"
575 ;;
83286d2a 576 --enable-shared) lshared="yes"
0319c531 577 ;;
320d060a
DB
578 --disable-shared) lshared="no"
579 ;;
cddf3f45
GM
580 --disable-debug) debug="no"
581 ;;
582 --disable-opts) optimize="no"
583 ;;
1eb2212e
FB
584 --disable-mpegaudio-hp) mpegaudio_hp="no"
585 ;;
04f46ced
GB
586 --disable-protocols) protocols="no"; network="no"; ffserver="no"
587 ;;
8154d2e0
FB
588 --disable-ffserver) ffserver="no"
589 ;;
a86b921c
FB
590 --disable-ffplay) ffplay="no"
591 ;;
cddf3f45 592 --enable-small) optimize="small"
553a6284 593 ;;
891f64b3 594 --enable-amr_nb) amr_nb="yes"
595 ;;
bc634f6f
ZK
596 --enable-amr_nb-fixed) amr_nb_fixed="yes"
597 ;;
64cba748 598 --enable-amr_wb) amr_wb="yes"
115329f1 599 ;;
2a515c08
TM
600 --enable-amr_if2) amr_if2="yes"
601 ;;
f80f7964
RS
602 --enable-sunmlib) sunmlib="yes"
603 ;;
9c3d33d6
MN
604 --enable-pthreads) pthreads="yes"
605 ;;
b2e3c528
MN
606 --enable-gpl) gpl="yes"
607 ;;
da9b170c
MN
608 --enable-memalign-hack) memalignhack="yes"
609 ;;
65d1bea2
MB
610 --disable-strip) dostrip="no"
611 ;;
f593b273 612 --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
009cf97d 613 ;;
f593b273
DB
614 --enable-decoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-decoder=}_decoder"
615 ;;
616 --disable-encoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-encoder=}_encoder##\"`"
617 ;;
618 --disable-decoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-decoder=}_decoder##\"`"
009cf97d
MN
619 ;;
620 --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
621 ;;
b4cad537
EP
622 --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
623 ;;
04f46ced 624 --disable-muxers) muxers="no"; ffserver="no"
a9e35095
DB
625 ;;
626 --disable-demuxers) demuxers="no"
627 ;;
b34c63f7
DB
628 *)
629 echo "Unknown option \"$opt\"."
630 echo "See $0 --help for available options."
631 exit 1
632 ;;
de6d9b64
FB
633 esac
634done
635
320d060a
DB
636# we need to build at least one lib type
637if test "$lstatic" = "no" && test "$lshared" = "no" ; then
638 cat <<EOF
639At least one library type must be built.
640Specify --enable-static to build the static libraries or --enable-shared to
641build the shared libraries as well. To only build the shared libraries specify
642--disable-static in addition to --enable-shared.
643EOF
644 exit 1;
645fi
646
5c5dea3f 647if test "$theora" = "yes" ; then
9146ca37 648 if test "$libogg" = "no"; then
29799f8b 649 echo "libogg must be enabled to enable Theora."
5c5dea3f
NB
650 fail="yes"
651 theora="no"
652 fi
653fi
654
655if test "$vorbis" = "yes" ; then
9146ca37 656 if test "$libogg" = "no"; then
29799f8b 657 echo "libogg must be enabled to enable Vorbis."
5c5dea3f
NB
658 fail="yes"
659 vorbis="no"
660 fi
661fi
662
b2e3c528 663if test "$gpl" != "yes"; then
ba64106a 664 if test "$pp" != "no"; then
29799f8b 665 echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
b2e3c528
MN
666 fail="yes"
667 fi
668
669 if test "$a52" != "no" -o "$a52bin" != "no"; then
29799f8b 670 echo "liba52 is under GPL and --enable-gpl is not specified."
b2e3c528
MN
671 fail="yes"
672 fi
23c99253 673
1ddadfa9 674 if test "$xvid" != "no"; then
29799f8b 675 echo "libxvidcore is under GPL and --enable-gpl is not specified."
1ddadfa9
AT
676 fail="yes"
677 fi
678
6662ec29 679 if test "$x264" != "no"; then
29799f8b 680 echo "x264 is under GPL and --enable-gpl is not specified."
6662ec29
MN
681 fail="yes"
682 fi
683
23c99253 684 if test "$dts" != "no"; then
29799f8b 685 echo "libdts is under GPL and --enable-gpl is not specified."
23c99253
MN
686 fail="yes"
687 fi
115329f1 688
b2e3c528
MN
689 if test "$faad" != "no" -o "$faadbin" != "no"; then
690 cat > $TMPC << EOF
691 #include <faad.h>
692 int main( void ) { return 0; }
693EOF
115329f1 694
b2e3c528
MN
695 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
696 cat > $TMPC << EOF
697 #include <faad.h>
698 #ifndef FAAD2_VERSION
699 ok faad1
700 #endif
701 int main( void ) { return 0; }
702EOF
703 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
29799f8b 704 echo "FAAD2 is under GPL and --enable-gpl is not specified."
b2e3c528
MN
705 fail="yes"
706 fi
707 else
708 faad="no"
709 faadbin="no"
29799f8b 710 echo "FAAD test failed."
b2e3c528
MN
711 fi
712 fi
115329f1 713
b2e3c528 714
a18b5183 715 if test "$fail" = "yes"; then
b2e3c528
MN
716 exit 1
717 fi
718fi
719
29799f8b 720# compute MMX state
0f3cb305 721if test $mmx = "default"; then
053dea12 722 if test $cpu = "x86" -o $cpu = "x86_64"; then
0f3cb305
FB
723 mmx="yes"
724 else
725 mmx="no"
726 fi
727fi
728
eba9ae3c
GB
729# check iwmmxt support
730if test $iwmmxt = "default" -a $cpu = "armv4l"; then
731 cat > $TMPC << EOF
115329f1 732 int main(void) {
eba9ae3c
GB
733 __asm__ __volatile__ ("wunpckelub wr6, wr4");
734 }
735EOF
736
737 iwmmxt=no
738 if ${cross_prefix}${cc} -o $TMPO $TMPC 2> /dev/null ; then
739 iwmmxt=yes
740 fi
741fi
742
cf9d24ad 743#Darwin CC versions
75388c74 744needmdynamicnopic="no"
cf9d24ad 745if test $targetos = Darwin; then
b2924696 746 if test -n "`$cc -v 2>&1 | grep xlc`"; then
bb270c08 747 CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
cf9d24ad 748 else
bb270c08
DB
749 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
750 case "$gcc_version" in
751 *2.95*)
752 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
753 ;;
754 *[34].*)
755 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
756 if test "$lshared" = no; then
757 needmdynamicnopic="yes"
758 fi
759 ;;
760 *)
761 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
762 if test "$lshared" = no; then
763 needmdynamicnopic="yes"
764 fi
765 ;;
766 esac
cf9d24ad
DC
767 fi
768fi
769
ab6c65f6
BF
770# Can only do AltiVec on PowerPC
771if test $altivec = "default"; then
772 if test $cpu = "powerpc"; then
773 altivec="yes"
774 else
775 altivec="no"
776 fi
777fi
778
a4adb608
MN
779# Add processor-specific flags
780TUNECPU="generic"
9007f514 781POWERPCMODE="32bits"
a4adb608
MN
782if test $tune != "generic"; then
783 case $tune in
bb270c08
DB
784 601|ppc601|PowerPC601)
785 CFLAGS="$CFLAGS -mcpu=601"
786 if test $altivec = "yes"; then
787 echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
788 fi
789 TUNECPU=ppc601
790 ;;
791 603*|ppc603*|PowerPC603*)
792 CFLAGS="$CFLAGS -mcpu=603"
793 if test $altivec = "yes"; then
794 echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
795 fi
796 TUNECPU=ppc603
797 ;;
798 604*|ppc604*|PowerPC604*)
799 CFLAGS="$CFLAGS -mcpu=604"
800 if test $altivec = "yes"; then
801 echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
802 fi
803 TUNECPU=ppc604
804 ;;
805 G3|g3|75*|ppc75*|PowerPC75*)
806 CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
807 if test $altivec = "yes"; then
808 echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
809 fi
810 TUNECPU=ppc750
811 ;;
812 G4|g4|745*|ppc745*|PowerPC745*)
813 CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
814 if test $altivec = "no"; then
815 echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
816 fi
817 TUNECPU=ppc7450
818 ;;
819 74*|ppc74*|PowerPC74*)
820 CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
821 if test $altivec = "no"; then
822 echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
823 fi
824 TUNECPU=ppc7400
825 ;;
826 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
827 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
828 if test $altivec = "no"; then
829 echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
830 fi
831 TUNECPU=ppc970
9007f514 832 POWERPCMODE="64bits"
bb270c08
DB
833 ;;
834 i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6|k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6|winchip2|c3|nocona|athlon64|k8|opteron|athlon-fx)
835 CFLAGS="$CFLAGS -march=$tune"
836 ;;
837 *)
838 echo "WARNING: Unknown CPU \"$tune\", ignored."
839 ;;
a4adb608
MN
840 esac
841fi
842
115329f1 843# AltiVec flags: The FSF version of GCC differs from the Apple version
b6e52719
MD
844if test $cpu = "powerpc"; then
845 if test $altivec = "yes"; then
b2924696 846 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
49f1a349 847 CFLAGS="$CFLAGS -faltivec"
b6e52719
MD
848 else
849 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
850 fi
851 fi
852fi
853
29799f8b 854# check if we have <altivec.h>
a9a07762
MN
855cat > $TMPC << EOF
856#include <altivec.h>
857int main( void ) { return 0; }
858EOF
859
860_altivec_h="no"
b6e52719 861if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
a9a07762
MN
862_altivec_h="yes"
863fi
864
29799f8b 865# check if our compiler supports Motorola AltiVec C API
ab6c65f6 866if test $altivec = "yes"; then
a9a07762 867if test $_altivec_h = "yes"; then
ab6c65f6 868cat > $TMPC << EOF
a9a07762 869#include <altivec.h>
ab6c65f6
BF
870int main(void) {
871 vector signed int v1, v2, v3;
872 v1 = vec_add(v2,v3);
873 return 0;
874}
875EOF
a9a07762
MN
876else
877cat > $TMPC << EOF
878int main(void) {
879 vector signed int v1, v2, v3;
880 v1 = vec_add(v2,v3);
881 return 0;
882}
883EOF
884fi
b6e52719 885$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
ab6c65f6
BF
886fi
887
29799f8b 888# mmi only available on mips
d46aba26
LS
889if test $mmi = "default"; then
890 if test $cpu = "mips"; then
891 mmi="yes"
892 else
893 mmi="no"
894 fi
895fi
896
29799f8b 897# check if our compiler supports mmi
d46aba26
LS
898if test $mmi = "yes"; then
899cat > $TMPC << EOF
900int main(void) {
901 __asm__ ("lq \$2, 0(\$2)");
902 return 0;
903}
904EOF
f3ec2d46 905$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
906fi
907
ac44871c 908if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
320d060a
DB
909 if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
910 cat <<EOF
911You can only build one library type at once on MinGW.
912Specify --disable-static --enable-shared to only build
913the shared libraries. To build only the static libraries
914you don't need to pass additional options.
915EOF
916 exit 1
917 fi
732d9245 918 v4l="no"
0a7b514f 919 v4l2="no"
6beefa40 920 bktr="no"
732d9245 921 audio_oss="no"
8aa3ee32 922 dv1394="no"
f02be79d 923 dc1394="no"
951bf3e6 924 ffserver="no"
732d9245 925 network="no"
0e8b594f 926if test "$mingwce" = "yes"; then
ac44871c
GB
927 protocols="no"
928fi
951bf3e6
FB
929 SLIBPREF=""
930 SLIBSUF=".dll"
931 EXESUF=".exe"
eba9ae3c
GB
932 if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
933 if test "$force_libdir" != yes; then bindir="$prefix"; fi
732d9245
BE
934fi
935
0f3cb305
FB
936cc="${cross_prefix}${cc}"
937ar="${cross_prefix}${ar}"
be7109c1 938ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
939strip="${cross_prefix}${strip}"
940
487a54d7
FB
941if test -z "$cross_prefix" ; then
942
3d204385 943# ---
29799f8b 944# big/little-endian test
a3999908
MN
945cat > $TMPC << EOF
946#include <inttypes.h>
947int main(int argc, char ** argv){
bb270c08
DB
948 volatile uint32_t i=0x01234567;
949 return (*((uint8_t*)(&i))) == 0x67;
a3999908
MN
950}
951EOF
952
f3ec2d46
SG
953if $cc -o $TMPE $TMPC 2>/dev/null ; then
954$TMPE && bigendian="yes"
a3999908
MN
955else
956echo big/little test failed
957fi
958
487a54d7
FB
959else
960
29799f8b 961# programs cannot be launched if cross compiling, so make a static guess
487a54d7
FB
962if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
963 bigendian="yes"
964fi
965
966fi
967
a3999908 968# ---
7f965c1c
CF
969# *inttypes.h* test
970cat > $TMPC << EOF
971#include <inttypes.h>
972int main(int argc, char ** argv){
973 return 0;
974}
975EOF
976
977$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
978
979# ---
b5c950c4
MN
980# *int_fast* test
981cat > $TMPC << EOF
982#include <inttypes.h>
983int main(int argc, char ** argv){
bb270c08
DB
984 volatile uint_fast64_t i=0x01234567;
985 return 0;
b5c950c4
MN
986}
987EOF
988
989$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
990
991# ---
3d204385
NK
992# check availability of some header files
993
994cat > $TMPC << EOF
995#include <malloc.h>
996int main( void ) { return 0; }
997EOF
998
999_memalign=no
1000_malloc_h=no
f3ec2d46 1001if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
1002_malloc_h=yes
1003_memalign=yes
1004# check for memalign - atmos
1005cat > $TMPC << EOF
487c2fad 1006#include <stdio.h>
3d204385
NK
1007#include <malloc.h>
1008int main ( void ) {
1009char *string = NULL;
1010string = memalign(64, sizeof(char));
1011return 0;
1012}
1013EOF
f3ec2d46 1014$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
1015fi
1016
8bf5d58f 1017if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
29799f8b 1018 echo "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
8bf5d58f
MN
1019 exit 1
1020fi
1021
68892110 1022cat > $TMPC << EOF
5e4639e2
GM
1023#include <time.h>
1024int main( void ) { localtime_r(NULL, NULL); }
1025EOF
1026
1027localtime_r=no
1028if $cc -o $TMPE $TMPC 2> /dev/null ; then
1029 localtime_r=yes
1030fi
1031
0147f198
FR
1032if test "$zlib" = "yes"; then
1033# check for zlib - mmu_man
1034cat > $TMPC << EOF
1035#include <zlib.h>
1036int main ( void ) {
1037if (zlibVersion() != ZLIB_VERSION)
1038 puts("zlib version differs !!!");
1039 return 1;
1040return 0;
1041}
1042EOF
e27ca59b 1043$cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
f3ec2d46 1044# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
1045# XXX: more tests needed - runtime test
1046fi
1047if test "$zlib" = "yes"; then
1048extralibs="$extralibs -lz"
1049fi
1050
e0f80bd7
RD
1051if test "$lzo" = "yes" -a "$gpl" = "yes"; then
1052# check for liblzo
1053cat > $TMPC << EOF
1054#include <lzo1x.h>
1055int main ( void ) {
1056lzo_init();
1057return 0;
1058}
1059EOF
1060$cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -llzo 2> /dev/null || lzo="no"
1061else
1062lzo="no"
1063fi
1064if test "$lzo" = "yes"; then
1065extralibs="$extralibs -llzo"
1066fi
1067
95e2ce4a
MN
1068# test for lrintf in math.h
1069cat > $TMPC << EOF
1070#define _ISOC9X_SOURCE 1
1071#include <math.h>
1072int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1073EOF
1074
1075have_lrintf="no"
96277634 1076if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC $extralibs 2> /dev/null ; then
95e2ce4a 1077 have_lrintf="yes"
c2b9685e
MN
1078 # allanc@chickenandporn.com: cannot execute cross-compiled
1079 # code on the host. Only execute if not cross-compiling.
1080 if test -z "$cross_prefix" ; then
1081 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
1082 fi
95e2ce4a
MN
1083fi
1084
c13e1abd
FH
1085_restrict=
1086for restrict_keyword in restrict __restrict__ __restrict; do
1087 echo "void foo(char * $restrict_keyword p);" > $TMPC
1088 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
1089 _restrict=$restrict_keyword
1090 break;
1091 fi
1092done
1093
52b41d7f
FB
1094# test gcc version to see if vector builtins can be used
1095# currently only used on i386 for MMX builtins
1096cat > $TMPC << EOF
053dea12 1097#include <xmmintrin.h>
115329f1 1098int main(void) {
52b41d7f
FB
1099#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
1100return 0;
1101#else
1102#error no vector builtins
1103#endif
1104}
1105EOF
1106
1107builtin_vector=no
13c2469d 1108if $cc -msse -o $TMPO $TMPC 2> /dev/null ; then
52b41d7f 1109 builtin_vector=yes
a8721c09
FB
1110fi
1111
82eb4b0f
ZM
1112# test for mm3dnow.h
1113cat > $TMPC << EOF
1114#include <mm3dnow.h>
1115int main(void) {
1116return 0;
1117}
1118EOF
1119
1120mm3dnow=no
1121if $cc -march=athlon -o $TMPO $TMPC 2> /dev/null ; then
1122 mm3dnow=yes
1123fi
1124
9f23a10a 1125# Probe for -Wdeclaration-after-statement
e3880318 1126if test "$cc" = "gcc"; then
9f23a10a
MB
1127 cat > $TMPC << EOF
1128 int main( void ) { return 0; }
1129EOF
1130
1131 if $cc -Wdeclaration-after-statement -Werror -o $TMPE $TMPC 2> /dev/null ; then
1132 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1133 fi
1134fi
1135
a8721c09
FB
1136# dlopen/dlfcn.h probing
1137
1138cat > $TMPC << EOF
1139#include <dlfcn.h>
1140int main( void ) { return (int) dlopen("foo", 0); }
1141EOF
1142
1143ldl=-ldl
1144
fd2ab74a 1145if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
1146dlfcn=yes
1147dlopen=yes
1148fi
1149
fd2ab74a 1150if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
1151dlfcn=yes
1152dlopen=yes
1153ldl=""
1154fi
1155
1156cat > $TMPC << EOF
1157int main( void ) { return (int) dlopen("foo", 0); }
1158EOF
1159
fd2ab74a 1160if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
1161dlopen=yes
1162fi
1163
fd2ab74a 1164if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
1165dlopen=yes
1166ldl=""
1167fi
1168
1169if test "$vhook" = "default" ; then
1170 vhook="$dlopen"
1171fi
1172
bfd2edeb
MN
1173if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
1174 extralibs="$extralibs $ldl"
1175fi
1176
1177
a86b921c 1178##########################################
29799f8b 1179# imlib check
a86b921c 1180
a8721c09
FB
1181cat > $TMPC << EOF
1182#include <X11/Xlib.h>
1183#include <Imlib2.h>
1184int main( void ) { return (int) imlib_load_font("foo"); }
1185EOF
1186
1187imlib2=no
56b04ceb 1188if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
a8721c09 1189imlib2=yes
52b41d7f
FB
1190fi
1191
a86b921c 1192##########################################
29799f8b 1193# FreeType check
a86b921c 1194
04511d53
PG
1195cat > $TMPC << EOF
1196#include <ft2build.h>
1197int main( void ) { return (int) FT_Init_FreeType(0); }
1198EOF
1199
1200freetype2=no
e2a5fd20 1201if test "x$targetos" != "xBeOS"; then
e2a3cd59 1202 if (freetype-config --version) >/dev/null 2>&1 ; then
cf9d24ad 1203 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
dee076fc 1204 freetype2=yes
04511d53 1205 fi
dee076fc 1206 fi
04511d53
PG
1207fi
1208
a86b921c 1209##########################################
29799f8b 1210# SDL check
a86b921c
FB
1211
1212cat > $TMPC << EOF
1213#include <SDL.h>
31319a8c 1214#undef main /* We don't want SDL to override our main() */
a86b921c
FB
1215int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1216EOF
1217
1218sdl_too_old=no
1219sdl=no
e2a3cd59 1220if (sdl-config --version) >/dev/null 2>&1 ; then
cf9d24ad 1221if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
a86b921c
FB
1222_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
1223if test "$_sdlversion" -lt 121 ; then
1224sdl_too_old=yes
1225else
1226sdl=yes
1227fi
1228fi
c3f6b472 1229fi
a86b921c 1230
146ea952 1231##########################################
29799f8b 1232# texi2html check
146ea952
NB
1233
1234texi2html=no
e2a3cd59 1235if (texi2html -version) >/dev/null 2>&1; then
146ea952
NB
1236texi2html=yes
1237fi
1238
7a91333f
HZ
1239if test "$network" = "yes" ; then
1240##########################################
29799f8b 1241# IPv6 check
7a91333f
HZ
1242
1243cat > $TMPC << EOF
1244#include <sys/types.h>
1245#include <sys/socket.h>
1246#include <netinet/in.h>
1247#include <netdb.h>
1248int main( void ) {
1249 struct sockaddr_storage saddr;
1250 struct ipv6_mreq mreq6;
1251 getaddrinfo(0,0,0,0);
1252 getnameinfo(0,0,0,0,0,0,0);
12fe88b4 1253 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
7a91333f
HZ
1254}
1255EOF
1256
1257ipv6=no
1258if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
1259ipv6=yes
1260fi
1261fi
1262
47f38850
LA
1263if test "$v4l2" = "yes"; then
1264# check for video4linux2 --- V4L2_PIX_FMT_YUV420
1265cat > $TMPC << EOF
84fe9963 1266#include <sys/time.h>
47f38850
LA
1267#include <linux/videodev.h>
1268int dummy = V4L2_PIX_FMT_YUV420;
1269EOF
1270$cc -c -o $TMPE $TMPC 2> /dev/null || v4l2="no"
1271fi
1272
b2924696 1273case "`$cc -v 2>&1 | grep version`" in
cf9d24ad 1274 *gcc*)
bb270c08
DB
1275 CFLAGS="-Wall -Wno-switch $CFLAGS"
1276 ;;
cf9d24ad 1277 *)
bb270c08 1278 ;;
cf9d24ad
DC
1279esac
1280
94a3401e
FB
1281if test "$sdl" = "no" ; then
1282 ffplay=no
1283fi
1284
cddf3f45 1285if test "$debug" = "yes"; then
bb270c08 1286 CFLAGS="-g $CFLAGS"
cddf3f45
GM
1287fi
1288
1289if test "$optimize" = "small"; then
98ca7790 1290# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
1291 CFLAGS="$CFLAGS -Os"
1292fi
1293
cddf3f45 1294if test "$optimize" = "yes"; then
b2924696 1295 if test -n "`$cc -v 2>&1 | grep xlc`"; then
bb270c08
DB
1296 CFLAGS="$CFLAGS -O5"
1297 LDFLAGS="$LDFLAGS -O5"
cf9d24ad 1298 else
bb270c08 1299 CFLAGS="-O3 $CFLAGS"
cf9d24ad 1300 fi
cddf3f45
GM
1301fi
1302
80581e98
MN
1303# PIC flags for shared library objects where they are needed
1304if test "$lshared" = "yes" ; then
1305 # LIBOBJFLAGS may have already been set in the OS configuration
1306 if test -z "$LIBOBJFLAGS" ; then
9261e3eb 1307 if test "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "alpha" ; then
80581e98
MN
1308 LIBOBJFLAGS="\$(PIC)"
1309 fi
1310 fi
1311fi
1312
951bf3e6
FB
1313if test x"$bindir" = x""; then
1314bindir="${prefix}/bin"
1315fi
1316
cc973ecb
LB
1317if test x"$libdir" = x""; then
1318libdir="${prefix}/lib"
1319fi
1320
1d67a1d4 1321if test x"$incdir" = x""; then
6fe2dcd0 1322incdir="${prefix}/include/ffmpeg"
1d67a1d4
DB
1323fi
1324
23a65308
FB
1325if test x"$mandir" = x""; then
1326mandir="${prefix}/man"
1327fi
1328
29799f8b
DB
1329echo "install prefix $prefix"
1330echo "source path $source_path"
de6d9b64 1331echo "C compiler $cc"
4a908fbc 1332echo "make $make"
a4adb608 1333echo "CPU $cpu ($tune)"
eb94aca9 1334if test "$BUILDSUF" != ""; then
29799f8b 1335echo "build suffix $BUILDSUF"
eb94aca9 1336fi
29799f8b 1337echo "big-endian $bigendian"
7f965c1c 1338echo "inttypes.h $inttypes"
b5c950c4 1339echo "broken inttypes.h $emu_fast_int"
053dea12 1340if test $cpu = "x86" -o $cpu = "x86_64"; then
de6d9b64 1341echo "MMX enabled $mmx"
52b41d7f 1342echo "Vector Builtins $builtin_vector"
82eb4b0f 1343echo "3DNow! Builtins $mm3dnow"
e41e8342 1344fi
eba9ae3c
GB
1345if test $cpu = "armv4l"; then
1346echo "IWMMXT enabled $iwmmxt"
1347fi
e41e8342 1348if test $cpu = "mips"; then
d46aba26 1349echo "MMI enabled $mmi"
e41e8342
FB
1350fi
1351if test $cpu = "powerpc"; then
ab6c65f6 1352echo "AltiVec enabled $altivec"
e41e8342 1353fi
de6d9b64 1354echo "gprof enabled $gprof"
0147f198 1355echo "zlib enabled $zlib"
e0f80bd7 1356echo "lzo enabled $lzo"
bb4c2140 1357echo "libgsm enabled $libgsm"
a6741398 1358echo "mp3lame enabled $mp3lame"
9146ca37 1359echo "libogg enabled $libogg"
29799f8b
DB
1360echo "Vorbis enabled $vorbis"
1361echo "Theora enabled $theora"
1362echo "FAAD enabled $faad"
445ad18d 1363echo "faadbin enabled $faadbin"
29799f8b
DB
1364echo "FAAC enabled $faac"
1365echo "XviD enabled $xvid"
6662ec29 1366echo "x264 enabled $x264"
5cbcf02c 1367echo "a52 support $a52"
57514323 1368echo "a52 dlopened $a52bin"
29799f8b 1369echo "DTS support $dts"
bba9b16c 1370echo "pp support $pp"
cddf3f45 1371echo "debug symbols $debug"
65d1bea2 1372echo "strip symbols $dostrip"
cddf3f45 1373echo "optimize $optimize"
320d060a 1374echo "static $lstatic"
1ddf5ba1 1375echo "shared $lshared"
29799f8b 1376echo "video hooking $vhook"
a86b921c
FB
1377echo "SDL support $sdl"
1378if test $sdl_too_old = "yes"; then
29799f8b 1379echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
a86b921c 1380fi
68892110
PG
1381
1382if test "$vhook" = "yes" ; then
47930f09 1383echo "Imlib2 support $imlib2"
29799f8b 1384echo "FreeType support $freetype2"
68892110 1385fi
f80f7964 1386echo "Sun medialib support" $sunmlib
9c3d33d6 1387echo "pthreads support" $pthreads
bc634f6f
ZK
1388echo "AMR-NB float support" $amr_nb
1389echo "AMR-NB fixed support" $amr_nb_fixed
d663a1fd 1390echo "AMR-WB float support" $amr_wb
2a515c08 1391echo "AMR-WB IF2 support" $amr_if2
7a91333f
HZ
1392echo "network support $network"
1393if test "$network" = "yes" ; then
1394echo "IPv6 support $ipv6"
1395fi
b2e3c528
MN
1396if test "$gpl" = "no" ; then
1397echo "License: LGPL"
1398else
1399echo "License: GPL"
1400fi
de6d9b64 1401
29799f8b 1402echo "Creating config.mak and config.h..."
de6d9b64 1403
f255e0ab
MB
1404date >> config.log
1405echo " $0 $FFMPEG_CONFIGURATION" >> config.log
29799f8b
DB
1406echo "# Automatically generated by configure - do not modify!" > config.mak
1407echo "/* Automatically generated by configure - do not modify! */" > $TMPH
f255e0ab 1408echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
de6d9b64 1409
9a695e98
DB
1410echo "prefix=\$(DESTDIR)$prefix" >> config.mak
1411echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1d67a1d4 1412echo "incdir=\$(DESTDIR)$incdir" >> config.mak
9a695e98
DB
1413echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1414echo "mandir=\$(DESTDIR)$mandir" >> config.mak
4a908fbc 1415echo "MAKE=$make" >> config.mak
980fc7b8
FB
1416echo "CC=$cc" >> config.mak
1417echo "AR=$ar" >> config.mak
be7109c1 1418echo "RANLIB=$ranlib" >> config.mak
65d1bea2 1419if test "$dostrip" = "yes" ; then
0f3cb305 1420echo "STRIP=$strip" >> config.mak
da186ae2 1421echo "INSTALLSTRIP=$installstrip" >> config.mak
65d1bea2
MB
1422else
1423echo "STRIP=echo ignoring strip" >> config.mak
1424echo "INSTALLSTRIP=" >> config.mak
1425fi
75388c74 1426
29799f8b 1427# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic, used when building
75388c74
MN
1428# shared modules on OS/X (vhook/Makefile).
1429SHCFLAGS=$CFLAGS
1430if test "$needmdynamicnopic" = yes; then
1431 CFLAGS="$CFLAGS -mdynamic-no-pic"
1432fi
1433
a9b3f630 1434echo "OPTFLAGS=$CFLAGS" >> config.mak
75388c74 1435echo "SHCFLAGS=$SHCFLAGS">>config.mak
0f3cb305 1436echo "LDFLAGS=$LDFLAGS" >> config.mak
f39e56a8 1437echo "LDCONFIG=$LDCONFIG" >> config.mak
4baca069 1438echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 1439echo "SHFLAGS=$SHFLAGS" >> config.mak
80581e98 1440echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
b12f8273 1441echo "BUILD_STATIC=$lstatic" >> config.mak
eb94aca9 1442echo "BUILDSUF=$BUILDSUF" >> config.mak
f3ec2d46 1443echo "LIBPREF=$LIBPREF" >> config.mak
eb94aca9 1444echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
320d060a
DB
1445if test "$lstatic" = "yes" ; then
1446 echo "LIB=$LIB" >> config.mak
1a44a8b6
AS
1447else # Some Make complain if this variable does not exist.
1448 echo "LIB=" >> config.mak
320d060a 1449fi
f3ec2d46 1450echo "SLIBPREF=$SLIBPREF" >> config.mak
eb94aca9
CY
1451echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1452echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
6852ac95 1453echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 1454if test "$cpu" = "x86" ; then
980fc7b8 1455 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 1456 echo "#define ARCH_X86 1" >> $TMPH
053dea12
AJ
1457elif test "$cpu" = "x86_64" ; then
1458 echo "TARGET_ARCH_X86_64=yes" >> config.mak
1459 echo "#define ARCH_X86_64 1" >> $TMPH
0f3cb305 1460elif test "$cpu" = "armv4l" ; then
6ed7422a 1461 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 1462 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 1463elif test "$cpu" = "alpha" ; then
91d1f1a4 1464 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 1465 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
1466elif test "$cpu" = "sparc64" ; then
1467 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1468 echo "#define ARCH_SPARC64 1" >> $TMPH
bb476ff3
JM
1469 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1470 echo "#define ARCH_SPARC 1" >> $TMPH
1471elif test "$cpu" = "sparc" ; then
1472 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1473 echo "#define ARCH_SPARC 1" >> $TMPH
0f3cb305
FB
1474elif test "$cpu" = "powerpc" ; then
1475 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1476 echo "#define ARCH_POWERPC 1" >> $TMPH
9007f514
RD
1477 if test $POWERPCMODE = "32bits"; then
1478 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1479 else
1480 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1481 fi
e45a2872
RD
1482 if test "$powerpc_perf" = "yes"; then
1483 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1484 fi
d46aba26
LS
1485elif test "$cpu" = "mips" ; then
1486 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1487 echo "#define ARCH_MIPS 1" >> $TMPH
bdb2e37c
AB
1488elif test "$cpu" = "sh4" ; then
1489 echo "TARGET_ARCH_SH4=yes" >> config.mak
1490 echo "#define ARCH_SH4 1" >> $TMPH
67860b26
SH
1491elif test "$cpu" = "parisc" ; then
1492 echo "TARGET_ARCH_PARISC=yes" >> config.mak
1493 echo "#define ARCH_PARISC 1" >> $TMPH
1494elif test "$cpu" = "s390" ; then
1495 echo "TARGET_ARCH_S390=yes" >> config.mak
1496 echo "#define ARCH_S390 1" >> $TMPH
1497elif test "$cpu" = "m68k" ; then
1498 echo "TARGET_ARCH_M68K=yes" >> config.mak
1499 echo "#define ARCH_M68K 1" >> $TMPH
1500elif test "$cpu" = "ia64" ; then
1501 echo "TARGET_ARCH_IA64=yes" >> config.mak
1502 echo "#define ARCH_IA64 1" >> $TMPH
bdb2e37c 1503fi
a4adb608 1504echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
1505if test "$bigendian" = "yes" ; then
1506 echo "WORDS_BIGENDIAN=yes" >> config.mak
1507 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 1508fi
d2a9bddd
MN
1509if test "$inttypes" != "yes" ; then
1510 echo "#define EMULATE_INTTYPES 1" >> $TMPH
7f965c1c 1511fi
b5c950c4 1512if test "$emu_fast_int" = "yes" ; then
19d053c5 1513 echo "#define EMULATE_FAST_INT 1" >> $TMPH
b5c950c4 1514fi
57514323 1515if test "$mmx" = "yes" ; then
980fc7b8 1516 echo "TARGET_MMX=yes" >> config.mak
045ed63f 1517 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 1518 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 1519fi
52b41d7f
FB
1520if test "$builtin_vector" = "yes" ; then
1521 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1522 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1523fi
82eb4b0f
ZM
1524if test "$mm3dnow" = "yes" ; then
1525 echo "TARGET_BUILTIN_3DNOW=yes" >> config.mak
1526 echo "#define HAVE_MM3DNOW 1" >> $TMPH
1527fi
eba9ae3c
GB
1528if test "$iwmmxt" = "yes" ; then
1529 echo "TARGET_IWMMXT=yes" >> config.mak
1530 echo "#define HAVE_IWMMXT 1" >> $TMPH
1531fi
d46aba26
LS
1532if test "$mmi" = "yes" ; then
1533 echo "TARGET_MMI=yes" >> config.mak
1534 echo "#define HAVE_MMI 1" >> $TMPH
1535fi
ab6c65f6
BF
1536if test "$altivec" = "yes" ; then
1537 echo "TARGET_ALTIVEC=yes" >> config.mak
1538 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
1539 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1540 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
1541 if test "$_altivec_h" = "yes" ; then
1542 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1543 else
e67e14d5 1544 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 1545 fi
ab6c65f6 1546fi
57514323 1547if test "$gprof" = "yes" ; then
980fc7b8 1548 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 1549 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 1550fi
5e4639e2
GM
1551if test "$localtime_r" = "yes" ; then
1552 echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
5e4639e2 1553fi
68892110
PG
1554if test "$imlib2" = "yes" ; then
1555 echo "HAVE_IMLIB2=yes" >> config.mak
1556fi
04511d53
PG
1557if test "$freetype2" = "yes" ; then
1558 echo "HAVE_FREETYPE2=yes" >> config.mak
1559fi
f80f7964
RS
1560if test "$sunmlib" = "yes" ; then
1561 echo "HAVE_MLIB=yes" >> config.mak
1562 echo "#define HAVE_MLIB 1" >> $TMPH
1563 extralibs="$extralibs -lmlib"
1564fi
9c3d33d6
MN
1565if test "$pthreads" = "yes" ; then
1566 echo "HAVE_PTHREADS=yes" >> config.mak
1567 echo "#define HAVE_PTHREADS 1" >> $TMPH
2450cff2 1568 echo "#define HAVE_THREADS 1" >> $TMPH
8c802695 1569 if test $targetos != FreeBSD -a $targetos != OpenBSD ; then
12043e1d
SS
1570 extralibs="$extralibs -lpthread"
1571 fi
9c3d33d6 1572fi
a86b921c
FB
1573if test "$sdl" = "yes" ; then
1574 echo "CONFIG_SDL=yes" >> config.mak
1575 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1576 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1577fi
146ea952
NB
1578if test "$texi2html" = "yes"; then
1579 echo "BUILD_DOC=yes" >> config.mak
1580fi
95e2ce4a
MN
1581if test "$have_lrintf" = "yes" ; then
1582 echo "#define HAVE_LRINTF 1" >> $TMPH
1583fi
68892110
PG
1584if test "$vhook" = "yes" ; then
1585 echo "BUILD_VHOOK=yes" >> config.mak
1586 echo "#define HAVE_VHOOK 1" >> $TMPH
68892110 1587fi
5a872801 1588
69e9b2cf 1589pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libavcodec/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
5a872801
LB
1590lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1591lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1592lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1593
1594
1595
57514323 1596if test "$lshared" = "yes" ; then
320d060a 1597 echo "#define BUILD_SHARED_AV 1" >> $TMPH
0319c531 1598 echo "BUILD_SHARED=yes" >> config.mak
97006039 1599 echo "PIC=-fPIC -DPIC" >> config.mak
39503a27 1600 echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
5a872801 1601 echo "SPPVERSION=$lavc_version" >> config.mak
39503a27 1602 echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
5a872801 1603 echo "LAVCVERSION=$lavc_version" >> config.mak
39503a27 1604 echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
5a872801 1605 echo "LAVFVERSION=$lavf_version" >> config.mak
39503a27 1606 echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
5a872801 1607 echo "LAVUVERSION=$lavu_version" >> config.mak
4bdd05e7 1608 echo "SLIBNAME=${SLIBNAME}" >> config.mak
f3b60109
DB
1609 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1610 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
0319c531 1611fi
ef0bc4c9 1612echo "EXTRALIBS=$extralibs" >> config.mak
281a74da 1613version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
258207b7
FB
1614 cut -d '"' -f 2`
1615echo "VERSION=$version" >>config.mak
29799f8b 1616# If you do not want to use encoders, disable them.
045ed63f 1617echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
1618echo "CONFIG_ENCODERS=yes" >> config.mak
1619
29799f8b 1620# If you do not want to use decoders, disable them.
045ed63f 1621echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
1622echo "CONFIG_DECODERS=yes" >> config.mak
1623
a9e35095
DB
1624# muxers
1625if test "$muxers" = "yes" ; then
1626 echo "#define CONFIG_MUXERS 1" >> $TMPH
1627 echo "CONFIG_MUXERS=yes" >> config.mak
1628fi
1629
1630# demuxers
1631if test "$demuxers" = "yes" ; then
1632 echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1633 echo "CONFIG_DEMUXERS=yes" >> config.mak
1634fi
1635
5cbcf02c
FB
1636# AC3
1637if test "$a52" = "yes" ; then
1638 echo "#define CONFIG_AC3 1" >> $TMPH
1639 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 1640
5cbcf02c
FB
1641 if test "$a52bin" = "yes" ; then
1642 echo "#define CONFIG_A52BIN 1" >> $TMPH
1643 echo "CONFIG_A52BIN=yes" >> config.mak
1644 fi
1645fi
1646
23c99253
MN
1647# DTS
1648if test "$dts" = "yes" ; then
1649 echo "#define CONFIG_DTS 1" >> $TMPH
1650 echo "CONFIG_DTS=yes" >> config.mak
1651fi
1652
bba9b16c
MN
1653# PP
1654if test "$pp" = "yes" ; then
1655 echo "#define CONFIG_PP 1" >> $TMPH
1656 echo "CONFIG_PP=yes" >> config.mak
bba9b16c
MN
1657fi
1658
29799f8b 1659# MPEG audio high precision mode
1eb2212e
FB
1660if test "$mpegaudio_hp" = "yes" ; then
1661 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1662fi
1663
5cbcf02c
FB
1664if test "$v4l" = "yes" ; then
1665 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1666 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1667fi
1668
0a7b514f
LA
1669if test "$v4l2" = "yes" ; then
1670 echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
1671 echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
1672fi
1673
6beefa40
MN
1674if test "$bktr" = "yes" ; then
1675 echo "#define CONFIG_BKTR 1" >> $TMPH
1676 echo "CONFIG_BKTR=yes" >> config.mak
1677fi
1678
8aa3ee32
MK
1679if test "$dv1394" = "yes" ; then
1680 echo "#define CONFIG_DV1394 1" >> $TMPH
1681 echo "CONFIG_DV1394=yes" >> config.mak
1682fi
1683
f02be79d
RS
1684if test "$dc1394" = "yes" ; then
1685 echo "#define CONFIG_DC1394 1" >> $TMPH
1686 echo "CONFIG_DC1394=yes" >> config.mak
1687fi
1688
adbc0510
PG
1689if test "$dlopen" = "yes" ; then
1690 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1691fi
1692
1693if test "$dlfcn" = "yes" ; then
1694 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1695fi
1696
5cbcf02c
FB
1697if test "$audio_oss" = "yes" ; then
1698 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1699 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
1700fi
1701
dfdfa47c
FR
1702if test "$audio_beos" = "yes" ; then
1703 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1704 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1705fi
1706
5cbcf02c
FB
1707if test "$network" = "yes" ; then
1708 echo "#define CONFIG_NETWORK 1" >> $TMPH
1709 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 1710fi
daf8e955 1711
7a91333f
HZ
1712if test "$ipv6" = "yes" ; then
1713 echo "#define CONFIG_IPV6 1" >> $TMPH
1714fi
1715
0147f198
FR
1716if test "$zlib" = "yes" ; then
1717 echo "#define CONFIG_ZLIB 1" >> $TMPH
1718 echo "CONFIG_ZLIB=yes" >> config.mak
1719fi
1720
e0f80bd7
RD
1721if test "$lzo" = "yes" ; then
1722 echo "#define CONFIG_LZO 1" >> $TMPH
1723 echo "CONFIG_LZO=yes" >> config.mak
1724fi
1725
bb4c2140
MN
1726if test "$libgsm" = "yes" ; then
1727 echo "#define CONFIG_LIBGSM 1" >> $TMPH
1728 echo "CONFIG_LIBGSM=yes" >> config.mak
1729fi
1730
57514323 1731if test "$mp3lame" = "yes" ; then
045ed63f 1732 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
1733 echo "CONFIG_MP3LAME=yes" >> config.mak
1734fi
1735
9146ca37 1736if test "$libogg" = "yes" ; then
5c5dea3f
NB
1737 echo "#define CONFIG_LIBOGG 1" >> $TMPH
1738 echo "CONFIG_LIBOGG=yes" >> config.mak
1739fi
1740
81e0d0b4 1741if test "$vorbis" = "yes" ; then
5c5dea3f
NB
1742 echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
1743 echo "CONFIG_LIBVORBIS=yes" >> config.mak
1744fi
1745
1746if test "$theora" = "yes" ; then
1747 echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
1748 echo "CONFIG_LIBTHEORA=yes" >> config.mak
81e0d0b4
MH
1749fi
1750
0fc50e58
ZK
1751if test "$faad" = "yes" ; then
1752 echo "#define CONFIG_FAAD 1" >> $TMPH
1753 echo "CONFIG_FAAD=yes" >> config.mak
1754fi
1755
1756if test "$faadbin" = "yes" ; then
1757 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1758 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1759fi
1760
29d48296
MN
1761if test "$faac" = "yes" ; then
1762 echo "#define CONFIG_FAAC 1" >> $TMPH
1763 echo "CONFIG_FAAC=yes" >> config.mak
1764fi
1765
1ddadfa9
AT
1766if test "$xvid" = "yes" ; then
1767 echo "#define CONFIG_XVID 1" >> $TMPH
1768 echo "CONFIG_XVID=yes" >> config.mak
1769fi
1770
6662ec29
MN
1771if test "$x264" = "yes" ; then
1772 echo "#define CONFIG_X264 1" >> $TMPH
1773 echo "CONFIG_X264=yes" >> config.mak
1774fi
1775
732d9245
BE
1776if test "$mingw32" = "yes" ; then
1777 echo "#define CONFIG_WIN32 1" >> $TMPH
1778 echo "CONFIG_WIN32=yes" >> config.mak
16806499
MN
1779 echo "HAVE_W32THREADS=yes" >> config.mak
1780 echo "#define HAVE_W32THREADS 1" >> $TMPH
2450cff2 1781 echo "#define HAVE_THREADS 1" >> $TMPH
7eea5766 1782 echo "#ifndef __MINGW32__" >> $TMPH
732d9245 1783 echo "#define __MINGW32__ 1" >> $TMPH
7eea5766 1784 echo "#endif" >> $TMPH
3f027ca7
FB
1785fi
1786
ac44871c
GB
1787if test "$mingwce" = "yes" ; then
1788 echo "#define CONFIG_WIN32 1" >> $TMPH
1789 echo "CONFIG_WIN32=yes" >> config.mak
1790 echo "#define CONFIG_WINCE 1" >> $TMPH
1791 echo "CONFIG_WINCE=yes" >> config.mak
1792 echo "#ifndef __MINGW32__" >> $TMPH
1793 echo "#define __MINGW32__ 1" >> $TMPH
1794 echo "#endif" >> $TMPH
1795fi
1796
f3ec2d46
SG
1797if test "$os2" = "yes" ; then
1798 echo "#define CONFIG_OS2 1" >> $TMPH
1799 echo "CONFIG_OS2=yes" >> config.mak
e2a5fd20
MN
1800 echo "HAVE_OS2THREADS=yes" >> config.mak
1801 echo "#define HAVE_OS2THREADS 1" >> $TMPH
1802 echo "#define HAVE_THREADS 1" >> $TMPH
f3ec2d46
SG
1803fi
1804
6e023978
RS
1805if test "$TARGET_OS" = "SunOS" ; then
1806 echo "#define CONFIG_SUNOS 1" >> $TMPH
1807fi
1808
2450cff2
FR
1809if test "$TARGET_OS" = "BeOS" ; then
1810 echo "HAVE_BEOSTHREADS=yes" >> config.mak
1811 echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
1812 echo "#define HAVE_THREADS 1" >> $TMPH
1813fi
1814
90cee0c3
MN
1815if test "$darwin" = "yes"; then
1816 echo "#define CONFIG_DARWIN 1" >> $TMPH
1817 echo "CONFIG_DARWIN=yes" >> config.mak
1818fi
1819
57514323 1820if test "$_malloc_h" = "yes" ; then
045ed63f 1821 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1822else
045ed63f 1823 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1824fi
1825
57514323 1826if test "$_memalign" = "yes" ; then
045ed63f
ZK
1827 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1828else
1829 echo "#undef HAVE_MEMALIGN" >> $TMPH
1830fi
1831
da9b170c
MN
1832if test "$memalignhack" = "yes" ; then
1833 echo "#define MEMALIGN_HACK 1" >> $TMPH
1834fi
1835
1836
26b35efb
FR
1837if test "$netserver" = "yes" ; then
1838 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1839 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1840fi
1841
4baca069
PG
1842if test "$need_inet_aton" = "yes" ; then
1843 echo "NEED_INET_ATON=yes" >> config.mak
1844fi
1845
57514323 1846if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1847 echo "#define SIMPLE_IDCT 1" >> $TMPH
1848fi
1849
04f46ced
GB
1850if test "$protocols" = "yes" ; then
1851 echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
1852 echo "CONFIG_PROTOCOLS=yes" >> config.mak
1853fi
1854
8154d2e0
FB
1855if test "$ffserver" = "yes" ; then
1856 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1857 echo "CONFIG_FFSERVER=yes" >> config.mak
1858fi
1859
a86b921c
FB
1860if test "$ffplay" = "yes" ; then
1861 echo "CONFIG_FFPLAY=yes" >> config.mak
1862fi
1863
b2e3c528
MN
1864if test "$gpl" = "yes" ; then
1865 echo "#define CONFIG_GPL 1" >> $TMPH
1866 echo "CONFIG_GPL=yes" >> config.mak
1867fi
1868
c13e1abd
FH
1869echo "#define restrict $_restrict" >> $TMPH
1870
bb801c97
MN
1871if test "$optimize" = "small"; then
1872 echo "#define always_inline" >> $TMPH
1873fi
1874
0f3cb305
FB
1875# build tree in object directory if source path is different from current one
1876if test "$source_path_used" = "yes" ; then
2a4e872b
AS
1877 DIRS="\
1878 doc \
1879 libavformat \
1880 libavcodec \
1881 libavcodec/alpha \
1882 libavcodec/armv4l \
1883 libavcodec/i386 \
1884 libavcodec/sparc \
1885 libavcodec/mlib \
1886 libavcodec/ppc \
1887 libavcodec/liba52 \
1888 libavcodec/libpostproc \
1889 libavutil \
1890 tests \
1891 vhook \
1892 "
1893 FILES="\
1894 Makefile \
1895 libavformat/Makefile \
1896 libavcodec/Makefile \
1897 libavcodec/libpostproc/Makefile \
1898 libavutil/Makefile \
1899 tests/Makefile \
1900 vhook/Makefile \
1901 doc/Makefile \
1902 doc/texi2pod.pl \
1903 "
0f3cb305
FB
1904 for dir in $DIRS ; do
1905 mkdir -p $dir
1906 done
1907 for f in $FILES ; do
281a74da 1908 ln -sf "$source_path/$f" $f
0f3cb305
FB
1909 done
1910fi
8e955b13 1911echo "SRC_PATH=$source_path" >> config.mak
8b2121e3 1912echo "BUILD_ROOT=$PWD" >> config.mak
0f3cb305 1913
d663a1fd
MN
1914if test "$amr_wb" = "yes" ; then
1915 echo "#define AMR_WB 1" >> $TMPH
1916 echo "AMR_WB=yes" >> config.mak
1917 echo
1918 echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1919 echo "V5.1.0 from "
1920 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1921 echo "and extracted the source to libavcodec/amrwb_float"
1922 echo
1923fi
1924
891f64b3 1925if test "$amr_nb" = "yes" ; then
1926 echo "#define AMR_NB 1" >> $TMPH
1927 echo "AMR_NB=yes" >> config.mak
1928 echo
bc634f6f
ZK
1929if test "$amr_nb_fixed" = "yes" ; then
1930 echo "AMR_NB_FIXED=yes" >> config.mak
1931 echo "#define AMR_NB_FIXED 1" >> $TMPH
1932 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1933 echo "REL-5 version 5.1.0 from "
184582de 1934 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
891f64b3 1935 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1936 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1937 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1938 echo
1939else
1940 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1941 echo "REL-5 V5.1.0 from "
184582de 1942 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
bc634f6f 1943 echo "and extracted the source to libavcodec/amr_float"
821e46f4 1944 echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
891f64b3 1945 echo
1946fi
1947
2a515c08
TM
1948if test "$amr_if2" = "yes" ; then
1949 echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1950fi
1951
bc634f6f
ZK
1952fi
1953
009cf97d 1954for codec in $CODEC_LIST ; do
ce869f59
MN
1955 echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
1956 echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
009cf97d
MN
1957done
1958
9cb2cf10
DB
1959# Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
1960diff $TMPH config.h >/dev/null 2>&1
214c5f26 1961if test "$?" != "0" ; then
9cb2cf10
DB
1962 mv -f $TMPH config.h
1963else
1964 echo "config.h is unchanged"
1965fi
3d204385 1966
f3ec2d46 1967rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
def4272a
AJ
1968
1969
29799f8b 1970# build pkg-config files libav*.pc and libpostproc.pc
31abdc45 1971# libavutil.pc
1972cat <<EOF >libavutil.pc
1973prefix=$prefix
1974exec_prefix=\${prefix}
1975libdir=\${exec_prefix}/lib
1976includedir=\${prefix}/include
1977
1978Name: libavutil
1979Description: FFmpeg utility library
1980Version: $lavu_version
115329f1 1981Requires:
31abdc45 1982Conflicts:
1983Libs: -L\${libdir} -lavutil
1984Cflags: -I\${includedir} -I\${includedir}/ffmpeg
1985EOF
1986
1987cat <<EOF >libavutil-uninstalled.pc
1988prefix=
1989exec_prefix=
1990libdir=\${pcfiledir}/libavutil
1991includedir=\${pcfiledir}/libavutil
1992
1993Name: libavutil
1994Description: FFmpeg utility library
1995Version: $lavu_version
115329f1 1996Requires:
31abdc45 1997Conflicts:
1998Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
1999Cflags: -I\${includedir}
2000EOF
def4272a
AJ
2001
2002# libavcodec.pc
2003cat <<EOF >libavcodec.pc
2004prefix=$prefix
2005exec_prefix=\${prefix}
2006libdir=\${exec_prefix}/lib
2007includedir=\${prefix}/include
2008
2009Name: libavcodec
2010Description: FFmpeg codec library
31abdc45 2011Version: $lavc_version
c99dd233 2012Requires: $pkg_requires libavutil = $lavu_version
def4272a
AJ
2013Conflicts:
2014Libs: -L\${libdir} -lavcodec $extralibs
2015Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2016EOF
2017
2018cat <<EOF >libavcodec-uninstalled.pc
2019prefix=
2020exec_prefix=
2021libdir=\${pcfiledir}/libavcodec
2022includedir=\${pcfiledir}/libavcodec
2023
2024Name: libavcodec
2025Description: FFmpeg codec library
31abdc45 2026Version: $lavc_version
c99dd233 2027Requires: $pkg_requires libavutil = $lavu_version
def4272a
AJ
2028Conflicts:
2029Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2030Cflags: -I\${includedir}
2031EOF
2032
2033# libavformat.pc
2034cat <<EOF >libavformat.pc
2035prefix=$prefix
2036exec_prefix=\${prefix}
2037libdir=\${exec_prefix}/lib
2038includedir=\${prefix}/include
2039
2040Name: libavformat
2041Description: FFmpeg container format library
31abdc45 2042Version: $lavf_version
c99dd233 2043Requires: $pkg_requires libavcodec = $lavc_version
def4272a
AJ
2044Conflicts:
2045Libs: -L\${libdir} -lavformat $extralibs
2046Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2047EOF
2048
2049cat <<EOF >libavformat-uninstalled.pc
2050prefix=
2051exec_prefix=
2052libdir=\${pcfiledir}/libavformat
2053includedir=\${pcfiledir}/libavformat
2054
2055Name: libavformat
2056Description: FFmpeg container format library
31abdc45 2057Version: $lavf_version
c99dd233 2058Requires: $pkg_requires libavcodec = $lavc_version
def4272a
AJ
2059Conflicts:
2060Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2061Cflags: -I\${includedir}
2062EOF
2063
2064
2065# libpostproc.pc
2066cat <<EOF >libpostproc.pc
2067prefix=$prefix
2068exec_prefix=\${prefix}
2069libdir=\${exec_prefix}/lib
2070includedir=\${prefix}/include
2071
2072Name: libpostproc
2073Description: FFmpeg post processing library
31abdc45 2074Version: $lavc_version
115329f1 2075Requires:
def4272a
AJ
2076Conflicts:
2077Libs: -L\${libdir} -lpostproc
2078Cflags: -I\${includedir} -I\${includedir}/postproc
2079EOF
2080
2081cat <<EOF >libpostproc-uninstalled.pc
2082prefix=
2083exec_prefix=
2084libdir=\${pcfiledir}/libavcodec/libpostproc
2085includedir=\${pcfiledir}/libavcodec/libpostproc
2086
2087Name: libpostproc
2088Description: FFmpeg post processing library
31abdc45 2089Version: $lavc_version
115329f1 2090Requires:
def4272a
AJ
2091Conflicts:
2092Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2093Cflags: -I\${includedir}
2094EOF