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