zigzag_direct_noperm doesn't exist, remove declaration
[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
cde2d79a 6# make sure we are running under a compatible shell
5237ce67
MR
7unset foo
8(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
cde2d79a
MR
9if test "$?" != 0; then
10 if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
11 FFMPEG_CONFIGURE_EXEC=1
12 export FFMPEG_CONFIGURE_EXEC
13 exec bash "$0" "$@"
14 exec ksh "$0" "$@"
15 exec /usr/xpg4/bin/sh "$0" "$@"
16 fi
17 echo "No compatible shell script interpreter found."
18 exit 1
19fi
20
74c53c2d
MR
21show_help(){
22 echo "Usage: configure [options]"
23 echo "Options: [defaults in brackets after descriptions]"
24 echo
25 echo "Standard options:"
26 echo " --help print this message"
2ba042a7 27 echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]"
2266e085 28 echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
74c53c2d 29 echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
84c22efd 30 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
74c53c2d
MR
31 echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
32 echo " --mandir=DIR install man page in DIR [PREFIX/man]"
33 echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]"
f956e129 34 echo " --enable-libnut enable NUT support via libnut [default=no]"
74c53c2d
MR
35 echo " --enable-libogg enable Ogg support via libogg [default=no]"
36 echo " --enable-vorbis enable Vorbis support via libvorbis [default=no]"
74c53c2d
MR
37 echo " --enable-faad enable FAAD support via libfaad [default=no]"
38 echo " --enable-faadbin build FAAD support with runtime linking [default=no]"
39 echo " --enable-faac enable FAAC support via libfaac [default=no]"
40 echo " --enable-libgsm enable GSM support via libgsm [default=no]"
41 echo " --enable-xvid enable XviD support via xvidcore [default=no]"
42 echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
43 echo " --enable-mingw32 enable MinGW native/cross Windows compile"
44 echo " --enable-mingwce enable MinGW native/cross WinCE compile"
45 echo " --enable-a52 enable GPLed A52 support [default=no]"
46 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
47 echo " --enable-dts enable GPLed DTS support [default=no]"
48 echo " --enable-pp enable GPLed postprocessing support [default=no]"
49 echo " --enable-static build static libraries [default=yes]"
50 echo " --disable-static do not build static libraries [default=no]"
51 echo " --enable-shared build shared libraries [default=no]"
52 echo " --disable-shared do not build shared libraries [default=yes]"
53 echo " --enable-amr_nb enable amr_nb float audio codec"
54 echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
55 echo " --enable-amr_wb enable amr_wb float audio codec"
56 echo " --enable-amr_if2 enable amr_wb IF2 audio codec"
57 echo " --enable-sunmlib use Sun medialib [default=no]"
58 echo " --enable-pthreads use pthreads [default=no]"
59 echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
60 echo " and libraw1394 [default=no]"
790c9ca7 61 echo " --enable-swscaler software scaler support [default=no]"
8ac17293 62 echo " --enable-avisynth allow reading AVISynth script files [default=no]"
74c53c2d
MR
63 echo " --enable-gpl allow use of GPL code, the resulting libav*"
64 echo " and ffmpeg will be under GPL [default=no]"
65 echo ""
66 echo "Advanced options (experts only):"
67 echo " --source-path=PATH path to source code [$source_path]"
68 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
fac252f9 69 echo " --cross-compile assume a cross-compiler is used"
74c53c2d
MR
70 echo " --cc=CC use C compiler CC [$cc]"
71 echo " --make=MAKE use specified make [$make]"
72 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
73 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
74 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
75 echo " --build-suffix=SUFFIX suffix for application specific build []"
cc6a90dd 76 echo " --arch=ARCH select architecture [$arch]"
38d0a8aa
GP
77 echo " --cpu=CPU selects the minimum cpu required (affects
78 instruction selection, may crash on older CPUs)"
74c53c2d
MR
79 echo " --powerpc-perf-enable enable performance report on PPC"
80 echo " (requires enabling PMC)"
81 echo " --disable-mmx disable MMX usage"
1839e854 82 echo " --disable-armv5te disable armv5te usage"
74c53c2d
MR
83 echo " --disable-iwmmxt disable iwmmxt usage"
84 echo " --disable-altivec disable AltiVec usage"
85 echo " --disable-audio-oss disable OSS audio support [default=no]"
86 echo " --disable-audio-beos disable BeOS audio support [default=no]"
87 echo " --disable-v4l disable video4linux grabbing [default=no]"
88 echo " --disable-v4l2 disable video4linux2 grabbing [default=no]"
89 echo " --disable-bktr disable bktr video grabbing [default=no]"
90 echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
91 echo " --disable-network disable network support [default=no]"
0c7bb0e5 92 echo " --disable-ipv6 disable ipv6 support [default=no]"
74c53c2d 93 echo " --disable-zlib disable zlib [default=no]"
74c53c2d
MR
94 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
95 echo " --disable-vhook disable video hooking support"
96 echo " --enable-gprof enable profiling with gprof [$gprof]"
97 echo " --disable-debug disable debugging symbols"
98 echo " --disable-opts disable compiler optimizations"
78fcba8f 99 echo " --enable-extra-warnings enable more compiler warnings"
74c53c2d
MR
100 echo " --disable-mpegaudio-hp faster (but less accurate)"
101 echo " MPEG audio decoding [default=no]"
102 echo " --disable-protocols disable I/O protocols support [default=no]"
786b30af 103 echo " --disable-ffmpeg disable ffmpeg build"
74c53c2d
MR
104 echo " --disable-ffserver disable ffserver build"
105 echo " --disable-ffplay disable ffplay build"
106 echo " --enable-small optimize for size instead of speed"
107 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
108 echo " --disable-strip disable stripping of executables and shared libraries"
109 echo " --disable-encoder=NAME disables encoder NAME"
110 echo " --enable-encoder=NAME enables encoder NAME"
111 echo " --disable-decoder=NAME disables decoder NAME"
112 echo " --enable-decoder=NAME enables decoder NAME"
113 echo " --disable-encoders disables all encoders"
114 echo " --disable-decoders disables all decoders"
ff70e601
MR
115 echo " --disable-muxer=NAME disables muxer NAME"
116 echo " --enable-muxer=NAME enables muxer NAME"
74c53c2d 117 echo " --disable-muxers disables all muxers"
ff70e601
MR
118 echo " --disable-demuxer=NAME disables demuxer NAME"
119 echo " --enable-demuxer=NAME enables demuxer NAME"
74c53c2d 120 echo " --disable-demuxers disables all demuxers"
af9e7d18
MR
121 echo " --enable-parser=NAME enables parser NAME"
122 echo " --disable-parser=NAME disables parser NAME"
123 echo " --disable-parsers disables all parsers"
74c53c2d
MR
124 echo ""
125 echo "NOTE: Object files are built at the place where configure is launched."
126 exit 1
127}
cf9d24ad 128
57bd82d4
MR
129log(){
130 echo "$@" >>$logfile
131}
132
720c69da 133log_file(){
c8e9f801
MR
134 log BEGIN $1
135 cat -n $1 >>$logfile
136 log END $1
137}
138
2ba042a7 139echolog(){
c8e9f801 140 log "$@"
57bd82d4 141 echo "$@"
2ba042a7
MR
142}
143
144die(){
145 echolog "$@"
146 cat <<EOF
147If you think configure made a mistake, make sure you are using the latest
148version from SVN. If the latest version fails, report the problem to the
149ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
150EOF
720c69da 151 if enabled logging; then
2ba042a7
MR
152 cat <<EOF
153Include the log file "$logfile" produced by configure as this will help
154solving the problem.
155EOF
156 else
157cat <<EOF
158Rerun configure with logging enabled (do not use --log=no), and include the
159log this produces with your report.
160EOF
161 fi
57bd82d4
MR
162 rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
163 exit 1
164}
165
a8d04fba
MR
166set_all(){
167 value=$1
168 shift
169 for var in $*; do
170 eval $var=$value
171 done
172}
173
174enable(){
175 set_all yes $*
176}
177
178disable(){
179 set_all no $*
180}
181
57bd82d4
MR
182enabled(){
183 eval test "\$$1" = "yes"
184}
185
186flags_saved(){
187 (: ${SAVE_CFLAGS?}) 2>/dev/null
188}
189
dcd479c0 190save_flags(){
57bd82d4 191 flags_saved && return
dcd479c0
MR
192 SAVE_CFLAGS="$CFLAGS"
193 SAVE_LDFLAGS="$LDFLAGS"
194 SAVE_extralibs="$extralibs"
195}
196
197restore_flags(){
198 CFLAGS="$SAVE_CFLAGS"
199 LDFLAGS="$SAVE_LDFLAGS"
200 extralibs="$SAVE_extralibs"
201 unset SAVE_CFLAGS
202 unset SAVE_LDFLAGS
203 unset SAVE_extralibs
204}
205
206temp_cflags(){
207 save_flags
208 CFLAGS="$CFLAGS $*"
209}
210
211temp_ldflags(){
212 save_flags
213 LDFLAGS="$LDFLAGS $*"
214}
215
216temp_extralibs(){
217 save_flags
218 extralibs="$extralibs $*"
219}
220
57bd82d4
MR
221append(){
222 var=$1
223 shift
224 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
225 eval "$var=\"\$$var $*\""
226}
227
228add_cflags(){
229 append CFLAGS "$@"
230}
231
232add_ldflags(){
233 append LDFLAGS "$@"
234}
235
236add_extralibs(){
237 append extralibs "$@"
238}
239
b0cfb663 240check_cmd(){
b3cb5d51 241 log "$@"
9b4f605c 242 "$@" >>$logfile 2>&1
b0cfb663
MR
243}
244
dcd479c0 245check_cc(){
57bd82d4
MR
246 log check_cc "$@"
247 cat >$TMPC
720c69da 248 log_file $TMPC
b0cfb663 249 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
57bd82d4
MR
250}
251
252check_cpp(){
253 log check_cpp "$@"
dcd479c0 254 cat >$TMPC
720c69da 255 log_file $TMPC
b0cfb663 256 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
dcd479c0
MR
257}
258
259check_ld(){
57bd82d4 260 log check_ld "$@"
0607887f 261 check_cc || return
b0cfb663 262 check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
dcd479c0
MR
263}
264
265check_cflags(){
57bd82d4
MR
266 log check_cflags "$@"
267 check_cc "$@" <<EOF && add_cflags "$@"
dcd479c0
MR
268int x;
269EOF
270}
271
272check_ldflags(){
57bd82d4
MR
273 log check_ldflags "$@"
274 check_ld "$@" <<EOF && add_ldflags "$@"
275int main(){
276 return 0;
277}
dcd479c0
MR
278EOF
279}
280
281check_header(){
57bd82d4 282 log check_header "$@"
dcd479c0
MR
283 header=$1
284 shift
57bd82d4 285 check_cpp "$@" <<EOF
dcd479c0
MR
286#include <$header>
287int x;
288EOF
289}
290
291check_func(){
57bd82d4 292 log check_func "$@"
dcd479c0
MR
293 func=$1
294 shift
295 check_ld "$@" <<EOF
296extern int $func();
297int main(){
298 $func();
299}
300EOF
301}
302
57bd82d4
MR
303check_lib(){
304 log check_lib "$@"
305 header="$1"
306 func="$2"
307 shift 2
308 temp_extralibs "$@"
309 check_header $header && check_func $func && add_extralibs "$@"
310 err=$?
311 restore_flags
312 return $err
313}
314
dcd479c0 315check_exec(){
bd4700b1 316 check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
57bd82d4
MR
317}
318
319require(){
320 name="$1"
321 header="$2"
322 func="$3"
323 shift 3
324 check_lib $header $func "$@" || die "ERROR: $name not found"
dcd479c0
MR
325}
326
3dc7174e
MR
327filter_out(){
328 pattern="$1"
329 shift
330 echo "$@" | sed "s%\\<$pattern\\>%%g"
331}
332
0f3cb305 333# set temporary file name
57514323 334if test ! -z "$TMPDIR" ; then
0f3cb305 335 TMPDIR1="${TMPDIR}"
57514323 336elif test ! -z "$TEMPDIR" ; then
0f3cb305 337 TMPDIR1="${TEMPDIR}"
3d204385 338else
0f3cb305 339 TMPDIR1="/tmp"
3d204385
NK
340fi
341
0f3cb305
FB
342TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
343TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 344TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
345TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
346TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
347
de6d9b64 348# default parameters
720c69da 349logging="yes"
2ba042a7 350logfile="config.err"
2266e085
DB
351PREFIX="/usr/local"
352libdir='${PREFIX}/lib'
84c22efd 353shlibdir="$libdir"
2266e085
DB
354incdir='${PREFIX}/include/ffmpeg'
355mandir='${PREFIX}/man'
356bindir='${PREFIX}/bin'
0f3cb305 357cross_prefix=""
fac252f9 358cross_compile="no"
de6d9b64
FB
359cc="gcc"
360ar="ar"
be7109c1 361ranlib="ranlib"
4a908fbc 362make="make"
0f3cb305 363strip="strip"
cc6a90dd 364arch=`uname -m`
38d0a8aa 365cpu="generic"
e45a2872 366powerpc_perf="no"
0f3cb305 367mmx="default"
e7768fc5 368cmov="no"
94e4c3a3 369cmov_is_fast="no"
1839e854 370armv5te="default"
eba9ae3c 371iwmmxt="default"
ab6c65f6 372altivec="default"
87ea51e0 373dcbzl="no"
d46aba26 374mmi="default"
cc6a90dd 375case "$arch" in
ef0bc4c9 376 i386|i486|i586|i686|i86pc|BePC)
419b8784 377 arch="x86_32"
de6d9b64 378 ;;
7bf9648e 379 x86_64|amd64)
a63e5f1c 380 arch="x86_32"
32255f6c 381 canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
7bf9648e
JM
382 if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
383 if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
cc6a90dd 384 arch="x86_64"
7bf9648e 385 fi
053dea12
AJ
386 fi
387 ;;
6dc7b6b3
DB
388 # armv4l is a subset of armv[567]*l
389 arm|armv[4567]*l)
cc6a90dd 390 arch="armv4l"
6ed7422a 391 ;;
91d1f1a4 392 alpha)
cc6a90dd 393 arch="alpha"
91d1f1a4 394 ;;
2645e80f 395 "Power Macintosh"|ppc|ppc64|powerpc)
cc6a90dd 396 arch="powerpc"
90cee0c3 397 ;;
b028a866 398 mips|mipsel|IP*)
cc6a90dd 399 arch="mips"
d46aba26 400 ;;
bb476ff3 401 sun4u|sparc64)
cc6a90dd 402 arch="sparc64"
a7beab73 403 ;;
bb476ff3 404 sparc)
cc6a90dd 405 arch="sparc"
bb476ff3 406 ;;
bdb2e37c 407 sh4)
cc6a90dd 408 arch="sh4"
bdb2e37c 409 ;;
67860b26 410 parisc|parisc64)
cc6a90dd 411 arch="parisc"
67860b26
SH
412 ;;
413 s390|s390x)
cc6a90dd 414 arch="s390"
67860b26
SH
415 ;;
416 m68k)
cc6a90dd 417 arch="m68k"
67860b26
SH
418 ;;
419 ia64)
cc6a90dd 420 arch="ia64"
67860b26 421 ;;
81a9b052 422 bfin)
cc6a90dd 423 arch="bfin"
81a9b052 424 ;;
de6d9b64 425 *)
cc6a90dd 426 arch="unknown"
de6d9b64
FB
427 ;;
428esac
429gprof="no"
5cbcf02c 430v4l="yes"
0a7b514f 431v4l2="yes"
6beefa40 432bktr="no"
5cbcf02c 433audio_oss="yes"
dfdfa47c 434audio_beos="no"
8aa3ee32 435dv1394="yes"
f02be79d 436dc1394="no"
5cbcf02c 437network="yes"
0c7bb0e5 438ipv6="yes"
0147f198 439zlib="yes"
bb4c2140 440libgsm="no"
a6741398 441mp3lame="no"
f956e129 442libnut="no"
9146ca37 443libogg="no"
81e0d0b4 444vorbis="no"
0fc50e58
ZK
445faad="no"
446faadbin="no"
29d48296 447faac="no"
1ddadfa9 448xvid="no"
6662ec29 449x264="no"
ba9261e5 450a52="no"
57514323 451a52bin="no"
23c99253 452dts="no"
ba9261e5 453pp="no"
732d9245 454mingw32="no"
ac44871c 455mingwce="no"
f3ec2d46 456os2="no"
320d060a 457lstatic="yes"
83286d2a 458lshared="no"
cddf3f45
GM
459optimize="yes"
460debug="yes"
78fcba8f 461extrawarnings="no"
65d1bea2 462dostrip="yes"
da186ae2 463installstrip="-s"
ef0bc4c9 464extralibs="-lm"
c02dbee1 465simpleidct="yes"
0f3cb305 466bigendian="no"
7f965c1c 467inttypes="yes"
b5c950c4 468emu_fast_int="no"
a8721c09 469vhook="default"
8ac17293 470avisynth="no"
adbc0510
PG
471dlfcn="no"
472dlopen="no"
1eb2212e 473mpegaudio_hp="yes"
baa3a937 474SHFLAGS='-shared -Wl,-soname,$@'
cab3ef82 475VHOOKSHFLAGS='$(SHFLAGS)'
26b35efb 476netserver="no"
4baca069 477need_inet_aton="no"
04f46ced 478protocols="yes"
786b30af 479ffmpeg="yes"
8154d2e0 480ffserver="yes"
a86b921c 481ffplay="yes"
80581e98 482LIBOBJFLAGS=""
e89b8b0a 483FFLDFLAGS=-Wl,--warn-common
e240ee67 484LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
c536cb09 485FFSERVERLDFLAGS=-Wl,-E
f39e56a8 486LDCONFIG="ldconfig"
f3ec2d46
SG
487LIBPREF="lib"
488LIBSUF=".a"
4bdd05e7 489LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
f3ec2d46
SG
490SLIBPREF="lib"
491SLIBSUF=".so"
4bdd05e7 492SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
b29bddab
DB
493SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
494SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
951bf3e6 495EXESUF=""
eb94aca9 496BUILDSUF=""
891f64b3 497amr_nb="no"
d663a1fd 498amr_wb="no"
bc634f6f 499amr_nb_fixed="no"
2a515c08 500amr_if2="no"
f80f7964 501sunmlib="no"
9c3d33d6 502pthreads="no"
790c9ca7 503swscaler="no"
b2e3c528 504gpl="no"
da9b170c 505memalignhack="no"
4454dc1b 506asmalign_pot="unknown"
d4596ae3 507LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
ef0bc4c9
FR
508
509# OS specific
510targetos=`uname -s`
511case $targetos in
512BeOS)
2266e085 513PREFIX="/boot/home/config"
ef0bc4c9 514# helps building libavcodec
30a3e5d4 515add_cflags "-DPIC -fomit-frame-pointer"
31ba0b4d 516# 3 gcc releases known for BeOS, each with ugly bugs
b2924696 517gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
31ba0b4d
FR
518case "$gcc_version" in
5192.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
520mmx="no"
521;;
522*20010315*) echo "BeBits gcc"
30a3e5d4 523add_cflags "-fno-expensive-optimizations"
31ba0b4d
FR
524;;
525esac
e1707f52 526SHFLAGS=-nostart
29799f8b 527# disable Linux things
e1707f52 528audio_oss="no"
5cbcf02c 529v4l="no"
0a7b514f 530v4l2="no"
8aa3ee32 531dv1394="no"
29799f8b 532# enable BeOS things
dfdfa47c 533audio_beos="yes"
ef0bc4c9
FR
534# no need for libm, but the inet stuff
535# Check for BONE
536if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
537extralibs="-lbind -lsocket"
538else
26b35efb 539netserver="yes"
4baca069 540need_inet_aton="yes"
26b35efb 541extralibs="-lnet"
ef0bc4c9 542fi ;;
4baca069
PG
543SunOS)
544v4l="no"
0a7b514f 545v4l2="no"
4baca069 546audio_oss="no"
8aa3ee32 547dv1394="no"
4baca069 548make="gmake"
e89b8b0a 549FFLDFLAGS=""
c536cb09 550FFSERVERLDFLAGS=""
813457e5 551SHFLAGS="-shared -Wl,-h,\$@"
4baca069 552need_inet_aton="yes"
30a3e5d4 553add_extralibs "-lsocket -lnsl"
4baca069 554;;
b7aa4a59
SS
555NetBSD)
556v4l="no"
0a7b514f 557v4l2="no"
6beefa40 558bktr="yes"
b7aa4a59
SS
559audio_oss="yes"
560dv1394="no"
561make="gmake"
30a3e5d4 562add_extralibs "-lossaudio"
b7aa4a59 563;;
8c802695
JM
564OpenBSD)
565v4l="no"
0a7b514f 566v4l2="no"
6beefa40 567bktr="yes"
8c802695
JM
568audio_oss="yes"
569dv1394="no"
570make="gmake"
80581e98 571LIBOBJFLAGS="\$(PIC)"
a1309f8f 572LDCONFIG="ldconfig -m \$(shlibdir)"
30a3e5d4 573add_extralibs "-lossaudio"
8c802695 574;;
9c938e77
PG
575FreeBSD)
576v4l="no"
0a7b514f 577v4l2="no"
6beefa40 578bktr="yes"
9c938e77 579audio_oss="yes"
8aa3ee32 580dv1394="no"
9c938e77 581make="gmake"
30a3e5d4 582add_cflags "-pthread"
9c938e77 583;;
38f0d3ce
DB
584GNU/kFreeBSD)
585v4l="no"
586v4l2="no"
587bktr="yes"
588audio_oss="yes"
589dv1394="no"
30a3e5d4 590add_cflags "-pthread"
38f0d3ce 591;;
4a908fbc 592BSD/OS)
5cbcf02c 593v4l="no"
0a7b514f 594v4l2="no"
6beefa40 595bktr="yes"
6063bce7 596audio_oss="yes"
8aa3ee32 597dv1394="no"
4a908fbc
AB
598extralibs="-lpoll -lgnugetopt -lm"
599make="gmake"
1db68540
SS
600strip="strip -d"
601installstrip=""
4a908fbc 602;;
90cee0c3 603Darwin)
a43bd1d7 604cc="cc"
90cee0c3 605v4l="no"
0a7b514f 606v4l2="no"
90cee0c3 607audio_oss="no"
8aa3ee32 608dv1394="no"
a1309f8f 609SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
408382a4 610VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
90cee0c3 611extralibs=""
47930f09 612strip="strip -x"
da186ae2 613installstrip=""
e89b8b0a 614FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
4e159595 615SLIBSUF=".dylib"
f3b60109
DB
616SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
617SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
c536cb09 618FFSERVERLDFLAGS=-Wl,-bind_at_load
d4596ae3 619LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
90cee0c3 620;;
732d9245 621MINGW32*)
951bf3e6 622# Note: the rest of the mingw32 config is done afterwards as mingw32
29799f8b 623# can be forced on the command line for Linux cross compilation.
732d9245
BE
624mingw32="yes"
625;;
3f027ca7 626CYGWIN*)
b2828252 627targetos=CYGWIN
4581fdff 628shlibdir='${PREFIX}/bin'
3f027ca7 629v4l="no"
0a7b514f 630v4l2="no"
3f027ca7 631audio_oss="yes"
8aa3ee32 632dv1394="no"
07a1b05e 633VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
fbb9d104 634VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
3f027ca7 635extralibs=""
487c2fad 636EXESUF=".exe"
4581fdff
VP
637SLIBPREF="cyg"
638SLIBSUF=".dll"
639SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
640SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
641SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
3f027ca7 642;;
b55e4ef4 643Linux)
e240ee67 644LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
b55e4ef4 645;;
99614dd4 646IRIX*)
b2828252 647targetos=IRIX
99614dd4
MB
648ranlib="echo ignoring ranlib"
649v4l="no"
0a7b514f 650v4l2="no"
99614dd4
MB
651audio_oss="no"
652make="gmake"
653;;
f3ec2d46
SG
654OS/2)
655TMPE=$TMPE".exe"
3ca4b654 656ar="emxomfar -p128"
69db4e10
SG
657ranlib="echo ignoring ranlib"
658strip="echo ignoring strip"
30a3e5d4 659add_cflags "-Zomf"
e89b8b0a 660FFLDFLAGS="-Zomf -Zstack 16384 -s"
3ca4b654 661SHFLAGS="-Zdll -Zomf"
c536cb09 662FFSERVERLDFLAGS=""
f3ec2d46
SG
663LIBPREF=""
664LIBSUF=".lib"
665SLIBPREF=""
666SLIBSUF=".dll"
951bf3e6 667EXESUF=".exe"
f3ec2d46 668extralibs=""
c99dd233 669pkg_requires=""
f3ec2d46 670v4l="no"
0a7b514f 671v4l2="no"
f3ec2d46 672audio_oss="no"
8aa3ee32 673dv1394="no"
f3ec2d46 674ffserver="no"
3ca4b654 675vhook="no"
f3ec2d46 676os2="yes"
3ca4b654 677
f3ec2d46 678;;
b2828252
DB
679*)
680targetos="${targetos}-UNKNOWN"
681;;
ef0bc4c9 682esac
de6d9b64 683
0f3cb305 684# find source path
997baf01 685source_path="`dirname \"$0\"`"
0f3cb305
FB
686source_path_used="yes"
687if test -z "$source_path" -o "$source_path" = "." ; then
997baf01 688 source_path="`pwd`"
0f3cb305 689 source_path_used="no"
e7a4dafb
MR
690else
691 source_path="`cd \"$source_path\"; pwd`"
997baf01
MR
692 echo "$source_path" | grep -q '[[:blank:]]' &&
693 die "Out of tree builds are impossible with whitespace in source path."
de6d9b64
FB
694fi
695
7d6ed4aa
MR
696if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
697 show_help
698fi
699
f255e0ab
MB
700FFMPEG_CONFIGURATION=" "
701for opt do
702 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
703done
704
13638ea9
SH
705ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
706DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
707PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
708MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
709DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
009cf97d 710
a8d04fba
MR
711enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
712
de6d9b64 713for opt do
fce53524 714 optval="${opt#*=}"
de6d9b64 715 case "$opt" in
2ba042a7
MR
716 --log)
717 ;;
fce53524 718 --log=*) logging="$optval"
57bd82d4 719 ;;
2266e085 720 --prefix=*) PREFIX="$optval"; force_prefix=yes
de6d9b64 721 ;;
fce53524 722 --libdir=*) libdir="$optval"; force_libdir=yes
cc973ecb 723 ;;
84c22efd
DB
724 --shlibdir=*) shlibdir="$optval"
725 ;;
fce53524 726 --incdir=*) incdir="$optval"
1d67a1d4 727 ;;
fce53524 728 --mandir=*) mandir="$optval"
23a65308 729 ;;
fce53524 730 --source-path=*) source_path="$optval"
0f3cb305 731 ;;
fce53524 732 --cross-prefix=*) cross_prefix="$optval"
0f3cb305 733 ;;
fac252f9
MR
734 --cross-compile) cross_compile=yes
735 ;;
fce53524 736 --cc=*) cc="$optval"
de6d9b64 737 ;;
fce53524 738 --make=*) make="$optval"
4a908fbc 739 ;;
30a3e5d4 740 --extra-cflags=*) add_cflags "$optval"
0f3cb305 741 ;;
28d8e661 742 --extra-ldflags=*) add_ldflags "$optval"
0f3cb305 743 ;;
28d8e661 744 --extra-libs=*) add_extralibs "$optval"
0f3cb305 745 ;;
fce53524 746 --build-suffix=*) BUILDSUF="$optval"
eb94aca9 747 ;;
cc6a90dd 748 --arch=*) arch="$optval"
de6d9b64 749 ;;
38d0a8aa 750 --cpu=*) cpu="$optval"
a4adb608 751 ;;
e45a2872
RD
752 --powerpc-perf-enable) powerpc_perf="yes"
753 ;;
de6d9b64
FB
754 --disable-mmx) mmx="no"
755 ;;
1839e854
SS
756 --disable-armv5te) armv5te="no"
757 ;;
eba9ae3c
GB
758 --disable-iwmmxt) iwmmxt="no"
759 ;;
ab6c65f6
BF
760 --disable-altivec) altivec="no"
761 ;;
de6d9b64
FB
762 --enable-gprof) gprof="yes"
763 ;;
5cbcf02c
FB
764 --disable-v4l) v4l="no"
765 ;;
0a7b514f
LA
766 --disable-v4l2) v4l2="no"
767 ;;
6beefa40
MN
768 --disable-bktr) bktr="no"
769 ;;
5cbcf02c
FB
770 --disable-audio-oss) audio_oss="no"
771 ;;
dfdfa47c
FR
772 --disable-audio-beos) audio_beos="no"
773 ;;
8aa3ee32
MK
774 --disable-dv1394) dv1394="no"
775 ;;
ffc0ef96 776 --disable-network) network="no"; ffserver="no"
5cbcf02c 777 ;;
0c7bb0e5
LB
778 --disable-ipv6) ipv6="no";
779 ;;
0147f198
FR
780 --disable-zlib) zlib="no"
781 ;;
ba9261e5 782 --enable-a52) a52="yes"
6ed7422a 783 ;;
bfd2edeb 784 --enable-a52bin) a52bin="yes"
57514323 785 ;;
c99dd233 786 --enable-dts) dts="yes"
23c99253 787 ;;
ba9261e5 788 --enable-pp) pp="yes"
bba9b16c 789 ;;
bb4c2140
MN
790 --enable-libgsm) libgsm="yes"
791 ;;
c99dd233 792 --enable-mp3lame) mp3lame="yes"
a6741398 793 ;;
f956e129
OS
794 --enable-libnut) libnut="yes"
795 ;;
9146ca37 796 --enable-libogg) libogg="yes"
c99dd233 797 pkg_requires="$pkg_requires ogg >= 1.1"
5c5dea3f 798 ;;
81e0d0b4 799 --enable-vorbis) vorbis="yes"
c99dd233 800 pkg_requires="$pkg_requires vorbis vorbisenc"
81e0d0b4 801 ;;
445ad18d
ZK
802 --enable-faad) faad="yes"
803 ;;
804 --enable-faadbin) faadbin="yes"
805 ;;
c99dd233 806 --enable-faac) faac="yes"
29d48296 807 ;;
1ddadfa9
AT
808 --enable-xvid) xvid="yes"
809 ;;
c99dd233 810 --enable-x264) x264="yes"
6662ec29 811 ;;
8ac17293
SH
812 --enable-avisynth) avisynth="yes";
813 ;;
f02be79d 814 --enable-dc1394) dc1394="yes"
c99dd233 815 pkg_requires="$pkg_requires libraw1394"
f02be79d 816 ;;
68892110
PG
817 --disable-vhook) vhook="no"
818 ;;
c02dbee1 819 --disable-simple_idct) simpleidct="no"
045ed63f 820 ;;
732d9245
BE
821 --enable-mingw32) mingw32="yes"
822 ;;
ac44871c
GB
823 --enable-mingwce) mingwce="yes"
824 ;;
320d060a
DB
825 --enable-static) lstatic="yes"
826 ;;
827 --disable-static) lstatic="no"
828 ;;
83286d2a 829 --enable-shared) lshared="yes"
0319c531 830 ;;
320d060a
DB
831 --disable-shared) lshared="no"
832 ;;
cddf3f45
GM
833 --disable-debug) debug="no"
834 ;;
835 --disable-opts) optimize="no"
836 ;;
78fcba8f
MR
837 --enable-extra-warnings) extrawarnings="yes"
838 ;;
1eb2212e
FB
839 --disable-mpegaudio-hp) mpegaudio_hp="no"
840 ;;
04f46ced
GB
841 --disable-protocols) protocols="no"; network="no"; ffserver="no"
842 ;;
786b30af
DB
843 --disable-ffmpeg) ffmpeg="no"
844 ;;
8154d2e0
FB
845 --disable-ffserver) ffserver="no"
846 ;;
a86b921c
FB
847 --disable-ffplay) ffplay="no"
848 ;;
cddf3f45 849 --enable-small) optimize="small"
553a6284 850 ;;
60827a1a 851 --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
891f64b3 852 ;;
60827a1a 853 --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
bc634f6f 854 ;;
60827a1a 855 --enable-amr_wb) amr="yes"; amr_wb="yes"
115329f1 856 ;;
60827a1a 857 --enable-amr_if2) amr="yes"; amr_if2="yes"
2a515c08 858 ;;
f80f7964
RS
859 --enable-sunmlib) sunmlib="yes"
860 ;;
9c3d33d6
MN
861 --enable-pthreads) pthreads="yes"
862 ;;
790c9ca7
LA
863 --enable-swscaler) swscaler="yes"
864 ;;
b2e3c528
MN
865 --enable-gpl) gpl="yes"
866 ;;
da9b170c
MN
867 --enable-memalign-hack) memalignhack="yes"
868 ;;
65d1bea2
MB
869 --disable-strip) dostrip="no"
870 ;;
a8d04fba 871 --enable-encoder=*) enable ${optval}_encoder
009cf97d 872 ;;
a8d04fba 873 --enable-decoder=*) enable ${optval}_decoder
f593b273 874 ;;
a8d04fba 875 --disable-encoder=*) disable ${optval}_encoder
f593b273 876 ;;
a8d04fba 877 --disable-decoder=*) disable ${optval}_decoder
009cf97d 878 ;;
a8d04fba 879 --disable-encoders) disable $ENCODER_LIST
009cf97d 880 ;;
a8d04fba 881 --disable-decoders) disable $DECODER_LIST
b4cad537 882 ;;
a8d04fba 883 --enable-muxer=*) enable ${optval}_muxer
a9e35095 884 ;;
a8d04fba 885 --disable-muxer=*) disable ${optval}_muxer
ff70e601 886 ;;
a8d04fba 887 --disable-muxers) disable $MUXER_LIST; ffserver="no"
ff70e601 888 ;;
a8d04fba 889 --enable-demuxer=*) enable ${optval}_demuxer
ff70e601 890 ;;
a8d04fba 891 --disable-demuxer=*) disable ${optval}_demuxer
ff70e601 892 ;;
a8d04fba 893 --disable-demuxers) disable $DEMUXER_LIST
a9e35095 894 ;;
a8d04fba 895 --enable-parser=*) enable ${optval}_parser
af9e7d18 896 ;;
a8d04fba 897 --disable-parser=*) disable ${optval}_parser
af9e7d18 898 ;;
a8d04fba 899 --disable-parsers) disable $PARSER_LIST
af9e7d18 900 ;;
74c53c2d
MR
901 --help) show_help
902 ;;
b34c63f7
DB
903 *)
904 echo "Unknown option \"$opt\"."
905 echo "See $0 --help for available options."
906 exit 1
907 ;;
de6d9b64
FB
908 esac
909done
910
720c69da
MR
911if test "$logging" != no; then
912 test "$logging" = yes || logfile="$logging"
57bd82d4
MR
913 echo "# $0 $@" >$logfile
914 set >>$logfile
2ba042a7
MR
915else
916 logfile=/dev/null
57bd82d4 917fi
e89b8b0a 918
e67bcdd9
DB
919if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
920 if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
921 cat <<EOF
922You can only build one library type at once on MinGW.
923Specify --disable-static --enable-shared to only build
924the shared libraries. To build only the static libraries
925you do not need to pass additional options.
926EOF
927 exit 1
928 fi
929 v4l="no"
930 v4l2="no"
931 bktr="no"
932 audio_oss="no"
933 dv1394="no"
934 dc1394="no"
935 ffserver="no"
936 network="no"
937 if test "$mingwce" = "yes"; then
938 protocols="no"
939 fi
e67bcdd9
DB
940 SLIBPREF=""
941 SLIBSUF=".dll"
942 EXESUF=".exe"
d6a07a13
DB
943 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
944 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
dfeb80a5 945 SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
b89c8f58 946 SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
2266e085 947 if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
1066a995
DB
948 if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
949 shlibdir='${PREFIX}'
e67bcdd9
DB
950fi
951
28d8e661
DB
952# Combine FFLDFLAGS and the LDFLAGS environment variable.
953LDFLAGS="$FFLDFLAGS $LDFLAGS"
e89b8b0a 954
fac252f9 955test -n "$cross_prefix" && cross_compile=yes
1ea46bed
MR
956cc="${cross_prefix}${cc}"
957ar="${cross_prefix}${ar}"
958ranlib="${cross_prefix}${ranlib}"
959strip="${cross_prefix}${strip}"
960
320d060a
DB
961# we need to build at least one lib type
962if test "$lstatic" = "no" && test "$lshared" = "no" ; then
963 cat <<EOF
964At least one library type must be built.
965Specify --enable-static to build the static libraries or --enable-shared to
966build the shared libraries as well. To only build the shared libraries specify
967--disable-static in addition to --enable-shared.
968EOF
969 exit 1;
970fi
971
5c5dea3f 972if test "$vorbis" = "yes" ; then
9146ca37 973 if test "$libogg" = "no"; then
29799f8b 974 echo "libogg must be enabled to enable Vorbis."
5c5dea3f 975 fail="yes"
5c5dea3f
NB
976 fi
977fi
978
b2e3c528 979if test "$gpl" != "yes"; then
ba64106a 980 if test "$pp" != "no"; then
29799f8b 981 echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
b2e3c528
MN
982 fail="yes"
983 fi
984
985 if test "$a52" != "no" -o "$a52bin" != "no"; then
29799f8b 986 echo "liba52 is under GPL and --enable-gpl is not specified."
b2e3c528
MN
987 fail="yes"
988 fi
23c99253 989
1ddadfa9 990 if test "$xvid" != "no"; then
29799f8b 991 echo "libxvidcore is under GPL and --enable-gpl is not specified."
1ddadfa9
AT
992 fail="yes"
993 fi
994
6662ec29 995 if test "$x264" != "no"; then
29799f8b 996 echo "x264 is under GPL and --enable-gpl is not specified."
6662ec29
MN
997 fail="yes"
998 fi
999
23c99253 1000 if test "$dts" != "no"; then
29799f8b 1001 echo "libdts is under GPL and --enable-gpl is not specified."
23c99253
MN
1002 fail="yes"
1003 fi
115329f1 1004
b2e3c528 1005 if test "$faad" != "no" -o "$faadbin" != "no"; then
dcd479c0
MR
1006 if check_header faad.h; then
1007 check_cc << EOF
b2e3c528
MN
1008 #include <faad.h>
1009 #ifndef FAAD2_VERSION
1010 ok faad1
1011 #endif
1012 int main( void ) { return 0; }
1013EOF
dcd479c0 1014 if test $? = 0 ; then
29799f8b 1015 echo "FAAD2 is under GPL and --enable-gpl is not specified."
b2e3c528
MN
1016 fail="yes"
1017 fi
1018 else
1019 faad="no"
1020 faadbin="no"
29799f8b 1021 echo "FAAD test failed."
b2e3c528
MN
1022 fi
1023 fi
115329f1 1024
790c9ca7
LA
1025 if test "$swscaler" != "no"; then
1026 echo "The software scaler is under GPL and --enable-gpl is not specified."
1027 fail="yes"
1028 fi
ebb810d9 1029fi
b2e3c528 1030
ebb810d9
RP
1031if test "$fail" = "yes"; then
1032 exit 1
b2e3c528
MN
1033fi
1034
29799f8b 1035# compute MMX state
0f3cb305 1036if test $mmx = "default"; then
419b8784 1037 if test $arch = "x86_32" -o $arch = "x86_64"; then
0f3cb305
FB
1038 mmx="yes"
1039 else
1040 mmx="no"
1041 fi
1042fi
1043
cf9d24ad 1044#Darwin CC versions
75388c74 1045needmdynamicnopic="no"
cf9d24ad 1046if test $targetos = Darwin; then
b2924696 1047 if test -n "`$cc -v 2>&1 | grep xlc`"; then
30a3e5d4 1048 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
cf9d24ad 1049 else
bb270c08
DB
1050 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1051 case "$gcc_version" in
1052 *2.95*)
30a3e5d4 1053 add_cflags "-no-cpp-precomp -pipe"
bb270c08
DB
1054 ;;
1055 *[34].*)
30a3e5d4 1056 add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
bb270c08
DB
1057 if test "$lshared" = no; then
1058 needmdynamicnopic="yes"
1059 fi
1060 ;;
1061 *)
30a3e5d4 1062 add_cflags "-no-cpp-precomp -pipe"
bb270c08
DB
1063 if test "$lshared" = no; then
1064 needmdynamicnopic="yes"
1065 fi
1066 ;;
1067 esac
cf9d24ad 1068 fi
2a1a6b64
MN
1069fi
1070
1071if test $optimize != "no"; then
1072 add_cflags "-fomit-frame-pointer"
cf9d24ad
DC
1073fi
1074
ab6c65f6
BF
1075# Can only do AltiVec on PowerPC
1076if test $altivec = "default"; then
cc6a90dd 1077 if test $arch = "powerpc"; then
ab6c65f6
BF
1078 altivec="yes"
1079 else
1080 altivec="no"
1081 fi
1082fi
1083
a4adb608
MN
1084# Add processor-specific flags
1085TUNECPU="generic"
9007f514 1086POWERPCMODE="32bits"
38d0a8aa
GP
1087if test $cpu != "generic"; then
1088 case $cpu in
bb270c08 1089 601|ppc601|PowerPC601)
1c5d830c 1090 add_cflags "-mcpu=601"
bb270c08
DB
1091 if test $altivec = "yes"; then
1092 echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
1093 fi
1094 TUNECPU=ppc601
1095 ;;
1096 603*|ppc603*|PowerPC603*)
1c5d830c 1097 add_cflags "-mcpu=603"
bb270c08
DB
1098 if test $altivec = "yes"; then
1099 echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
1100 fi
1101 TUNECPU=ppc603
1102 ;;
1103 604*|ppc604*|PowerPC604*)
1c5d830c 1104 add_cflags "-mcpu=604"
bb270c08
DB
1105 if test $altivec = "yes"; then
1106 echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
1107 fi
1108 TUNECPU=ppc604
1109 ;;
1110 G3|g3|75*|ppc75*|PowerPC75*)
1c5d830c 1111 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
bb270c08
DB
1112 if test $altivec = "yes"; then
1113 echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
1114 fi
1115 TUNECPU=ppc750
1116 ;;
1117 G4|g4|745*|ppc745*|PowerPC745*)
1c5d830c 1118 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
bb270c08
DB
1119 if test $altivec = "no"; then
1120 echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
1121 fi
1122 TUNECPU=ppc7450
1123 ;;
1124 74*|ppc74*|PowerPC74*)
1c5d830c 1125 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
bb270c08
DB
1126 if test $altivec = "no"; then
1127 echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
1128 fi
1129 TUNECPU=ppc7400
1130 ;;
1131 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1c5d830c 1132 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
bb270c08
DB
1133 if test $altivec = "no"; then
1134 echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
1135 fi
1136 TUNECPU=ppc970
9007f514 1137 POWERPCMODE="64bits"
bb270c08 1138 ;;
e7768fc5
GP
1139 # targets that do NOT support conditional mov (cmov)
1140 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
38d0a8aa 1141 add_cflags "-march=$cpu"
e7768fc5
GP
1142 cmov="no"
1143 ;;
1144 # targets that do support conditional mov (cmov)
94e4c3a3 1145 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
e7768fc5 1146 add_cflags "-march=$cpu"
4c8d81fa 1147 cmov="yes"
94e4c3a3
GP
1148 cmov_is_fast="yes"
1149 ;;
1150 # targets that do support conditional mov but on which it's slow
1151 pentium4|prescott|nocona)
1152 add_cflags "-march=$cpu"
1153 cmov="yes"
1154 cmov_is_fast="no"
bb270c08 1155 ;;
d7b34d08 1156 sparc64)
1c5d830c 1157 add_cflags "-mcpu=v9"
d7b34d08 1158 ;;
bb270c08 1159 *)
38d0a8aa 1160 echo "WARNING: Unknown CPU \"$cpu\", ignored."
bb270c08 1161 ;;
a4adb608
MN
1162 esac
1163fi
1164
be0d52ab
MR
1165# make sure we can execute files in $TMPDIR
1166cat >$TMPE 2>>$logfile <<EOF
1167#! /bin/sh
1168EOF
1169chmod +x $TMPE >>$logfile 2>&1
1170if ! $TMPE >>$logfile 2>&1; then
1171 cat <<EOF
1172Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
68300911
DB
1173variable to another directory and make sure that $TMPDIR1 is not mounted
1174noexec.
be0d52ab
MR
1175EOF
1176 die "Sanity test failed."
1177fi
0244f743 1178rm $TMPE
be0d52ab 1179
1a268acc
MR
1180# compiler sanity check
1181check_exec <<EOF
1182int main(){
1183 return 0;
1184}
1185EOF
1186if test "$?" != 0; then
1187 echo "$cc is unable to create an executable file."
1188 if test -z "$cross_prefix" -a "$cross_compile" = no; then
1189 echo "If $cc is a cross-compiler, use the --cross-compile option."
c7ae6345 1190 echo "Only do this if you know what cross compiling means."
1a268acc
MR
1191 fi
1192 die "C compiler test failed."
1193fi
1194
87ea51e0
LB
1195# check for assembler specific support
1196
cc6a90dd 1197if test $arch = "powerpc"; then
87ea51e0
LB
1198check_cc <<EOF && dcbzl=yes
1199int main(void) {
1200 register long zero = 0;
1201 char data[1024];
1202 asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1203return 0;
1204}
1205EOF
1206fi
1207
57bd82d4
MR
1208# check for SIMD availability
1209
115329f1 1210# AltiVec flags: The FSF version of GCC differs from the Apple version
cc6a90dd 1211if test $arch = "powerpc"; then
b6e52719 1212 if test $altivec = "yes"; then
b2924696 1213 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
30a3e5d4 1214 add_cflags "-faltivec"
b6e52719 1215 else
30a3e5d4 1216 add_cflags "-maltivec -mabi=altivec"
b6e52719
MD
1217 fi
1218 fi
1219fi
1220
dcd479c0 1221check_header altivec.h && _altivec_h=yes || _altivec_h=no
a9a07762 1222
29799f8b 1223# check if our compiler supports Motorola AltiVec C API
ab6c65f6 1224if test $altivec = "yes"; then
f25fc9b1
MR
1225 if test $_altivec_h = "yes"; then
1226 inc_altivec_h="#include <altivec.h>"
1227 else
1228 inc_altivec_h=
1229 fi
1230 check_cc <<EOF || altivec=no
dcd479c0 1231$inc_altivec_h
a9a07762
MN
1232int main(void) {
1233 vector signed int v1, v2, v3;
1234 v1 = vec_add(v2,v3);
1235 return 0;
1236}
1237EOF
1238fi
ab6c65f6 1239
854fdb51 1240# check armv5te instructions support
cc6a90dd 1241if test $armv5te = "default" -a $arch = "armv4l"; then
854fdb51
MR
1242 armv5te=no
1243 check_cc <<EOF && armv5te=yes
1244 int main(void) {
1245 __asm__ __volatile__ ("qadd r0, r0, r0");
1246 }
1247EOF
1248fi
1249
1250# check iwmmxt support
cc6a90dd 1251if test $iwmmxt = "default" -a $arch = "armv4l"; then
854fdb51
MR
1252 iwmmxt=no
1253 check_cc <<EOF && iwmmxt=yes
1254 int main(void) {
1255 __asm__ __volatile__ ("wunpckelub wr6, wr4");
1256 }
1257EOF
1258fi
1259
29799f8b 1260# mmi only available on mips
d46aba26 1261if test $mmi = "default"; then
cc6a90dd 1262 if test $arch = "mips"; then
d46aba26
LS
1263 mmi="yes"
1264 else
1265 mmi="no"
1266 fi
1267fi
1268
29799f8b 1269# check if our compiler supports mmi
57bd82d4 1270enabled mmi && check_cc <<EOF || mmi="no"
d46aba26
LS
1271int main(void) {
1272 __asm__ ("lq \$2, 0(\$2)");
1273 return 0;
1274}
1275EOF
57bd82d4 1276
57bd82d4
MR
1277# ---
1278# big/little-endian test
fac252f9 1279if test "$cross_compile" = "no"; then
57bd82d4 1280 check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
a3999908
MN
1281#include <inttypes.h>
1282int main(int argc, char ** argv){
bb270c08
DB
1283 volatile uint32_t i=0x01234567;
1284 return (*((uint8_t*)(&i))) == 0x67;
a3999908
MN
1285}
1286EOF
487a54d7 1287else
f25fc9b1 1288 # programs cannot be launched if cross compiling, so make a static guess
cc6a90dd 1289 if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
f25fc9b1
MR
1290 bigendian="yes"
1291 fi
487a54d7
FB
1292fi
1293
a3999908 1294# ---
7f965c1c 1295# *inttypes.h* test
dcd479c0 1296check_header inttypes.h || inttypes=no
7f965c1c
CF
1297
1298# ---
b5c950c4 1299# *int_fast* test
dcd479c0 1300check_cc <<EOF || emu_fast_int=yes
b5c950c4
MN
1301#include <inttypes.h>
1302int main(int argc, char ** argv){
bb270c08
DB
1303 volatile uint_fast64_t i=0x01234567;
1304 return 0;
b5c950c4
MN
1305}
1306EOF
1307
b5c950c4 1308# ---
3d204385
NK
1309# check availability of some header files
1310
3d204385
NK
1311_memalign=no
1312_malloc_h=no
dcd479c0
MR
1313if check_header malloc.h; then
1314 _malloc_h=yes
1315 _memalign=yes
1316 check_func memalign || _memalign="no"
3d204385
NK
1317fi
1318
8b3a43cf 1319if test "$_memalign" = "no" -a "$mmx" = "yes" -a \
a9907393
DM
1320 "$memalignhack" != "yes" -a "$targetos" != "Darwin" -a \
1321 "$targetos" != "FreeBSD" ; then
57bd82d4 1322 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
8bf5d58f
MN
1323fi
1324
47d23bbf
MR
1325check_header byteswap.h && byteswap_h=yes || byteswap_h=no
1326
dcd479c0 1327check_func localtime_r && localtime_r=yes || localtime_r=no
57bd82d4 1328enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
57bd82d4
MR
1329
1330# check for some common methods of building with pthread support
1331# do this before the optional library checks as some of them require pthreads
1332if enabled pthreads; then
1333 { check_cflags -pthread && check_ldflags -pthread; } ||
1334 { check_cflags -pthreads && check_ldflags -pthreads; } ||
1335 check_lib pthread.h pthread_create -lpthread ||
1336 check_func pthread_create ||
1337 die "ERROR: can't find pthreads library"
1338fi
1339
1340# these are off by default, so fail if requested and not available
4cbed916 1341enabled dts && require libdts dts.h dts_init -ldts -lm
57bd82d4 1342enabled libgsm && require libgsm gsm.h gsm_create -lgsm
4cbed916 1343enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
8515d1c8 1344enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
aedf11f8 1345enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
f956e129 1346enabled libnut && require libnut nut.h nut_demuxer_init -lnut
57bd82d4
MR
1347enabled xvid && require XviD xvid.h xvid_global -lxvidcore
1348enabled x264 && require x264 x264.h x264_encoder_open -lx264
1349enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1350enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
e0f80bd7 1351
3b9bee88
MR
1352# Ugh, faac uses stdcall calling convention on win32 so we can't use
1353# the generic test functions
1354if enabled faac; then
1355 save_flags
1356 temp_extralibs -lfaac
1357 check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1358#include <stdint.h>
1359#include <faac.h>
1360int main(){
1361 char *id, *cpr;
1362 faacEncGetVersion(&id, &cpr);
1363 return 0;
1364}
1365EOF
1366 restore_flags
1367fi
1368
87f1c97e
MR
1369# Ugh, recent faad2 versions have renamed all functions and #define the
1370# old names in faad.h. Generic tests won't work.
1371if enabled faad; then
1372 save_flags
1373 temp_extralibs -lfaad
1374 check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1375#include <faad.h>
1376int main(){
1377 faacDecOpen();
1378 return 0;
1379}
1380EOF
1381 restore_flags
1382fi
1383
8ac17293
SH
1384# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1385if enabled avisynth; then
1386 save_flags
1387 temp_extralibs -lvfw32
1388 check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1389#include <windows.h>
1390#include <vfw.h>
1391int main(){
1392 AVIFileInit();
1393 return 0;
1394}
1395EOF
1396 restore_flags
1397fi
1398
1399
95e2ce4a 1400# test for lrintf in math.h
dcd479c0 1401check_exec <<EOF && have_lrintf=yes || have_lrintf=no
95e2ce4a
MN
1402#define _ISOC9X_SOURCE 1
1403#include <math.h>
1404int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1405EOF
1406
c13e1abd
FH
1407_restrict=
1408for restrict_keyword in restrict __restrict__ __restrict; do
57bd82d4 1409 check_cc <<EOF && _restrict=$restrict_keyword && break
dcd479c0
MR
1410void foo(char * $restrict_keyword p);
1411EOF
c13e1abd
FH
1412done
1413
a8721c09
FB
1414# dlopen/dlfcn.h probing
1415
dcd479c0 1416check_header dlfcn.h && dlfcn=yes
a8721c09 1417
dcd479c0
MR
1418temp_extralibs -ldl
1419if check_func dlopen; then
1420 dlopen=yes
1421 ldl=-ldl
a8721c09 1422fi
dcd479c0 1423restore_flags
a8721c09 1424
dcd479c0
MR
1425if check_func dlopen; then
1426 dlopen=yes
1427 ldl=
a8721c09
FB
1428fi
1429
f25fc9b1
MR
1430if test "$vhook" = "default"; then
1431 vhook="$dlopen"
a8721c09
FB
1432fi
1433
bfd2edeb 1434if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
57bd82d4 1435 add_extralibs $ldl
bfd2edeb
MN
1436fi
1437
fbb9d104
VP
1438if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1439 vhook="no"
1440 echo
1441 echo "At the moment vhooks don't work on Cygwin static builds."
1442 echo "Patches welcome."
1443 echo
1444fi
1445
8d923001
MR
1446if enabled vhook; then
1447 check_ldflags -rdynamic
1448 check_ldflags -export-dynamic
1449fi
bfd2edeb 1450
a86b921c 1451##########################################
29799f8b 1452# imlib check
a86b921c 1453
dcd479c0
MR
1454temp_extralibs -lImlib2
1455check_ld <<EOF && imlib2=yes || imlib2=no
a8721c09
FB
1456#include <X11/Xlib.h>
1457#include <Imlib2.h>
1458int main( void ) { return (int) imlib_load_font("foo"); }
1459EOF
dcd479c0 1460restore_flags
52b41d7f 1461
a86b921c 1462##########################################
29799f8b 1463# FreeType check
a86b921c 1464
04511d53 1465freetype2=no
e2a5fd20 1466if test "x$targetos" != "xBeOS"; then
e2a3cd59 1467 if (freetype-config --version) >/dev/null 2>&1 ; then
dcd479c0
MR
1468 temp_cflags `freetype-config --cflags`
1469 temp_extralibs `freetype-config --libs`
1470 check_ld <<EOF && freetype2=yes
1471#include <ft2build.h>
1472int main( void ) { return (int) FT_Init_FreeType(0); }
1473EOF
1474 restore_flags
dee076fc 1475 fi
04511d53
PG
1476fi
1477
a86b921c 1478##########################################
29799f8b 1479# SDL check
a86b921c 1480
a86b921c
FB
1481sdl_too_old=no
1482sdl=no
6a1a892f
FD
1483SDL_CONFIG="${cross_prefix}sdl-config"
1484if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
dcd479c0
MR
1485 temp_cflags `"${SDL_CONFIG}" --cflags`
1486 temp_extralibs `"${SDL_CONFIG}" --libs`
1487 check_ld <<EOF
1488#include <SDL.h>
1489#undef main /* We don't want SDL to override our main() */
1490int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1491EOF
dcd479c0
MR
1492 if test $? = 0; then
1493 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
29f3b38a 1494 if test "$_sdlversion" -lt 121 ; then
dcd479c0
MR
1495 sdl_too_old=yes
1496 else
1497 sdl=yes
29f3b38a
MR
1498 check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
1499#include <SDL.h>
1500int main(void){
1501 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1502 int w = vi->current_w;
1503 return 0;
1504}
1505EOF
dcd479c0
MR
1506 fi
1507 fi
29f3b38a 1508 restore_flags
c3f6b472 1509fi
a86b921c 1510
57bd82d4
MR
1511enabled sdl || ffplay=no
1512
146ea952 1513##########################################
29799f8b 1514# texi2html check
146ea952
NB
1515
1516texi2html=no
e2a3cd59 1517if (texi2html -version) >/dev/null 2>&1; then
146ea952
NB
1518texi2html=yes
1519fi
1520
7a91333f 1521##########################################
29799f8b 1522# IPv6 check
7a91333f 1523
0c7bb0e5 1524enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
7a91333f
HZ
1525#include <sys/types.h>
1526#include <sys/socket.h>
1527#include <netinet/in.h>
1528#include <netdb.h>
1529int main( void ) {
1530 struct sockaddr_storage saddr;
1531 struct ipv6_mreq mreq6;
1532 getaddrinfo(0,0,0,0);
1533 getnameinfo(0,0,0,0,0,0,0);
12fe88b4 1534 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
7a91333f
HZ
1535}
1536EOF
1537
47f38850 1538# check for video4linux2 --- V4L2_PIX_FMT_YUV420
57bd82d4 1539enabled v4l2 && check_cc <<EOF || v4l2="no"
84fe9963 1540#include <sys/time.h>
f743a062
LA
1541#include <asm/types.h>
1542#include <linux/videodev2.h>
47f38850 1543int dummy = V4L2_PIX_FMT_YUV420;
490c189b 1544struct v4l2_buffer dummy1;
47f38850 1545EOF
47f38850 1546
57bd82d4
MR
1547enabled debug && add_cflags -g
1548
1549# add some useful compiler flags if supported
1550check_cflags -Wdeclaration-after-statement
dcd479c0
MR
1551check_cflags -Wall
1552check_cflags -Wno-switch
c07bd6a9
MN
1553check_cflags -Wdisabled-optimization
1554check_cflags -Wpointer-arith
1555check_cflags -Wredundant-decls
78fcba8f 1556enabled extrawarnings && check_cflags -Winline
cf9d24ad 1557
57bd82d4 1558# add some linker flags
e240ee67 1559check_ldflags $LDLATEFLAGS
94a3401e 1560
57bd82d4
MR
1561# not all compilers support -Os
1562test "$optimize" = "small" && check_cflags -Os
cddf3f45 1563
57bd82d4 1564if enabled optimize; then
b2924696 1565 if test -n "`$cc -v 2>&1 | grep xlc`"; then
30a3e5d4
NP
1566 add_cflags "-O5"
1567 add_ldflags "-O5"
cf9d24ad 1568 else
30a3e5d4 1569 add_cflags "-O3"
cf9d24ad 1570 fi
cddf3f45
GM
1571fi
1572
80581e98
MN
1573# PIC flags for shared library objects where they are needed
1574if test "$lshared" = "yes" ; then
f25fc9b1
MR
1575 # LIBOBJFLAGS may have already been set in the OS configuration
1576 if test -z "$LIBOBJFLAGS" ; then
cc6a90dd 1577 case "$arch" in
813457e5
MR
1578 x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1579 esac
80581e98 1580 fi
80581e98
MN
1581fi
1582
1db54e20 1583if test "$gprof" = "yes" ; then
30a3e5d4
NP
1584 add_cflags "-p"
1585 add_ldflags "-p"
1db54e20
DB
1586fi
1587
4454dc1b
JD
1588# find if .align arg is power-of-two or not
1589if test $asmalign_pot = "unknown"; then
1590 asmalign_pot="no"
1591 echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1592fi
1593
2266e085 1594echo "install prefix $PREFIX"
29799f8b 1595echo "source path $source_path"
de6d9b64 1596echo "C compiler $cc"
4a908fbc 1597echo "make $make"
38d0a8aa 1598echo "ARCH $arch ($cpu)"
eb94aca9 1599if test "$BUILDSUF" != ""; then
f25fc9b1 1600 echo "build suffix $BUILDSUF"
eb94aca9 1601fi
29799f8b 1602echo "big-endian $bigendian"
7f965c1c 1603echo "inttypes.h $inttypes"
b5c950c4 1604echo "broken inttypes.h $emu_fast_int"
419b8784 1605if test $arch = "x86_32" -o $arch = "x86_64"; then
f25fc9b1 1606 echo "MMX enabled $mmx"
e7768fc5 1607 echo "CMOV enabled $cmov"
94e4c3a3 1608 echo "CMOV is fast $cmov_is_fast"
e41e8342 1609fi
cc6a90dd 1610if test $arch = "armv4l"; then
1839e854 1611 echo "ARMv5TE enabled $armv5te"
f25fc9b1 1612 echo "IWMMXT enabled $iwmmxt"
eba9ae3c 1613fi
cc6a90dd 1614if test $arch = "mips"; then
f25fc9b1 1615 echo "MMI enabled $mmi"
e41e8342 1616fi
cc6a90dd 1617if test $arch = "powerpc"; then
f25fc9b1 1618 echo "AltiVec enabled $altivec"
87ea51e0 1619 echo "dcbzl available $dcbzl"
e41e8342 1620fi
de6d9b64 1621echo "gprof enabled $gprof"
0147f198 1622echo "zlib enabled $zlib"
bb4c2140 1623echo "libgsm enabled $libgsm"
a6741398 1624echo "mp3lame enabled $mp3lame"
f956e129 1625echo "libnut enabled $libnut"
9146ca37 1626echo "libogg enabled $libogg"
29799f8b 1627echo "Vorbis enabled $vorbis"
29799f8b 1628echo "FAAD enabled $faad"
445ad18d 1629echo "faadbin enabled $faadbin"
29799f8b
DB
1630echo "FAAC enabled $faac"
1631echo "XviD enabled $xvid"
6662ec29 1632echo "x264 enabled $x264"
5cbcf02c 1633echo "a52 support $a52"
57514323 1634echo "a52 dlopened $a52bin"
29799f8b 1635echo "DTS support $dts"
bba9b16c 1636echo "pp support $pp"
790c9ca7 1637echo "Software Scaler enabled $swscaler"
8ac17293 1638echo "AVISynth enabled $avisynth"
cddf3f45 1639echo "debug symbols $debug"
65d1bea2 1640echo "strip symbols $dostrip"
cddf3f45 1641echo "optimize $optimize"
320d060a 1642echo "static $lstatic"
1ddf5ba1 1643echo "shared $lshared"
29799f8b 1644echo "video hooking $vhook"
a86b921c
FB
1645echo "SDL support $sdl"
1646if test $sdl_too_old = "yes"; then
f25fc9b1 1647 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
a86b921c 1648fi
68892110 1649
f25fc9b1
MR
1650if test "$vhook" = "yes"; then
1651 echo "Imlib2 support $imlib2"
1652 echo "FreeType support $freetype2"
68892110 1653fi
f80f7964 1654echo "Sun medialib support" $sunmlib
9c3d33d6 1655echo "pthreads support" $pthreads
bc634f6f
ZK
1656echo "AMR-NB float support" $amr_nb
1657echo "AMR-NB fixed support" $amr_nb_fixed
d663a1fd 1658echo "AMR-WB float support" $amr_wb
2a515c08 1659echo "AMR-WB IF2 support" $amr_if2
7a91333f
HZ
1660echo "network support $network"
1661if test "$network" = "yes" ; then
f25fc9b1 1662 echo "IPv6 support $ipv6"
7a91333f 1663fi
4454dc1b 1664echo ".align is power-of-two" $asmalign_pot
b2e3c528 1665if test "$gpl" = "no" ; then
f25fc9b1 1666 echo "License: LGPL"
b2e3c528 1667else
f25fc9b1 1668 echo "License: GPL"
b2e3c528 1669fi
de6d9b64 1670
29799f8b 1671echo "Creating config.mak and config.h..."
de6d9b64 1672
f255e0ab
MB
1673date >> config.log
1674echo " $0 $FFMPEG_CONFIGURATION" >> config.log
29799f8b
DB
1675echo "# Automatically generated by configure - do not modify!" > config.mak
1676echo "/* Automatically generated by configure - do not modify! */" > $TMPH
f255e0ab 1677echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
de6d9b64 1678
2266e085
DB
1679echo "PREFIX=$PREFIX" >> config.mak
1680echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
9a695e98 1681echo "libdir=\$(DESTDIR)$libdir" >> config.mak
84c22efd 1682echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1d67a1d4 1683echo "incdir=\$(DESTDIR)$incdir" >> config.mak
9a695e98
DB
1684echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1685echo "mandir=\$(DESTDIR)$mandir" >> config.mak
4a908fbc 1686echo "MAKE=$make" >> config.mak
980fc7b8
FB
1687echo "CC=$cc" >> config.mak
1688echo "AR=$ar" >> config.mak
be7109c1 1689echo "RANLIB=$ranlib" >> config.mak
65d1bea2 1690if test "$dostrip" = "yes" ; then
f25fc9b1
MR
1691 echo "STRIP=$strip" >> config.mak
1692 echo "INSTALLSTRIP=$installstrip" >> config.mak
65d1bea2 1693else
f25fc9b1
MR
1694 echo "STRIP=echo ignoring strip" >> config.mak
1695 echo "INSTALLSTRIP=" >> config.mak
65d1bea2 1696fi
75388c74 1697
408382a4 1698VHOOKCFLAGS="-fPIC $CFLAGS"
57bd82d4 1699test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
75388c74 1700
a9b3f630 1701echo "OPTFLAGS=$CFLAGS" >> config.mak
408382a4 1702echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
0f3cb305 1703echo "LDFLAGS=$LDFLAGS" >> config.mak
f39e56a8 1704echo "LDCONFIG=$LDCONFIG" >> config.mak
c536cb09 1705echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
e1707f52 1706echo "SHFLAGS=$SHFLAGS" >> config.mak
408382a4 1707echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
fbb9d104 1708echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
80581e98 1709echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
b12f8273 1710echo "BUILD_STATIC=$lstatic" >> config.mak
eb94aca9 1711echo "BUILDSUF=$BUILDSUF" >> config.mak
f3ec2d46 1712echo "LIBPREF=$LIBPREF" >> config.mak
eb94aca9 1713echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
320d060a
DB
1714if test "$lstatic" = "yes" ; then
1715 echo "LIB=$LIB" >> config.mak
1a44a8b6
AS
1716else # Some Make complain if this variable does not exist.
1717 echo "LIB=" >> config.mak
320d060a 1718fi
f3ec2d46 1719echo "SLIBPREF=$SLIBPREF" >> config.mak
eb94aca9
CY
1720echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1721echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
b2828252 1722echo "TARGET_OS=$targetos" >> config.mak
419b8784 1723if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then
980fc7b8 1724 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 1725 echo "#define ARCH_X86 1" >> $TMPH
419b8784
DB
1726fi
1727if test "$arch" = "x86_32" ; then
1728 echo "TARGET_ARCH_X86_32=yes" >> config.mak
1729 echo "#define ARCH_X86_32 1" >> $TMPH
cc6a90dd 1730elif test "$arch" = "x86_64" ; then
053dea12
AJ
1731 echo "TARGET_ARCH_X86_64=yes" >> config.mak
1732 echo "#define ARCH_X86_64 1" >> $TMPH
cc6a90dd 1733elif test "$arch" = "armv4l" ; then
6ed7422a 1734 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 1735 echo "#define ARCH_ARMV4L 1" >> $TMPH
cc6a90dd 1736elif test "$arch" = "alpha" ; then
91d1f1a4 1737 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 1738 echo "#define ARCH_ALPHA 1" >> $TMPH
cc6a90dd 1739elif test "$arch" = "sparc64" ; then
35fedfc3
PG
1740 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1741 echo "#define ARCH_SPARC64 1" >> $TMPH
bb476ff3
JM
1742 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1743 echo "#define ARCH_SPARC 1" >> $TMPH
cc6a90dd 1744elif test "$arch" = "sparc" ; then
bb476ff3
JM
1745 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1746 echo "#define ARCH_SPARC 1" >> $TMPH
cc6a90dd 1747elif test "$arch" = "powerpc" ; then
0f3cb305
FB
1748 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1749 echo "#define ARCH_POWERPC 1" >> $TMPH
9007f514
RD
1750 if test $POWERPCMODE = "32bits"; then
1751 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1752 else
1753 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1754 fi
e45a2872
RD
1755 if test "$powerpc_perf" = "yes"; then
1756 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1757 fi
cc6a90dd 1758elif test "$arch" = "mips" ; then
d46aba26
LS
1759 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1760 echo "#define ARCH_MIPS 1" >> $TMPH
cc6a90dd 1761elif test "$arch" = "sh4" ; then
bdb2e37c
AB
1762 echo "TARGET_ARCH_SH4=yes" >> config.mak
1763 echo "#define ARCH_SH4 1" >> $TMPH
cc6a90dd 1764elif test "$arch" = "parisc" ; then
67860b26
SH
1765 echo "TARGET_ARCH_PARISC=yes" >> config.mak
1766 echo "#define ARCH_PARISC 1" >> $TMPH
cc6a90dd 1767elif test "$arch" = "s390" ; then
67860b26
SH
1768 echo "TARGET_ARCH_S390=yes" >> config.mak
1769 echo "#define ARCH_S390 1" >> $TMPH
cc6a90dd 1770elif test "$arch" = "m68k" ; then
67860b26
SH
1771 echo "TARGET_ARCH_M68K=yes" >> config.mak
1772 echo "#define ARCH_M68K 1" >> $TMPH
cc6a90dd 1773elif test "$arch" = "ia64" ; then
67860b26
SH
1774 echo "TARGET_ARCH_IA64=yes" >> config.mak
1775 echo "#define ARCH_IA64 1" >> $TMPH
cc6a90dd 1776elif test "$arch" = "bfin" ; then
81a9b052
MB
1777 echo "TARGET_ARCH_BFIN=yes" >> config.mak
1778 echo "#define ARCH_BFIN 1" >> $TMPH
bdb2e37c 1779fi
a4adb608 1780echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
1781if test "$bigendian" = "yes" ; then
1782 echo "WORDS_BIGENDIAN=yes" >> config.mak
1783 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 1784fi
d2a9bddd
MN
1785if test "$inttypes" != "yes" ; then
1786 echo "#define EMULATE_INTTYPES 1" >> $TMPH
7f965c1c 1787fi
b5c950c4 1788if test "$emu_fast_int" = "yes" ; then
19d053c5 1789 echo "#define EMULATE_FAST_INT 1" >> $TMPH
b5c950c4 1790fi
57514323 1791if test "$mmx" = "yes" ; then
980fc7b8 1792 echo "TARGET_MMX=yes" >> config.mak
045ed63f 1793 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 1794 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 1795fi
e7768fc5
GP
1796if test "$cmov" = "yes" ; then
1797 echo "TARGET_CMOV=yes" >> config.mak
1798 echo "#define HAVE_CMOV 1" >> $TMPH
1799fi
94e4c3a3
GP
1800if test "$cmov_is_fast" = "yes" ; then
1801 echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
1802 echo "#define CMOV_IS_FAST 1" >> $TMPH
1803fi
1839e854
SS
1804if test "$armv5te" = "yes" ; then
1805 echo "TARGET_ARMV5TE=yes" >> config.mak
1806 echo "#define HAVE_ARMV5TE 1" >> $TMPH
1807fi
eba9ae3c
GB
1808if test "$iwmmxt" = "yes" ; then
1809 echo "TARGET_IWMMXT=yes" >> config.mak
1810 echo "#define HAVE_IWMMXT 1" >> $TMPH
1811fi
d46aba26
LS
1812if test "$mmi" = "yes" ; then
1813 echo "TARGET_MMI=yes" >> config.mak
1814 echo "#define HAVE_MMI 1" >> $TMPH
1815fi
87ea51e0
LB
1816
1817if test "$dcbzl" = "yes" ; then
1818 echo "#define HAVE_DCBZL 1" >> $TMPH
1819else
1820 echo "#undef HAVE_DCBZL" >> $TMPH
1821fi
1822
ab6c65f6
BF
1823if test "$altivec" = "yes" ; then
1824 echo "TARGET_ALTIVEC=yes" >> config.mak
1825 echo "#define HAVE_ALTIVEC 1" >> $TMPH
a9a07762
MN
1826 if test "$_altivec_h" = "yes" ; then
1827 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1828 else
e67e14d5 1829 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 1830 fi
ab6c65f6 1831fi
57514323 1832if test "$gprof" = "yes" ; then
045ed63f 1833 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 1834fi
5e4639e2
GM
1835if test "$localtime_r" = "yes" ; then
1836 echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
5e4639e2 1837fi
68892110
PG
1838if test "$imlib2" = "yes" ; then
1839 echo "HAVE_IMLIB2=yes" >> config.mak
1840fi
04511d53
PG
1841if test "$freetype2" = "yes" ; then
1842 echo "HAVE_FREETYPE2=yes" >> config.mak
1843fi
f80f7964
RS
1844if test "$sunmlib" = "yes" ; then
1845 echo "HAVE_MLIB=yes" >> config.mak
1846 echo "#define HAVE_MLIB 1" >> $TMPH
f80f7964 1847fi
9c3d33d6
MN
1848if test "$pthreads" = "yes" ; then
1849 echo "HAVE_PTHREADS=yes" >> config.mak
1850 echo "#define HAVE_PTHREADS 1" >> $TMPH
2450cff2 1851 echo "#define HAVE_THREADS 1" >> $TMPH
9c3d33d6 1852fi
a86b921c 1853if test "$sdl" = "yes" ; then
c63b9a11 1854 echo "HAVE_SDL=yes" >> config.mak
6a1a892f
FD
1855 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
1856 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
29f3b38a
MR
1857 if test "$sdl_video_size" = "yes"; then
1858 echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
1859 fi
a86b921c 1860fi
146ea952
NB
1861if test "$texi2html" = "yes"; then
1862 echo "BUILD_DOC=yes" >> config.mak
1863fi
95e2ce4a
MN
1864if test "$have_lrintf" = "yes" ; then
1865 echo "#define HAVE_LRINTF 1" >> $TMPH
1866fi
68892110 1867if test "$vhook" = "yes" ; then
d226c750
MR
1868 echo "CONFIG_VHOOK=yes" >> config.mak
1869 echo "#define CONFIG_VHOOK 1" >> $TMPH
68892110 1870fi
5a872801 1871
790c9ca7 1872sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
6d9a2421 1873pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
5a872801
LB
1874lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1875lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1876lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1877
1878
1879
57514323 1880if test "$lshared" = "yes" ; then
320d060a 1881 echo "#define BUILD_SHARED_AV 1" >> $TMPH
0319c531 1882 echo "BUILD_SHARED=yes" >> config.mak
97006039 1883 echo "PIC=-fPIC -DPIC" >> config.mak
39503a27 1884 echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
5a872801 1885 echo "SPPVERSION=$lavc_version" >> config.mak
39503a27 1886 echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
5a872801 1887 echo "LAVCVERSION=$lavc_version" >> config.mak
39503a27 1888 echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
5a872801 1889 echo "LAVFVERSION=$lavf_version" >> config.mak
39503a27 1890 echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
5a872801 1891 echo "LAVUVERSION=$lavu_version" >> config.mak
790c9ca7
LA
1892 echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
1893 echo "SWSVERSION=$sws_version" >> config.mak
4bdd05e7 1894 echo "SLIBNAME=${SLIBNAME}" >> config.mak
f3b60109
DB
1895 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1896 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
5cb854e1 1897 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
0319c531 1898fi
d7e27559 1899echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
ef0bc4c9 1900echo "EXTRALIBS=$extralibs" >> config.mak
d2845d68 1901
29799f8b 1902# If you do not want to use encoders, disable them.
55006fc0 1903if echo "$ENCODER_LIST" | grep -q encoder; then
6eefb6fd
MR
1904 echo "#define CONFIG_ENCODERS 1" >> $TMPH
1905 echo "CONFIG_ENCODERS=yes" >> config.mak
1906fi
d771bcae 1907
29799f8b 1908# If you do not want to use decoders, disable them.
55006fc0 1909if echo "$DECODER_LIST" | grep -q decoder; then
6eefb6fd
MR
1910 echo "#define CONFIG_DECODERS 1" >> $TMPH
1911 echo "CONFIG_DECODERS=yes" >> config.mak
1912fi
d771bcae 1913
a9e35095 1914# muxers
ff70e601 1915if echo "$MUXER_LIST" | grep -q muxer; then
a9e35095
DB
1916 echo "#define CONFIG_MUXERS 1" >> $TMPH
1917 echo "CONFIG_MUXERS=yes" >> config.mak
1918fi
1919
1920# demuxers
ff70e601 1921if echo "$DEMUXER_LIST" | grep -q demuxer; then
a9e35095
DB
1922 echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1923 echo "CONFIG_DEMUXERS=yes" >> config.mak
1924fi
1925
5cbcf02c
FB
1926# AC3
1927if test "$a52" = "yes" ; then
1928 echo "#define CONFIG_AC3 1" >> $TMPH
1929 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 1930
5cbcf02c
FB
1931 if test "$a52bin" = "yes" ; then
1932 echo "#define CONFIG_A52BIN 1" >> $TMPH
1933 echo "CONFIG_A52BIN=yes" >> config.mak
1934 fi
1935fi
1936
23c99253
MN
1937# DTS
1938if test "$dts" = "yes" ; then
1939 echo "#define CONFIG_DTS 1" >> $TMPH
1940 echo "CONFIG_DTS=yes" >> config.mak
1941fi
1942
bba9b16c
MN
1943# PP
1944if test "$pp" = "yes" ; then
1945 echo "#define CONFIG_PP 1" >> $TMPH
1946 echo "CONFIG_PP=yes" >> config.mak
bba9b16c
MN
1947fi
1948
790c9ca7
LA
1949if test "$swscaler" = "yes" ; then
1950 echo "#define CONFIG_SWSCALER 1" >> $TMPH
1951 echo "CONFIG_SWSCALER=yes" >> config.mak
1952fi
1953
29799f8b 1954# MPEG audio high precision mode
1eb2212e
FB
1955if test "$mpegaudio_hp" = "yes" ; then
1956 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1957fi
1958
5cbcf02c
FB
1959if test "$v4l" = "yes" ; then
1960 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1961 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1962fi
1963
0a7b514f
LA
1964if test "$v4l2" = "yes" ; then
1965 echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
1966 echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
1967fi
1968
6beefa40
MN
1969if test "$bktr" = "yes" ; then
1970 echo "#define CONFIG_BKTR 1" >> $TMPH
1971 echo "CONFIG_BKTR=yes" >> config.mak
1972fi
1973
8aa3ee32
MK
1974if test "$dv1394" = "yes" ; then
1975 echo "#define CONFIG_DV1394 1" >> $TMPH
1976 echo "CONFIG_DV1394=yes" >> config.mak
1977fi
1978
f02be79d
RS
1979if test "$dc1394" = "yes" ; then
1980 echo "#define CONFIG_DC1394 1" >> $TMPH
1981 echo "CONFIG_DC1394=yes" >> config.mak
1982fi
1983
adbc0510
PG
1984if test "$dlopen" = "yes" ; then
1985 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1986fi
1987
1988if test "$dlfcn" = "yes" ; then
1989 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1990fi
1991
5cbcf02c
FB
1992if test "$audio_oss" = "yes" ; then
1993 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1994 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
1995fi
1996
dfdfa47c
FR
1997if test "$audio_beos" = "yes" ; then
1998 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1999 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
2000fi
2001
5cbcf02c
FB
2002if test "$network" = "yes" ; then
2003 echo "#define CONFIG_NETWORK 1" >> $TMPH
2004 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 2005fi
daf8e955 2006
7a91333f
HZ
2007if test "$ipv6" = "yes" ; then
2008 echo "#define CONFIG_IPV6 1" >> $TMPH
2009fi
2010
0147f198
FR
2011if test "$zlib" = "yes" ; then
2012 echo "#define CONFIG_ZLIB 1" >> $TMPH
2013 echo "CONFIG_ZLIB=yes" >> config.mak
2014fi
2015
bb4c2140
MN
2016if test "$libgsm" = "yes" ; then
2017 echo "#define CONFIG_LIBGSM 1" >> $TMPH
2018 echo "CONFIG_LIBGSM=yes" >> config.mak
2019fi
2020
57514323 2021if test "$mp3lame" = "yes" ; then
045ed63f 2022 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
2023 echo "CONFIG_MP3LAME=yes" >> config.mak
2024fi
2025
f956e129
OS
2026if test "$libnut" = "yes" ; then
2027 echo "#define CONFIG_LIBNUT 1" >> $TMPH
2028 echo "CONFIG_LIBNUT=yes" >> config.mak
2029fi
2030
9146ca37 2031if test "$libogg" = "yes" ; then
5c5dea3f
NB
2032 echo "#define CONFIG_LIBOGG 1" >> $TMPH
2033 echo "CONFIG_LIBOGG=yes" >> config.mak
2034fi
2035
81e0d0b4 2036if test "$vorbis" = "yes" ; then
5c5dea3f
NB
2037 echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
2038 echo "CONFIG_LIBVORBIS=yes" >> config.mak
2039fi
2040
0fc50e58
ZK
2041if test "$faad" = "yes" ; then
2042 echo "#define CONFIG_FAAD 1" >> $TMPH
2043 echo "CONFIG_FAAD=yes" >> config.mak
2044fi
2045
2046if test "$faadbin" = "yes" ; then
2047 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 2048 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
2049fi
2050
29d48296
MN
2051if test "$faac" = "yes" ; then
2052 echo "#define CONFIG_FAAC 1" >> $TMPH
2053 echo "CONFIG_FAAC=yes" >> config.mak
2054fi
2055
1ddadfa9
AT
2056if test "$xvid" = "yes" ; then
2057 echo "#define CONFIG_XVID 1" >> $TMPH
2058 echo "CONFIG_XVID=yes" >> config.mak
2059fi
2060
6662ec29
MN
2061if test "$x264" = "yes" ; then
2062 echo "#define CONFIG_X264 1" >> $TMPH
2063 echo "CONFIG_X264=yes" >> config.mak
2064fi
2065
8ac17293
SH
2066if test "$avisynth" = "yes" ; then
2067 echo "#define CONFIG_AVISYNTH 1" >> $TMPH
2068 echo "CONFIG_AVISYNTH=yes" >> config.mak
2069fi
2070
732d9245 2071if test "$mingw32" = "yes" ; then
2f30a81d 2072 echo "CONFIG_MINGW=yes" >> config.mak
16806499
MN
2073 echo "HAVE_W32THREADS=yes" >> config.mak
2074 echo "#define HAVE_W32THREADS 1" >> $TMPH
2450cff2 2075 echo "#define HAVE_THREADS 1" >> $TMPH
7eea5766 2076 echo "#ifndef __MINGW32__" >> $TMPH
732d9245 2077 echo "#define __MINGW32__ 1" >> $TMPH
7eea5766 2078 echo "#endif" >> $TMPH
3f027ca7
FB
2079fi
2080
ac44871c 2081if test "$mingwce" = "yes" ; then
2f30a81d 2082 echo "CONFIG_MINGW=yes" >> config.mak
ac44871c
GB
2083 echo "#define CONFIG_WINCE 1" >> $TMPH
2084 echo "CONFIG_WINCE=yes" >> config.mak
2085 echo "#ifndef __MINGW32__" >> $TMPH
2086 echo "#define __MINGW32__ 1" >> $TMPH
2087 echo "#endif" >> $TMPH
2088fi
2089
f3ec2d46
SG
2090if test "$os2" = "yes" ; then
2091 echo "#define CONFIG_OS2 1" >> $TMPH
2092 echo "CONFIG_OS2=yes" >> config.mak
e2a5fd20
MN
2093 echo "HAVE_OS2THREADS=yes" >> config.mak
2094 echo "#define HAVE_OS2THREADS 1" >> $TMPH
2095 echo "#define HAVE_THREADS 1" >> $TMPH
f3ec2d46
SG
2096fi
2097
b2828252 2098if test "$targetos" = "SunOS" ; then
6e023978
RS
2099 echo "#define CONFIG_SUNOS 1" >> $TMPH
2100fi
2101
b2828252 2102if test "$targetos" = "BeOS" ; then
2450cff2
FR
2103 echo "HAVE_BEOSTHREADS=yes" >> config.mak
2104 echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
2105 echo "#define HAVE_THREADS 1" >> $TMPH
2106fi
2107
b2828252 2108if test "$targetos" = "Darwin"; then
90cee0c3
MN
2109 echo "#define CONFIG_DARWIN 1" >> $TMPH
2110 echo "CONFIG_DARWIN=yes" >> config.mak
2111fi
2112
57514323 2113if test "$_malloc_h" = "yes" ; then
045ed63f 2114 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 2115else
045ed63f 2116 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
2117fi
2118
57514323 2119if test "$_memalign" = "yes" ; then
045ed63f
ZK
2120 echo "#define HAVE_MEMALIGN 1" >> $TMPH
2121else
2122 echo "#undef HAVE_MEMALIGN" >> $TMPH
2123fi
2124
da9b170c
MN
2125if test "$memalignhack" = "yes" ; then
2126 echo "#define MEMALIGN_HACK 1" >> $TMPH
2127fi
2128
47d23bbf
MR
2129if test "$byteswap_h" = "yes"; then
2130 echo "#define HAVE_BYTESWAP_H 1" >> $TMPH
2131fi
da9b170c 2132
26b35efb
FR
2133if test "$netserver" = "yes" ; then
2134 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
2135 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
2136fi
2137
4baca069
PG
2138if test "$need_inet_aton" = "yes" ; then
2139 echo "NEED_INET_ATON=yes" >> config.mak
2140fi
2141
57514323 2142if test "$simpleidct" = "yes" ; then
045ed63f
ZK
2143 echo "#define SIMPLE_IDCT 1" >> $TMPH
2144fi
2145
04f46ced
GB
2146if test "$protocols" = "yes" ; then
2147 echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
2148 echo "CONFIG_PROTOCOLS=yes" >> config.mak
2149fi
2150
786b30af
DB
2151if test "$ffmpeg" = "yes" ; then
2152 echo "#define CONFIG_FFMPEG 1" >> $TMPH
2153 echo "CONFIG_FFMPEG=yes" >> config.mak
2154fi
2155
8154d2e0
FB
2156if test "$ffserver" = "yes" ; then
2157 echo "#define CONFIG_FFSERVER 1" >> $TMPH
2158 echo "CONFIG_FFSERVER=yes" >> config.mak
2159fi
2160
a86b921c
FB
2161if test "$ffplay" = "yes" ; then
2162 echo "CONFIG_FFPLAY=yes" >> config.mak
2163fi
2164
b2e3c528
MN
2165if test "$gpl" = "yes" ; then
2166 echo "#define CONFIG_GPL 1" >> $TMPH
2167 echo "CONFIG_GPL=yes" >> config.mak
2168fi
2169
c13e1abd
FH
2170echo "#define restrict $_restrict" >> $TMPH
2171
bb801c97
MN
2172if test "$optimize" = "small"; then
2173 echo "#define always_inline" >> $TMPH
e5f28e8f 2174 echo "#define CONFIG_SMALL 1" >> $TMPH
bb801c97
MN
2175fi
2176
0f3cb305
FB
2177# build tree in object directory if source path is different from current one
2178if test "$source_path_used" = "yes" ; then
2a4e872b
AS
2179 DIRS="\
2180 doc \
2181 libavformat \
2182 libavcodec \
2183 libavcodec/alpha \
2184 libavcodec/armv4l \
c4e96cee 2185 libavcodec/bfin \
2a4e872b
AS
2186 libavcodec/i386 \
2187 libavcodec/sparc \
2188 libavcodec/mlib \
2189 libavcodec/ppc \
2190 libavcodec/liba52 \
6d9a2421 2191 libpostproc \
2a4e872b 2192 libavutil \
790c9ca7 2193 libswscale \
2a4e872b
AS
2194 tests \
2195 vhook \
2196 "
2197 FILES="\
2198 Makefile \
997baf01 2199 common.mak \
2a4e872b
AS
2200 libavformat/Makefile \
2201 libavcodec/Makefile \
6d9a2421 2202 libpostproc/Makefile \
2a4e872b 2203 libavutil/Makefile \
790c9ca7 2204 libswscale/Makefile \
2a4e872b
AS
2205 tests/Makefile \
2206 vhook/Makefile \
2207 doc/Makefile \
2208 doc/texi2pod.pl \
2209 "
0f3cb305
FB
2210 for dir in $DIRS ; do
2211 mkdir -p $dir
2212 done
2213 for f in $FILES ; do
281a74da 2214 ln -sf "$source_path/$f" $f
0f3cb305
FB
2215 done
2216fi
997baf01
MR
2217echo "SRC_PATH=\"$source_path\"" >> config.mak
2218echo "SRC_PATH_BARE=$source_path" >> config.mak
2219echo "BUILD_ROOT=\"$PWD\"" >> config.mak
0f3cb305 2220
60827a1a 2221if test "$amr" = "yes" ; then
6636b7e8
MR
2222 echo "#define CONFIG_AMR 1" >> $TMPH
2223 echo "CONFIG_AMR=yes" >> config.mak
60827a1a
DB
2224fi
2225
d663a1fd 2226if test "$amr_wb" = "yes" ; then
6636b7e8
MR
2227 echo "#define CONFIG_AMR_WB 1" >> $TMPH
2228 echo "CONFIG_AMR_WB=yes" >> config.mak
d663a1fd
MN
2229 echo
2230 echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
2231 echo "V5.1.0 from "
2232 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
2233 echo "and extracted the source to libavcodec/amrwb_float"
d663a1fd
MN
2234fi
2235
891f64b3 2236if test "$amr_nb" = "yes" ; then
6636b7e8
MR
2237 echo "#define CONFIG_AMR_NB 1" >> $TMPH
2238 echo "CONFIG_AMR_NB=yes" >> config.mak
891f64b3 2239 echo
6eb07e73
DB
2240 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
2241 echo "REL-5 V5.1.0 from "
c51c4fa0 2242 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
6eb07e73
DB
2243 echo "and extracted the source to libavcodec/amr_float"
2244 echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
2245fi
2246
bc634f6f 2247if test "$amr_nb_fixed" = "yes" ; then
6636b7e8
MR
2248 echo "#define CONFIG_AMR_NB_FIXED 1" >> $TMPH
2249 echo "CONFIG_AMR_NB_FIXED=yes" >> config.mak
b9ca6d47 2250 echo
bc634f6f
ZK
2251 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
2252 echo "REL-5 version 5.1.0 from "
c51c4fa0 2253 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
891f64b3 2254 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
2255 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
2256 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
891f64b3 2257fi
2258
2a515c08
TM
2259if test "$amr_if2" = "yes" ; then
2260 echo "AMR_CFLAGS=-DIF2=1" >> config.mak
2261fi
2262
8156056e 2263# Apparently it's not possible to portably echo a backslash.
4454dc1b 2264if test "$asmalign_pot" = "yes" ; then
8156056e 2265 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
4454dc1b 2266else
8156056e 2267 printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
4454dc1b
JD
2268fi
2269
bc634f6f 2270
fe84b3f0 2271# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
55006fc0 2272for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
a8d04fba
MR
2273 ucname="`echo $codec | tr '[a-z]' '[A-Z]'`"
2274 config_name="CONFIG_$ucname"
2275 enabled_name="ENABLE_$ucname"
2276 if enabled $codec; then
2277 echo "#define $config_name 1" >> $TMPH
2278 echo "#define $enabled_name 1" >> $TMPH
2279 echo "$config_name=yes" >> config.mak
2280 else
2281 echo "#define $enabled_name 0" >> $TMPH
2282 fi
009cf97d
MN
2283done
2284
9cb2cf10
DB
2285# Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
2286diff $TMPH config.h >/dev/null 2>&1
214c5f26 2287if test "$?" != "0" ; then
9cb2cf10
DB
2288 mv -f $TMPH config.h
2289else
2290 echo "config.h is unchanged"
2291fi
3d204385 2292
f3ec2d46 2293rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
def4272a
AJ
2294
2295
29799f8b 2296# build pkg-config files libav*.pc and libpostproc.pc
31abdc45 2297# libavutil.pc
2298cat <<EOF >libavutil.pc
2266e085 2299prefix=$PREFIX
a94e666c 2300exec_prefix=\${prefix}
31abdc45 2301libdir=\${exec_prefix}/lib
a94e666c 2302includedir=\${prefix}/include
31abdc45 2303
2304Name: libavutil
2305Description: FFmpeg utility library
2306Version: $lavu_version
115329f1 2307Requires:
31abdc45 2308Conflicts:
2309Libs: -L\${libdir} -lavutil
2310Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2311EOF
2312
2313cat <<EOF >libavutil-uninstalled.pc
2314prefix=
2315exec_prefix=
2316libdir=\${pcfiledir}/libavutil
2317includedir=\${pcfiledir}/libavutil
2318
2319Name: libavutil
2320Description: FFmpeg utility library
2321Version: $lavu_version
115329f1 2322Requires:
31abdc45 2323Conflicts:
2324Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2325Cflags: -I\${includedir}
2326EOF
def4272a
AJ
2327
2328# libavcodec.pc
2329cat <<EOF >libavcodec.pc
2266e085 2330prefix=$PREFIX
a94e666c 2331exec_prefix=\${prefix}
def4272a 2332libdir=\${exec_prefix}/lib
a94e666c 2333includedir=\${prefix}/include
def4272a
AJ
2334
2335Name: libavcodec
2336Description: FFmpeg codec library
31abdc45 2337Version: $lavc_version
c99dd233 2338Requires: $pkg_requires libavutil = $lavu_version
def4272a
AJ
2339Conflicts:
2340Libs: -L\${libdir} -lavcodec $extralibs
2341Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2342EOF
2343
2344cat <<EOF >libavcodec-uninstalled.pc
2345prefix=
2346exec_prefix=
2347libdir=\${pcfiledir}/libavcodec
2348includedir=\${pcfiledir}/libavcodec
2349
2350Name: libavcodec
2351Description: FFmpeg codec library
31abdc45 2352Version: $lavc_version
c99dd233 2353Requires: $pkg_requires libavutil = $lavu_version
def4272a
AJ
2354Conflicts:
2355Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2356Cflags: -I\${includedir}
2357EOF
2358
2359# libavformat.pc
2360cat <<EOF >libavformat.pc
2266e085 2361prefix=$PREFIX
a94e666c 2362exec_prefix=\${prefix}
def4272a 2363libdir=\${exec_prefix}/lib
a94e666c 2364includedir=\${prefix}/include
def4272a
AJ
2365
2366Name: libavformat
2367Description: FFmpeg container format library
31abdc45 2368Version: $lavf_version
c99dd233 2369Requires: $pkg_requires libavcodec = $lavc_version
def4272a
AJ
2370Conflicts:
2371Libs: -L\${libdir} -lavformat $extralibs
2372Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2373EOF
2374
2375cat <<EOF >libavformat-uninstalled.pc
2376prefix=
2377exec_prefix=
2378libdir=\${pcfiledir}/libavformat
2379includedir=\${pcfiledir}/libavformat
2380
2381Name: libavformat
2382Description: FFmpeg container format library
31abdc45 2383Version: $lavf_version
c99dd233 2384Requires: $pkg_requires libavcodec = $lavc_version
def4272a
AJ
2385Conflicts:
2386Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2387Cflags: -I\${includedir}
2388EOF
2389
2390
2391# libpostproc.pc
2392cat <<EOF >libpostproc.pc
2266e085 2393prefix=$PREFIX
a94e666c 2394exec_prefix=\${prefix}
def4272a 2395libdir=\${exec_prefix}/lib
a94e666c 2396includedir=\${prefix}/include
def4272a
AJ
2397
2398Name: libpostproc
2399Description: FFmpeg post processing library
31abdc45 2400Version: $lavc_version
115329f1 2401Requires:
def4272a
AJ
2402Conflicts:
2403Libs: -L\${libdir} -lpostproc
2404Cflags: -I\${includedir} -I\${includedir}/postproc
2405EOF
2406
2407cat <<EOF >libpostproc-uninstalled.pc
2408prefix=
2409exec_prefix=
6d9a2421
DB
2410libdir=\${pcfiledir}/libpostproc
2411includedir=\${pcfiledir}/libpostproc
def4272a
AJ
2412
2413Name: libpostproc
2414Description: FFmpeg post processing library
31abdc45 2415Version: $lavc_version
115329f1 2416Requires:
def4272a
AJ
2417Conflicts:
2418Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2419Cflags: -I\${includedir}
2420EOF
790c9ca7
LA
2421
2422# libswscale.pc
2423cat <<EOF >libswscale.pc
2424prefix=$PREFIX
2425exec_prefix=\${prefix}
2426libdir=\${exec_prefix}/lib
2427includedir=\${prefix}/include
2428
2429Name: libswscale
2430Description: FFmpeg image rescaling library
2431Version: $sws_version
2432Requires: $pkg_requires libavutil = $lavu_version
2433Conflicts:
2434Libs: -L\${libdir} -lswscale
2435Cflags: -I\${includedir} -I\${includedir}/swscale
2436EOF
2437
2438cat <<EOF >libswscale-uninstalled.pc
2439prefix=
2440exec_prefix=
2441libdir=\${pcfiledir}/libswscale
2442includedir=\${pcfiledir}/libswscale
2443
2444Name: libswscale
2445Description: FFmpeg image rescaling library
2446Version: $sws_version
2447Requires: $pkg_requires libavutil = $lavu_version
2448Conflicts:
2449Libs: \${libdir}/${LIBPREF}swscale${LIBSUF}
2450Cflags: -I\${includedir}
2451EOF