Statistics
| Branch: | Revision:

ffmpeg / configure @ 4a7e068b

History | View | Annotate | Download (100 KB)

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