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