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