Statistics
| Branch: | Revision:

ffmpeg / configure @ 2f821b03

History | View | Annotate | Download (88.8 KB)

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