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