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