Statistics
| Branch: | Revision:

ffmpeg / configure @ 727a20cb

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