rtmp: do not hardcode invoke numbers
[libav.git] / configure
CommitLineData
aeb29222 1#!/bin/sh
0f3cb305 2#
070c5d0f 3# Libav configure script
f57620d5 4#
949906ea
DB
5# Copyright (c) 2000-2002 Fabrice Bellard
6# Copyright (c) 2005-2008 Diego Biurrun
7# Copyright (c) 2005-2008 Mans Rullgard
0f3cb305 8#
cf9d24ad 9
31e647f8 10# Prevent locale nonsense from breaking basic text processing.
79ab96ba
DB
11LC_ALL=C
12export LC_ALL
31e647f8 13
cde2d79a 14# make sure we are running under a compatible shell
c21d6325
MR
15# try to make this part work with most shells
16
17try_exec(){
0dbe81bb 18 echo "Trying shell $1"
2270b4b2 19 type "$1" > /dev/null 2>&1 && exec "$@"
c21d6325
MR
20}
21
5237ce67 22unset foo
2270b4b2 23(: ${foo%%bar}) 2> /dev/null
0dbe81bb
MR
24E1="$?"
25
2270b4b2 26(: ${foo?}) 2> /dev/null
0dbe81bb
MR
27E2="$?"
28
29if test "$E1" != 0 || test "$E2" = 0; then
30 echo "Broken shell detected. Trying alternatives."
c21d6325
MR
31 export FF_CONF_EXEC
32 if test "0$FF_CONF_EXEC" -lt 1; then
33 FF_CONF_EXEC=1
34 try_exec bash "$0" "$@"
35 fi
36 if test "0$FF_CONF_EXEC" -lt 2; then
37 FF_CONF_EXEC=2
38 try_exec ksh "$0" "$@"
39 fi
40 if test "0$FF_CONF_EXEC" -lt 3; then
41 FF_CONF_EXEC=3
42 try_exec /usr/xpg4/bin/sh "$0" "$@"
cde2d79a
MR
43 fi
44 echo "No compatible shell script interpreter found."
fc53da20 45 echo "This configure script requires a POSIX-compatible shell"
c21d6325 46 echo "such as bash or ksh."
070c5d0f 47 echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
505dfb09 48 echo "Instead, install a working POSIX-compatible shell."
070c5d0f 49 echo "Disabling this configure test will create a broken Libav."
c21d6325
MR
50 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51 echo "This bash version ($BASH_VERSION) is broken on your platform."
52 echo "Upgrade to a later version if available."
53 fi
cde2d79a
MR
54 exit 1
55fi
56
74c53c2d 57show_help(){
06454877
MR
58cat <<EOF
59Usage: configure [options]
60Options: [defaults in brackets after descriptions]
61
62Standard options:
63 --help print this message
19bd477d 64 --logfile=FILE log tests and output to FILE [config.log]
06454877
MR
65 --disable-logging do not log configure debug information
66 --prefix=PREFIX install in PREFIX [$prefix]
67 --bindir=DIR install binaries in DIR [PREFIX/bin]
6291d7e4 68 --datadir=DIR install data files in DIR [PREFIX/share/avconv]
06454877
MR
69 --libdir=DIR install libs in DIR [PREFIX/lib]
70 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
71 --incdir=DIR install includes in DIR [PREFIX/include]
72 --mandir=DIR install man page in DIR [PREFIX/share/man]
73
74Configuration options:
75 --disable-static do not build static libraries [no]
76 --enable-shared build shared libraries [no]
77 --enable-gpl allow use of GPL code, the resulting libs
78 and binaries will be under GPL [no]
79 --enable-version3 upgrade (L)GPL to version 3 [no]
80 --enable-nonfree allow use of nonfree code, the resulting libs
81 and binaries will be unredistributable [no]
82 --disable-doc do not build documentation
83 --disable-ffmpeg disable ffmpeg build
6291d7e4 84 --disable-avconv disable avconv build
266463da 85 --disable-avplay disable avplay build
9e12f0bf 86 --disable-avprobe disable avprobe build
4d58e4cb 87 --disable-avserver disable avserver build
5a0f7131
MR
88 --disable-avdevice disable libavdevice build
89 --disable-avcodec disable libavcodec build
90 --disable-avformat disable libavformat build
91 --disable-swscale disable libswscale build
ced9556b 92 --disable-postproc disable libpostproc build
cccc039f 93 --disable-avfilter disable video filter support [no]
0dbfc1db 94 --disable-pthreads disable pthreads [auto]
7b7b220c 95 --disable-w32threads disable Win32 threads [auto]
06454877
MR
96 --enable-x11grab enable X11 grabbing [no]
97 --disable-network disable network support [no]
06454877
MR
98 --enable-gray enable full grayscale support (slower color)
99 --disable-swscale-alpha disable alpha channel support in swscale
100 --disable-fastdiv disable table-based division
101 --enable-small optimize for size instead of speed
102 --disable-aandct disable AAN DCT code
7f3f5f46 103 --disable-dct disable DCT code
06454877
MR
104 --disable-fft disable FFT code
105 --disable-golomb disable Golomb code
3447f12d 106 --disable-huffman disable Huffman code
06454877
MR
107 --disable-lpc disable LPC code
108 --disable-mdct disable MDCT code
109 --disable-rdft disable RDFT code
dcb73592 110 --enable-vaapi enable VAAPI code
ac3dbb4d 111 --enable-vda enable VDA code
e8f6bd4b 112 --enable-vdpau enable VDPAU code
92c6a099 113 --disable-dxva2 disable DXVA2 code
06454877
MR
114 --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
115 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
116 --enable-memalign-hack emulate memalign, interferes with memory debuggers
bb55e3a3 117 --disable-everything disable all components listed below
06454877
MR
118 --disable-encoder=NAME disable encoder NAME
119 --enable-encoder=NAME enable encoder NAME
120 --disable-encoders disable all encoders
121 --disable-decoder=NAME disable decoder NAME
122 --enable-decoder=NAME enable decoder NAME
123 --disable-decoders disable all decoders
124 --disable-hwaccel=NAME disable hwaccel NAME
125 --enable-hwaccel=NAME enable hwaccel NAME
126 --disable-hwaccels disable all hwaccels
127 --disable-muxer=NAME disable muxer NAME
128 --enable-muxer=NAME enable muxer NAME
129 --disable-muxers disable all muxers
130 --disable-demuxer=NAME disable demuxer NAME
131 --enable-demuxer=NAME enable demuxer NAME
132 --disable-demuxers disable all demuxers
133 --enable-parser=NAME enable parser NAME
134 --disable-parser=NAME disable parser NAME
135 --disable-parsers disable all parsers
136 --enable-bsf=NAME enable bitstream filter NAME
137 --disable-bsf=NAME disable bitstream filter NAME
138 --disable-bsfs disable all bitstream filters
139 --enable-protocol=NAME enable protocol NAME
140 --disable-protocol=NAME disable protocol NAME
141 --disable-protocols disable all protocols
142 --disable-indev=NAME disable input device NAME
143 --disable-outdev=NAME disable output device NAME
144 --disable-indevs disable input devices
145 --disable-outdevs disable output devices
146 --disable-devices disable all devices
147 --enable-filter=NAME enable filter NAME
148 --disable-filter=NAME disable filter NAME
149 --disable-filters disable all filters
150 --list-decoders show all available decoders
151 --list-encoders show all available encoders
152 --list-hwaccels show all available hardware accelerators
153 --list-muxers show all available muxers
154 --list-demuxers show all available demuxers
155 --list-parsers show all available parsers
156 --list-protocols show all available protocols
157 --list-bsfs show all available bitstream filters
158 --list-indevs show all available input devices
159 --list-outdevs show all available output devices
160 --list-filters show all available filters
161
162External library support:
163 --enable-avisynth enable reading of AVISynth script files [no]
164 --enable-bzlib enable bzlib [autodetect]
47941088 165 --enable-frei0r enable frei0r video filtering
bc8c1395 166 --enable-gnutls enable gnutls [no]
06454877
MR
167 --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
168 --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
6ebf0bfc 169 --enable-libopencv enable video filtering via libopencv [no]
e417d80d 170 --enable-libcdio enable audio CD grabbing with libcdio
06454877
MR
171 --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
172 and libraw1394 [no]
173 --enable-libdirac enable Dirac support via libdirac [no]
174 --enable-libfaac enable FAAC support via libfaac [no]
a5b64584 175 --enable-libfreetype enable libfreetype [no]
06454877
MR
176 --enable-libgsm enable GSM support via libgsm [no]
177 --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
178 --enable-libnut enable NUT (de)muxing via libnut,
179 native (de)muxer exists [no]
180 --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
0f943ce6 181 --enable-librtmp enable RTMP[E] support via librtmp [no]
06454877 182 --enable-libschroedinger enable Dirac support via libschroedinger [no]
b606a017 183 --enable-libspeex enable Speex support via libspeex [no]
06454877 184 --enable-libtheora enable Theora encoding via libtheora [no]
d89e738a 185 --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
f502ff3f 186 --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
06454877
MR
187 --enable-libvorbis enable Vorbis encoding via libvorbis,
188 native implementation exists [no]
8299a7f8 189 --enable-libvpx enable VP8 support via libvpx [no]
06454877 190 --enable-libx264 enable H.264 encoding via x264 [no]
de295976 191 --enable-libxavs enable AVS encoding via xavs [no]
06454877
MR
192 --enable-libxvid enable Xvid encoding via xvidcore,
193 native MPEG-4/Xvid encoder exists [no]
194 --enable-mlib enable Sun medialib [no]
a060866f 195 --enable-openssl enable openssl [no]
06454877
MR
196 --enable-zlib enable zlib [autodetect]
197
198Advanced options (experts only):
06454877
MR
199 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
200 --enable-cross-compile assume a cross-compiler is used
201 --sysroot=PATH root of cross-build tree
202 --sysinclude=PATH location of cross-build system headers
203 --target-os=OS compiler targets OS [$target_os]
204 --target-exec=CMD command to run executables on target
205 --target-path=DIR path to view of build directory on target
206 --nm=NM use nm tool
121d78d0 207 --ar=AR use archive tool AR [$ar_default]
06454877
MR
208 --as=AS use assembler AS [$as_default]
209 --cc=CC use C compiler CC [$cc_default]
210 --ld=LD use linker LD
211 --host-cc=HOSTCC use host C compiler HOSTCC
212 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
213 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
214 --host-libs=HLIBS use libs HLIBS when linking for host
215 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
216 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
217 --extra-libs=ELIBS add ELIBS [$ELIBS]
218 --extra-version=STRING version string suffix []
219 --build-suffix=SUFFIX library name suffix []
220 --arch=ARCH select architecture [$arch]
221 --cpu=CPU select the minimum required CPU (affects
222 instruction selection, may crash on older CPUs)
c8a4ae00 223 --disable-asm disable all assembler optimizations
06454877
MR
224 --disable-altivec disable AltiVec optimizations
225 --disable-amd3dnow disable 3DNow! optimizations
226 --disable-amd3dnowext disable 3DNow! extended optimizations
227 --disable-mmx disable MMX optimizations
228 --disable-mmx2 disable MMX2 optimizations
229 --disable-sse disable SSE optimizations
230 --disable-ssse3 disable SSSE3 optimizations
87f1355f 231 --disable-avx disable AVX optimizations
06454877
MR
232 --disable-armv5te disable armv5te optimizations
233 --disable-armv6 disable armv6 optimizations
234 --disable-armv6t2 disable armv6t2 optimizations
235 --disable-armvfp disable ARM VFP optimizations
236 --disable-iwmmxt disable iwmmxt optimizations
237 --disable-mmi disable MMI optimizations
238 --disable-neon disable neon optimizations
239 --disable-vis disable VIS optimizations
240 --disable-yasm disable use of yasm assembler
241 --enable-pic build position-independent code
4ae40685 242 --malloc-prefix=PFX prefix malloc and related names with PFX
6b35d421 243 --enable-sram allow use of on-chip SRAM
9baec618 244 --disable-symver disable symbol versioning
9cd7b854 245 --optflags override optimization-related compiler flags
06454877 246
070c5d0f 247Developer options (useful when working on Libav itself):
06454877
MR
248 --disable-debug disable debugging symbols
249 --enable-debug=LEVEL set the debug level [$debuglevel]
06454877
MR
250 --disable-optimizations disable compiler optimizations
251 --enable-extra-warnings enable more compiler warnings
52b3cc60
RD
252 --samples=PATH location of test samples for FATE, if not set use
253 \$FATE_SAMPLES at make invocation time.
06454877
MR
254
255NOTE: Object files are built at the place where configure is launched.
256EOF
60e8bc13 257 exit 0
74c53c2d 258}
cf9d24ad 259
0884fadf
MR
260quotes='""'
261
57bd82d4 262log(){
2270b4b2 263 echo "$@" >> $logfile
57bd82d4
MR
264}
265
720c69da 266log_file(){
c8e9f801 267 log BEGIN $1
2270b4b2 268 pr -n -t $1 >> $logfile
c8e9f801
MR
269 log END $1
270}
271
2ba042a7 272echolog(){
c8e9f801 273 log "$@"
57bd82d4 274 echo "$@"
2ba042a7
MR
275}
276
7bfc8ae6
MR
277warn(){
278 log "WARNING: $*"
279 WARNINGS="${WARNINGS}WARNING: $*\n"
280}
281
2ba042a7
MR
282die(){
283 echolog "$@"
284 cat <<EOF
d326cf7f 285
2ba042a7 286If you think configure made a mistake, make sure you are using the latest
4a6a21f5 287version from Git. If the latest version fails, report the problem to the
070c5d0f 288libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
2ba042a7 289EOF
e155a21a 290 if disabled logging; then
2ba042a7 291 cat <<EOF
e155a21a
DB
292Rerun configure with logging enabled (do not use --disable-logging), and
293include the log this produces with your report.
2ba042a7
MR
294EOF
295 else
296cat <<EOF
e155a21a
DB
297Include the log file "$logfile" produced by configure as this will help
298solving the problem.
2ba042a7
MR
299EOF
300 fi
57bd82d4
MR
301 exit 1
302}
303
6c6007d6 304# Avoid locale weirdness, besides we really just want to translate ASCII.
44161118 305toupper(){
6c6007d6 306 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
44161118
MR
307}
308
4a5444db 309tolower(){
6c6007d6 310 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
4a5444db
MR
311}
312
14a8acf1
MR
313c_escape(){
314 echo "$*" | sed 's/["\\]/\\\0/g'
315}
316
b04251c5
MR
317sh_quote(){
318 v=$(echo "$1" | sed "s/'/'\\\\''/g")
d72c981c 319 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
b04251c5
MR
320 echo "$v"
321}
322
bb7a22b5
MR
323cleanws(){
324 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
325}
326
be8f2501
MR
327filter(){
328 pat=$1
329 shift
330 for v; do
98ef6079 331 eval "case $v in $pat) echo $v ;; esac"
be8f2501
MR
332 done
333}
334
9d201b26
MR
335filter_out(){
336 pat=$1
337 shift
338 for v; do
339 eval "case $v in $pat) ;; *) echo $v ;; esac"
340 done
341}
342
36e2dea0
MR
343map(){
344 m=$1
345 shift
e0e335a0 346 for v; do eval $m; done
36e2dea0
MR
347}
348
a8d04fba
MR
349set_all(){
350 value=$1
351 shift
352 for var in $*; do
353 eval $var=$value
354 done
355}
356
72a43668
MR
357set_weak(){
358 value=$1
359 shift
360 for var; do
361 eval : \${$var:=$value}
362 done
363}
364
3f8040db
MR
365set_safe(){
366 var=$1
367 shift
368 eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
369}
370
371get_safe(){
372 eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
373}
374
799c9e9b
MR
375pushvar(){
376 for var in $*; do
377 eval level=\${${var}_level:=0}
378 eval ${var}_${level}="\$$var"
379 eval ${var}_level=$(($level+1))
380 done
381}
382
383popvar(){
384 for var in $*; do
385 eval level=\${${var}_level:-0}
386 test $level = 0 && continue
387 eval level=$(($level-1))
388 eval $var="\${${var}_${level}}"
389 eval ${var}_level=$level
390 eval unset ${var}_${level}
391 done
392}
393
a8d04fba
MR
394enable(){
395 set_all yes $*
396}
397
398disable(){
399 set_all no $*
400}
401
72a43668
MR
402enable_weak(){
403 set_weak yes $*
404}
405
406disable_weak(){
407 set_weak no $*
408}
409
72702705 410enable_safe(){
fd07f803
MR
411 for var; do
412 enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
413 done
72702705
MR
414}
415
416disable_safe(){
fd07f803
MR
417 for var; do
418 disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
419 done
72702705
MR
420}
421
f9d328da
MR
422do_enable_deep(){
423 for var; do
424 enabled $var && continue
425 eval sel="\$${var}_select"
c510c7b5
MR
426 eval sgs="\$${var}_suggest"
427 pushvar var sgs
f9d328da 428 enable_deep $sel
c510c7b5
MR
429 popvar sgs
430 enable_deep_weak $sgs
f9d328da
MR
431 popvar var
432 done
433}
434
435enable_deep(){
436 do_enable_deep $*
437 enable $*
438}
439
72a43668
MR
440enable_deep_weak(){
441 do_enable_deep $*
442 enable_weak $*
443}
444
57bd82d4 445enabled(){
3250003c
MR
446 test "${1#!}" = "$1" && op== || op=!=
447 eval test "x\$${1#!}" $op "xyes"
44161118
MR
448}
449
37970ebf 450disabled(){
3250003c
MR
451 test "${1#!}" = "$1" && op== || op=!=
452 eval test "x\$${1#!}" $op "xno"
37970ebf
RP
453}
454
44161118
MR
455enabled_all(){
456 for opt; do
457 enabled $opt || return 1
458 done
459}
460
85bca2c5
DB
461disabled_all(){
462 for opt; do
463 disabled $opt || return 1
464 done
465}
466
44161118
MR
467enabled_any(){
468 for opt; do
469 enabled $opt && return 0
470 done
471}
472
85bca2c5
DB
473disabled_any(){
474 for opt; do
475 disabled $opt && return 0
476 done
f7b230a7 477 return 1
85bca2c5
DB
478}
479
c9d19248
MR
480set_default(){
481 for opt; do
88268e94 482 eval : \${$opt:=\$${opt}_default}
c9d19248
MR
483 done
484}
485
4a0d6686
AJ
486is_in(){
487 value=$1
488 shift
489 for var in $*; do
490 [ $var = $value ] && return 0
491 done
492 return 1
493}
494
30fd06be
MR
495check_deps(){
496 for cfg; do
3250003c 497 cfg="${cfg#!}"
799c9e9b
MR
498 enabled ${cfg}_checking && die "Circular dependency for $cfg."
499 disabled ${cfg}_checking && continue
500 enable ${cfg}_checking
501
30fd06be
MR
502 eval dep_all="\$${cfg}_deps"
503 eval dep_any="\$${cfg}_deps_any"
7ef3425f 504 eval dep_sel="\$${cfg}_select"
c510c7b5 505 eval dep_sgs="\$${cfg}_suggest"
3d7453e0
MR
506 eval dep_ifa="\$${cfg}_if"
507 eval dep_ifn="\$${cfg}_if_any"
799c9e9b 508
3d7453e0
MR
509 pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
510 check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
511 popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
799c9e9b 512
3d7453e0
MR
513 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
514 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
6a702d4c
MR
515 enabled_all $dep_all || disable $cfg
516 enabled_any $dep_any || disable $cfg
7ef3425f 517 disabled_any $dep_sel && disable $cfg
799c9e9b 518
4ec45764
RP
519 if enabled $cfg; then
520 eval dep_extralibs="\$${cfg}_extralibs"
521 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
f9d328da 522 enable_deep $dep_sel
c510c7b5 523 enable_deep_weak $dep_sgs
4ec45764
RP
524 fi
525
799c9e9b 526 disable ${cfg}_checking
30fd06be
MR
527 done
528}
529
72cfcf41
MR
530print_config_h(){
531 enabled $1 && v=1 || v=0
532 echo "#define $2 $v"
533}
534
535print_config_mak(){
536 enabled $1 && v= || v=!
537 echo "$v$2=yes"
538}
539
55127e7b
MR
540print_config_asm(){
541 enabled $1 && echo "%define $2"
542}
543
44161118
MR
544print_config(){
545 pfx=$1
72cfcf41
MR
546 files=$2
547 shift 2
44161118 548 for cfg; do
5e622c40 549 ucname="$(toupper $cfg)"
72cfcf41
MR
550 for f in $files; do
551 "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
552 done
44161118 553 done
57bd82d4
MR
554}
555
31c0121d
MR
556print_enabled(){
557 test "$1" = -n && end=" " && shift || end="\n"
558 suf=$1
559 shift
560 for v; do
561 enabled $v && printf "%s$end" ${v%$suf};
562 done
563}
564
57bd82d4
MR
565append(){
566 var=$1
567 shift
57bd82d4
MR
568 eval "$var=\"\$$var $*\""
569}
570
60361817
MR
571prepend(){
572 var=$1
573 shift
574 eval "$var=\"$* \$$var\""
575}
576
50a334e4 577add_cppflags(){
caf458dd 578 append CPPFLAGS $($filter_cppflags "$@")
50a334e4
MR
579}
580
57bd82d4 581add_cflags(){
caf458dd 582 append CFLAGS $($filter_cflags "$@")
57bd82d4
MR
583}
584
2f2e6c7c 585add_asflags(){
caf458dd 586 append ASFLAGS $($filter_asflags "$@")
2f2e6c7c
MR
587}
588
57bd82d4
MR
589add_ldflags(){
590 append LDFLAGS "$@"
591}
592
593add_extralibs(){
60361817 594 prepend extralibs "$@"
57bd82d4
MR
595}
596
b0cfb663 597check_cmd(){
b3cb5d51 598 log "$@"
2270b4b2 599 "$@" >> $logfile 2>&1
b0cfb663
MR
600}
601
dcd479c0 602check_cc(){
57bd82d4 603 log check_cc "$@"
2270b4b2 604 cat > $TMPC
720c69da 605 log_file $TMPC
50a334e4 606 check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
57bd82d4
MR
607}
608
609check_cpp(){
610 log check_cpp "$@"
2270b4b2 611 cat > $TMPC
720c69da 612 log_file $TMPC
9e7f3277 613 check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
dcd479c0
MR
614}
615
f65883c8
MR
616check_as(){
617 log check_as "$@"
618 cat > $TMPC
619 log_file $TMPC
2f2e6c7c 620 check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
f65883c8
MR
621}
622
940f335a
MR
623check_asm(){
624 log check_asm "$@"
625 name="$1"
3784e82e 626 code="$2"
940f335a 627 shift 2
49214f61
MR
628 disable $name
629 check_as "$@" <<EOF && enable $name
3784e82e 630void foo(void){ __asm__ volatile($code); }
940f335a
MR
631EOF
632}
633
304d586d
LM
634check_yasm(){
635 log check_yasm "$@"
636 echo "$1" > $TMPS
637 log_file $TMPS
638 shift 1
639 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
640}
641
dcd479c0 642check_ld(){
57bd82d4 643 log check_ld "$@"
3155a644
MR
644 flags=''
645 libs=''
646 for f; do
647 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
648 done
2a194acd 649 check_cc $($filter_cflags $flags) || return
7e75f9fe 650 check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
dcd479c0
MR
651}
652
50a334e4
MR
653check_cppflags(){
654 log check_cppflags "$@"
caf458dd
MR
655 set -- $($filter_cppflags "$@")
656 check_cc "$@" <<EOF && append CPPFLAGS "$@"
50a334e4
MR
657int x;
658EOF
659}
660
dcd479c0 661check_cflags(){
57bd82d4 662 log check_cflags "$@"
caf458dd
MR
663 set -- $($filter_cflags "$@")
664 check_cc "$@" <<EOF && append CFLAGS "$@"
dcd479c0
MR
665int x;
666EOF
667}
668
2ed46eea
MR
669test_ldflags(){
670 log test_ldflags "$@"
671 check_ld "$@" <<EOF
c23a0ac8 672int main(void){ return 0; }
dcd479c0
MR
673EOF
674}
675
2ed46eea
MR
676check_ldflags(){
677 log check_ldflags "$@"
678 test_ldflags "$@" && add_ldflags "$@"
679}
680
dcd479c0 681check_header(){
57bd82d4 682 log check_header "$@"
dcd479c0
MR
683 header=$1
684 shift
b77df637
MR
685 disable_safe $header
686 check_cpp "$@" <<EOF && enable_safe $header
dcd479c0
MR
687#include <$header>
688int x;
689EOF
690}
691
692check_func(){
57bd82d4 693 log check_func "$@"
dcd479c0
MR
694 func=$1
695 shift
d8bc5f06
MR
696 disable $func
697 check_ld "$@" <<EOF && enable $func
dcd479c0 698extern int $func();
c23a0ac8 699int main(void){ $func(); }
dcd479c0
MR
700EOF
701}
702
645d2652 703check_mathfunc(){
6b73c0ae 704 log check_mathfunc "$@"
645d2652
MR
705 func=$1
706 shift
707 disable $func
708 check_ld "$@" <<EOF && enable $func
709#include <math.h>
33bd38db
MR
710float foo(float f) { return $func(f); }
711int main(void){ return 0; }
645d2652
MR
712EOF
713}
714
2446d3d6
DB
715check_func_headers(){
716 log check_func_headers "$@"
f8d7b072 717 headers=$1
edaf1ae2 718 funcs=$2
f8d7b072 719 shift 2
edaf1ae2
MR
720 {
721 for hdr in $headers; do
722 echo "#include <$hdr>"
723 done
724 for func in $funcs; do
725 echo "long check_$func(void) { return (long) $func; }"
726 done
727 echo "int main(void) { return 0; }"
728 } | check_ld "$@" && enable $funcs && enable_safe $headers
f8d7b072
MR
729}
730
a5344cf7
SS
731check_cpp_condition(){
732 log check_cpp_condition "$@"
733 header=$1
734 condition=$2
f855b7b9
MR
735 shift 2
736 check_cpp $($filter_cppflags "$@") <<EOF
a5344cf7
SS
737#include <$header>
738#if !($condition)
739#error "unsatisfied condition: $condition"
740#endif
741EOF
742}
743
57bd82d4
MR
744check_lib(){
745 log check_lib "$@"
746 header="$1"
747 func="$2"
748 shift 2
84400e9d 749 check_header $header && check_func $func "$@" && add_extralibs "$@"
57bd82d4
MR
750}
751
f8d7b072
MR
752check_lib2(){
753 log check_lib2 "$@"
754 headers="$1"
edaf1ae2 755 funcs="$2"
f8d7b072 756 shift 2
edaf1ae2 757 check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
f8d7b072
MR
758}
759
3f8040db
MR
760check_pkg_config(){
761 log check_pkg_config "$@"
762 pkg="$1"
763 headers="$2"
764 funcs="$3"
765 shift 3
766 $pkg_config --exists $pkg || return
767 pkg_cflags=$($pkg_config --cflags $pkg)
768 pkg_libs=$($pkg_config --libs $pkg)
769 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
770 set_safe ${pkg}_cflags $pkg_cflags &&
771 set_safe ${pkg}_libs $pkg_libs
772}
773
dcd479c0 774check_exec(){
2270b4b2 775 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
57bd82d4
MR
776}
777
7dfef245 778check_exec_crash(){
5e622c40 779 code=$(cat)
7dfef245
MR
780
781 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
782 # are safe but may not be available everywhere. Thus we use
783 # raise(SIGTERM) instead. The check is run in a subshell so we
784 # can redirect the "Terminated" message from the shell. SIGBUS
785 # is not defined by standard C so it is used conditionally.
786
2270b4b2 787 (check_exec "$@") >> $logfile 2>&1 <<EOF
7dfef245
MR
788#include <signal.h>
789static void sighandler(int sig){
790 raise(SIGTERM);
791}
e5af4a11 792int main(void){
7dfef245
MR
793 signal(SIGILL, sighandler);
794 signal(SIGFPE, sighandler);
795 signal(SIGSEGV, sighandler);
796#ifdef SIGBUS
797 signal(SIGBUS, sighandler);
798#endif
799 { $code }
800}
801EOF
802}
803
72be9e73
DY
804check_type(){
805 log check_type "$@"
806 headers=$1
807 type=$2
808 shift 2
ae550ce9 809 disable_safe "$type"
72be9e73
DY
810 incs=""
811 for hdr in $headers; do
812 incs="$incs
813#include <$hdr>"
814 done
ae550ce9 815 check_cc "$@" <<EOF && enable_safe "$type"
72be9e73
DY
816$incs
817$type v;
818EOF
819}
820
14d36751
MR
821check_struct(){
822 log check_type "$@"
823 headers=$1
824 struct=$2
825 member=$3
826 shift 3
827 disable_safe "${struct}_${member}"
828 incs=""
829 for hdr in $headers; do
830 incs="$incs
831#include <$hdr>"
832 done
833 check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
834$incs
835const void *p = &(($struct *)0)->$member;
836EOF
837}
838
57bd82d4
MR
839require(){
840 name="$1"
841 header="$2"
842 func="$3"
843 shift 3
844 check_lib $header $func "$@" || die "ERROR: $name not found"
dcd479c0
MR
845}
846
f8d7b072
MR
847require2(){
848 name="$1"
849 headers="$2"
850 func="$3"
851 shift 3
852 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
853}
854
3f8040db
MR
855require_pkg_config(){
856 pkg="$1"
857 check_pkg_config "$@" || die "ERROR: $pkg not found"
858 add_cflags $(get_safe ${pkg}_cflags)
859 add_extralibs $(get_safe ${pkg}_libs)
860}
861
f0125de9
MR
862check_host_cc(){
863 log check_host_cc "$@"
864 cat > $TMPC
865 log_file $TMPC
866 check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
867}
868
869check_host_cflags(){
870 log check_host_cflags "$@"
871 check_host_cc "$@" <<EOF && append host_cflags "$@"
872int x;
873EOF
874}
875
c505dd31
MR
876apply(){
877 file=$1
878 shift
879 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
880}
881
c34681df 882cp_if_changed(){
5e27ec28
MR
883 cmp -s "$1" "$2" && echo "$2 is unchanged" && return
884 mkdir -p "$(dirname $2)"
885 cp -f "$1" "$2"
c34681df
MR
886}
887
dcd61286
DB
888# CONFIG_LIST contains configurable options, while HAVE_LIST is for
889# system-dependent things.
890
4a0d6686
AJ
891COMPONENT_LIST="
892 bsfs
893 decoders
894 demuxers
895 encoders
3cde40aa 896 filters
5666fd73 897 hwaccels
c552605c 898 indevs
4a0d6686 899 muxers
c552605c 900 outdevs
4a0d6686
AJ
901 parsers
902 protocols
903"
904
905CONFIG_LIST="
906 $COMPONENT_LIST
e8ed9b7a 907 aandct
a5444fee 908 ac3dsp
5a0f7131
MR
909 avcodec
910 avdevice
f7679c54 911 avfilter
5a0f7131 912 avformat
c88f5d72 913 avisynth
f402916e 914 bzlib
7f3f5f46 915 dct
c73f65d9 916 doc
05aec7bb 917 dwt
92c6a099 918 dxva2
27a9466b 919 fastdiv
c88f5d72 920 ffmpeg
6291d7e4 921 avconv
266463da 922 avplay
9e12f0bf 923 avprobe
4d58e4cb 924 avserver
1848f7d9 925 fft
47941088 926 frei0r
bc8c1395 927 gnutls
4f034993 928 golomb
c88f5d72 929 gpl
d8d0d0b2 930 gray
4693b031 931 h264dsp
4a384de5 932 h264pred
3abe5fbd 933 hardcoded_tables
3447f12d 934 huffman
e417d80d 935 libcdio
f7b8bffe 936 libdc1394
690bfceb 937 libdirac
2eed5a46 938 libfaac
a5b64584 939 libfreetype
c88f5d72 940 libgsm
6ebe07fb 941 libmp3lame
c88f5d72 942 libnut
0b175caa
DB
943 libopencore_amrnb
944 libopencore_amrwb
6ebf0bfc 945 libopencv
9a77d59a 946 libopenjpeg
0de9c41f 947 libpulse
0f943ce6 948 librtmp
f7cd9eed 949 libschroedinger
ae14f311 950 libspeex
150d2772 951 libtheora
d89e738a 952 libvo_aacenc
f502ff3f 953 libvo_amrwbenc
c88f5d72 954 libvorbis
8299a7f8 955 libvpx
1cc60c47 956 libx264
de295976 957 libxavs
1cc60c47 958 libxvid
f4d608e3 959 lpc
b781cc12 960 lsp
47a158cb 961 mdct
c88f5d72 962 memalign_hack
a8150374 963 mlib
c4f5c2d6 964 mpegaudiodsp
c88f5d72 965 network
3fe142e2 966 nonfree
a060866f 967 openssl
8a3c8627 968 pic
4a24ab64 969 postproc
68602540 970 rdft
44b70ce5 971 rtpdec
e90f5b5a 972 runtime_cpudetect
2e35e684 973 shared
4538729a 974 sinewin
bd2216e4 975 small
6b35d421 976 sram
2e35e684 977 static
5a0f7131 978 swscale
a9ddb5b1 979 swscale_alpha
8986fddc 980 thumb
17492d5e 981 vaapi
ac3dbb4d 982 vda
17492d5e 983 vdpau
9cad0e4e 984 version3
56a059ac 985 x11grab
c88f5d72 986 zlib
4a0d6686 987"
c88f5d72 988
8eee7025 989THREADS_LIST='
8eee7025
DB
990 pthreads
991 w32threads
992'
993
3f5b56e5
MR
994ARCH_LIST='
995 alpha
a2fc0f6a 996 arm
fdcd782d
MR
997 avr32
998 avr32_ap
999 avr32_uc
3f5b56e5
MR
1000 bfin
1001 ia64
1002 m68k
1003 mips
bae3abb0 1004 mips64
3f5b56e5 1005 parisc
79cb09b2 1006 ppc
34d11b87 1007 ppc64
3f5b56e5
MR
1008 s390
1009 sh4
1010 sparc
1011 sparc64
0844bae1 1012 tomi
3f5b56e5
MR
1013 x86
1014 x86_32
1015 x86_64
1016'
1017
1018ARCH_EXT_LIST='
1ac9331a 1019 altivec
3bf96eec 1020 amd3dnow
a1ef9f08 1021 amd3dnowext
1ac9331a 1022 armv5te
edab3048 1023 armv6
ab5cb084 1024 armv6t2
f55b299a 1025 armvfp
87f1355f 1026 avx
3f5b56e5
MR
1027 iwmmxt
1028 mmi
1029 mmx
d7f0920b 1030 mmx2
6b18d278 1031 neon
799fde37 1032 ppc4xx
1bb04d5a 1033 sse
9eeed841 1034 ssse3
93eb8e4d 1035 vfpv3
bd9d34a0 1036 vis
3f5b56e5
MR
1037'
1038
a3e02a8c
MR
1039HAVE_LIST_PUB='
1040 bigendian
d268eee9 1041 fast_unaligned
a3e02a8c
MR
1042'
1043
3f5b56e5
MR
1044HAVE_LIST="
1045 $ARCH_EXT_LIST
a3e02a8c 1046 $HAVE_LIST_PUB
3f5b56e5 1047 $THREADS_LIST
59782b82 1048 aligned_stack
35fd8122 1049 alsa_asoundlib_h
3f5b56e5 1050 altivec_h
c9fdab0d 1051 arpa_inet_h
6308729e 1052 asm_mod_y
dffb41b9 1053 attribute_may_alias
e7ea5e3d 1054 attribute_packed
6bd859d6 1055 bswap
ecf97f22 1056 closesocket
1ac9331a 1057 cmov
c88f5d72 1058 dcbzl
f8aa696f
DB
1059 dev_bktr_ioctl_bt848_h
1060 dev_bktr_ioctl_meteor_h
1061 dev_ic_bt8xx_h
1062 dev_video_meteor_ioctl_meteor_h
1063 dev_video_bktr_ioctl_bt848_h
18b67ae5 1064 dlfcn_h
c88f5d72 1065 dlopen
bc574408 1066 dos_paths
245626d0
DB
1067 ebp_available
1068 ebx_available
6b7c7703
VS
1069 exp2
1070 exp2f
c2a29455 1071 fast_64bit
669b5583 1072 fast_clz
7073e9fc 1073 fast_cmov
534a2231 1074 fcntl
9d99cc5a 1075 fork
84882df6 1076 getaddrinfo
da9e86f8 1077 gethrtime
fc5607f8 1078 GetProcessMemoryInfo
4e68cb8a 1079 GetProcessTimes
66be5b45 1080 getrusage
a49d3025 1081 gnu_as
fc5607f8 1082 struct_rusage_ru_maxrss
2f0c136e 1083 ibm_asm
2e1913b1 1084 inet_aton
61d251db 1085 inline_asm
abfc8d05 1086 isatty
9f5ff83f 1087 ldbrx
0b4a1821
AS
1088 libdc1394_1
1089 libdc1394_2
a33cab3a 1090 llrint
07876e25 1091 llrintf
d96cd429
MR
1092 local_aligned_16
1093 local_aligned_8
a5b64584 1094 localtime_r
291fd18a 1095 log2
6b7c7703 1096 log2f
85dd97ad 1097 loongson
a33cab3a 1098 lrint
c88f5d72 1099 lrintf
e4673692 1100 lzo1x_999_compress
f8aa696f
DB
1101 machine_ioctl_bt848_h
1102 machine_ioctl_meteor_h
c88f5d72 1103 malloc_h
73f6d31e 1104 MapViewOfFile
c88f5d72 1105 memalign
6ffa87d3 1106 mkstemp
0328b9ea 1107 mmap
1f91cdce 1108 posix_memalign
a33cab3a
MK
1109 round
1110 roundf
c88f5d72
MR
1111 sdl
1112 sdl_video_size
b507ebd1 1113 setmode
15d59d2c 1114 sndio_h
72be9e73 1115 socklen_t
deb29777 1116 soundcard_h
f8cda19e 1117 poll_h
0104b608 1118 setrlimit
87958234 1119 strerror_r
6379900c 1120 strptime
47941088 1121 strtok_r
c0018613 1122 struct_addrinfo
b4d68544
MS
1123 struct_ipv6_mreq
1124 struct_sockaddr_in6
3b2372bf 1125 struct_sockaddr_sa_len
33a4dbdd 1126 struct_sockaddr_storage
b462d132
MR
1127 symver
1128 symver_gnu_asm
1129 symver_asm_label
b58412f1 1130 sys_mman_h
b091aa44 1131 sys_resource_h
81644c2e 1132 sys_select_h
deb29777 1133 sys_soundcard_h
1b6e8b73 1134 sys_videoio_h
b265431e 1135 threads
23d3931a 1136 trunc
7b04b8a0 1137 truncf
ce742de2 1138 vfp_args
7c5bfe7a 1139 VirtualAlloc
6ff3f3e7 1140 winsock2_h
cc078b5d 1141 xform_asm
6f74fb03 1142 xmm_clobbers
304d586d 1143 yasm
0cb78cef 1144"
44161118 1145
b6bb00b0
MR
1146# options emitted with CONFIG_ prefix but not available on command line
1147CONFIG_EXTRA="
dc4f5a1c 1148 avutil
9cad0e4e
DB
1149 gplv3
1150 lgplv3
b6bb00b0
MR
1151"
1152
520cc7f1 1153CMDLINE_SELECT="
3f5b56e5 1154 $ARCH_EXT_LIST
520cc7f1 1155 $CONFIG_LIST
8eee7025 1156 $THREADS_LIST
c8a4ae00 1157 asm
db6107b6 1158 cross_compile
520cc7f1
MR
1159 debug
1160 extra_warnings
8c6afa4d 1161 logging
d2bbb2f7 1162 optimizations
9baec618 1163 symver
7595a5e4 1164 yasm
520cc7f1 1165"
426be5dc
DB
1166
1167PATHS_LIST='
d156bede 1168 bindir
14a8acf1 1169 datadir
26759c44
MR
1170 incdir
1171 libdir
26759c44
MR
1172 mandir
1173 prefix
1174 shlibdir
426be5dc
DB
1175'
1176
1177CMDLINE_SET="
1178 $PATHS_LIST
121d78d0 1179 ar
426be5dc 1180 arch
313c46a6 1181 as
426be5dc
DB
1182 build_suffix
1183 cc
1184 cpu
1185 cross_prefix
50567afa 1186 dep_cc
ac63af34 1187 extra_version
9da6609f
MR
1188 host_cc
1189 host_cflags
1190 host_ldflags
1191 host_libs
82bb3329 1192 host_os
684b28e0 1193 ld
426be5dc 1194 logfile
4ae40685 1195 malloc_prefix
89641463 1196 nm
9cd7b854 1197 optflags
3f8040db 1198 pkg_config
2fad0977 1199 samples
c5200f17
MR
1200 sysinclude
1201 sysroot
a7ada2ba 1202 target_exec
26759c44 1203 target_os
a7ada2ba 1204 target_path
426be5dc 1205"
520cc7f1 1206
89f2932b
MR
1207CMDLINE_APPEND="
1208 extra_cflags
1209"
1210
912f3148
DB
1211# code dependency declarations
1212
9eeed841 1213# architecture extensions
808fa33c 1214
a2fc0f6a
MR
1215armv5te_deps="arm"
1216armv6_deps="arm"
ab5cb084 1217armv6t2_deps="arm"
a2fc0f6a
MR
1218armvfp_deps="arm"
1219iwmmxt_deps="arm"
808fa33c 1220neon_deps="arm"
93eb8e4d 1221vfpv3_deps="armvfp"
808fa33c 1222
e241ba14 1223mmi_deps="mips"
808fa33c
MR
1224
1225altivec_deps="ppc"
1226ppc4xx_deps="ppc"
1227
1228vis_deps="sparc"
1229
7f8c3d1f 1230x86_64_suggest="cmov fast_cmov"
808fa33c
MR
1231amd3dnow_deps="mmx"
1232amd3dnowext_deps="amd3dnow"
9eeed841 1233mmx_deps="x86"
75aa95a6 1234mmx2_deps="mmx"
75aa95a6
DB
1235sse_deps="mmx"
1236ssse3_deps="sse"
87f1355f 1237avx_deps="ssse3"
9eeed841 1238
59782b82 1239aligned_stack_if_any="ppc x86"
e939cedd 1240fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
669b5583 1241fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
e939cedd 1242fast_unaligned_if_any="armv6 ppc x86"
669b5583 1243
89e053f8 1244need_memalign="altivec neon sse"
6fec122a 1245inline_asm_deps="!tms470"
89e053f8 1246
b462d132
MR
1247symver_if_any="symver_asm_label symver_gnu_asm"
1248
26fbcc85 1249# subsystems
dc609252 1250dct_select="rdft"
26fbcc85
MR
1251mdct_select="fft"
1252rdft_select="fft"
c4f5c2d6 1253mpegaudiodsp_select="dct"
26fbcc85 1254
5666fd73 1255# decoders / encoders / hardware accelerators
cfc2a0cf 1256aac_decoder_select="mdct sinewin"
4538729a 1257aac_encoder_select="mdct sinewin"
136e19e1 1258aac_latm_decoder_select="aac_decoder aac_latm_parser"
6d9f52b2 1259ac3_decoder_select="mdct ac3dsp ac3_parser"
a5444fee 1260ac3_encoder_select="mdct ac3dsp"
3d269059 1261ac3_fixed_encoder_select="mdct ac3dsp"
f4d608e3 1262alac_encoder_select="lpc"
b781cc12 1263amrnb_decoder_select="lsp"
2b2a597e 1264amrwb_decoder_select="lsp"
4538729a 1265atrac1_decoder_select="mdct sinewin"
26fbcc85 1266atrac3_decoder_select="mdct"
a33657ce
DB
1267binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1268binkaudio_rdft_decoder_select="mdct rdft sinewin"
4f034993 1269cavs_decoder_select="golomb"
4538729a 1270cook_decoder_select="mdct sinewin"
2eef7c62 1271cscd_decoder_suggest="zlib"
26fbcc85 1272dca_decoder_select="mdct"
e8ed9b7a 1273dnxhd_encoder_select="aandct"
2eef7c62 1274dxa_decoder_select="zlib"
baf91bb9 1275eac3_decoder_select="ac3_decoder"
aa47c35d 1276eac3_encoder_select="mdct ac3dsp"
84c04e25 1277eamad_decoder_select="aandct"
e8ed9b7a 1278eatgq_decoder_select="aandct"
d52b39c7 1279eatqi_decoder_select="aandct"
4f034993
MR
1280ffv1_decoder_select="golomb"
1281flac_decoder_select="golomb"
f4d608e3 1282flac_encoder_select="golomb lpc"
2eef7c62
AJ
1283flashsv_decoder_select="zlib"
1284flashsv_encoder_select="zlib"
c2d23309 1285flashsv2_decoder_select="zlib"
4414137e 1286flv_decoder_select="h263_decoder"
4d4b4bd1 1287flv_encoder_select="h263_encoder"
3447f12d 1288fraps_decoder_select="huffman"
e8ed9b7a 1289h261_encoder_select="aandct"
7f647ae0 1290h263_decoder_select="h263_parser"
e8ed9b7a 1291h263_encoder_select="aandct"
95a61cfc 1292h263_vaapi_hwaccel_select="vaapi h263_decoder"
4414137e 1293h263i_decoder_select="h263_decoder"
fe629c2d 1294h263p_encoder_select="h263_encoder"
4a384de5 1295h264_decoder_select="golomb h264dsp h264pred"
92c6a099
LA
1296h264_dxva2_hwaccel_deps="dxva2api_h"
1297h264_dxva2_hwaccel_select="dxva2 h264_decoder"
76718f3f 1298h264_vaapi_hwaccel_select="vaapi h264_decoder"
ac3dbb4d 1299h264_vda_hwaccel_select="vda h264_decoder"
95a61cfc 1300h264_vdpau_decoder_select="vdpau h264_decoder"
56c8227d 1301imc_decoder_select="fft mdct sinewin"
4f034993
MR
1302jpegls_decoder_select="golomb"
1303jpegls_encoder_select="golomb"
e8ed9b7a 1304ljpeg_encoder_select="aandct"
4f034993 1305loco_decoder_select="golomb"
e8ed9b7a 1306mjpeg_encoder_select="aandct"
2cca233b 1307mlp_decoder_select="mlp_parser"
c4f5c2d6
MR
1308mp1_decoder_select="mpegaudiodsp"
1309mp2_decoder_select="mpegaudiodsp"
1310mp3adu_decoder_select="mpegaudiodsp"
1311mp3_decoder_select="mpegaudiodsp"
1312mp3on4_decoder_select="mpegaudiodsp"
1313mp1float_decoder_select="mpegaudiodsp"
1314mp2float_decoder_select="mpegaudiodsp"
1315mp3adufloat_decoder_select="mpegaudiodsp"
1316mp3float_decoder_select="mpegaudiodsp"
1317mp3on4float_decoder_select="mpegaudiodsp"
e8ed9b7a
DB
1318mpeg1video_encoder_select="aandct"
1319mpeg2video_encoder_select="aandct"
4414137e 1320mpeg4_decoder_select="h263_decoder mpeg4video_parser"
c37de5e1 1321mpeg4_encoder_select="h263_encoder"
95a61cfc 1322mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
95a61cfc 1323mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
164aab02
LA
1324mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1325mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
95a61cfc 1326mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
95a61cfc 1327mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
70e0c871 1328mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
8f6f050a 1329mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
4d8eecf4 1330mpeg_xvmc_decoder_select="mpegvideo_decoder"
4414137e 1331msmpeg4v1_decoder_select="h263_decoder"
4e169d89 1332msmpeg4v1_encoder_select="h263_encoder"
4414137e 1333msmpeg4v2_decoder_select="h263_decoder"
4e169d89 1334msmpeg4v2_encoder_select="h263_encoder"
4414137e 1335msmpeg4v3_decoder_select="h263_decoder"
4e169d89 1336msmpeg4v3_encoder_select="h263_encoder"
4538729a
MR
1337nellymoser_decoder_select="mdct sinewin"
1338nellymoser_encoder_select="mdct sinewin"
2eef7c62
AJ
1339png_decoder_select="zlib"
1340png_encoder_select="zlib"
b781cc12 1341qcelp_decoder_select="lsp"
c4f5c2d6 1342qdm2_decoder_select="mdct rdft mpegaudiodsp"
31ed3f1f 1343ra_144_encoder_select="lpc"
a8beb22f 1344rv10_decoder_select="h263_decoder"
b2bf38b4 1345rv10_encoder_select="h263_encoder"
a8beb22f 1346rv20_decoder_select="h263_decoder"
b2bf38b4 1347rv20_encoder_select="h263_encoder"
4a384de5
JGG
1348rv30_decoder_select="golomb h264pred"
1349rv40_decoder_select="golomb h264pred"
4f034993 1350shorten_decoder_select="golomb"
b781cc12 1351sipr_decoder_select="lsp"
05aec7bb
MR
1352snow_decoder_select="dwt"
1353snow_encoder_select="aandct dwt"
19ecfb8a 1354svq1_encoder_select="aandct"
4a384de5 1355svq3_decoder_select="golomb h264dsp h264pred"
bee2eac5 1356svq3_decoder_suggest="zlib"
4eef77c1 1357theora_decoder_select="vp3_decoder"
2eef7c62
AJ
1358tiff_decoder_suggest="zlib"
1359tiff_encoder_suggest="zlib"
aec09a00 1360truehd_decoder_select="mlp_decoder"
2eef7c62 1361tscc_decoder_select="zlib"
4538729a 1362twinvq_decoder_select="mdct lsp sinewin"
f95bfab0 1363vc1_decoder_select="h263_decoder"
9104cd51 1364vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
f0f86627 1365vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
95a61cfc 1366vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
95a61cfc 1367vc1_vdpau_decoder_select="vdpau vc1_decoder"
45ecda85 1368vc1image_decoder_select="vc1_decoder"
26fbcc85
MR
1369vorbis_decoder_select="mdct"
1370vorbis_encoder_select="mdct"
3447f12d 1371vp6_decoder_select="huffman"
e82dc4c9
DB
1372vp6a_decoder_select="vp6_decoder"
1373vp6f_decoder_select="vp6_decoder"
4a384de5 1374vp8_decoder_select="h264pred"
4538729a
MR
1375wmapro_decoder_select="mdct sinewin"
1376wmav1_decoder_select="mdct sinewin"
1377wmav1_encoder_select="mdct sinewin"
1378wmav2_decoder_select="mdct sinewin"
1379wmav2_encoder_select="mdct sinewin"
1380wmavoice_decoder_select="lsp rdft dct mdct sinewin"
f95bfab0 1381wmv1_decoder_select="h263_decoder"
665507aa 1382wmv1_encoder_select="h263_encoder"
f95bfab0 1383wmv2_decoder_select="h263_decoder"
1746e2a9 1384wmv2_encoder_select="h263_encoder"
015f8ee0 1385wmv3_decoder_select="vc1_decoder"
f0f86627 1386wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
015f8ee0
DB
1387wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1388wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
45ecda85 1389wmv3image_decoder_select="wmv3_decoder"
2eef7c62
AJ
1390zlib_decoder_select="zlib"
1391zlib_encoder_select="zlib"
1392zmbv_decoder_select="zlib"
1393zmbv_encoder_select="zlib"
30fd06be 1394
0afab17e 1395vaapi_deps="va_va_h"
ac3dbb4d 1396vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
c89c96e9
MR
1397vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1398
28b80940 1399# parsers
4a384de5 1400h264_parser_select="golomb h264dsp h264pred"
28b80940 1401
912f3148 1402# external libraries
1b71f045 1403libdirac_decoder_deps="libdirac !libschroedinger"
690bfceb 1404libdirac_encoder_deps="libdirac"
c9171a83 1405libfaac_encoder_deps="libfaac"
299c77d5
MR
1406libgsm_decoder_deps="libgsm"
1407libgsm_encoder_deps="libgsm"
8ffed8d8
MR
1408libgsm_ms_decoder_deps="libgsm"
1409libgsm_ms_encoder_deps="libgsm"
1cc60c47 1410libmp3lame_encoder_deps="libmp3lame"
0b175caa
DB
1411libopencore_amrnb_decoder_deps="libopencore_amrnb"
1412libopencore_amrnb_encoder_deps="libopencore_amrnb"
1413libopencore_amrwb_decoder_deps="libopencore_amrwb"
9a77d59a 1414libopenjpeg_decoder_deps="libopenjpeg"
f7cd9eed
AS
1415libschroedinger_decoder_deps="libschroedinger"
1416libschroedinger_encoder_deps="libschroedinger"
ae14f311 1417libspeex_decoder_deps="libspeex"
b606a017 1418libspeex_encoder_deps="libspeex"
150d2772 1419libtheora_encoder_deps="libtheora"
d89e738a 1420libvo_aacenc_encoder_deps="libvo_aacenc"
f502ff3f 1421libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
b0caf888 1422libvorbis_encoder_deps="libvorbis"
8299a7f8 1423libvpx_decoder_deps="libvpx"
ee0e9146 1424libvpx_encoder_deps="libvpx"
1cc60c47 1425libx264_encoder_deps="libx264"
de295976 1426libxavs_encoder_deps="libxavs"
1cc60c47 1427libxvid_encoder_deps="libxvid"
30fd06be 1428
912f3148 1429# demuxers / muxers
c2dd0e9e 1430ac3_demuxer_select="ac3_parser"
647c2356 1431asf_stream_muxer_select="asf_muxer"
4e622dea 1432avisynth_demuxer_deps="avisynth"
c2dd0e9e 1433dirac_demuxer_select="dirac_parser"
5b423887 1434eac3_demuxer_select="ac3_parser"
c2dd0e9e 1435flac_demuxer_select="flac_parser"
647c2356 1436ipod_muxer_select="mov_muxer"
4e622dea
SS
1437libnut_demuxer_deps="libnut"
1438libnut_muxer_deps="libnut"
647c2356 1439matroska_audio_muxer_select="matroska_muxer"
4e622dea
SS
1440matroska_demuxer_suggest="zlib bzlib"
1441mov_demuxer_suggest="zlib"
c2dd0e9e 1442mp3_demuxer_select="mpegaudio_parser"
647c2356
DB
1443mp4_muxer_select="mov_muxer"
1444mpegtsraw_demuxer_select="mpegts_demuxer"
1445mxf_d10_muxer_select="mxf_muxer"
24ca518b 1446ogg_demuxer_select="golomb"
647c2356 1447psp_muxer_select="mov_muxer"
44594cc7 1448rtp_demuxer_select="sdp_demuxer"
44b70ce5
MS
1449rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
1450rtsp_demuxer_select="http_protocol rtpdec"
1451rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
01c8d258 1452sap_demuxer_select="sdp_demuxer"
2aab70c4 1453sap_muxer_select="rtp_muxer rtp_protocol"
44b70ce5 1454sdp_demuxer_select="rtpdec"
f1e94694 1455spdif_muxer_select="aac_parser"
647c2356
DB
1456tg2_muxer_select="mov_muxer"
1457tgp_muxer_select="mov_muxer"
6bdaa5f4 1458w64_demuxer_deps="wav_demuxer"
4e622dea
SS
1459
1460# indevs / outdevs
38e54a75 1461alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
38e54a75 1462alsa_outdev_deps="alsa_asoundlib_h"
38e54a75 1463bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
38e54a75 1464dv1394_indev_deps="dv1394 dv_demuxer"
c6f95144 1465fbdev_indev_deps="linux_fb_h"
38e54a75 1466jack_indev_deps="jack_jack_h"
e417d80d 1467libcdio_indev_deps="libcdio"
38e54a75 1468libdc1394_indev_deps="libdc1394"
38e54a75
SS
1469oss_indev_deps_any="soundcard_h sys_soundcard_h"
1470oss_outdev_deps_any="soundcard_h sys_soundcard_h"
0de9c41f 1471pulse_indev_deps="libpulse"
15d59d2c
B
1472sndio_indev_deps="sndio_h"
1473sndio_outdev_deps="sndio_h"
38e54a75
SS
1474v4l_indev_deps="linux_videodev_h"
1475v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
ec1ee802 1476vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
a1b3c5a3 1477vfwcap_indev_extralibs="-lavicap32"
38e54a75 1478x11_grab_device_indev_deps="x11grab XShmCreateImage"
781c1aa6 1479x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
30fd06be 1480
912f3148 1481# protocols
3fff6382 1482gopher_protocol_deps="network"
c08fb000 1483http_protocol_deps="network"
279a0c97 1484http_protocol_select="tcp_protocol"
183baead 1485https_protocol_select="tls_protocol"
c60a2d70 1486mmsh_protocol_select="http_protocol"
b4cf3f6c 1487mmst_protocol_deps="network"
deeb7012
MS
1488rtmp_protocol_select="tcp_protocol"
1489rtp_protocol_select="udp_protocol"
c08fb000 1490tcp_protocol_deps="network"
558d192d
MS
1491tls_protocol_deps_any="openssl gnutls"
1492tls_protocol_select="tcp_protocol"
c08fb000
AB
1493udp_protocol_deps="network"
1494
6ebf0bfc 1495# filters
13fabd7a 1496blackframe_filter_deps="gpl"
ce6b6ef6 1497boxblur_filter_deps="gpl"
68b79bfc 1498cropdetect_filter_deps="gpl"
b157be1f 1499delogo_filter_deps="gpl"
a5b64584 1500drawtext_filter_deps="libfreetype"
2e5ff4d0 1501frei0r_filter_deps="frei0r dlopen strtok_r"
a42bb9d6 1502frei0r_src_filter_deps="frei0r dlopen strtok_r"
a4dc7aa5 1503hqdn3d_filter_deps="gpl"
cf69ad35 1504ocv_filter_deps="libopencv"
92fe2587 1505scale_filter_deps="swscale"
acbac567 1506yadif_filter_deps="gpl"
6ebf0bfc 1507
5a0f7131
MR
1508# libraries
1509avdevice_deps="avcodec avformat"
1510avformat_deps="avcodec"
ced9556b 1511postproc_deps="gpl"
f7679c54 1512
912f3148 1513# programs
5a0f7131 1514ffmpeg_deps="avcodec avformat swscale"
21ae6790 1515ffmpeg_select="buffer_filter"
d2ba1fb5
DB
1516avconv_deps="avcodec avformat swscale"
1517avconv_select="buffer_filter"
266463da
AK
1518avplay_deps="avcodec avformat swscale sdl"
1519avplay_select="rdft"
9e12f0bf 1520avprobe_deps="avcodec avformat"
4d58e4cb
AK
1521avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
1522avserver_extralibs='$ldl'
a2830dca 1523
c73f65d9 1524doc_deps="texi2html"
912f3148 1525
57442411
MR
1526# tests
1527
1528test_deps(){
1529 suf1=$1
1530 suf2=$2
1531 shift 2
1532 for v; do
1533 dep=${v%=*}
1534 tests=${v#*=}
1535 for name in ${tests}; do
908f12f3 1536 append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
57442411
MR
1537 done
1538 done
1539}
1540
908f12f3
MR
1541mxf_d10_test_deps="avfilter"
1542seek_lavf_mxf_d10_test_deps="mxf_d10_test"
1543
57442411 1544test_deps _encoder _decoder \
57442411
MR
1545 adpcm_g726=g726 \
1546 adpcm_ima_qt \
1547 adpcm_ima_wav \
1548 adpcm_ms \
1549 adpcm_swf \
1550 adpcm_yamaha=adpcm_yam \
1551 alac \
1552 asv1 \
1553 asv2 \
1554 bmp \
a7638957 1555 dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
57442411
MR
1556 dvvideo="dv dv50" \
1557 ffv1 \
1558 flac \
1559 flashsv \
1560 flv \
1561 gif \
1562 h261 \
1563 h263="h263 h263p" \
1564 huffyuv \
1565 jpegls \
1566 mjpeg="jpg mjpeg ljpeg" \
1567 mp2 \
1568 mpeg1video="mpeg mpeg1b" \
1569 mpeg2video="mpeg2 mpeg2thread" \
1570 mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
c0b16605 1571 msmpeg4v3=msmpeg4 \
57442411
MR
1572 msmpeg4v2 \
1573 pbm=pbmpipe \
1574 pcx \
1575 pgm="pgm pgmpipe" \
f0f54c29 1576 png \
57442411
MR
1577 ppm="ppm ppmpipe" \
1578 rawvideo="rgb yuv" \
1579 roq \
1580 rv10 \
1581 rv20 \
1582 sgi \
1583 snow="snow snowll" \
1584 svq1 \
1585 targa=tga \
1586 tiff \
1587 wmav1 \
1588 wmav2 \
1589 wmv1 \
1590 wmv2 \
1591
1592test_deps _muxer _demuxer \
1593 aiff \
1594 pcm_alaw=alaw \
1595 asf \
1596 au \
1597 avi \
1598 dv=dv_fmt \
1599 ffm \
1600 flv=flv_fmt \
1601 gxf \
1602 matroska=mkv \
1603 mmf \
1604 mov \
1605 pcm_mulaw=mulaw \
0218808d 1606 mxf="mxf mxf_d10" \
57442411
MR
1607 nut \
1608 ogg \
1609 rawvideo=pixfmt \
1610 rm \
1611 swf \
1612 mpegts=ts \
1613 voc \
1614 wav \
1615 yuv4mpegpipe=yuv4mpeg \
1616
6fd96d1a 1617ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
57442411 1618mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
9c261f83 1619
de6d9b64 1620# default parameters
8a608357 1621
19bd477d 1622logfile="config.log"
8a608357
MR
1623
1624# installation paths
c9d19248
MR
1625prefix_default="/usr/local"
1626bindir_default='${prefix}/bin'
6291d7e4 1627datadir_default='${prefix}/share/avconv'
c9d19248
MR
1628incdir_default='${prefix}/include'
1629libdir_default='${prefix}/lib'
1630mandir_default='${prefix}/share/man'
1631shlibdir_default="$libdir_default"
8a608357
MR
1632
1633# toolchain
121d78d0 1634ar_default="ar"
13c7df3d 1635cc_default="gcc"
a3d7c197 1636cc_version=\"unknown\"
9da6609f 1637host_cc_default="gcc"
11e6d03a 1638ln_s="ln -sf"
89641463 1639nm_default="nm"
11e6d03a 1640objformat="elf"
3f8040db 1641pkg_config_default=pkg-config
be7109c1 1642ranlib="ranlib"
11e6d03a 1643yasmexe="yasm"
301ab19d 1644nogas=":"
8a608357 1645
8182dc34
MR
1646nm_opts='-g'
1647
8a608357 1648# machine
8d4c00ed 1649arch_default=$(uname -m)
38d0a8aa 1650cpu="generic"
8a608357 1651
8a608357 1652# OS
8d4c00ed
MR
1653target_os_default=$(tolower $(uname -s))
1654host_os=$target_os_default
8a608357 1655
8a608357 1656# configurable options
5a0f7131
MR
1657enable avcodec
1658enable avdevice
cccc039f 1659enable avfilter
5a0f7131 1660enable avformat
dc4f5a1c 1661enable avutil
c8a4ae00 1662enable asm
497237c7 1663enable debug
c73f65d9 1664enable doc
aa033b1e 1665enable fastdiv
497237c7 1666enable ffmpeg
6291d7e4 1667enable avconv
266463da 1668enable avplay
9e12f0bf 1669enable avprobe
4d58e4cb 1670enable avserver
497237c7 1671enable network
8400d6b8 1672enable optimizations
ced9556b 1673enable postproc
497237c7 1674enable protocols
530dc538 1675enable static
5a0f7131 1676enable swscale
a9ddb5b1 1677enable swscale_alpha
8a608357 1678
8a608357 1679# build settings
9987769a 1680SHFLAGS='-shared -Wl,-soname,$$(@F)'
4d58e4cb 1681AVSERVERLDFLAGS=-Wl,-E
f3ec2d46
SG
1682LIBPREF="lib"
1683LIBSUF=".a"
c5f14466
RP
1684FULLNAME='$(NAME)$(BUILDSUF)'
1685LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
f3ec2d46
SG
1686SLIBPREF="lib"
1687SLIBSUF=".so"
c5f14466 1688SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
b29bddab
DB
1689SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1690SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
6cfac0e9 1691LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2f138f0b
MR
1692SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
1693SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
ef0bc4c9 1694
bc877faf 1695AS_O='-o $@'
7e6c86e6
MR
1696CC_O='-o $@'
1697
0a6db2a2 1698host_cflags='-D_ISOC99_SOURCE -O3 -g'
9da6609f
MR
1699host_libs='-lm'
1700
9b861379 1701target_path='$(CURDIR)'
a7ada2ba 1702
a158446b
MR
1703# since the object filename is not given with the -MM flag, the compiler
1704# is only able to print the basename, and we must add the path ourselves
c1c3933a 1705DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
d8059267 1706DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
315c741d 1707
c597172e 1708# find source path
24524f36 1709if test -f configure; then
f038cf3c 1710 source_path=.
c597172e 1711else
8477f2de 1712 source_path=$(cd $(dirname "$0"); pwd)
c597172e 1713 echo "$source_path" | grep -q '[[:blank:]]' &&
7483e694 1714 die "Out of tree builds are impossible with whitespace in source path."
337cee68
MC
1715 test -e "$source_path/config.h" &&
1716 die "Out of tree builds are impossible with config.h in source dir."
c597172e
MR
1717fi
1718
13cbe2c0 1719for v in "$@"; do
b04251c5
MR
1720 r=${v#*=}
1721 l=${v%"$r"}
1722 r=$(sh_quote "$r")
29ba0911 1723 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
13cbe2c0 1724done
c597172e 1725
73ef8980
MR
1726find_things(){
1727 thing=$1
1728 pattern=$2
1729 file=$source_path/$3
932ccf39 1730 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
73ef8980
MR
1731}
1732
1733ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1734DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
5666fd73 1735HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
73ef8980
MR
1736PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1737BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1738MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1739DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
38e54a75
SS
1740OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
1741INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
73ef8980 1742PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
81124ba0 1743FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
c597172e 1744
57442411 1745find_tests(){
b9d5f1b7 1746 map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
57442411
MR
1747}
1748
1749ACODEC_TESTS=$(find_tests acodec)
1750VCODEC_TESTS=$(find_tests vsynth1)
1751LAVF_TESTS=$(find_tests lavf)
48c28162 1752LAVFI_TESTS=$(find_tests lavfi)
b9d5f1b7 1753SEEK_TESTS=$(find_tests seek seek_)
57442411 1754
40fe5019
MR
1755pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
1756
8469ae22
MR
1757for n in $COMPONENT_LIST; do
1758 v=$(toupper ${n%s})_LIST
1759 eval enable \$$v
1760 eval ${n}_if_any="\$$v"
1761done
1762
b9d5f1b7 1763enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
c597172e
MR
1764
1765die_unknown(){
1766 echo "Unknown option \"$1\"."
1767 echo "See $0 --help for available options."
1768 exit 1
1769}
1770
794f8e97 1771show_list() {
bf0c4afa
RP
1772 suffix=_$1
1773 shift
2b444ea7 1774 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
794f8e97
PI
1775 exit 0
1776}
1777
c597172e 1778for opt do
7483e694
DB
1779 optval="${opt#*=}"
1780 case "$opt" in
0f010b2f 1781 --extra-ldflags=*) add_ldflags $optval
7483e694 1782 ;;
0f010b2f 1783 --extra-libs=*) add_extralibs $optval
7483e694 1784 ;;
8fb1cb58 1785 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
9aa8ed9d 1786 ;;
40bcf4c7
BL
1787 --enable-debug=*) debuglevel="$optval"
1788 ;;
36e2dea0 1789 --disable-everything)
1b15dc3c 1790 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
36e2dea0 1791 ;;
7483e694 1792 --enable-*=*|--disable-*=*)
8b93ddc3 1793 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
be8f2501
MR
1794 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1795 eval list=\$$(toupper $thing)_LIST
8b93ddc3
MR
1796 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1797 $action $(filter "$name" $list)
7483e694
DB
1798 ;;
1799 --enable-?*|--disable-?*)
5e622c40 1800 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
e3773a55 1801 if is_in $option $COMPONENT_LIST; then
fed5d54b 1802 test $action = disable && action=unset
e3773a55
MR
1803 eval $action \$$(toupper ${option%s})_LIST
1804 elif is_in $option $CMDLINE_SELECT; then
1805 $action $option
1806 else
1807 die_unknown $opt
1808 fi
7483e694
DB
1809 ;;
1810 --list-*)
1811 NAME="${opt#--list-}"
1812 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1813 NAME=${NAME%s}
1814 eval show_list $NAME \$$(toupper $NAME)_LIST
1815 ;;
1816 --help|-h) show_help
1817 ;;
1818 *)
884a36a7 1819 optname="${opt%%=*}"
26759c44
MR
1820 optname="${optname#--}"
1821 optname=$(echo "$optname" | sed 's/-/_/g')
89f2932b
MR
1822 if is_in $optname $CMDLINE_SET; then
1823 eval $optname='$optval'
1824 elif is_in $optname $CMDLINE_APPEND; then
1825 append $optname "$optval"
1826 else
1827 die_unknown $opt
1828 fi
7483e694
DB
1829 ;;
1830 esac
c597172e
MR
1831done
1832
bcea99bb
MR
1833disabled logging && logfile=/dev/null
1834
29ba0911 1835echo "# $0 $LIBAV_CONFIGURATION" > $logfile
bcea99bb
MR
1836set >> $logfile
1837
9da6609f
MR
1838test -n "$cross_prefix" && enable cross_compile
1839
8d4c00ed
MR
1840if enabled cross_compile; then
1841 test -n "$arch" && test -n "$target_os" ||
1842 die "Must specify target arch and OS when cross-compiling"
1843fi
1844
1845set_default arch target_os
1846
121d78d0 1847ar_default="${cross_prefix}${ar_default}"
11e6d03a 1848cc_default="${cross_prefix}${cc_default}"
20e0ed95 1849nm_default="${cross_prefix}${nm_default}"
3f8040db 1850pkg_config_default="${cross_prefix}${pkg_config_default}"
adb2b908 1851ranlib="${cross_prefix}${ranlib}"
adb2b908 1852
c5200f17
MR
1853sysinclude_default="${sysroot}/usr/include"
1854
e0be794a 1855set_default cc nm pkg_config sysinclude
9da6609f
MR
1856enabled cross_compile || host_cc_default=$cc
1857set_default host_cc
13c7df3d 1858
762f95e4
MR
1859if ! $pkg_config --version >/dev/null 2>&1; then
1860 warn "$pkg_config not found, library detection may fail."
1861 pkg_config=false
1862fi
1863
82bb3329
MR
1864exesuf() {
1865 case $1 in
1c69c79f 1866 mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
82bb3329
MR
1867 esac
1868}
1869
1870EXESUF=$(exesuf $target_os)
1871HOSTEXESUF=$(exesuf $host_os)
c0f5b7f1 1872
e4e69e0b 1873# set temporary file name
a49d42c2 1874: ${TMPDIR:=$TEMPDIR}
c51fafa1 1875: ${TMPDIR:=$TMP}
a49d42c2 1876: ${TMPDIR:=/tmp}
e4e69e0b 1877
a210bce2 1878if ! check_cmd mktemp -u XXXXXX; then
54460a83
MR
1879 # simple replacement for missing mktemp
1880 # NOT SAFE FOR GENERAL USE
1881 mktemp(){
09a5c245 1882 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
54460a83
MR
1883 }
1884fi
1885
1886tmpfile(){
1887 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1888 (set -C; exec > $tmp) 2>/dev/null ||
f7ba16a7 1889 die "Unable to create temporary file in $TMPDIR."
54460a83
MR
1890 append TMPFILES $tmp
1891 eval $1=$tmp
1892}
1893
1894trap 'rm -f -- $TMPFILES' EXIT
54460a83
MR
1895
1896tmpfile TMPC .c
1897tmpfile TMPE $EXESUF
1898tmpfile TMPH .h
1899tmpfile TMPO .o
1900tmpfile TMPS .S
a482e61b 1901tmpfile TMPV .ver
54460a83 1902tmpfile TMPSH .sh
55127e7b 1903tmpfile TMPASM .asm
54460a83
MR
1904
1905unset -f mktemp
e4e69e0b 1906
fb3c4ffc
MR
1907chmod +x $TMPE
1908
993f2d0f
MR
1909# make sure we can execute files in $TMPDIR
1910cat > $TMPSH 2>> $logfile <<EOF
1911#! /bin/sh
1912EOF
1913chmod +x $TMPSH >> $logfile 2>&1
1914if ! $TMPSH >> $logfile 2>&1; then
1915 cat <<EOF
1916Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
1917variable to another directory and make sure that it is not mounted noexec.
1918EOF
1919 die "Sanity test failed."
1920fi
993f2d0f 1921
19b4c628
MR
1922filter_cflags=echo
1923filter_cppflags=echo
1924filter_asflags=echo
1925
613a4e3f
MR
1926if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
1927 cc_type=llvm_gcc
1928 cc_version=__VERSION__
1929 gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
1930 cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
1931 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1932 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1933 speed_cflags='-O3'
1934 size_cflags='-Os'
1935elif $cc -v 2>&1 | grep -qi ^gcc; then
629687f6 1936 cc_type=gcc
a3d7c197 1937 cc_version=__VERSION__
5d57846b
MR
1938 gcc_version=$($cc --version | head -n1)
1939 gcc_basever=$($cc -dumpversion)
3ad464bf 1940 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
5d57846b
MR
1941 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
1942 cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
aef6bd1b
MR
1943 if ! $cc -dumpversion | grep -q '^2\.'; then
1944 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1945 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1946 fi
14ca9cd0
MR
1947 speed_cflags='-O3'
1948 size_cflags='-Os'
629687f6
MR
1949elif $cc --version 2>/dev/null | grep -q Intel; then
1950 cc_type=icc
6e3fa35d 1951 cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
bb5cecdc 1952 cc_ident=$($cc --version | head -n1)
bdefad73 1953 icc_version=$($cc -dumpversion)
07dec06e
MR
1954 CC_DEPFLAGS='-MMD'
1955 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
1956 speed_cflags='-O3'
1957 size_cflags='-Os'
b05394a0 1958 noopt_cflags='-O1'
629687f6
MR
1959elif $cc -v 2>&1 | grep -q xlc; then
1960 cc_type=xlc
6e3fa35d 1961 cc_version="AV_STRINGIFY(__IBMC__)"
bb5cecdc 1962 cc_ident=$($cc -qversion 2>/dev/null | head -n1)
14ca9cd0
MR
1963 speed_cflags='-O5'
1964 size_cflags='-O5 -qcompact'
df442a8d
MR
1965elif $cc -V 2>/dev/null | grep -q Compaq; then
1966 cc_type=ccc
6e3fa35d 1967 cc_version="AV_STRINGIFY(__DECC_VER)"
bb5cecdc 1968 cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
d8059267 1969 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
03754fcd 1970 debuglevel=3
df442a8d 1971 add_ldflags -Wl,-z,now # calls to libots crash without this
14ca9cd0
MR
1972 speed_cflags='-fast'
1973 size_cflags='-O1'
6a0d5493 1974elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
03e37762
MR
1975 test -d "$sysroot" || die "No valid sysroot specified."
1976 cc_type=armcc
6e3fa35d 1977 cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
bb5cecdc 1978 cc_ident=$($cc --vsn | head -n1)
03e37762
MR
1979 armcc_conf="$PWD/armcc.conf"
1980 $cc --arm_linux_configure \
1981 --arm_linux_config_file="$armcc_conf" \
1982 --configure_sysroot="$sysroot" \
1983 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
1984 die "Error creating armcc configuration file."
bcafde61 1985 $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
03e37762 1986 cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
75800dce 1987 as_default="${cross_prefix}gcc"
07dec06e
MR
1988 CC_DEPFLAGS='-MMD'
1989 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
1990 speed_cflags='-O3'
1991 size_cflags='-Os'
d0f0f628 1992 filter_asflags="filter_out -W${armcc_opt}*"
6fec122a
MR
1993elif $cc -version 2>/dev/null | grep -q TMS470; then
1994 cc_type=tms470
6e3fa35d 1995 cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
bb5cecdc 1996 cc_ident=$($cc -version | head -n1 | tr -s ' ')
6fec122a
MR
1997 cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
1998 CC_O='-fr=$(@D)'
1999 as_default="${cross_prefix}gcc"
2000 ld_default="${cross_prefix}gcc"
6fec122a
MR
2001 TMPO=$(basename $TMPC .c).o
2002 append TMPFILES $TMPO
2003 add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
07dec06e
MR
2004 CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
2005 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
2006 speed_cflags='-O3 -mf=5'
2007 size_cflags='-O3 -mf=2'
6fec122a
MR
2008 filter_cflags=tms470_flags
2009 tms470_flags(){
2010 for flag; do
2011 case $flag in
2012 -march=*|-mcpu=*)
2013 case "${flag#*=}" in
2014 armv7-a|cortex-a*) echo -mv=7a8 ;;
2015 armv7-r|cortex-r*) echo -mv=7r4 ;;
2016 armv7-m|cortex-m*) echo -mv=7m3 ;;
2017 armv6*|arm11*) echo -mv=6 ;;
2018 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
2019 echo -mv=5e ;;
2020 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
2021 esac
2022 ;;
2023 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
2024 -mfpu=vfp) echo --float_support=vfpv2 ;;
5fcb865b 2025 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
a2709020 2026 -msoft-float) echo --float_support=vfplib ;;
14ca9cd0 2027 -O[0-3]|-mf=*) echo $flag ;;
6fec122a 2028 -g) echo -g -mn ;;
587d24ff 2029 -pds=*) echo $flag ;;
6fec122a
MR
2030 esac
2031 done
2032 }
06da6943
DC
2033elif $cc -v 2>&1 | grep -q clang; then
2034 cc_type=clang
b67a8f49
DC
2035 $cc -dM -E $TMPC | grep -q __clang_version__ &&
2036 cc_version=__clang_version__ || cc_version=__VERSION__
bb5cecdc 2037 cc_ident=$($cc --version | head -n1)
06da6943
DC
2038 CC_DEPFLAGS='-MMD'
2039 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
2040 speed_cflags='-O3'
2041 size_cflags='-Os'
2a472e9c
MK
2042elif $cc -V 2>&1 | grep -q Sun; then
2043 cc_type=suncc
2044 cc_version="AV_STRINGIFY(__SUNPRO_C)"
448f5b83 2045 cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
faa374b7 2046 DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
2a472e9c 2047 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
558c2683 2048 add_ldflags -xc99
14ca9cd0
MR
2049 speed_cflags='-O5'
2050 size_cflags='-O5 -xspace'
03279bbe
MK
2051 filter_cflags=suncc_flags
2052 suncc_flags(){
2053 for flag; do
2054 case $flag in
2055 -march=*|-mcpu=*)
2056 case "${flag#*=}" in
2057 native) echo -xtarget=native ;;
87ddc38b 2058 v9|niagara) echo -xarch=sparc ;;
03279bbe 2059 ultrasparc) echo -xarch=sparcvis ;;
87ddc38b 2060 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
03279bbe
MK
2061 i586|pentium) echo -xchip=pentium ;;
2062 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
2063 pentium3*|c3-2) echo -xtarget=pentium3 ;;
2064 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
2065 pentium4*) echo -xtarget=pentium4 ;;
2066 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
2067 *-sse3) echo -xarch=sse3 ;;
2068 core2) echo -xarch=ssse3 -xchip=core2 ;;
2069 amdfam10|barcelona) echo -xarch=sse4_1 ;;
2070 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
2071 k8|opteron|athlon64|athlon-fx)
2072 echo -xarch=sse2a ;;
2073 athlon*) echo -xarch=pentium_proa ;;
2074 esac
2075 ;;
2076 -std=c99) echo -xc99 ;;
2077 -fomit-frame-pointer) echo -xregs=frameptr ;;
2078 -fPIC) echo -KPIC -xcode=pic32 ;;
03279bbe
MK
2079 -W*,*) echo $flag ;;
2080 -f*-*|-W*) ;;
2081 *) echo $flag ;;
2082 esac
2083 done
2084 }
180ec37d 2085elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
349d78fe
MR
2086 cc_type=pathscale
2087 cc_version=__PATHSCALE__
2088 cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2089 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2090 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2091 speed_cflags='-O2'
2092 size_cflags='-Os'
7b2d2190 2093 filter_cflags='filter_out -Wdisabled-optimization'
6de163e9
MR
2094elif $cc -v 2>&1 | grep -q Open64; then
2095 cc_type=open64
2096 cc_version=__OPEN64__
2097 cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2098 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2099 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2100 speed_cflags='-O2'
2101 size_cflags='-Os'
7b2d2190 2102 filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
629687f6
MR
2103fi
2104
851ffa80
MR
2105test -n "$cc_type" && enable $cc_type ||
2106 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
629687f6 2107
75bafbac 2108: ${as_default:=$cc}
50567afa 2109: ${dep_cc_default:=$cc}
684b28e0 2110: ${ld_default:=$cc}
121d78d0 2111set_default ar as dep_cc ld
75800dce 2112
07dec06e
MR
2113test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
2114test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
2115
7f32f40c 2116add_cflags $extra_cflags
2f2e6c7c 2117add_asflags $extra_cflags
7f32f40c 2118
154d432c
MR
2119if test -n "$sysroot"; then
2120 case "$cc_type" in
00ba041c 2121 gcc|llvm_gcc|clang)
467256f2 2122 add_cppflags --sysroot="$sysroot"
154d432c
MR
2123 add_ldflags --sysroot="$sysroot"
2124 ;;
6fec122a
MR
2125 tms470)
2126 add_cppflags -I"$sysinclude"
2127 add_ldflags --sysroot="$sysroot"
2128 ;;
154d432c
MR
2129 esac
2130fi
2131
d22c13a8
MR
2132if test "$cpu" = host; then
2133 enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
2134
2135 case "$cc_type" in
613a4e3f 2136 gcc|llvm_gcc)
d22c13a8
MR
2137 check_native(){
2138 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
b695256e 2139 sed -n "/cc1.*$1=/{
27ce1be8
MR
2140 s/.*$1=\\([^ ]*\\).*/\\1/
2141 p
2142 q
2143 }" $TMPE
d22c13a8
MR
2144 }
2145 cpu=$(check_native -march || check_native -mcpu)
2146 ;;
2147 esac
2148
2149 test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
2150fi
2151
e939cedd
MR
2152# Deal with common $arch aliases
2153case "$arch" in
2154 arm*)
2155 arch="arm"
2156 ;;
2157 mips|mipsel|IP*)
2158 arch="mips"
2159 ;;
47b1860e 2160 mips64*)
e939cedd
MR
2161 arch="mips"
2162 subarch="mips64"
2163 ;;
2164 parisc|hppa)
2165 arch="parisc"
2166 ;;
2167 parisc64|hppa64)
2168 arch="parisc"
2169 subarch="parisc64"
2170 ;;
2171 "Power Macintosh"|ppc|powerpc)
2172 arch="ppc"
2173 ;;
47b1860e 2174 ppc64|powerpc64)
e939cedd
MR
2175 arch="ppc"
2176 subarch="ppc64"
2177 ;;
2178 s390|s390x)
2179 arch="s390"
2180 ;;
2181 sh4|sh)
2182 arch="sh4"
2183 ;;
2184 sun4u|sparc64)
2185 arch="sparc"
2186 subarch="sparc64"
2187 ;;
d33ed7b3 2188 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
e939cedd
MR
2189 arch="x86"
2190 ;;
2191esac
2192
851ffa80 2193is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
343aef9b 2194enable $arch
e939cedd 2195
df5cdc24 2196# Add processor-specific flags
5d54c126
MR
2197if test "$cpu" = generic; then
2198 : do nothing
2199elif enabled ppc; then
343aef9b 2200
56348891
MR
2201 case $(tolower $cpu) in
2202 601|ppc601|powerpc601)
9dbd5c3d 2203 cpuflags="-mcpu=601"
64ad53ff 2204 disable altivec
9dbd5c3d 2205 ;;
56348891 2206 603*|ppc603*|powerpc603*)
9dbd5c3d 2207 cpuflags="-mcpu=603"
64ad53ff 2208 disable altivec
9dbd5c3d 2209 ;;
56348891 2210 604*|ppc604*|powerpc604*)
9dbd5c3d 2211 cpuflags="-mcpu=604"
64ad53ff 2212 disable altivec
9dbd5c3d 2213 ;;
56348891 2214 g3|75*|ppc75*|powerpc75*)
9dbd5c3d 2215 cpuflags="-mcpu=750 -mpowerpc-gfxopt"
64ad53ff 2216 disable altivec
9dbd5c3d 2217 ;;
56348891 2218 g4|745*|ppc745*|powerpc745*)
9dbd5c3d
MR
2219 cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
2220 ;;
56348891 2221 74*|ppc74*|powerpc74*)
9dbd5c3d
MR
2222 cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
2223 ;;
56348891 2224 g5|970|ppc970|powerpc970|power4*)
9dbd5c3d
MR
2225 cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
2226 ;;
56348891 2227 cell)
9dbd5c3d
MR
2228 cpuflags="-mcpu=cell"
2229 enable ldbrx
2230 ;;
7b0b81a1
AL
2231 e500v2)
2232 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
2233 disable altivec
2234 ;;
2235 e500)
2236 cpuflags="-mcpu=8540 -mhard-float"
2237 disable altivec
2238 ;;
9dbd5c3d 2239 esac
343aef9b
MR
2240
2241elif enabled x86; then
2242
9dbd5c3d
MR
2243 case $cpu in
2244 i[345]86|pentium)
2245 cpuflags="-march=$cpu"
2246 disable mmx
2247 ;;
2248 # targets that do NOT support conditional mov (cmov)
2249 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
2250 cpuflags="-march=$cpu"
2251 disable cmov
2252 ;;
2253 # targets that do support conditional mov (cmov)
9ddf1b1a 2254 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
9dbd5c3d
MR
2255 cpuflags="-march=$cpu"
2256 enable cmov
2257 enable fast_cmov
2258 ;;
2259 # targets that do support conditional mov but on which it's slow
2260 pentium4|pentium4m|prescott|nocona)
2261 cpuflags="-march=$cpu"
2262 enable cmov
2263 disable fast_cmov
2264 ;;
2265 esac
343aef9b
MR
2266
2267elif enabled sparc; then
2268
9dbd5c3d 2269 case $cpu in
26b7199e
MK
2270 niagara)
2271 cpuflags="-mcpu=$cpu"
2272 disable vis
2273 ;;
9dbd5c3d
MR
2274 sparc64)
2275 cpuflags="-mcpu=v9"
2276 ;;
2277 esac
343aef9b
MR
2278
2279elif enabled arm; then
2280
34ba23c9
MR
2281 case $cpu in
2282 armv*)
2283 cpuflags="-march=$cpu"
c2eae137 2284 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
34ba23c9
MR
2285 ;;
2286 *)
2287 cpuflags="-mcpu=$cpu"
c2eae137
MR
2288 case $cpu in
2289 cortex-a*) subarch=armv7a ;;
2290 cortex-r*) subarch=armv7r ;;
9e19704a 2291 cortex-m*) enable thumb; subarch=armv7m ;;
c2eae137
MR
2292 arm11*) subarch=armv6 ;;
2293 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
2294 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
2295 esac
34ba23c9
MR
2296 ;;
2297 esac
343aef9b
MR
2298
2299elif enabled alpha; then
2300
34ba23c9 2301 enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
343aef9b
MR
2302
2303elif enabled bfin; then
2304
34ba23c9 2305 cpuflags="-mcpu=$cpu"
343aef9b
MR
2306
2307elif enabled mips; then
2308
34ba23c9 2309 cpuflags="-march=$cpu"
343aef9b
MR
2310
2311elif enabled avr32; then
2312
9dbd5c3d
MR
2313 case $cpu in
2314 ap7[02]0[0-2])
2315 subarch="avr32_ap"
2316 cpuflags="-mpart=$cpu"
2317 ;;
2318 ap)
2319 subarch="avr32_ap"
2320 cpuflags="-march=$cpu"
2321 ;;
2322 uc3[ab]*)
2323 subarch="avr32_uc"
2324 cpuflags="-mcpu=$cpu"
2325 ;;
2326 uc)
2327 subarch="avr32_uc"
2328 cpuflags="-march=$cpu"
2329 ;;
2330 esac
df5cdc24 2331
343aef9b
MR
2332fi
2333
df5cdc24
MR
2334add_cflags $cpuflags
2335add_asflags $cpuflags
2336
993f2d0f
MR
2337# compiler sanity check
2338check_exec <<EOF
2339int main(void){ return 0; }
2340EOF
2341if test "$?" != 0; then
2342 echo "$cc is unable to create an executable file."
2343 if test -z "$cross_prefix" && ! enabled cross_compile ; then
2344 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
2345 echo "Only do this if you know what cross compiling means."
2346 fi
2347 die "C compiler test failed."
2348fi
2349
046f081b 2350add_cppflags -D_ISOC99_SOURCE
e9b9a2f8 2351check_cflags -std=c99
50a334e4 2352check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
9d821fc2
DB
2353#include <stdlib.h>
2354EOF
50a334e4 2355check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
9d821fc2
DB
2356#include <stdlib.h>
2357EOF
e9b9a2f8 2358
f0125de9 2359check_host_cflags -std=c99
0a6db2a2 2360check_host_cflags -Wall
f0125de9 2361
b24dbcbd 2362case "$arch" in
e939cedd 2363 alpha|ia64|mips|parisc|sparc)
8a3c8627 2364 spic=$shared
b24dbcbd 2365 ;;
e939cedd 2366 x86)
cfdb6148 2367 subarch="x86_32"
e939cedd 2368 check_cc <<EOF && subarch="x86_64"
58b3536d 2369 int test[(int)sizeof(char*) - 7];
cfdb6148 2370EOF
de27f4d9 2371 if test "$subarch" = "x86_64"; then
e939cedd 2372 spic=$shared
de27f4d9 2373 fi
b24dbcbd 2374 ;;
b24dbcbd
RP
2375esac
2376
343aef9b 2377enable $subarch
8a3c8627 2378enabled spic && enable pic
b24dbcbd 2379
7483e694 2380# OS specific
4f854758 2381case $target_os in
a1629e28 2382 haiku)
63ae7e7c 2383 prefix_default="/boot/common"
108caaaa 2384 network_extralibs="-lnetwork"
f59c4bd6 2385 host_libs=
a1629e28 2386 ;;
7483e694 2387 sunos)
4d58e4cb 2388 AVSERVERLDFLAGS=""
9987769a 2389 SHFLAGS='-shared -Wl,-h,$$(@F)'
0600d30a 2390 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
7483e694 2391 network_extralibs="-lsocket -lnsl"
50a334e4 2392 add_cppflags -D__EXTENSIONS__
87a74f47
SM
2393 # When using suncc to build, the Solaris linker will mark
2394 # an executable with each instruction set encountered by
2395 # the Solaris assembler. As our libraries contain their own
2396 # guards for processor-specific code, instead suppress
2397 # generation of the HWCAPS ELF section on Solaris x86 only.
2398 enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
8182dc34 2399 nm_opts='-P -g'
7483e694
DB
2400 ;;
2401 netbsd)
a1e4b3f6 2402 disable symver
07a8eef6
MR
2403 oss_indev_extralibs="-lossaudio"
2404 oss_outdev_extralibs="-lossaudio"
7483e694
DB
2405 ;;
2406 openbsd)
89e053f8 2407 enable malloc_aligned
7c4a001a 2408 # On OpenBSD 4.5. the compiler does not use PIC unless
070c5d0f 2409 # explicitly using -fPIC. Libav builds fine without PIC,
7c4a001a
MR
2410 # however the generated executable will not do anything
2411 # (simply quits with exit-code 1, no crash, no output).
a7b9c8ae 2412 # Thus explicitly enable PIC here.
cd78208b 2413 enable pic
a1e4b3f6 2414 disable symver
7483e694 2415 SHFLAGS='-shared'
07a8eef6
MR
2416 oss_indev_extralibs="-lossaudio"
2417 oss_outdev_extralibs="-lossaudio"
7483e694 2418 ;;
a1e4b3f6
MR
2419 dragonfly)
2420 enable malloc_aligned
2421 disable symver
2422 ;;
2423 freebsd)
89e053f8 2424 enable malloc_aligned
7483e694
DB
2425 ;;
2426 bsd/os)
355d81df 2427 add_extralibs -lpoll -lgnugetopt
7483e694
DB
2428 ;;
2429 darwin)
89e053f8 2430 enable malloc_aligned
301ab19d 2431 gas="gas-preprocessor.pl $cc"
e08b8239 2432 enabled ppc && add_asflags -force_cpusubtype_ALL
dff68563
SM
2433 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
2434 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
355d81df 2435 add_ldflags -Wl,-dynamic,-search_paths_first
7483e694
DB
2436 SLIBSUF=".dylib"
2437 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2438 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
4d58e4cb 2439 AVSERVERLDFLAGS=-Wl,-bind_at_load
304d586d 2440 objformat="macho"
1b0f6fb8 2441 enabled x86_64 && objformat="macho64"
8dfa86f7 2442 enabled_any pic shared ||
2704bd1a 2443 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
7483e694
DB
2444 ;;
2445 mingw32*)
9d3f4f50 2446 if test $target_os = "mingw32ce"; then
1aa71e25
MS
2447 disable network
2448 else
2449 target_os=mingw32
7b7b220c 2450 enable_weak w32threads
1aa71e25 2451 fi
dcc01c06 2452 LIBTARGET=i386
1fc9fb8a 2453 if enabled x86_64; then
89e053f8 2454 enable malloc_aligned
417516f6 2455 LIBTARGET="i386:x86-64"
336cc1b0 2456 elif enabled arm; then
15c5156d 2457 LIBTARGET=arm-wince
dcc01c06 2458 fi
fbd971a4 2459 shlibdir_default="$bindir_default"
7483e694
DB
2460 SLIBPREF=""
2461 SLIBSUF=".dll"
7483e694
DB
2462 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2463 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2f138f0b
MR
2464 SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
2465 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2466 SLIB_INSTALL_LINKS=
2467 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
2468 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
4b51fb1c 2469 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
304d586d 2470 objformat="win32"
ec10a9ab 2471 dlltool="${cross_prefix}dlltool"
bc574408 2472 enable dos_paths
1894e741 2473 check_cflags -fno-common
e26011d0
RP
2474 check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
2475 || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
f7ad5aa2 2476 die "ERROR: MinGW runtime version must be >= 3.15."
5666a9f2 2477 add_cppflags -U__STRICT_ANSI__
7483e694
DB
2478 ;;
2479 cygwin*)
4f854758 2480 target_os=cygwin
fbd971a4 2481 shlibdir_default="$bindir_default"
7483e694
DB
2482 SLIBPREF="cyg"
2483 SLIBSUF=".dll"
2484 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2485 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2486 SHFLAGS='-shared -Wl,--enable-auto-image-base'
304d586d 2487 objformat="win32"
bc574408 2488 enable dos_paths
1894e741 2489 check_cflags -fno-common
a7a187a1 2490 add_cppflags -U__STRICT_ANSI__
7483e694 2491 ;;
4f365f37 2492 *-dos|freedos|opendos)
4f365f37 2493 network_extralibs="-lsocket"
ff1c015d 2494 objformat="coff"
bc574408 2495 enable dos_paths
a7a187a1 2496 add_cppflags -U__STRICT_ANSI__
4f365f37 2497 ;;
7483e694 2498 linux)
046f081b 2499 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
7483e694
DB
2500 enable dv1394
2501 ;;
2502 irix*)
4f854758 2503 target_os=irix
7483e694
DB
2504 ranlib="echo ignoring ranlib"
2505 ;;
d22e8442 2506 os/2*)
d22e8442 2507 ln_s="cp -f"
9297f1ed 2508 objformat="aout"
e14574eb 2509 add_cppflags -D_GNU_SOURCE
355d81df 2510 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
71c61f62 2511 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
4d58e4cb 2512 AVSERVERLDFLAGS=""
287d3b13 2513 LIBSUF="_s.a"
d22e8442
DY
2514 SLIBPREF=""
2515 SLIBSUF=".dll"
2516 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2517 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
71c61f62
MR
2518 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2519 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2520 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2521 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2522 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2523 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2524 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2525 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2f138f0b 2526 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
bc574408 2527 enable dos_paths
d22e8442 2528 ;;
83993c1c 2529 gnu/kfreebsd)
c1f54478 2530 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
83993c1c 2531 ;;
34e82167 2532 gnu)
f60d1366 2533 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
34e82167 2534 ;;
d33ed7b3
MR
2535 qnx)
2536 add_cppflags -D_QNX_SOURCE
2537 network_extralibs="-lsocket"
2538 ;;
1c69c79f
MS
2539 symbian)
2540 SLIBSUF=".dll"
2541 enable dos_paths
e3bc07f4
MS
2542 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
2543 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
2544 add_ldflags -Wl,--target1-abs,--no-undefined \
2545 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
2546 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
2547 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
2548 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
2549 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
1c69c79f 2550 ;;
614d8911
MR
2551 none)
2552 ;;
7483e694 2553 *)
4f924f9a 2554 die "Unknown OS '$target_os'."
7483e694
DB
2555 ;;
2556esac
2557
29ba0911 2558echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
db7515fd 2559
13cb2187
AS
2560check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
2561
c9d19248
MR
2562set_default $PATHS_LIST
2563
320d060a 2564# we need to build at least one lib type
93b3c083 2565if ! enabled_any static shared; then
320d060a
DB
2566 cat <<EOF
2567At least one library type must be built.
2568Specify --enable-static to build the static libraries or --enable-shared to
2569build the shared libraries as well. To only build the shared libraries specify
2570--disable-static in addition to --enable-shared.
2571EOF
2572 exit 1;
2573fi
2574
2184c6f7 2575die_license_disabled() {
4c27207c 2576 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2184c6f7
DB
2577}
2578
e417d80d 2579die_license_disabled gpl libcdio
2184c6f7 2580die_license_disabled gpl libx264
de295976 2581die_license_disabled gpl libxavs
2184c6f7 2582die_license_disabled gpl libxvid
2184c6f7
DB
2583die_license_disabled gpl x11grab
2584
2f7ae63b 2585die_license_disabled nonfree libfaac
a060866f 2586die_license_disabled nonfree openssl
b2e3c528 2587
0b175caa
DB
2588die_license_disabled version3 libopencore_amrnb
2589die_license_disabled version3 libopencore_amrwb
d89e738a 2590die_license_disabled version3 libvo_aacenc
f502ff3f 2591die_license_disabled version3 libvo_amrwbenc
0b175caa 2592
9cad0e4e 2593enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
3fe142e2 2594
40617a6d 2595disabled optimizations || check_cflags -fomit-frame-pointer
cf9d24ad 2596
e276d9e8
MR
2597enable_pic() {
2598 enable pic
bce7b696
MR
2599 add_cppflags -DPIC
2600 add_cflags -fPIC
2601 add_asflags -fPIC
e276d9e8
MR
2602}
2603
2604enabled pic && enable_pic
bce7b696 2605
b4d96ba2
MR
2606check_cc <<EOF || die "Symbol mangling check failed."
2607int ff_extern;
2608EOF
8182dc34 2609sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
b4d96ba2
MR
2610extern_prefix=${sym%%ff_extern*}
2611
f65883c8
MR
2612check_cc <<EOF && enable inline_asm
2613void foo(void) { __asm__ volatile ("" ::); }
2614EOF
61d251db 2615
df5e3978
MR
2616_restrict=
2617for restrict_keyword in restrict __restrict__ __restrict; do
2618 check_cc <<EOF && _restrict=$restrict_keyword && break
2619void foo(char * $restrict_keyword p);
2620EOF
2621done
2622
2623check_cc <<EOF && enable attribute_packed
2624struct { int x; } __attribute__((packed)) x;
2625EOF
2626
dffb41b9
MR
2627check_cc <<EOF && enable attribute_may_alias
2628union { int x; } __attribute__((may_alias)) x;
2629EOF
2630
df5e3978
MR
2631check_cc <<EOF || die "endian test failed"
2632unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2633EOF
48fc536a 2634od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
df5e3978 2635
e939cedd
MR
2636if enabled alpha; then
2637
2638 check_cflags -mieee
2639
2640elif enabled arm; then
e45391bb 2641
8986fddc 2642 enabled thumb && check_cflags -mthumb || check_cflags -marm
301ab19d 2643 nogas=die
50fa82e6 2644
44caaa56
MR
2645 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
2646 enable vfp_args
2647 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
2648 case "${cross_prefix:-$cc}" in
2649 *hardfloat*) enable vfp_args; fpabi=vfp ;;
2650 *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
fa0912fe
MR
2651__asm__ (".eabi_attribute 28, 1");
2652int main(void) { return 0; }
2653EOF
44caaa56
MR
2654 esac
2655 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
2656 fi
fa0912fe 2657
fa0912fe
MR
2658 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2659 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
2660 enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2661 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
2662 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
2663 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
93eb8e4d 2664 enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
e45391bb 2665
6308729e
MR
2666 check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
2667
e276d9e8
MR
2668 enabled_all armv6t2 shared !pic && enable_pic
2669
fa0912fe 2670elif enabled mips; then
e45391bb 2671
fa0912fe
MR
2672 check_asm loongson '"dmult.g $1, $2, $3"'
2673 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
e45391bb 2674
fa0912fe 2675elif enabled ppc; then
e45391bb 2676
e6a0c354
MR
2677 enable local_aligned_8 local_aligned_16
2678
135448fa 2679 check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
2f0c136e 2680 check_asm ibm_asm '"add 0, 0, 0"'
fa0912fe 2681 check_asm ppc4xx '"maclhw r10, r11, r12"'
64de20d1 2682 check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
fa0912fe
MR
2683
2684 # AltiVec flags: The FSF version of GCC differs from the Apple version
2685 if enabled altivec; then
301ab19d 2686 nogas=warn
fa0912fe
MR
2687 check_cflags -maltivec -mabi=altivec &&
2688 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2689 check_cflags -faltivec
2690
2691 # check if our compiler supports Motorola AltiVec C API
2692 check_cc <<EOF || disable altivec
2693$inc_altivec_h
2694int main(void) {
2695 vector signed int v1, v2, v3;
2696 v1 = vec_add(v2,v3);
2697 return 0;
2698}
2699EOF
2700
2701 # check if our compiler supports braces for vector declarations
2702 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2703$inc_altivec_h
2704int main (void) { (vector int) {1}; return 0; }
2705EOF
2706 fi
e45391bb 2707
fa0912fe 2708elif enabled sparc; then
e45391bb 2709
fa0912fe
MR
2710 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2711 add_cflags -mcpu=ultrasparc -mtune=ultrasparc
e45391bb 2712
fa0912fe 2713elif enabled x86; then
e45391bb 2714
e6a0c354
MR
2715 enable local_aligned_8 local_aligned_16
2716
44965991
PI
2717 # check whether EBP is available on x86
2718 # As 'i' is stored on the stack, this program will crash
2719 # if the base pointer is used to access it because the
2720 # base pointer is cleared in the inline assembly code.
7dfef245 2721 check_exec_crash <<EOF && enable ebp_available
44965991 2722 volatile int i=0;
be449fca 2723 __asm__ volatile (
44965991
PI
2724 "xorl %%ebp, %%ebp"
2725 ::: "%ebp");
2726 return i;
44965991
PI
2727EOF
2728
f494213c 2729 # check whether EBX is available on x86
7cee5421
MR
2730 check_asm ebx_available '""::"b"(0)' &&
2731 check_asm ebx_available '"":::"%ebx"'
8e380710 2732
6f74fb03
RP
2733 # check whether xmm clobbers are supported
2734 check_asm xmm_clobbers '"":::"%xmm0"'
2735
d7f0920b 2736 # check whether binutils is new enough to compile SSSE3/MMX2
940f335a 2737 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
5fd89ca0 2738 enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
6bd859d6
MR
2739
2740 check_asm bswap '"bswap %%eax" ::: "%eax"'
304d586d 2741
9cca1e40 2742 if ! disabled_any asm mmx yasm; then
b6c06894
MR
2743 if check_cmd $yasmexe --version; then
2744 enabled x86_64 && yasm_extra="-m amd64"
2745 yasm_debug="-g dwarf2"
2746 elif check_cmd nasm -v; then
2747 yasmexe=nasm
2748 yasm_debug="-g -F dwarf"
2749 enabled x86_64 && test "$objformat" = elf && objformat=elf64
2750 fi
2751
2752 YASMFLAGS="-f $objformat $yasm_extra"
2753 enabled pic && append YASMFLAGS "-DPIC"
2754 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
2755 case "$objformat" in
2756 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
2757 esac
2758
48545a8f 2759 check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
25432e85 2760 die "yasm not found, use --disable-yasm for a crippled build"
429059f8 2761 check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
31a0dcb2 2762 fi
e45391bb 2763
669b5583
MR
2764 case "$cpu" in
2765 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2766 disable fast_clz
2767 ;;
2768 esac
2769
44965991
PI
2770fi
2771
301ab19d
MR
2772if enabled asm; then
2773 as=${gas:=$as}
2774 check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
2775 $nogas "GNU assembler not found, install gas-preprocessor"
2776fi
2777
4a7e068b
MR
2778check_ldflags -Wl,--as-needed
2779
a98bb16d
RP
2780if check_func dlopen; then
2781 ldl=
2782elif check_func dlopen -ldl; then
2783 ldl=-ldl
8bf5d58f
MN
2784fi
2785
54fe299b
DV
2786if enabled network; then
2787 check_type "sys/types.h sys/socket.h" socklen_t
2788 check_type netdb.h "struct addrinfo"
2789 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
2790 check_type netinet/in.h "struct sockaddr_in6"
2791 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2792 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2793 # Prefer arpa/inet.h over winsock2
2794 if check_header arpa/inet.h ; then
2795 check_func closesocket
2796 elif check_header winsock2.h ; then
2797 check_func_headers winsock2.h closesocket -lws2 && \
2798 network_extralibs="-lws2" || \
2799 { check_func_headers winsock2.h closesocket -lws2_32 && \
2800 network_extralibs="-lws2_32"; }
2801 check_type ws2tcpip.h socklen_t
2802 check_type ws2tcpip.h "struct addrinfo"
2803 check_type ws2tcpip.h "struct ipv6_mreq"
2804 check_type ws2tcpip.h "struct sockaddr_in6"
2805 check_type ws2tcpip.h "struct sockaddr_storage"
2806 check_struct winsock2.h "struct sockaddr" sa_len
2807 else
2808 disable network
2809 fi
2810fi
2811
75ecf149
DB
2812# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2813check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2814
534a2231 2815check_func fcntl
7483e694 2816check_func fork
84882df6 2817check_func getaddrinfo $network_extralibs
7483e694
DB
2818check_func gethrtime
2819check_func getrusage
fc5607f8 2820check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
094c09bb 2821check_func inet_aton $network_extralibs
abfc8d05 2822check_func isatty
a5b64584 2823check_func localtime_r
4ae40685 2824check_func ${malloc_prefix}memalign && enable memalign
7483e694 2825check_func mkstemp
0328b9ea 2826check_func mmap
4ae40685 2827check_func ${malloc_prefix}posix_memalign && enable posix_memalign
0104b608 2828check_func setrlimit
87958234 2829check_func strerror_r
6379900c 2830check_func strptime
47941088 2831check_func strtok_r
b507ebd1 2832check_func_headers io.h setmode
e4673692 2833check_func_headers lzo/lzo1x.h lzo1x_999_compress
fc5607f8 2834check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
2446d3d6 2835check_func_headers windows.h GetProcessTimes
73f6d31e 2836check_func_headers windows.h MapViewOfFile
7c5bfe7a 2837check_func_headers windows.h VirtualAlloc
6ffa87d3 2838
a98bb16d 2839check_header dlfcn.h
92c6a099 2840check_header dxva2api.h
a98bb16d 2841check_header malloc.h
bf6ce82d 2842check_header poll.h
b58412f1 2843check_header sys/mman.h
b091aa44 2844check_header sys/resource.h
bf6ce82d 2845check_header sys/select.h
272081b0
CEH
2846check_header vdpau/vdpau.h
2847check_header vdpau/vdpau_x11.h
68178ca9 2848check_header X11/extensions/XvMClib.h
a98bb16d 2849
9104cd51
RP
2850check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
2851
a4fa192c 2852disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
632948bd 2853disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
57bd82d4
MR
2854
2855# check for some common methods of building with pthread support
2856# do this before the optional library checks as some of them require pthreads
0dbfc1db
MR
2857if ! disabled pthreads && ! enabled w32threads; then
2858 enable pthreads
9e7fd101
MR
2859 if check_func pthread_create; then
2860 :
2861 elif check_func pthread_create -pthread; then
2862 add_cflags -pthread
afc9aee2 2863 add_extralibs -pthread
9e7fd101
MR
2864 elif check_func pthread_create -pthreads; then
2865 add_cflags -pthreads
afc9aee2 2866 add_extralibs -pthreads
8d94f606
GT
2867 elif check_func pthread_create -lpthreadGC2; then
2868 add_extralibs -lpthreadGC2
9e7fd101 2869 elif ! check_lib pthread.h pthread_create -lpthread; then
0dbfc1db 2870 disable pthreads
9e7fd101 2871 fi
57bd82d4
MR
2872fi
2873
8eee7025 2874for thread in $THREADS_LIST; do
e5f94c2b 2875 if enabled $thread; then
3ae3b721
RP
2876 test -n "$thread_type" &&
2877 die "ERROR: Only one thread type must be selected." ||
e5f94c2b 2878 thread_type="$thread"
e5f94c2b
RP
2879 fi
2880done
2881
50f7c296 2882check_lib math.h sin -lm && LIBM="-lm"
f3e3f28e 2883enabled vaapi && require vaapi va/va.h vaInitialize -lva
fdf88598 2884
645d2652
MR
2885check_mathfunc exp2
2886check_mathfunc exp2f
2887check_mathfunc llrint
07876e25 2888check_mathfunc llrintf
645d2652
MR
2889check_mathfunc log2
2890check_mathfunc log2f
2891check_mathfunc lrint
2892check_mathfunc lrintf
2893check_mathfunc round
2894check_mathfunc roundf
23d3931a 2895check_mathfunc trunc
645d2652 2896check_mathfunc truncf
f32adb22 2897
57bd82d4 2898# these are off by default, so fail if requested and not available
a1b3c5a3 2899enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
47941088 2900enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
bc8c1395 2901enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
4fa18c56
MR
2902enabled libdirac && require_pkg_config dirac \
2903 "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
2904 "dirac_decoder_init dirac_encoder_init"
79fda097 2905enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
a5b64584 2906enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
5af41508 2907enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
9b9d3868 2908enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
7483e694 2909enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
eb7626a3
MR
2910enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
2911enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
4fa18c56 2912enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
3d6fac8c 2913enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
0de9c41f 2914enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
4fa18c56
MR
2915enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
2916enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
ae14f311 2917enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
c261a5d9 2918enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
d89e738a 2919enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
f502ff3f 2920enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
7483e694 2921enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
7d07d6f5
DB
2922enabled libvpx && {
2923 enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
2924 die "ERROR: libvpx decoder version must be >=0.9.1"; }
2925 enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
2926 die "ERROR: libvpx encoder version must be >=0.9.1"; } }
eb7626a3 2927enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
46c3c53b
AK
2928 { check_cpp_condition x264.h "X264_BUILD >= 118" ||
2929 die "ERROR: libx264 version must be >= 0.118."; }
de295976 2930enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
2bfecf73 2931enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
7483e694 2932enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
a060866f
MS
2933enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
2934 check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
2935 check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
2936 die "ERROR: openssl not found"; }
8ac17293 2937
0b4a1821
AS
2938# libdc1394 check
2939if enabled libdc1394; then
2940 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2941 enable libdc1394_2; } ||
2942 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2943 enable libdc1394_1; } ||
2944 die "ERROR: No version of libdc1394 found "
2945fi
2946
8f1b06c8 2947if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
aa692d54
MR
2948 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
2949 enable sdl &&
2950 check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
c3f6b472 2951fi
57bd82d4 2952
2270b4b2 2953texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
146ea952 2954
c6f95144 2955check_header linux/fb.h
06e31011
RP
2956check_header linux/videodev.h
2957check_header linux/videodev2.h
1b6e8b73 2958check_header sys/videoio.h
47f38850 2959
27796dc3 2960check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
ec1ee802
RP
2961# check that WM_CAP_DRIVER_CONNECT is defined to the proper value
2962# w32api 3.12 had it defined wrong
2963check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
c2345207 2964
f8aa696f 2965# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1c915f83
RP
2966{ check_header dev/bktr/ioctl_meteor.h &&
2967 check_header dev/bktr/ioctl_bt848.h; } ||
2968{ check_header machine/ioctl_meteor.h &&
2969 check_header machine/ioctl_bt848.h; } ||
2970{ check_header dev/video/meteor/ioctl_meteor.h &&
2971 check_header dev/video/bktr/ioctl_bt848.h; } ||
2972check_header dev/ic/bt8xx.h
f8aa696f 2973
15d59d2c 2974check_header sndio.h
c7682de0
RP
2975check_header sys/soundcard.h
2976check_header soundcard.h
deb29777 2977
b6f3d925 2978enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
35fd8122 2979
0e57fe17 2980enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
80ff8a16 2981
15d59d2c
B
2982enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
2983
e417d80d
AK
2984enabled libcdio &&
2985 check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
2986
56a059ac 2987enabled x11grab &&
f58f4ce1
GP
2988check_header X11/Xlib.h &&
2989check_header X11/extensions/XShm.h &&
0a045661 2990check_header X11/extensions/Xfixes.h &&
f58f4ce1 2991check_func XOpenDisplay -lX11 &&
781c1aa6
R
2992check_func XShmCreateImage -lX11 -lXext &&
2993check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
f58f4ce1 2994
ac3dbb4d
SZ
2995# check for VDA header
2996if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
2997 enable vda && add_ldflags -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
2998fi
2999
598ef02b 3000if ! disabled vdpau && enabled vdpau_vdpau_h; then
deda2a4a
AC
3001check_cpp_condition \
3002 vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
d1ebd4a9
AC
3003 { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
3004 disable vdpau; }
abf649c7 3005fi
deda2a4a 3006
95e561ec 3007enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
57bd82d4
MR
3008
3009# add some useful compiler flags if supported
3010check_cflags -Wdeclaration-after-statement
dcd479c0 3011check_cflags -Wall
440e3b2f 3012check_cflags -Wno-parentheses
dcd479c0 3013check_cflags -Wno-switch
b36518dc 3014check_cflags -Wno-format-zero-length
c07bd6a9
MN
3015check_cflags -Wdisabled-optimization
3016check_cflags -Wpointer-arith
3017check_cflags -Wredundant-decls
cc1fb623 3018check_cflags -Wno-pointer-sign
f4929996 3019check_cflags -Wcast-qual
9aceb3cf 3020check_cflags -Wwrite-strings
652a5bf6 3021check_cflags -Wtype-limits
764551c6 3022check_cflags -Wundef
fc298fd9 3023check_cflags -Wmissing-prototypes
c2ed91de 3024check_cflags -Wstrict-prototypes
5af4e0cc 3025enabled extra_warnings && check_cflags -Winline
cf9d24ad 3026
57bd82d4 3027# add some linker flags
5c0e9479 3028check_ldflags -Wl,--warn-common
965dbe09 3029check_ldflags -Wl,-rpath-link=libpostproc:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
fef2d661 3030test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
94a3401e 3031
a482e61b 3032echo "X{};" > $TMPV
b462d132 3033if test_ldflags -Wl,--version-script,$TMPV; then
a482e61b 3034 append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
b462d132
MR
3035 check_cc <<EOF && enable symver_asm_label
3036void ff_foo(void) __asm__ ("av_foo@VERSION");
0884fadf 3037void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
b462d132
MR
3038EOF
3039 check_cc <<EOF && enable symver_gnu_asm
3040__asm__(".symver ff_foo,av_foo@VERSION");
3041void ff_foo(void) {}
3042EOF
3043fi
a482e61b 3044
9cd7b854
MR
3045if [ -n "$optflags" ]; then
3046 add_cflags $optflags
3047elif enabled small; then
14ca9cd0 3048 add_cflags $size_cflags
8400d6b8 3049elif enabled optimizations; then
14ca9cd0 3050 add_cflags $speed_cflags
b05394a0
MR
3051else
3052 add_cflags $noopt_cflags
cddf3f45 3053fi
11fdbc44 3054check_cflags -fno-math-errno
b2eb2ff0 3055check_cflags -fno-signed-zeros
cddf3f45 3056
629687f6 3057if enabled icc; then
b1598b58
MR
3058 # Just warnings, no remarks
3059 check_cflags -w1
3060 # -wd: Disable following warnings
3061 # 144, 167, 556: -Wno-pointer-sign
91bcad19 3062 # 1292: attribute "foo" ignored
b1598b58 3063 # 10006: ignoring unknown option -fno-signed-zeros
f1c7c6ae 3064 # 10148: ignoring unknown option -Wno-parentheses
b1598b58 3065 # 10156: ignoring option '-W'; no argument required
91bcad19 3066 check_cflags -wd144,167,556,1292,10006,10148,10156
b1598b58
MR
3067 # 11030: Warning unknown option --as-needed
3068 # 10156: ignoring option '-export'; no argument required
3069 check_ldflags -wd10156,11030
3070 # Allow to compile with optimizations
3071 check_ldflags -march=$cpu
be2cf98a
CEH
3072 # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
3073 enable ebp_available
bdefad73
MR
3074 if enabled x86_32; then
3075 test ${icc_version%%.*} -ge 11 && \
3076 check_cflags -falign-stack=maintain-16-byte || \
3077 disable aligned_stack
3078 fi
df442a8d
MR
3079elif enabled ccc; then
3080 # disable some annoying warnings
3081 add_cflags -msg_disable cvtu32to64
3082 add_cflags -msg_disable embedcomment
3083 add_cflags -msg_disable needconstext
3084 add_cflags -msg_disable nomainieee
3085 add_cflags -msg_disable ptrmismatch1
3086 add_cflags -msg_disable unreachcode
973859f5
MR
3087elif enabled gcc; then
3088 check_cflags -fno-tree-vectorize
765e6134 3089 check_cflags -Werror=implicit-function-declaration
de63bfec 3090 check_cflags -Werror=missing-prototypes
613a4e3f
MR
3091elif enabled llvm_gcc; then
3092 check_cflags -mllvm -stack-alignment=16
06da6943 3093elif enabled clang; then
5c8ef670 3094 check_cflags -mllvm -stack-alignment=16
06da6943 3095 check_cflags -Qunused-arguments
138132be
MR
3096elif enabled armcc; then
3097 # 2523: use of inline assembler is deprecated
bcafde61
MR
3098 add_cflags -W${armcc_opt},--diag_suppress=2523
3099 add_cflags -W${armcc_opt},--diag_suppress=1207
5a92140b 3100 add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
b0c1b66a 3101 add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
d0ce090e
MR
3102 add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
3103 add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
587d24ff
MR
3104elif enabled tms470; then
3105 add_cflags -pds=824 -pds=837
5f3b8314
MR
3106elif enabled pathscale; then
3107 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
504a64b9
CEH
3108fi
3109
7483e694
DB
3110enabled_any $THREADS_LIST && enable threads
3111
3112check_deps $CONFIG_LIST \
b6bb00b0 3113 $CONFIG_EXTRA \
7483e694
DB
3114 $HAVE_LIST \
3115 $DECODER_LIST \
3116 $ENCODER_LIST \
5666fd73 3117 $HWACCEL_LIST \
7483e694
DB
3118 $PARSER_LIST \
3119 $BSF_LIST \
3120 $DEMUXER_LIST \
3121 $MUXER_LIST \
f7679c54 3122 $FILTER_LIST \
7483e694
DB
3123 $INDEV_LIST \
3124 $OUTDEV_LIST \
3125 $PROTOCOL_LIST \
57442411
MR
3126 $ACODEC_TESTS \
3127 $VCODEC_TESTS \
3128 $LAVF_TESTS \
48c28162 3129 $LAVFI_TESTS \
b9d5f1b7 3130 $SEEK_TESTS \
f70f03f6 3131
3bfd582c 3132enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
c8a4ae00 3133
9bbd6a4c
MR
3134! enabled_any memalign posix_memalign malloc_aligned &&
3135 enabled_any $need_memalign && enable memalign_hack
3136
3e89171a 3137echo "install prefix $prefix"
f36958f8
DB
3138echo "source path $source_path"
3139echo "C compiler $cc"
f36958f8 3140echo "ARCH $arch ($cpu)"
ce8871c2
MR
3141if test "$build_suffix" != ""; then
3142 echo "build suffix $build_suffix"
eb94aca9 3143fi
ac63af34
DB
3144if test "$extra_version" != ""; then
3145 echo "version string suffix $extra_version"
3146fi
0db2ce77 3147echo "big-endian ${bigendian-no}"
e90f5b5a 3148echo "runtime cpu detection ${runtime_cpudetect-no}"
5b6c2cbd 3149if enabled x86; then
6348a96c 3150 echo "${yasmexe} ${yasm-no}"
0db2ce77 3151 echo "MMX enabled ${mmx-no}"
30e98e62 3152 echo "MMX2 enabled ${mmx2-no}"
3bf96eec 3153 echo "3DNow! enabled ${amd3dnow-no}"
a1ef9f08 3154 echo "3DNow! extended enabled ${amd3dnowext-no}"
1bb04d5a 3155 echo "SSE enabled ${sse-no}"
30e98e62 3156 echo "SSSE3 enabled ${ssse3-no}"
c73b779d 3157 echo "AVX enabled ${avx-no}"
0db2ce77
MR
3158 echo "CMOV enabled ${cmov-no}"
3159 echo "CMOV is fast ${fast_cmov-no}"
971cc990
MN
3160 echo "EBX available ${ebx_available-no}"
3161 echo "EBP available ${ebp_available-no}"
e41e8342 3162fi
5b6c2cbd 3163if enabled arm; then
0db2ce77
MR
3164 echo "ARMv5TE enabled ${armv5te-no}"
3165 echo "ARMv6 enabled ${armv6-no}"
ab5cb084 3166 echo "ARMv6T2 enabled ${armv6t2-no}"
f55b299a 3167 echo "ARM VFP enabled ${armvfp-no}"
0db2ce77 3168 echo "IWMMXT enabled ${iwmmxt-no}"
6b18d278 3169 echo "NEON enabled ${neon-no}"
eba9ae3c 3170fi
5b6c2cbd 3171if enabled mips; then
0db2ce77 3172 echo "MMI enabled ${mmi-no}"
e41e8342 3173fi
5b6c2cbd 3174if enabled ppc; then
0db2ce77 3175 echo "AltiVec enabled ${altivec-no}"
30e98e62 3176 echo "PPC 4xx optimizations ${ppc4xx-no}"
0db2ce77 3177 echo "dcbzl available ${dcbzl-no}"
30e98e62
DB
3178fi
3179if enabled sparc; then
3180 echo "VIS enabled ${vis-no}"
e41e8342 3181fi
0db2ce77 3182echo "debug symbols ${debug-no}"
f082a0fb 3183echo "optimize for size ${small-no}"
8400d6b8 3184echo "optimizations ${optimizations-no}"
0db2ce77
MR
3185echo "static ${static-no}"
3186echo "shared ${shared-no}"
4a24ab64 3187echo "postprocessing support ${postproc-no}"
f7679c54 3188echo "new filter support ${avfilter-no}"
0db2ce77 3189echo "network support ${network-no}"
0db2ce77
MR
3190echo "threading support ${thread_type-no}"
3191echo "SDL support ${sdl-no}"
0db2ce77 3192echo "Sun medialib support ${mlib-no}"
c562ba4c
DB
3193echo "libdxva2 enabled ${dxva2-no}"
3194echo "libva enabled ${vaapi-no}"
3195echo "libvdpau enabled ${vdpau-no}"
0db2ce77 3196echo "AVISynth enabled ${avisynth-no}"
47941088 3197echo "frei0r enabled ${frei0r-no}"
bc8c1395 3198echo "gnutls enabled ${gnutls-no}"
e417d80d 3199echo "libcdio support ${libcdio-no}"
f7b8bffe 3200echo "libdc1394 support ${libdc1394-no}"
690bfceb 3201echo "libdirac enabled ${libdirac-no}"
0db2ce77 3202echo "libfaac enabled ${libfaac-no}"
0db2ce77
MR
3203echo "libgsm enabled ${libgsm-no}"
3204echo "libmp3lame enabled ${libmp3lame-no}"
3205echo "libnut enabled ${libnut-no}"
0b175caa
DB
3206echo "libopencore-amrnb support ${libopencore_amrnb-no}"
3207echo "libopencore-amrwb support ${libopencore_amrwb-no}"
6ebf0bfc 3208echo "libopencv support ${libopencv-no}"
9a77d59a 3209echo "libopenjpeg enabled ${libopenjpeg-no}"
0de9c41f 3210echo "libpulse enabled ${libpulse-no}"
0f943ce6 3211echo "librtmp enabled ${librtmp-no}"
f7cd9eed 3212echo "libschroedinger enabled ${libschroedinger-no}"
ae14f311 3213echo "libspeex enabled ${libspeex-no}"
0db2ce77 3214echo "libtheora enabled ${libtheora-no}"
d89e738a 3215echo "libvo-aacenc support ${libvo_aacenc-no}"
f502ff3f 3216echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"