rawdec: refactor private option for raw video demuxers
[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"
45ecda85 1357vc1image_decoder_select="vc1_decoder"
26fbcc85
MR
1358vorbis_decoder_select="mdct"
1359vorbis_encoder_select="mdct"
3447f12d 1360vp6_decoder_select="huffman"
e82dc4c9
DB
1361vp6a_decoder_select="vp6_decoder"
1362vp6f_decoder_select="vp6_decoder"
4a384de5 1363vp8_decoder_select="h264pred"
4538729a
MR
1364wmapro_decoder_select="mdct sinewin"
1365wmav1_decoder_select="mdct sinewin"
1366wmav1_encoder_select="mdct sinewin"
1367wmav2_decoder_select="mdct sinewin"
1368wmav2_encoder_select="mdct sinewin"
1369wmavoice_decoder_select="lsp rdft dct mdct sinewin"
f95bfab0 1370wmv1_decoder_select="h263_decoder"
665507aa 1371wmv1_encoder_select="h263_encoder"
f95bfab0 1372wmv2_decoder_select="h263_decoder"
1746e2a9 1373wmv2_encoder_select="h263_encoder"
015f8ee0 1374wmv3_decoder_select="vc1_decoder"
f0f86627 1375wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
015f8ee0
DB
1376wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1377wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
45ecda85 1378wmv3image_decoder_select="wmv3_decoder"
2eef7c62
AJ
1379zlib_decoder_select="zlib"
1380zlib_encoder_select="zlib"
1381zmbv_decoder_select="zlib"
1382zmbv_encoder_select="zlib"
30fd06be 1383
0afab17e 1384vaapi_deps="va_va_h"
c89c96e9
MR
1385vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1386
28b80940 1387# parsers
4a384de5 1388h264_parser_select="golomb h264dsp h264pred"
28b80940 1389
912f3148 1390# external libraries
1b71f045 1391libdirac_decoder_deps="libdirac !libschroedinger"
690bfceb 1392libdirac_encoder_deps="libdirac"
c9171a83 1393libfaac_encoder_deps="libfaac"
299c77d5
MR
1394libgsm_decoder_deps="libgsm"
1395libgsm_encoder_deps="libgsm"
8ffed8d8
MR
1396libgsm_ms_decoder_deps="libgsm"
1397libgsm_ms_encoder_deps="libgsm"
1cc60c47 1398libmp3lame_encoder_deps="libmp3lame"
0b175caa
DB
1399libopencore_amrnb_decoder_deps="libopencore_amrnb"
1400libopencore_amrnb_encoder_deps="libopencore_amrnb"
1401libopencore_amrwb_decoder_deps="libopencore_amrwb"
9a77d59a 1402libopenjpeg_decoder_deps="libopenjpeg"
f7cd9eed
AS
1403libschroedinger_decoder_deps="libschroedinger"
1404libschroedinger_encoder_deps="libschroedinger"
ae14f311 1405libspeex_decoder_deps="libspeex"
150d2772 1406libtheora_encoder_deps="libtheora"
d89e738a 1407libvo_aacenc_encoder_deps="libvo_aacenc"
f502ff3f 1408libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
b0caf888 1409libvorbis_encoder_deps="libvorbis"
8299a7f8 1410libvpx_decoder_deps="libvpx"
ee0e9146 1411libvpx_encoder_deps="libvpx"
1cc60c47 1412libx264_encoder_deps="libx264"
de295976 1413libxavs_encoder_deps="libxavs"
1cc60c47 1414libxvid_encoder_deps="libxvid"
30fd06be 1415
912f3148 1416# demuxers / muxers
c2dd0e9e 1417ac3_demuxer_select="ac3_parser"
647c2356 1418asf_stream_muxer_select="asf_muxer"
4e622dea 1419avisynth_demuxer_deps="avisynth"
c2dd0e9e 1420dirac_demuxer_select="dirac_parser"
5b423887 1421eac3_demuxer_select="ac3_parser"
c2dd0e9e 1422flac_demuxer_select="flac_parser"
647c2356 1423ipod_muxer_select="mov_muxer"
4e622dea
SS
1424libnut_demuxer_deps="libnut"
1425libnut_muxer_deps="libnut"
647c2356 1426matroska_audio_muxer_select="matroska_muxer"
4e622dea
SS
1427matroska_demuxer_suggest="zlib bzlib"
1428mov_demuxer_suggest="zlib"
c2dd0e9e 1429mp3_demuxer_select="mpegaudio_parser"
647c2356
DB
1430mp4_muxer_select="mov_muxer"
1431mpegtsraw_demuxer_select="mpegts_demuxer"
1432mxf_d10_muxer_select="mxf_muxer"
24ca518b 1433ogg_demuxer_select="golomb"
647c2356 1434psp_muxer_select="mov_muxer"
44594cc7 1435rtp_demuxer_select="sdp_demuxer"
44b70ce5
MS
1436rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
1437rtsp_demuxer_select="http_protocol rtpdec"
1438rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
01c8d258 1439sap_demuxer_select="sdp_demuxer"
2aab70c4 1440sap_muxer_select="rtp_muxer rtp_protocol"
44b70ce5 1441sdp_demuxer_select="rtpdec"
f1e94694 1442spdif_muxer_select="aac_parser"
647c2356
DB
1443tg2_muxer_select="mov_muxer"
1444tgp_muxer_select="mov_muxer"
6bdaa5f4 1445w64_demuxer_deps="wav_demuxer"
4e622dea
SS
1446
1447# indevs / outdevs
38e54a75 1448alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
38e54a75 1449alsa_outdev_deps="alsa_asoundlib_h"
38e54a75 1450bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
38e54a75 1451dv1394_indev_deps="dv1394 dv_demuxer"
c6f95144 1452fbdev_indev_deps="linux_fb_h"
38e54a75 1453jack_indev_deps="jack_jack_h"
38e54a75 1454libdc1394_indev_deps="libdc1394"
38e54a75
SS
1455oss_indev_deps_any="soundcard_h sys_soundcard_h"
1456oss_outdev_deps_any="soundcard_h sys_soundcard_h"
15d59d2c
B
1457sndio_indev_deps="sndio_h"
1458sndio_outdev_deps="sndio_h"
38e54a75
SS
1459v4l_indev_deps="linux_videodev_h"
1460v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
ec1ee802 1461vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
a1b3c5a3 1462vfwcap_indev_extralibs="-lavicap32"
38e54a75 1463x11_grab_device_indev_deps="x11grab XShmCreateImage"
781c1aa6 1464x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
30fd06be 1465
912f3148 1466# protocols
3fff6382 1467gopher_protocol_deps="network"
c08fb000 1468http_protocol_deps="network"
279a0c97 1469http_protocol_select="tcp_protocol"
c60a2d70 1470mmsh_protocol_select="http_protocol"
b4cf3f6c 1471mmst_protocol_deps="network"
deeb7012
MS
1472rtmp_protocol_select="tcp_protocol"
1473rtp_protocol_select="udp_protocol"
c08fb000
AB
1474tcp_protocol_deps="network"
1475udp_protocol_deps="network"
1476
6ebf0bfc 1477# filters
13fabd7a 1478blackframe_filter_deps="gpl"
68b79bfc 1479cropdetect_filter_deps="gpl"
a5b64584 1480drawtext_filter_deps="libfreetype"
2e5ff4d0 1481frei0r_filter_deps="frei0r dlopen strtok_r"
a42bb9d6 1482frei0r_src_filter_deps="frei0r dlopen strtok_r"
a4dc7aa5 1483hqdn3d_filter_deps="gpl"
cf69ad35 1484ocv_filter_deps="libopencv"
92fe2587 1485scale_filter_deps="swscale"
acbac567 1486yadif_filter_deps="gpl"
6ebf0bfc 1487
5a0f7131
MR
1488# libraries
1489avdevice_deps="avcodec avformat"
1490avformat_deps="avcodec"
ced9556b 1491postproc_deps="gpl"
f7679c54 1492
912f3148 1493# programs
5a0f7131 1494ffmpeg_deps="avcodec avformat swscale"
21ae6790 1495ffmpeg_select="buffer_filter"
d2ba1fb5
DB
1496avconv_deps="avcodec avformat swscale"
1497avconv_select="buffer_filter"
266463da
AK
1498avplay_deps="avcodec avformat swscale sdl"
1499avplay_select="rdft"
9e12f0bf 1500avprobe_deps="avcodec avformat"
4d58e4cb
AK
1501avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
1502avserver_extralibs='$ldl'
a2830dca 1503
c73f65d9 1504doc_deps="texi2html"
912f3148 1505
57442411
MR
1506# tests
1507
1508test_deps(){
1509 suf1=$1
1510 suf2=$2
1511 shift 2
1512 for v; do
1513 dep=${v%=*}
1514 tests=${v#*=}
1515 for name in ${tests}; do
1516 eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'"
1517 done
1518 done
1519}
1520
1521test_deps _encoder _decoder \
57442411
MR
1522 adpcm_g726=g726 \
1523 adpcm_ima_qt \
1524 adpcm_ima_wav \
1525 adpcm_ms \
1526 adpcm_swf \
1527 adpcm_yamaha=adpcm_yam \
1528 alac \
1529 asv1 \
1530 asv2 \
1531 bmp \
a7638957 1532 dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
57442411
MR
1533 dvvideo="dv dv50" \
1534 ffv1 \
1535 flac \
1536 flashsv \
1537 flv \
1538 gif \
1539 h261 \
1540 h263="h263 h263p" \
1541 huffyuv \
1542 jpegls \
1543 mjpeg="jpg mjpeg ljpeg" \
1544 mp2 \
1545 mpeg1video="mpeg mpeg1b" \
1546 mpeg2video="mpeg2 mpeg2thread" \
1547 mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
c0b16605 1548 msmpeg4v3=msmpeg4 \
57442411
MR
1549 msmpeg4v2 \
1550 pbm=pbmpipe \
1551 pcx \
1552 pgm="pgm pgmpipe" \
f0f54c29 1553 png \
57442411
MR
1554 ppm="ppm ppmpipe" \
1555 rawvideo="rgb yuv" \
1556 roq \
1557 rv10 \
1558 rv20 \
1559 sgi \
1560 snow="snow snowll" \
1561 svq1 \
1562 targa=tga \
1563 tiff \
1564 wmav1 \
1565 wmav2 \
1566 wmv1 \
1567 wmv2 \
1568
1569test_deps _muxer _demuxer \
1570 aiff \
1571 pcm_alaw=alaw \
1572 asf \
1573 au \
1574 avi \
1575 dv=dv_fmt \
1576 ffm \
1577 flv=flv_fmt \
1578 gxf \
1579 matroska=mkv \
1580 mmf \
1581 mov \
1582 pcm_mulaw=mulaw \
0218808d 1583 mxf="mxf mxf_d10" \
57442411
MR
1584 nut \
1585 ogg \
1586 rawvideo=pixfmt \
1587 rm \
1588 swf \
1589 mpegts=ts \
1590 voc \
1591 wav \
1592 yuv4mpegpipe=yuv4mpeg \
1593
6fd96d1a 1594ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
57442411 1595mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
9c261f83 1596
de6d9b64 1597# default parameters
8a608357 1598
19bd477d 1599logfile="config.log"
8a608357
MR
1600
1601# installation paths
c9d19248
MR
1602prefix_default="/usr/local"
1603bindir_default='${prefix}/bin'
6291d7e4 1604datadir_default='${prefix}/share/avconv'
c9d19248
MR
1605incdir_default='${prefix}/include'
1606libdir_default='${prefix}/lib'
1607mandir_default='${prefix}/share/man'
1608shlibdir_default="$libdir_default"
8a608357
MR
1609
1610# toolchain
121d78d0 1611ar_default="ar"
13c7df3d 1612cc_default="gcc"
a3d7c197 1613cc_version=\"unknown\"
9da6609f 1614host_cc_default="gcc"
11e6d03a 1615ln_s="ln -sf"
89641463 1616nm_default="nm"
11e6d03a 1617objformat="elf"
3f8040db 1618pkg_config_default=pkg-config
be7109c1 1619ranlib="ranlib"
11e6d03a 1620yasmexe="yasm"
301ab19d 1621nogas=":"
8a608357 1622
8182dc34
MR
1623nm_opts='-g'
1624
8a608357 1625# machine
8d4c00ed 1626arch_default=$(uname -m)
38d0a8aa 1627cpu="generic"
8a608357 1628
8a608357 1629# OS
8d4c00ed
MR
1630target_os_default=$(tolower $(uname -s))
1631host_os=$target_os_default
8a608357 1632
8a608357 1633# configurable options
5a0f7131
MR
1634enable avcodec
1635enable avdevice
cccc039f 1636enable avfilter
5a0f7131 1637enable avformat
dc4f5a1c 1638enable avutil
c8a4ae00 1639enable asm
497237c7 1640enable debug
c73f65d9 1641enable doc
aa033b1e 1642enable fastdiv
497237c7 1643enable ffmpeg
6291d7e4 1644enable avconv
266463da 1645enable avplay
9e12f0bf 1646enable avprobe
4d58e4cb 1647enable avserver
497237c7 1648enable network
8400d6b8 1649enable optimizations
ced9556b 1650enable postproc
497237c7 1651enable protocols
530dc538 1652enable static
5a0f7131 1653enable swscale
a9ddb5b1 1654enable swscale_alpha
8a608357 1655
8a608357 1656# build settings
9987769a 1657SHFLAGS='-shared -Wl,-soname,$$(@F)'
4d58e4cb 1658AVSERVERLDFLAGS=-Wl,-E
f3ec2d46
SG
1659LIBPREF="lib"
1660LIBSUF=".a"
c5f14466
RP
1661FULLNAME='$(NAME)$(BUILDSUF)'
1662LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
f3ec2d46
SG
1663SLIBPREF="lib"
1664SLIBSUF=".so"
c5f14466 1665SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
b29bddab
DB
1666SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1667SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
6cfac0e9 1668LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2f138f0b
MR
1669SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
1670SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
ef0bc4c9 1671
bc877faf 1672AS_O='-o $@'
7e6c86e6
MR
1673CC_O='-o $@'
1674
0a6db2a2 1675host_cflags='-D_ISOC99_SOURCE -O3 -g'
9da6609f
MR
1676host_libs='-lm'
1677
9b861379 1678target_path='$(CURDIR)'
a7ada2ba 1679
a158446b
MR
1680# since the object filename is not given with the -MM flag, the compiler
1681# is only able to print the basename, and we must add the path ourselves
c1c3933a 1682DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
d8059267 1683DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
315c741d 1684
c597172e 1685# find source path
24524f36 1686if test -f configure; then
f038cf3c 1687 source_path=.
c597172e 1688else
8477f2de 1689 source_path=$(cd $(dirname "$0"); pwd)
c597172e 1690 echo "$source_path" | grep -q '[[:blank:]]' &&
7483e694 1691 die "Out of tree builds are impossible with whitespace in source path."
337cee68
MC
1692 test -e "$source_path/config.h" &&
1693 die "Out of tree builds are impossible with config.h in source dir."
c597172e
MR
1694fi
1695
13cbe2c0 1696for v in "$@"; do
b04251c5
MR
1697 r=${v#*=}
1698 l=${v%"$r"}
1699 r=$(sh_quote "$r")
29ba0911 1700 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
13cbe2c0 1701done
c597172e 1702
73ef8980
MR
1703find_things(){
1704 thing=$1
1705 pattern=$2
1706 file=$source_path/$3
932ccf39 1707 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
73ef8980
MR
1708}
1709
1710ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1711DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
5666fd73 1712HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
73ef8980
MR
1713PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1714BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1715MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1716DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
38e54a75
SS
1717OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
1718INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
73ef8980 1719PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
81124ba0 1720FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
c597172e 1721
57442411 1722find_tests(){
b9d5f1b7 1723 map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
57442411
MR
1724}
1725
1726ACODEC_TESTS=$(find_tests acodec)
1727VCODEC_TESTS=$(find_tests vsynth1)
1728LAVF_TESTS=$(find_tests lavf)
48c28162 1729LAVFI_TESTS=$(find_tests lavfi)
b9d5f1b7 1730SEEK_TESTS=$(find_tests seek seek_)
57442411 1731
40fe5019
MR
1732pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
1733
8469ae22
MR
1734for n in $COMPONENT_LIST; do
1735 v=$(toupper ${n%s})_LIST
1736 eval enable \$$v
1737 eval ${n}_if_any="\$$v"
1738done
1739
b9d5f1b7 1740enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
c597172e
MR
1741
1742die_unknown(){
1743 echo "Unknown option \"$1\"."
1744 echo "See $0 --help for available options."
1745 exit 1
1746}
1747
794f8e97 1748show_list() {
bf0c4afa
RP
1749 suffix=_$1
1750 shift
2b444ea7 1751 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
794f8e97
PI
1752 exit 0
1753}
1754
c597172e 1755for opt do
7483e694
DB
1756 optval="${opt#*=}"
1757 case "$opt" in
0f010b2f 1758 --extra-ldflags=*) add_ldflags $optval
7483e694 1759 ;;
0f010b2f 1760 --extra-libs=*) add_extralibs $optval
7483e694 1761 ;;
8fb1cb58 1762 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
9aa8ed9d 1763 ;;
40bcf4c7
BL
1764 --enable-debug=*) debuglevel="$optval"
1765 ;;
36e2dea0 1766 --disable-everything)
1b15dc3c 1767 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
36e2dea0 1768 ;;
7483e694 1769 --enable-*=*|--disable-*=*)
8b93ddc3 1770 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
be8f2501
MR
1771 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1772 eval list=\$$(toupper $thing)_LIST
8b93ddc3
MR
1773 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1774 $action $(filter "$name" $list)
7483e694
DB
1775 ;;
1776 --enable-?*|--disable-?*)
5e622c40 1777 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
e3773a55 1778 if is_in $option $COMPONENT_LIST; then
fed5d54b 1779 test $action = disable && action=unset
e3773a55
MR
1780 eval $action \$$(toupper ${option%s})_LIST
1781 elif is_in $option $CMDLINE_SELECT; then
1782 $action $option
1783 else
1784 die_unknown $opt
1785 fi
7483e694
DB
1786 ;;
1787 --list-*)
1788 NAME="${opt#--list-}"
1789 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1790 NAME=${NAME%s}
1791 eval show_list $NAME \$$(toupper $NAME)_LIST
1792 ;;
1793 --help|-h) show_help
1794 ;;
1795 *)
884a36a7 1796 optname="${opt%%=*}"
26759c44
MR
1797 optname="${optname#--}"
1798 optname=$(echo "$optname" | sed 's/-/_/g')
89f2932b
MR
1799 if is_in $optname $CMDLINE_SET; then
1800 eval $optname='$optval'
1801 elif is_in $optname $CMDLINE_APPEND; then
1802 append $optname "$optval"
1803 else
1804 die_unknown $opt
1805 fi
7483e694
DB
1806 ;;
1807 esac
c597172e
MR
1808done
1809
bcea99bb
MR
1810disabled logging && logfile=/dev/null
1811
29ba0911 1812echo "# $0 $LIBAV_CONFIGURATION" > $logfile
bcea99bb
MR
1813set >> $logfile
1814
9da6609f
MR
1815test -n "$cross_prefix" && enable cross_compile
1816
8d4c00ed
MR
1817if enabled cross_compile; then
1818 test -n "$arch" && test -n "$target_os" ||
1819 die "Must specify target arch and OS when cross-compiling"
1820fi
1821
1822set_default arch target_os
1823
121d78d0 1824ar_default="${cross_prefix}${ar_default}"
11e6d03a 1825cc_default="${cross_prefix}${cc_default}"
20e0ed95 1826nm_default="${cross_prefix}${nm_default}"
3f8040db 1827pkg_config_default="${cross_prefix}${pkg_config_default}"
adb2b908 1828ranlib="${cross_prefix}${ranlib}"
adb2b908 1829
c5200f17
MR
1830sysinclude_default="${sysroot}/usr/include"
1831
e0be794a 1832set_default cc nm pkg_config sysinclude
9da6609f
MR
1833enabled cross_compile || host_cc_default=$cc
1834set_default host_cc
13c7df3d 1835
762f95e4
MR
1836if ! $pkg_config --version >/dev/null 2>&1; then
1837 warn "$pkg_config not found, library detection may fail."
1838 pkg_config=false
1839fi
1840
82bb3329
MR
1841exesuf() {
1842 case $1 in
1c69c79f 1843 mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
82bb3329
MR
1844 esac
1845}
1846
1847EXESUF=$(exesuf $target_os)
1848HOSTEXESUF=$(exesuf $host_os)
c0f5b7f1 1849
e4e69e0b 1850# set temporary file name
a49d42c2 1851: ${TMPDIR:=$TEMPDIR}
c51fafa1 1852: ${TMPDIR:=$TMP}
a49d42c2 1853: ${TMPDIR:=/tmp}
e4e69e0b 1854
a210bce2 1855if ! check_cmd mktemp -u XXXXXX; then
54460a83
MR
1856 # simple replacement for missing mktemp
1857 # NOT SAFE FOR GENERAL USE
1858 mktemp(){
09a5c245 1859 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
54460a83
MR
1860 }
1861fi
1862
1863tmpfile(){
1864 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1865 (set -C; exec > $tmp) 2>/dev/null ||
f7ba16a7 1866 die "Unable to create temporary file in $TMPDIR."
54460a83
MR
1867 append TMPFILES $tmp
1868 eval $1=$tmp
1869}
1870
1871trap 'rm -f -- $TMPFILES' EXIT
54460a83
MR
1872
1873tmpfile TMPC .c
1874tmpfile TMPE $EXESUF
1875tmpfile TMPH .h
1876tmpfile TMPO .o
1877tmpfile TMPS .S
a482e61b 1878tmpfile TMPV .ver
54460a83 1879tmpfile TMPSH .sh
55127e7b 1880tmpfile TMPASM .asm
54460a83
MR
1881
1882unset -f mktemp
e4e69e0b 1883
fb3c4ffc
MR
1884chmod +x $TMPE
1885
993f2d0f
MR
1886# make sure we can execute files in $TMPDIR
1887cat > $TMPSH 2>> $logfile <<EOF
1888#! /bin/sh
1889EOF
1890chmod +x $TMPSH >> $logfile 2>&1
1891if ! $TMPSH >> $logfile 2>&1; then
1892 cat <<EOF
1893Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
1894variable to another directory and make sure that it is not mounted noexec.
1895EOF
1896 die "Sanity test failed."
1897fi
993f2d0f 1898
19b4c628
MR
1899filter_cflags=echo
1900filter_cppflags=echo
1901filter_asflags=echo
1902
613a4e3f
MR
1903if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
1904 cc_type=llvm_gcc
1905 cc_version=__VERSION__
1906 gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
1907 cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
1908 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1909 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1910 speed_cflags='-O3'
1911 size_cflags='-Os'
1912elif $cc -v 2>&1 | grep -qi ^gcc; then
629687f6 1913 cc_type=gcc
a3d7c197 1914 cc_version=__VERSION__
5d57846b
MR
1915 gcc_version=$($cc --version | head -n1)
1916 gcc_basever=$($cc -dumpversion)
3ad464bf 1917 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
5d57846b
MR
1918 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
1919 cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
aef6bd1b
MR
1920 if ! $cc -dumpversion | grep -q '^2\.'; then
1921 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1922 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1923 fi
14ca9cd0
MR
1924 speed_cflags='-O3'
1925 size_cflags='-Os'
629687f6
MR
1926elif $cc --version 2>/dev/null | grep -q Intel; then
1927 cc_type=icc
6e3fa35d 1928 cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
bb5cecdc 1929 cc_ident=$($cc --version | head -n1)
bdefad73 1930 icc_version=$($cc -dumpversion)
07dec06e
MR
1931 CC_DEPFLAGS='-MMD'
1932 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
1933 speed_cflags='-O3'
1934 size_cflags='-Os'
b05394a0 1935 noopt_cflags='-O1'
629687f6
MR
1936elif $cc -v 2>&1 | grep -q xlc; then
1937 cc_type=xlc
6e3fa35d 1938 cc_version="AV_STRINGIFY(__IBMC__)"
bb5cecdc 1939 cc_ident=$($cc -qversion 2>/dev/null | head -n1)
14ca9cd0
MR
1940 speed_cflags='-O5'
1941 size_cflags='-O5 -qcompact'
df442a8d
MR
1942elif $cc -V 2>/dev/null | grep -q Compaq; then
1943 cc_type=ccc
6e3fa35d 1944 cc_version="AV_STRINGIFY(__DECC_VER)"
bb5cecdc 1945 cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
d8059267 1946 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
03754fcd 1947 debuglevel=3
df442a8d 1948 add_ldflags -Wl,-z,now # calls to libots crash without this
14ca9cd0
MR
1949 speed_cflags='-fast'
1950 size_cflags='-O1'
6a0d5493 1951elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
03e37762
MR
1952 test -d "$sysroot" || die "No valid sysroot specified."
1953 cc_type=armcc
6e3fa35d 1954 cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
bb5cecdc 1955 cc_ident=$($cc --vsn | head -n1)
03e37762
MR
1956 armcc_conf="$PWD/armcc.conf"
1957 $cc --arm_linux_configure \
1958 --arm_linux_config_file="$armcc_conf" \
1959 --configure_sysroot="$sysroot" \
1960 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
1961 die "Error creating armcc configuration file."
bcafde61 1962 $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
03e37762 1963 cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
75800dce 1964 as_default="${cross_prefix}gcc"
07dec06e
MR
1965 CC_DEPFLAGS='-MMD'
1966 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
1967 speed_cflags='-O3'
1968 size_cflags='-Os'
d0f0f628 1969 filter_asflags="filter_out -W${armcc_opt}*"
6fec122a
MR
1970elif $cc -version 2>/dev/null | grep -q TMS470; then
1971 cc_type=tms470
6e3fa35d 1972 cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
bb5cecdc 1973 cc_ident=$($cc -version | head -n1 | tr -s ' ')
6fec122a
MR
1974 cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
1975 CC_O='-fr=$(@D)'
1976 as_default="${cross_prefix}gcc"
1977 ld_default="${cross_prefix}gcc"
6fec122a
MR
1978 TMPO=$(basename $TMPC .c).o
1979 append TMPFILES $TMPO
1980 add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
07dec06e
MR
1981 CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
1982 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
1983 speed_cflags='-O3 -mf=5'
1984 size_cflags='-O3 -mf=2'
6fec122a
MR
1985 filter_cflags=tms470_flags
1986 tms470_flags(){
1987 for flag; do
1988 case $flag in
1989 -march=*|-mcpu=*)
1990 case "${flag#*=}" in
1991 armv7-a|cortex-a*) echo -mv=7a8 ;;
1992 armv7-r|cortex-r*) echo -mv=7r4 ;;
1993 armv7-m|cortex-m*) echo -mv=7m3 ;;
1994 armv6*|arm11*) echo -mv=6 ;;
1995 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
1996 echo -mv=5e ;;
1997 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
1998 esac
1999 ;;
2000 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
2001 -mfpu=vfp) echo --float_support=vfpv2 ;;
5fcb865b 2002 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
a2709020 2003 -msoft-float) echo --float_support=vfplib ;;
14ca9cd0 2004 -O[0-3]|-mf=*) echo $flag ;;
6fec122a 2005 -g) echo -g -mn ;;
587d24ff 2006 -pds=*) echo $flag ;;
6fec122a
MR
2007 esac
2008 done
2009 }
06da6943
DC
2010elif $cc -v 2>&1 | grep -q clang; then
2011 cc_type=clang
b67a8f49
DC
2012 $cc -dM -E $TMPC | grep -q __clang_version__ &&
2013 cc_version=__clang_version__ || cc_version=__VERSION__
bb5cecdc 2014 cc_ident=$($cc --version | head -n1)
06da6943
DC
2015 CC_DEPFLAGS='-MMD'
2016 AS_DEPFLAGS='-MMD'
14ca9cd0
MR
2017 speed_cflags='-O3'
2018 size_cflags='-Os'
2a472e9c
MK
2019elif $cc -V 2>&1 | grep -q Sun; then
2020 cc_type=suncc
2021 cc_version="AV_STRINGIFY(__SUNPRO_C)"
448f5b83 2022 cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
faa374b7 2023 DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
2a472e9c 2024 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
558c2683 2025 add_ldflags -xc99
14ca9cd0
MR
2026 speed_cflags='-O5'
2027 size_cflags='-O5 -xspace'
03279bbe
MK
2028 filter_cflags=suncc_flags
2029 suncc_flags(){
2030 for flag; do
2031 case $flag in
2032 -march=*|-mcpu=*)
2033 case "${flag#*=}" in
2034 native) echo -xtarget=native ;;
87ddc38b 2035 v9|niagara) echo -xarch=sparc ;;
03279bbe 2036 ultrasparc) echo -xarch=sparcvis ;;
87ddc38b 2037 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
03279bbe
MK
2038 i586|pentium) echo -xchip=pentium ;;
2039 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
2040 pentium3*|c3-2) echo -xtarget=pentium3 ;;
2041 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
2042 pentium4*) echo -xtarget=pentium4 ;;
2043 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
2044 *-sse3) echo -xarch=sse3 ;;
2045 core2) echo -xarch=ssse3 -xchip=core2 ;;
2046 amdfam10|barcelona) echo -xarch=sse4_1 ;;
2047 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
2048 k8|opteron|athlon64|athlon-fx)
2049 echo -xarch=sse2a ;;
2050 athlon*) echo -xarch=pentium_proa ;;
2051 esac
2052 ;;
2053 -std=c99) echo -xc99 ;;
2054 -fomit-frame-pointer) echo -xregs=frameptr ;;
2055 -fPIC) echo -KPIC -xcode=pic32 ;;
03279bbe
MK
2056 -W*,*) echo $flag ;;
2057 -f*-*|-W*) ;;
2058 *) echo $flag ;;
2059 esac
2060 done
2061 }
180ec37d 2062elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
349d78fe
MR
2063 cc_type=pathscale
2064 cc_version=__PATHSCALE__
2065 cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2066 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2067 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2068 speed_cflags='-O2'
2069 size_cflags='-Os'
7b2d2190 2070 filter_cflags='filter_out -Wdisabled-optimization'
6de163e9
MR
2071elif $cc -v 2>&1 | grep -q Open64; then
2072 cc_type=open64
2073 cc_version=__OPEN64__
2074 cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
2075 CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2076 AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
2077 speed_cflags='-O2'
2078 size_cflags='-Os'
7b2d2190 2079 filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
629687f6
MR
2080fi
2081
851ffa80
MR
2082test -n "$cc_type" && enable $cc_type ||
2083 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
629687f6 2084
75bafbac 2085: ${as_default:=$cc}
50567afa 2086: ${dep_cc_default:=$cc}
684b28e0 2087: ${ld_default:=$cc}
121d78d0 2088set_default ar as dep_cc ld
75800dce 2089
07dec06e
MR
2090test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
2091test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
2092
7f32f40c 2093add_cflags $extra_cflags
2f2e6c7c 2094add_asflags $extra_cflags
7f32f40c 2095
154d432c
MR
2096if test -n "$sysroot"; then
2097 case "$cc_type" in
00ba041c 2098 gcc|llvm_gcc|clang)
467256f2 2099 add_cppflags --sysroot="$sysroot"
154d432c
MR
2100 add_ldflags --sysroot="$sysroot"
2101 ;;
6fec122a
MR
2102 tms470)
2103 add_cppflags -I"$sysinclude"
2104 add_ldflags --sysroot="$sysroot"
2105 ;;
154d432c
MR
2106 esac
2107fi
2108
d22c13a8
MR
2109if test "$cpu" = host; then
2110 enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
2111
2112 case "$cc_type" in
613a4e3f 2113 gcc|llvm_gcc)
d22c13a8
MR
2114 check_native(){
2115 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
b695256e 2116 sed -n "/cc1.*$1=/{
27ce1be8
MR
2117 s/.*$1=\\([^ ]*\\).*/\\1/
2118 p
2119 q
2120 }" $TMPE
d22c13a8
MR
2121 }
2122 cpu=$(check_native -march || check_native -mcpu)
2123 ;;
2124 esac
2125
2126 test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
2127fi
2128
e939cedd
MR
2129# Deal with common $arch aliases
2130case "$arch" in
2131 arm*)
2132 arch="arm"
2133 ;;
2134 mips|mipsel|IP*)
2135 arch="mips"
2136 ;;
47b1860e 2137 mips64*)
e939cedd
MR
2138 arch="mips"
2139 subarch="mips64"
2140 ;;
2141 parisc|hppa)
2142 arch="parisc"
2143 ;;
2144 parisc64|hppa64)
2145 arch="parisc"
2146 subarch="parisc64"
2147 ;;
2148 "Power Macintosh"|ppc|powerpc)
2149 arch="ppc"
2150 ;;
47b1860e 2151 ppc64|powerpc64)
e939cedd
MR
2152 arch="ppc"
2153 subarch="ppc64"
2154 ;;
2155 s390|s390x)
2156 arch="s390"
2157 ;;
2158 sh4|sh)
2159 arch="sh4"
2160 ;;
2161 sun4u|sparc64)
2162 arch="sparc"
2163 subarch="sparc64"
2164 ;;
d33ed7b3 2165 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
e939cedd
MR
2166 arch="x86"
2167 ;;
2168esac
2169
851ffa80 2170is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
343aef9b 2171enable $arch
e939cedd 2172
df5cdc24 2173# Add processor-specific flags
5d54c126
MR
2174if test "$cpu" = generic; then
2175 : do nothing
2176elif enabled ppc; then
343aef9b 2177
56348891
MR
2178 case $(tolower $cpu) in
2179 601|ppc601|powerpc601)
9dbd5c3d 2180 cpuflags="-mcpu=601"
64ad53ff 2181 disable altivec
9dbd5c3d 2182 ;;
56348891 2183 603*|ppc603*|powerpc603*)
9dbd5c3d 2184 cpuflags="-mcpu=603"
64ad53ff 2185 disable altivec
9dbd5c3d 2186 ;;
56348891 2187 604*|ppc604*|powerpc604*)
9dbd5c3d 2188 cpuflags="-mcpu=604"
64ad53ff 2189 disable altivec
9dbd5c3d 2190 ;;
56348891 2191 g3|75*|ppc75*|powerpc75*)
9dbd5c3d 2192 cpuflags="-mcpu=750 -mpowerpc-gfxopt"
64ad53ff 2193 disable altivec
9dbd5c3d 2194 ;;
56348891 2195 g4|745*|ppc745*|powerpc745*)
9dbd5c3d
MR
2196 cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
2197 ;;
56348891 2198 74*|ppc74*|powerpc74*)
9dbd5c3d
MR
2199 cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
2200 ;;
56348891 2201 g5|970|ppc970|powerpc970|power4*)
9dbd5c3d
MR
2202 cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
2203 ;;
56348891 2204 cell)
9dbd5c3d
MR
2205 cpuflags="-mcpu=cell"
2206 enable ldbrx
2207 ;;
7b0b81a1
AL
2208 e500v2)
2209 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
2210 disable altivec
2211 ;;
2212 e500)
2213 cpuflags="-mcpu=8540 -mhard-float"
2214 disable altivec
2215 ;;
9dbd5c3d 2216 esac
343aef9b
MR
2217
2218elif enabled x86; then
2219
9dbd5c3d
MR
2220 case $cpu in
2221 i[345]86|pentium)
2222 cpuflags="-march=$cpu"
2223 disable mmx
2224 ;;
2225 # targets that do NOT support conditional mov (cmov)
2226 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
2227 cpuflags="-march=$cpu"
2228 disable cmov
2229 ;;
2230 # targets that do support conditional mov (cmov)
9ddf1b1a 2231 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
2232 cpuflags="-march=$cpu"
2233 enable cmov
2234 enable fast_cmov
2235 ;;
2236 # targets that do support conditional mov but on which it's slow
2237 pentium4|pentium4m|prescott|nocona)
2238 cpuflags="-march=$cpu"
2239 enable cmov
2240 disable fast_cmov
2241 ;;
2242 esac
343aef9b
MR
2243
2244elif enabled sparc; then
2245
9dbd5c3d 2246 case $cpu in
26b7199e
MK
2247 niagara)
2248 cpuflags="-mcpu=$cpu"
2249 disable vis
2250 ;;
9dbd5c3d
MR
2251 sparc64)
2252 cpuflags="-mcpu=v9"
2253 ;;
2254 esac
343aef9b
MR
2255
2256elif enabled arm; then
2257
34ba23c9
MR
2258 case $cpu in
2259 armv*)
2260 cpuflags="-march=$cpu"
c2eae137 2261 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
34ba23c9
MR
2262 ;;
2263 *)
2264 cpuflags="-mcpu=$cpu"
c2eae137
MR
2265 case $cpu in
2266 cortex-a*) subarch=armv7a ;;
2267 cortex-r*) subarch=armv7r ;;
9e19704a 2268 cortex-m*) enable thumb; subarch=armv7m ;;
c2eae137
MR
2269 arm11*) subarch=armv6 ;;
2270 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
2271 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
2272 esac
34ba23c9
MR
2273 ;;
2274 esac
343aef9b
MR
2275
2276elif enabled alpha; then
2277
34ba23c9 2278 enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
343aef9b
MR
2279
2280elif enabled bfin; then
2281
34ba23c9 2282 cpuflags="-mcpu=$cpu"
343aef9b
MR
2283
2284elif enabled mips; then
2285
34ba23c9 2286 cpuflags="-march=$cpu"
343aef9b
MR
2287
2288elif enabled avr32; then
2289
9dbd5c3d
MR
2290 case $cpu in
2291 ap7[02]0[0-2])
2292 subarch="avr32_ap"
2293 cpuflags="-mpart=$cpu"
2294 ;;
2295 ap)
2296 subarch="avr32_ap"
2297 cpuflags="-march=$cpu"
2298 ;;
2299 uc3[ab]*)
2300 subarch="avr32_uc"
2301 cpuflags="-mcpu=$cpu"
2302 ;;
2303 uc)
2304 subarch="avr32_uc"
2305 cpuflags="-march=$cpu"
2306 ;;
2307 esac
df5cdc24 2308
343aef9b
MR
2309fi
2310
df5cdc24
MR
2311add_cflags $cpuflags
2312add_asflags $cpuflags
2313
993f2d0f
MR
2314# compiler sanity check
2315check_exec <<EOF
2316int main(void){ return 0; }
2317EOF
2318if test "$?" != 0; then
2319 echo "$cc is unable to create an executable file."
2320 if test -z "$cross_prefix" && ! enabled cross_compile ; then
2321 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
2322 echo "Only do this if you know what cross compiling means."
2323 fi
2324 die "C compiler test failed."
2325fi
2326
046f081b 2327add_cppflags -D_ISOC99_SOURCE
e9b9a2f8 2328check_cflags -std=c99
50a334e4 2329check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
9d821fc2
DB
2330#include <stdlib.h>
2331EOF
50a334e4 2332check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
9d821fc2
DB
2333#include <stdlib.h>
2334EOF
e9b9a2f8 2335
f0125de9 2336check_host_cflags -std=c99
0a6db2a2 2337check_host_cflags -Wall
f0125de9 2338
b24dbcbd 2339case "$arch" in
e939cedd 2340 alpha|ia64|mips|parisc|sparc)
8a3c8627 2341 spic=$shared
b24dbcbd 2342 ;;
e939cedd 2343 x86)
cfdb6148 2344 subarch="x86_32"
e939cedd 2345 check_cc <<EOF && subarch="x86_64"
58b3536d 2346 int test[(int)sizeof(char*) - 7];
cfdb6148 2347EOF
de27f4d9 2348 if test "$subarch" = "x86_64"; then
e939cedd 2349 spic=$shared
de27f4d9 2350 fi
b24dbcbd 2351 ;;
b24dbcbd
RP
2352esac
2353
343aef9b 2354enable $subarch
8a3c8627 2355enabled spic && enable pic
b24dbcbd 2356
7483e694 2357# OS specific
4f854758 2358case $target_os in
a1629e28 2359 haiku)
63ae7e7c 2360 prefix_default="/boot/common"
108caaaa 2361 network_extralibs="-lnetwork"
f59c4bd6 2362 host_libs=
a1629e28 2363 ;;
7483e694 2364 sunos)
4d58e4cb 2365 AVSERVERLDFLAGS=""
9987769a 2366 SHFLAGS='-shared -Wl,-h,$$(@F)'
0600d30a 2367 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
7483e694 2368 network_extralibs="-lsocket -lnsl"
50a334e4 2369 add_cppflags -D__EXTENSIONS__
8182dc34 2370 nm_opts='-P -g'
7483e694
DB
2371 ;;
2372 netbsd)
a1e4b3f6 2373 disable symver
07a8eef6
MR
2374 oss_indev_extralibs="-lossaudio"
2375 oss_outdev_extralibs="-lossaudio"
7483e694
DB
2376 ;;
2377 openbsd)
89e053f8 2378 enable malloc_aligned
7c4a001a 2379 # On OpenBSD 4.5. the compiler does not use PIC unless
070c5d0f 2380 # explicitly using -fPIC. Libav builds fine without PIC,
7c4a001a
MR
2381 # however the generated executable will not do anything
2382 # (simply quits with exit-code 1, no crash, no output).
a7b9c8ae 2383 # Thus explicitly enable PIC here.
cd78208b 2384 enable pic
a1e4b3f6 2385 disable symver
7483e694 2386 SHFLAGS='-shared'
07a8eef6
MR
2387 oss_indev_extralibs="-lossaudio"
2388 oss_outdev_extralibs="-lossaudio"
7483e694 2389 ;;
a1e4b3f6
MR
2390 dragonfly)
2391 enable malloc_aligned
2392 disable symver
2393 ;;
2394 freebsd)
89e053f8 2395 enable malloc_aligned
7483e694
DB
2396 ;;
2397 bsd/os)
355d81df 2398 add_extralibs -lpoll -lgnugetopt
7483e694
DB
2399 ;;
2400 darwin)
89e053f8 2401 enable malloc_aligned
301ab19d 2402 gas="gas-preprocessor.pl $cc"
e08b8239 2403 enabled ppc && add_asflags -force_cpusubtype_ALL
dff68563
SM
2404 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
2405 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
355d81df 2406 add_ldflags -Wl,-dynamic,-search_paths_first
7483e694
DB
2407 SLIBSUF=".dylib"
2408 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2409 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
4d58e4cb 2410 AVSERVERLDFLAGS=-Wl,-bind_at_load
304d586d 2411 objformat="macho"
1b0f6fb8 2412 enabled x86_64 && objformat="macho64"
8dfa86f7 2413 enabled_any pic shared ||
2704bd1a 2414 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
7483e694
DB
2415 ;;
2416 mingw32*)
9d3f4f50 2417 if test $target_os = "mingw32ce"; then
1aa71e25
MS
2418 disable network
2419 else
2420 target_os=mingw32
2421 fi
dcc01c06 2422 LIBTARGET=i386
1fc9fb8a 2423 if enabled x86_64; then
89e053f8 2424 enable malloc_aligned
417516f6 2425 LIBTARGET="i386:x86-64"
336cc1b0 2426 elif enabled arm; then
15c5156d 2427 LIBTARGET=arm-wince
dcc01c06 2428 fi
fbd971a4 2429 shlibdir_default="$bindir_default"
7483e694
DB
2430 SLIBPREF=""
2431 SLIBSUF=".dll"
7483e694
DB
2432 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2433 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2f138f0b
MR
2434 SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
2435 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2436 SLIB_INSTALL_LINKS=
2437 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
2438 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
4b51fb1c 2439 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 2440 objformat="win32"
ec10a9ab 2441 dlltool="${cross_prefix}dlltool"
bc574408 2442 enable dos_paths
1894e741 2443 check_cflags -fno-common
e26011d0
RP
2444 check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
2445 || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
f7ad5aa2 2446 die "ERROR: MinGW runtime version must be >= 3.15."
5666a9f2 2447 add_cppflags -U__STRICT_ANSI__
7483e694
DB
2448 ;;
2449 cygwin*)
4f854758 2450 target_os=cygwin
fbd971a4 2451 shlibdir_default="$bindir_default"
7483e694
DB
2452 SLIBPREF="cyg"
2453 SLIBSUF=".dll"
2454 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2455 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2456 SHFLAGS='-shared -Wl,--enable-auto-image-base'
304d586d 2457 objformat="win32"
bc574408 2458 enable dos_paths
1894e741 2459 check_cflags -fno-common
a7a187a1 2460 add_cppflags -U__STRICT_ANSI__
7483e694 2461 ;;
4f365f37 2462 *-dos|freedos|opendos)
4f365f37 2463 network_extralibs="-lsocket"
ff1c015d 2464 objformat="coff"
bc574408 2465 enable dos_paths
a7a187a1 2466 add_cppflags -U__STRICT_ANSI__
4f365f37 2467 ;;
7483e694 2468 linux)
046f081b 2469 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
7483e694
DB
2470 enable dv1394
2471 ;;
2472 irix*)
4f854758 2473 target_os=irix
7483e694
DB
2474 ranlib="echo ignoring ranlib"
2475 ;;
d22e8442 2476 os/2*)
d22e8442 2477 ln_s="cp -f"
9297f1ed 2478 objformat="aout"
e14574eb 2479 add_cppflags -D_GNU_SOURCE
355d81df 2480 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
71c61f62 2481 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
4d58e4cb 2482 AVSERVERLDFLAGS=""
287d3b13 2483 LIBSUF="_s.a"
d22e8442
DY
2484 SLIBPREF=""
2485 SLIBSUF=".dll"
2486 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2487 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
71c61f62
MR
2488 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2489 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2490 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2491 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2492 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2493 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2494 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2495 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2f138f0b 2496 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
bc574408 2497 enable dos_paths
d22e8442 2498 ;;
83993c1c 2499 gnu/kfreebsd)
c1f54478 2500 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
83993c1c 2501 ;;
34e82167 2502 gnu)
f60d1366 2503 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
34e82167 2504 ;;
d33ed7b3
MR
2505 qnx)
2506 add_cppflags -D_QNX_SOURCE
2507 network_extralibs="-lsocket"
2508 ;;
1c69c79f
MS
2509 symbian)
2510 SLIBSUF=".dll"
2511 enable dos_paths
e3bc07f4
MS
2512 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
2513 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
2514 add_ldflags -Wl,--target1-abs,--no-undefined \
2515 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
2516 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
2517 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
2518 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
2519 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
1c69c79f 2520 ;;
614d8911
MR
2521 none)
2522 ;;
7483e694 2523 *)
4f924f9a 2524 die "Unknown OS '$target_os'."
7483e694
DB
2525 ;;
2526esac
2527
29ba0911 2528echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
db7515fd 2529
13cb2187
AS
2530check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
2531
c9d19248
MR
2532set_default $PATHS_LIST
2533
320d060a 2534# we need to build at least one lib type
93b3c083 2535if ! enabled_any static shared; then
320d060a
DB
2536 cat <<EOF
2537At least one library type must be built.
2538Specify --enable-static to build the static libraries or --enable-shared to
2539build the shared libraries as well. To only build the shared libraries specify
2540--disable-static in addition to --enable-shared.
2541EOF
2542 exit 1;
2543fi
2544
2184c6f7 2545die_license_disabled() {
4c27207c 2546 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2184c6f7
DB
2547}
2548
2184c6f7 2549die_license_disabled gpl libx264
de295976 2550die_license_disabled gpl libxavs
2184c6f7 2551die_license_disabled gpl libxvid
2184c6f7
DB
2552die_license_disabled gpl x11grab
2553
2f7ae63b 2554die_license_disabled nonfree libfaac
b2e3c528 2555
0b175caa
DB
2556die_license_disabled version3 libopencore_amrnb
2557die_license_disabled version3 libopencore_amrwb
d89e738a 2558die_license_disabled version3 libvo_aacenc
f502ff3f 2559die_license_disabled version3 libvo_amrwbenc
0b175caa 2560
9cad0e4e 2561enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
3fe142e2 2562
40617a6d 2563disabled optimizations || check_cflags -fomit-frame-pointer
cf9d24ad 2564
e276d9e8
MR
2565enable_pic() {
2566 enable pic
bce7b696
MR
2567 add_cppflags -DPIC
2568 add_cflags -fPIC
2569 add_asflags -fPIC
e276d9e8
MR
2570}
2571
2572enabled pic && enable_pic
bce7b696 2573
b4d96ba2
MR
2574check_cc <<EOF || die "Symbol mangling check failed."
2575int ff_extern;
2576EOF
8182dc34 2577sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
b4d96ba2
MR
2578extern_prefix=${sym%%ff_extern*}
2579
f65883c8
MR
2580check_cc <<EOF && enable inline_asm
2581void foo(void) { __asm__ volatile ("" ::); }
2582EOF
61d251db 2583
df5e3978
MR
2584_restrict=
2585for restrict_keyword in restrict __restrict__ __restrict; do
2586 check_cc <<EOF && _restrict=$restrict_keyword && break
2587void foo(char * $restrict_keyword p);
2588EOF
2589done
2590
2591check_cc <<EOF && enable attribute_packed
2592struct { int x; } __attribute__((packed)) x;
2593EOF
2594
dffb41b9
MR
2595check_cc <<EOF && enable attribute_may_alias
2596union { int x; } __attribute__((may_alias)) x;
2597EOF
2598
df5e3978
MR
2599check_cc <<EOF || die "endian test failed"
2600unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2601EOF
48fc536a 2602od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
df5e3978 2603
e939cedd
MR
2604if enabled alpha; then
2605
2606 check_cflags -mieee
2607
2608elif enabled arm; then
e45391bb 2609
8986fddc 2610 enabled thumb && check_cflags -mthumb || check_cflags -marm
301ab19d 2611 nogas=die
50fa82e6 2612
44caaa56
MR
2613 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
2614 enable vfp_args
2615 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
2616 case "${cross_prefix:-$cc}" in
2617 *hardfloat*) enable vfp_args; fpabi=vfp ;;
2618 *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
fa0912fe
MR
2619__asm__ (".eabi_attribute 28, 1");
2620int main(void) { return 0; }
2621EOF
44caaa56
MR
2622 esac
2623 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
2624 fi
fa0912fe 2625
fa0912fe
MR
2626 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2627 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
2628 enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2629 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
2630 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
2631 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
93eb8e4d 2632 enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
e45391bb 2633
e276d9e8
MR
2634 enabled_all armv6t2 shared !pic && enable_pic
2635
fa0912fe 2636elif enabled mips; then
e45391bb 2637
fa0912fe
MR
2638 check_asm loongson '"dmult.g $1, $2, $3"'
2639 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
e45391bb 2640
fa0912fe 2641elif enabled ppc; then
e45391bb 2642
e6a0c354
MR
2643 enable local_aligned_8 local_aligned_16
2644
135448fa 2645 check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
2f0c136e 2646 check_asm ibm_asm '"add 0, 0, 0"'
fa0912fe 2647 check_asm ppc4xx '"maclhw r10, r11, r12"'
64de20d1 2648 check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
fa0912fe
MR
2649
2650 # AltiVec flags: The FSF version of GCC differs from the Apple version
2651 if enabled altivec; then
301ab19d 2652 nogas=warn
fa0912fe
MR
2653 check_cflags -maltivec -mabi=altivec &&
2654 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2655 check_cflags -faltivec
2656
2657 # check if our compiler supports Motorola AltiVec C API
2658 check_cc <<EOF || disable altivec
2659$inc_altivec_h
2660int main(void) {
2661 vector signed int v1, v2, v3;
2662 v1 = vec_add(v2,v3);
2663 return 0;
2664}
2665EOF
2666
2667 # check if our compiler supports braces for vector declarations
2668 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2669$inc_altivec_h
2670int main (void) { (vector int) {1}; return 0; }
2671EOF
2672 fi
e45391bb 2673
fa0912fe 2674elif enabled sparc; then
e45391bb 2675
fa0912fe
MR
2676 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2677 add_cflags -mcpu=ultrasparc -mtune=ultrasparc
e45391bb 2678
fa0912fe 2679elif enabled x86; then
e45391bb 2680
e6a0c354
MR
2681 enable local_aligned_8 local_aligned_16
2682
44965991
PI
2683 # check whether EBP is available on x86
2684 # As 'i' is stored on the stack, this program will crash
2685 # if the base pointer is used to access it because the
2686 # base pointer is cleared in the inline assembly code.
7dfef245 2687 check_exec_crash <<EOF && enable ebp_available
44965991 2688 volatile int i=0;
be449fca 2689 __asm__ volatile (
44965991
PI
2690 "xorl %%ebp, %%ebp"
2691 ::: "%ebp");
2692 return i;
44965991
PI
2693EOF
2694
f494213c 2695 # check whether EBX is available on x86
7cee5421
MR
2696 check_asm ebx_available '""::"b"(0)' &&
2697 check_asm ebx_available '"":::"%ebx"'
8e380710 2698
6f74fb03
RP
2699 # check whether xmm clobbers are supported
2700 check_asm xmm_clobbers '"":::"%xmm0"'
2701
d7f0920b 2702 # check whether binutils is new enough to compile SSSE3/MMX2
940f335a 2703 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
5fd89ca0 2704 enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
6bd859d6
MR
2705
2706 check_asm bswap '"bswap %%eax" ::: "%eax"'
304d586d 2707
9cca1e40 2708 if ! disabled_any asm mmx yasm; then
b6c06894
MR
2709 if check_cmd $yasmexe --version; then
2710 enabled x86_64 && yasm_extra="-m amd64"
2711 yasm_debug="-g dwarf2"
2712 elif check_cmd nasm -v; then
2713 yasmexe=nasm
2714 yasm_debug="-g -F dwarf"
2715 enabled x86_64 && test "$objformat" = elf && objformat=elf64
2716 fi
2717
2718 YASMFLAGS="-f $objformat $yasm_extra"
2719 enabled pic && append YASMFLAGS "-DPIC"
2720 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
2721 case "$objformat" in
2722 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
2723 esac
2724
48545a8f 2725 check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
25432e85 2726 die "yasm not found, use --disable-yasm for a crippled build"
429059f8 2727 check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
31a0dcb2 2728 fi
e45391bb 2729
669b5583
MR
2730 case "$cpu" in
2731 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2732 disable fast_clz
2733 ;;
2734 esac
2735
44965991
PI
2736fi
2737
301ab19d
MR
2738if enabled asm; then
2739 as=${gas:=$as}
2740 check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
2741 $nogas "GNU assembler not found, install gas-preprocessor"
2742fi
2743
4a7e068b
MR
2744check_ldflags -Wl,--as-needed
2745
a98bb16d
RP
2746if check_func dlopen; then
2747 ldl=
2748elif check_func dlopen -ldl; then
2749 ldl=-ldl
8bf5d58f
MN
2750fi
2751
54fe299b
DV
2752if enabled network; then
2753 check_type "sys/types.h sys/socket.h" socklen_t
2754 check_type netdb.h "struct addrinfo"
2755 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
2756 check_type netinet/in.h "struct sockaddr_in6"
2757 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2758 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2759 # Prefer arpa/inet.h over winsock2
2760 if check_header arpa/inet.h ; then
2761 check_func closesocket
2762 elif check_header winsock2.h ; then
2763 check_func_headers winsock2.h closesocket -lws2 && \
2764 network_extralibs="-lws2" || \
2765 { check_func_headers winsock2.h closesocket -lws2_32 && \
2766 network_extralibs="-lws2_32"; }
2767 check_type ws2tcpip.h socklen_t
2768 check_type ws2tcpip.h "struct addrinfo"
2769 check_type ws2tcpip.h "struct ipv6_mreq"
2770 check_type ws2tcpip.h "struct sockaddr_in6"
2771 check_type ws2tcpip.h "struct sockaddr_storage"
2772 check_struct winsock2.h "struct sockaddr" sa_len
2773 else
2774 disable network
2775 fi
2776fi
2777
75ecf149
DB
2778# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2779check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2780
534a2231 2781check_func fcntl
7483e694 2782check_func fork
84882df6 2783check_func getaddrinfo $network_extralibs
7483e694
DB
2784check_func gethrtime
2785check_func getrusage
fc5607f8 2786check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
094c09bb 2787check_func inet_aton $network_extralibs
abfc8d05 2788check_func isatty
a5b64584 2789check_func localtime_r
4ae40685 2790check_func ${malloc_prefix}memalign && enable memalign
7483e694 2791check_func mkstemp
0328b9ea 2792check_func mmap
4ae40685 2793check_func ${malloc_prefix}posix_memalign && enable posix_memalign
0104b608 2794check_func setrlimit
87958234 2795check_func strerror_r
6379900c 2796check_func strptime
47941088 2797check_func strtok_r
b507ebd1 2798check_func_headers io.h setmode
e4673692 2799check_func_headers lzo/lzo1x.h lzo1x_999_compress
fc5607f8 2800check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
2446d3d6 2801check_func_headers windows.h GetProcessTimes
73f6d31e 2802check_func_headers windows.h MapViewOfFile
7c5bfe7a 2803check_func_headers windows.h VirtualAlloc
6ffa87d3 2804
a98bb16d 2805check_header dlfcn.h
92c6a099 2806check_header dxva2api.h
a98bb16d 2807check_header malloc.h
bf6ce82d 2808check_header poll.h
b58412f1 2809check_header sys/mman.h
b091aa44 2810check_header sys/resource.h
bf6ce82d 2811check_header sys/select.h
272081b0
CEH
2812check_header vdpau/vdpau.h
2813check_header vdpau/vdpau_x11.h
68178ca9 2814check_header X11/extensions/XvMClib.h
a98bb16d 2815
9104cd51
RP
2816check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
2817
a4fa192c 2818disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
632948bd 2819disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
57bd82d4
MR
2820
2821# check for some common methods of building with pthread support
2822# do this before the optional library checks as some of them require pthreads
0dbfc1db
MR
2823if ! disabled pthreads && ! enabled w32threads; then
2824 enable pthreads
9e7fd101
MR
2825 if check_func pthread_create; then
2826 :
2827 elif check_func pthread_create -pthread; then
2828 add_cflags -pthread
afc9aee2 2829 add_extralibs -pthread
9e7fd101
MR
2830 elif check_func pthread_create -pthreads; then
2831 add_cflags -pthreads
afc9aee2 2832 add_extralibs -pthreads
8d94f606
GT
2833 elif check_func pthread_create -lpthreadGC2; then
2834 add_extralibs -lpthreadGC2
9e7fd101 2835 elif ! check_lib pthread.h pthread_create -lpthread; then
0dbfc1db 2836 disable pthreads
9e7fd101 2837 fi
57bd82d4
MR
2838fi
2839
8eee7025 2840for thread in $THREADS_LIST; do
e5f94c2b 2841 if enabled $thread; then
3ae3b721
RP
2842 test -n "$thread_type" &&
2843 die "ERROR: Only one thread type must be selected." ||
e5f94c2b 2844 thread_type="$thread"
e5f94c2b
RP
2845 fi
2846done
2847
50f7c296 2848check_lib math.h sin -lm && LIBM="-lm"
f3e3f28e 2849enabled vaapi && require vaapi va/va.h vaInitialize -lva
fdf88598 2850
645d2652
MR
2851check_mathfunc exp2
2852check_mathfunc exp2f
2853check_mathfunc llrint
07876e25 2854check_mathfunc llrintf
645d2652
MR
2855check_mathfunc log2
2856check_mathfunc log2f
2857check_mathfunc lrint
2858check_mathfunc lrintf
2859check_mathfunc round
2860check_mathfunc roundf
23d3931a 2861check_mathfunc trunc
645d2652 2862check_mathfunc truncf
f32adb22 2863
57bd82d4 2864# these are off by default, so fail if requested and not available
a1b3c5a3 2865enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
47941088 2866enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
4fa18c56
MR
2867enabled libdirac && require_pkg_config dirac \
2868 "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
2869 "dirac_decoder_init dirac_encoder_init"
79fda097 2870enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
a5b64584 2871enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
5af41508 2872enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
9b9d3868 2873enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
7483e694 2874enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
eb7626a3
MR
2875enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
2876enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
4fa18c56 2877enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
3d6fac8c 2878enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
4fa18c56
MR
2879enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
2880enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
ae14f311 2881enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
c261a5d9 2882enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
d89e738a 2883enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
f502ff3f 2884enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
7483e694 2885enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
7d07d6f5
DB
2886enabled libvpx && {
2887 enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
2888 die "ERROR: libvpx decoder version must be >=0.9.1"; }
2889 enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
2890 die "ERROR: libvpx encoder version must be >=0.9.1"; } }
eb7626a3 2891enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
e25c6710
JM
2892 { check_cpp_condition x264.h "X264_BUILD >= 115" ||
2893 die "ERROR: libx264 version must be >= 0.115."; }
de295976 2894enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
2bfecf73 2895enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
7483e694 2896enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
8ac17293 2897
0b4a1821
AS
2898# libdc1394 check
2899if enabled libdc1394; then
2900 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2901 enable libdc1394_2; } ||
2902 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2903 enable libdc1394_1; } ||
2904 die "ERROR: No version of libdc1394 found "
2905fi
2906
8f1b06c8 2907if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
aa692d54
MR
2908 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
2909 enable sdl &&
2910 check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
c3f6b472 2911fi
57bd82d4 2912
2270b4b2 2913texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
146ea952 2914
c6f95144 2915check_header linux/fb.h
06e31011
RP
2916check_header linux/videodev.h
2917check_header linux/videodev2.h
1b6e8b73 2918check_header sys/videoio.h
47f38850 2919
27796dc3 2920check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
ec1ee802
RP
2921# check that WM_CAP_DRIVER_CONNECT is defined to the proper value
2922# w32api 3.12 had it defined wrong
2923check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
c2345207 2924
f8aa696f 2925# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1c915f83
RP
2926{ check_header dev/bktr/ioctl_meteor.h &&
2927 check_header dev/bktr/ioctl_bt848.h; } ||
2928{ check_header machine/ioctl_meteor.h &&
2929 check_header machine/ioctl_bt848.h; } ||
2930{ check_header dev/video/meteor/ioctl_meteor.h &&
2931 check_header dev/video/bktr/ioctl_bt848.h; } ||
2932check_header dev/ic/bt8xx.h
f8aa696f 2933
15d59d2c 2934check_header sndio.h
c7682de0
RP
2935check_header sys/soundcard.h
2936check_header soundcard.h
deb29777 2937
b6f3d925 2938enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
35fd8122 2939
0e57fe17 2940enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
80ff8a16 2941
15d59d2c
B
2942enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
2943
56a059ac 2944enabled x11grab &&
f58f4ce1
GP
2945check_header X11/Xlib.h &&
2946check_header X11/extensions/XShm.h &&
0a045661 2947check_header X11/extensions/Xfixes.h &&
f58f4ce1 2948check_func XOpenDisplay -lX11 &&
781c1aa6
R
2949check_func XShmCreateImage -lX11 -lXext &&
2950check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
f58f4ce1 2951
598ef02b 2952if ! disabled vdpau && enabled vdpau_vdpau_h; then
deda2a4a
AC
2953check_cpp_condition \
2954 vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
d1ebd4a9
AC
2955 { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
2956 disable vdpau; }
abf649c7 2957fi
deda2a4a 2958
95e561ec 2959enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
57bd82d4
MR
2960
2961# add some useful compiler flags if supported
2962check_cflags -Wdeclaration-after-statement
dcd479c0 2963check_cflags -Wall
440e3b2f 2964check_cflags -Wno-parentheses
dcd479c0 2965check_cflags -Wno-switch
b36518dc 2966check_cflags -Wno-format-zero-length
c07bd6a9
MN
2967check_cflags -Wdisabled-optimization
2968check_cflags -Wpointer-arith
2969check_cflags -Wredundant-decls
cc1fb623 2970check_cflags -Wno-pointer-sign
f4929996 2971check_cflags -Wcast-qual
9aceb3cf 2972check_cflags -Wwrite-strings
652a5bf6 2973check_cflags -Wtype-limits
764551c6 2974check_cflags -Wundef
fc298fd9 2975check_cflags -Wmissing-prototypes
5af4e0cc 2976enabled extra_warnings && check_cflags -Winline
cf9d24ad 2977
57bd82d4 2978# add some linker flags
5c0e9479 2979check_ldflags -Wl,--warn-common
965dbe09 2980check_ldflags -Wl,-rpath-link=libpostproc:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
fef2d661 2981test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
94a3401e 2982
a482e61b 2983echo "X{};" > $TMPV
b462d132 2984if test_ldflags -Wl,--version-script,$TMPV; then
a482e61b 2985 append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
b462d132
MR
2986 check_cc <<EOF && enable symver_asm_label
2987void ff_foo(void) __asm__ ("av_foo@VERSION");
0884fadf 2988void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
b462d132
MR
2989EOF
2990 check_cc <<EOF && enable symver_gnu_asm
2991__asm__(".symver ff_foo,av_foo@VERSION");
2992void ff_foo(void) {}
2993EOF
2994fi
a482e61b 2995
9cd7b854
MR
2996if [ -n "$optflags" ]; then
2997 add_cflags $optflags
2998elif enabled small; then
14ca9cd0 2999 add_cflags $size_cflags
8400d6b8 3000elif enabled optimizations; then
14ca9cd0 3001 add_cflags $speed_cflags
b05394a0
MR
3002else
3003 add_cflags $noopt_cflags
cddf3f45 3004fi
11fdbc44 3005check_cflags -fno-math-errno
b2eb2ff0 3006check_cflags -fno-signed-zeros
cddf3f45 3007
629687f6 3008if enabled icc; then
b1598b58
MR
3009 # Just warnings, no remarks
3010 check_cflags -w1
3011 # -wd: Disable following warnings
3012 # 144, 167, 556: -Wno-pointer-sign
91bcad19 3013 # 1292: attribute "foo" ignored
b1598b58 3014 # 10006: ignoring unknown option -fno-signed-zeros
f1c7c6ae 3015 # 10148: ignoring unknown option -Wno-parentheses
b1598b58 3016 # 10156: ignoring option '-W'; no argument required
91bcad19 3017 check_cflags -wd144,167,556,1292,10006,10148,10156
b1598b58
MR
3018 # 11030: Warning unknown option --as-needed
3019 # 10156: ignoring option '-export'; no argument required
3020 check_ldflags -wd10156,11030
3021 # Allow to compile with optimizations
3022 check_ldflags -march=$cpu
be2cf98a
CEH
3023 # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
3024 enable ebp_available
bdefad73
MR
3025 if enabled x86_32; then
3026 test ${icc_version%%.*} -ge 11 && \
3027 check_cflags -falign-stack=maintain-16-byte || \
3028 disable aligned_stack
3029 fi
df442a8d
MR
3030elif enabled ccc; then
3031 # disable some annoying warnings
3032 add_cflags -msg_disable cvtu32to64
3033 add_cflags -msg_disable embedcomment
3034 add_cflags -msg_disable needconstext
3035 add_cflags -msg_disable nomainieee
3036 add_cflags -msg_disable ptrmismatch1
3037 add_cflags -msg_disable unreachcode
973859f5
MR
3038elif enabled gcc; then
3039 check_cflags -fno-tree-vectorize
765e6134 3040 check_cflags -Werror=implicit-function-declaration
de63bfec 3041 check_cflags -Werror=missing-prototypes
613a4e3f
MR
3042elif enabled llvm_gcc; then
3043 check_cflags -mllvm -stack-alignment=16
06da6943 3044elif enabled clang; then
5c8ef670 3045 check_cflags -mllvm -stack-alignment=16
06da6943 3046 check_cflags -Qunused-arguments
138132be
MR
3047elif enabled armcc; then
3048 # 2523: use of inline assembler is deprecated
bcafde61
MR
3049 add_cflags -W${armcc_opt},--diag_suppress=2523
3050 add_cflags -W${armcc_opt},--diag_suppress=1207
5a92140b 3051 add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
b0c1b66a 3052 add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
d0ce090e
MR
3053 add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
3054 add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
587d24ff
MR
3055elif enabled tms470; then
3056 add_cflags -pds=824 -pds=837
5f3b8314
MR
3057elif enabled pathscale; then
3058 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
504a64b9
CEH
3059fi
3060
7483e694
DB
3061enabled_any $THREADS_LIST && enable threads
3062
3063check_deps $CONFIG_LIST \
b6bb00b0 3064 $CONFIG_EXTRA \
7483e694
DB
3065 $HAVE_LIST \
3066 $DECODER_LIST \
3067 $ENCODER_LIST \
5666fd73 3068 $HWACCEL_LIST \
7483e694
DB
3069 $PARSER_LIST \
3070 $BSF_LIST \
3071 $DEMUXER_LIST \
3072 $MUXER_LIST \
f7679c54 3073 $FILTER_LIST \
7483e694
DB
3074 $INDEV_LIST \
3075 $OUTDEV_LIST \
3076 $PROTOCOL_LIST \
57442411
MR
3077 $ACODEC_TESTS \
3078 $VCODEC_TESTS \
3079 $LAVF_TESTS \
48c28162 3080 $LAVFI_TESTS \
b9d5f1b7 3081 $SEEK_TESTS \
f70f03f6 3082
3bfd582c 3083enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
c8a4ae00 3084
9bbd6a4c
MR
3085! enabled_any memalign posix_memalign malloc_aligned &&
3086 enabled_any $need_memalign && enable memalign_hack
3087
3e89171a 3088echo "install prefix $prefix"
f36958f8
DB
3089echo "source path $source_path"
3090echo "C compiler $cc"
f36958f8 3091echo "ARCH $arch ($cpu)"
ce8871c2
MR
3092if test "$build_suffix" != ""; then
3093 echo "build suffix $build_suffix"
eb94aca9 3094fi
ac63af34
DB
3095if test "$extra_version" != ""; then
3096 echo "version string suffix $extra_version"
3097fi
0db2ce77 3098echo "big-endian ${bigendian-no}"
e90f5b5a 3099echo "runtime cpu detection ${runtime_cpudetect-no}"
5b6c2cbd 3100if enabled x86; then
6348a96c 3101 echo "${yasmexe} ${yasm-no}"
0db2ce77 3102 echo "MMX enabled ${mmx-no}"
30e98e62 3103 echo "MMX2 enabled ${mmx2-no}"
3bf96eec 3104 echo "3DNow! enabled ${amd3dnow-no}"
a1ef9f08 3105 echo "3DNow! extended enabled ${amd3dnowext-no}"
1bb04d5a 3106 echo "SSE enabled ${sse-no}"
30e98e62 3107 echo "SSSE3 enabled ${ssse3-no}"
c73b779d 3108 echo "AVX enabled ${avx-no}"
0db2ce77
MR
3109 echo "CMOV enabled ${cmov-no}"
3110 echo "CMOV is fast ${fast_cmov-no}"
971cc990
MN
3111 echo "EBX available ${ebx_available-no}"
3112 echo "EBP available ${ebp_available-no}"
e41e8342 3113fi
5b6c2cbd 3114if enabled arm; then
0db2ce77
MR
3115 echo "ARMv5TE enabled ${armv5te-no}"
3116 echo "ARMv6 enabled ${armv6-no}"
ab5cb084 3117 echo "ARMv6T2 enabled ${armv6t2-no}"
f55b299a 3118 echo "ARM VFP enabled ${armvfp-no}"
0db2ce77 3119 echo "IWMMXT enabled ${iwmmxt-no}"
6b18d278 3120 echo "NEON enabled ${neon-no}"
eba9ae3c 3121fi
5b6c2cbd 3122if enabled mips; then
0db2ce77 3123 echo "MMI enabled ${mmi-no}"
e41e8342 3124fi
5b6c2cbd 3125if enabled ppc; then
0db2ce77 3126 echo "AltiVec enabled ${altivec-no}"
30e98e62 3127 echo "PPC 4xx optimizations ${ppc4xx-no}"
0db2ce77 3128 echo "dcbzl available ${dcbzl-no}"
30e98e62
DB
3129fi
3130if enabled sparc; then
3131 echo "VIS enabled ${vis-no}"
e41e8342 3132fi
0db2ce77 3133echo "debug symbols ${debug-no}"
f082a0fb 3134echo "optimize for size ${small-no}"
8400d6b8 3135echo "optimizations ${optimizations-no}"
0db2ce77
MR
3136echo "static ${static-no}"
3137echo "shared ${shared-no}"
4a24ab64 3138echo "postprocessing support ${postproc-no}"
f7679c54 3139echo "new filter support ${avfilter-no}"
0db2ce77 3140echo "network support ${network-no}"
0db2ce77
MR
3141echo "threading support ${thread_type-no}"
3142echo "SDL support ${sdl-no}"
0db2ce77 3143echo "Sun medialib support ${mlib-no}"
c562ba4c
DB
3144echo "libdxva2 enabled ${dxva2-no}"
3145echo "libva enabled ${vaapi-no}"
3146echo "libvdpau enabled ${vdpau-no}"
0db2ce77 3147echo "AVISynth enabled ${avisynth-no}"
47941088 3148echo "frei0r enabled ${frei0r-no}"
f7b8bffe 3149echo "libdc1394 support ${libdc1394-no}"
690bfceb 3150echo "libdirac enabled ${libdirac-no}"
0db2ce77 3151echo "libfaac enabled ${libfaac-no}"
0db2ce77
MR
3152echo "libgsm enabled ${libgsm-no}"
3153echo "libmp3lame enabled ${libmp3lame-no}"
3154echo "libnut enabled ${libnut-no}"
0b175caa
DB
3155echo "libopencore-amrnb support ${libopencore_amrnb-no}"
3156echo "libopencore-amrwb support ${libopencore_amrwb-no}"
6ebf0bfc 3157echo "libopencv support ${libopencv-no}"
9a77d59a 3158echo "libopenjpeg enabled ${libopenjpeg-no}"
0f943ce6 3159echo "librtmp enabled ${librtmp-no}"
f7cd9eed 3160echo "libschroedinger enabled ${libschroedinger-no}"
ae14f311 3161echo "libspeex enabled ${libspeex-no}"
0db2ce77 3162echo "libtheora enabled ${libtheora-no}"
d89e738a 3163echo "libvo-aacenc support ${libvo_aacenc-no}"
f502ff3f 3164echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
0db2ce77 3165echo "libvorbis enabled ${libvorbis-no}"
8299a7f8 3166echo "libvpx enabled ${libvpx-no}"
d6bd62db 3167echo "libx264 enabled ${libx264-no}"
de295976 3168echo "libxavs enabled ${libxavs-no}"
d6bd62db 3169echo "libxvid enabled ${libxvid-no}"
0db2ce77 3170echo "zlib enabled ${zlib-no}"
f402916e 3171echo "bzlib enabled ${bzlib-no}"
2c62e737 3172echo
de6d9b64 3173
5666fd73 3174for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
8138b9db 3175 echo "Enabled ${type}s:"
f65c9da1 3176 eval list=\$$(toupper $type)_LIST
fda299f0 3177 print_enabled '_*' $list | sort | pr -r -3 -t
f65c9da1 3178 echo
8138b9db
RP
3179done
3180
ba7a7039 3181license="LGPL version 2.1 or later"
ba321adb 3182if enabled nonfree; then
ba7a7039 3183 license="nonfree and unredistributable"
9cad0e4e
DB
3184elif enabled gplv3; then
3185 license="GPL version 3 or later"
3186elif enabled lgplv3; then
3187 license="LGPL version 3 or later"
ba321adb 3188elif enabled gpl; then
ba7a7039 3189 license="GPL version 2 or later"
ba321adb
JK
3190fi
3191
3192echo "License: $license"
ca5323af 3193
cf1392e9
DB
3194echo "Creating config.mak and config.h..."
3195
5e27ec28 3196test -e Makefile || $ln_s "$source_path/Makefile" .
df642790 3197
72cfcf41
MR
3198config_files="$TMPH config.mak"
3199
173c983b
MR
3200cat > config.mak <<EOF
3201# Automatically generated by configure - do not modify!
29ba0911 3202LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
173c983b
MR
3203prefix=$prefix
3204LIBDIR=\$(DESTDIR)$libdir
3205SHLIBDIR=\$(DESTDIR)$shlibdir
3206INCDIR=\$(DESTDIR)$incdir
3207BINDIR=\$(DESTDIR)$bindir
3208DATADIR=\$(DESTDIR)$datadir
3209MANDIR=\$(DESTDIR)$mandir
f038cf3c 3210SRC_PATH=$source_path
bb5cecdc 3211CC_IDENT=$cc_ident
173c983b
MR
3212ARCH=$arch
3213CC=$cc
3214AS=$as
3215LD=$ld
3216DEPCC=$dep_cc
3217YASM=$yasmexe
a4aea515 3218YASMDEP=$yasmexe
173c983b
MR
3219AR=$ar
3220RANLIB=$ranlib
3221LN_S=$ln_s
173c983b
MR
3222CPPFLAGS=$CPPFLAGS
3223CFLAGS=$CFLAGS
3224ASFLAGS=$ASFLAGS
bc877faf 3225AS_O=$CC_O
173c983b