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