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