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