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