Statistics
| Branch: | Revision:

ffmpeg / configure @ 8cf2d3d3

History | View | Annotate | Download (99.8 KB)

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