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