Statistics
| Branch: | Revision:

ffmpeg / configure @ 3d7453e0

History | View | Annotate | Download (83.7 KB)

1
#!/bin/sh
2
#
3
# FFmpeg configure script
4
#
5
# Copyright (c) 2000-2002 Fabrice Bellard
6
# Copyright (c) 2005-2008 Diego Biurrun
7
# Copyright (c) 2005-2008 Mans Rullgard
8
#
9

    
10
# Prevent locale nonsense from breaking basic text processing.
11
LC_ALL=C
12
export LC_ALL
13

    
14
# make sure we are running under a compatible shell
15
# try to make this part work with most shells
16

    
17
try_exec(){
18
    echo "Trying shell $1"
19
    type "$1" > /dev/null 2>&1 && exec "$@"
20
}
21

    
22
unset foo
23
(: ${foo%%bar}) 2> /dev/null
24
E1="$?"
25

    
26
(: ${foo?}) 2> /dev/null
27
E2="$?"
28

    
29
if test "$E1" != 0 || test "$E2" = 0; then
30
    echo "Broken shell detected.  Trying alternatives."
31
    export FF_CONF_EXEC
32
    if test "0$FF_CONF_EXEC" -lt 1; then
33
        FF_CONF_EXEC=1
34
        try_exec bash "$0" "$@"
35
    fi
36
    if test "0$FF_CONF_EXEC" -lt 2; then
37
        FF_CONF_EXEC=2
38
        try_exec ksh "$0" "$@"
39
    fi
40
    if test "0$FF_CONF_EXEC" -lt 3; then
41
        FF_CONF_EXEC=3
42
        try_exec /usr/xpg4/bin/sh "$0" "$@"
43
    fi
44
    echo "No compatible shell script interpreter found."
45
    echo "This configure script requires a POSIX-compatible shell"
46
    echo "such as bash or ksh."
47
    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
    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
    exit 1
55
fi
56

    
57
show_help(){
58
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
  --disable-ffserver       disable ffserver build
86
  --enable-postproc        enable GPLed postprocessing support [no]
87
  --enable-avfilter        video filter support [no]
88
  --enable-avfilter-lavf   video filters dependent on avformat [no]
89
  --enable-beosthreads     use BeOS threads [no]
90
  --enable-os2threads      use OS/2 threads [no]
91
  --enable-pthreads        use pthreads [no]
92
  --enable-w32threads      use Win32 threads [no]
93
  --enable-x11grab         enable X11 grabbing [no]
94
  --disable-network        disable network support [no]
95
  --disable-ipv6           disable IPv6 support [no]
96
  --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
97
  --enable-gray            enable full grayscale support (slower color)
98
  --disable-swscale-alpha  disable alpha channel support in swscale
99
  --disable-fastdiv        disable table-based division
100
  --enable-small           optimize for size instead of speed
101
  --disable-aandct         disable AAN DCT code
102
  --disable-fft            disable FFT code
103
  --disable-golomb         disable Golomb code
104
  --disable-lpc            disable LPC code
105
  --disable-mdct           disable MDCT code
106
  --disable-rdft           disable RDFT code
107
  --disable-vaapi          disable VAAPI code
108
  --disable-vdpau          disable VDPAU code
109
  --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
110
  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
111
  --enable-memalign-hack   emulate memalign, interferes with memory debuggers
112
  --enable-beos-netserver  enable BeOS netserver
113
  --disable-encoder=NAME   disable encoder NAME
114
  --enable-encoder=NAME    enable encoder NAME
115
  --disable-encoders       disable all encoders
116
  --disable-decoder=NAME   disable decoder NAME
117
  --enable-decoder=NAME    enable decoder NAME
118
  --disable-decoders       disable all decoders
119
  --disable-hwaccel=NAME   disable hwaccel NAME
120
  --enable-hwaccel=NAME    enable hwaccel NAME
121
  --disable-hwaccels       disable all hwaccels
122
  --disable-muxer=NAME     disable muxer NAME
123
  --enable-muxer=NAME      enable muxer NAME
124
  --disable-muxers         disable all muxers
125
  --disable-demuxer=NAME   disable demuxer NAME
126
  --enable-demuxer=NAME    enable demuxer NAME
127
  --disable-demuxers       disable all demuxers
128
  --enable-parser=NAME     enable parser NAME
129
  --disable-parser=NAME    disable parser NAME
130
  --disable-parsers        disable all parsers
131
  --enable-bsf=NAME        enable bitstream filter NAME
132
  --disable-bsf=NAME       disable bitstream filter NAME
133
  --disable-bsfs           disable all bitstream filters
134
  --enable-protocol=NAME   enable protocol NAME
135
  --disable-protocol=NAME  disable protocol NAME
136
  --disable-protocols      disable all protocols
137
  --disable-indev=NAME     disable input device NAME
138
  --disable-outdev=NAME    disable output device NAME
139
  --disable-indevs         disable input devices
140
  --disable-outdevs        disable output devices
141
  --disable-devices        disable all devices
142
  --enable-filter=NAME     enable filter NAME
143
  --disable-filter=NAME    disable filter NAME
144
  --disable-filters        disable all filters
145
  --list-decoders          show all available decoders
146
  --list-encoders          show all available encoders
147
  --list-hwaccels          show all available hardware accelerators
148
  --list-muxers            show all available muxers
149
  --list-demuxers          show all available demuxers
150
  --list-parsers           show all available parsers
151
  --list-protocols         show all available protocols
152
  --list-bsfs              show all available bitstream filters
153
  --list-indevs            show all available input devices
154
  --list-outdevs           show all available output devices
155
  --list-filters           show all available filters
156

    
157
External library support:
158
  --enable-avisynth        enable reading of AVISynth script files [no]
159
  --enable-bzlib           enable bzlib [autodetect]
160
  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
161
  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
162
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
163
                           and libraw1394 [no]
164
  --enable-libdirac        enable Dirac support via libdirac [no]
165
  --enable-libfaac         enable FAAC support via libfaac [no]
166
  --enable-libfaad         enable FAAD support via libfaad [no]
167
  --enable-libfaadbin      open libfaad.so.0 at runtime [no]
168
  --enable-libgsm          enable GSM support via libgsm [no]
169
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
170
  --enable-libnut          enable NUT (de)muxing via libnut,
171
                           native (de)muxer exists [no]
172
  --enable-libopenjpeg     enable JPEG 2000 decoding via OpenJPEG [no]
173
  --enable-libschroedinger enable Dirac support via libschroedinger [no]
174
  --enable-libspeex        enable Speex decoding via libspeex [no]
175
  --enable-libtheora       enable Theora encoding via libtheora [no]
176
  --enable-libvorbis       enable Vorbis encoding via libvorbis,
177
                           native implementation exists [no]
178
  --enable-libx264         enable H.264 encoding via x264 [no]
179
  --enable-libxvid         enable Xvid encoding via xvidcore,
180
                           native MPEG-4/Xvid encoder exists [no]
181
  --enable-mlib            enable Sun medialib [no]
182
  --enable-zlib            enable zlib [autodetect]
183

    
184
Advanced options (experts only):
185
  --source-path=PATH       path to source code [$source_path]
186
  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
187
  --enable-cross-compile   assume a cross-compiler is used
188
  --sysroot=PATH           root of cross-build tree
189
  --sysinclude=PATH        location of cross-build system headers
190
  --target-os=OS           compiler targets OS [$target_os]
191
  --target-exec=CMD        command to run executables on target
192
  --target-path=DIR        path to view of build directory on target
193
  --nm=NM                  use nm tool
194
  --as=AS                  use assembler AS [$as_default]
195
  --cc=CC                  use C compiler CC [$cc_default]
196
  --ld=LD                  use linker LD
197
  --host-cc=HOSTCC         use host C compiler HOSTCC
198
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
199
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
200
  --host-libs=HLIBS        use libs HLIBS when linking for host
201
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
202
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
203
  --extra-libs=ELIBS       add ELIBS [$ELIBS]
204
  --extra-version=STRING   version string suffix []
205
  --build-suffix=SUFFIX    library name suffix []
206
  --arch=ARCH              select architecture [$arch]
207
  --cpu=CPU                select the minimum required CPU (affects
208
                           instruction selection, may crash on older CPUs)
209
  --enable-powerpc-perf    enable performance report on PPC
210
                           (requires enabling PMC)
211
  --disable-altivec        disable AltiVec optimizations
212
  --disable-amd3dnow       disable 3DNow! optimizations
213
  --disable-amd3dnowext    disable 3DNow! extended optimizations
214
  --disable-mmx            disable MMX optimizations
215
  --disable-mmx2           disable MMX2 optimizations
216
  --disable-sse            disable SSE optimizations
217
  --disable-ssse3          disable SSSE3 optimizations
218
  --disable-armv5te        disable armv5te optimizations
219
  --disable-armv6          disable armv6 optimizations
220
  --disable-armv6t2        disable armv6t2 optimizations
221
  --disable-armvfp         disable ARM VFP optimizations
222
  --disable-iwmmxt         disable iwmmxt optimizations
223
  --disable-mmi            disable MMI optimizations
224
  --disable-neon           disable neon optimizations
225
  --disable-vis            disable VIS optimizations
226
  --disable-yasm           disable use of yasm assembler
227
  --enable-pic             build position-independent code
228

    
229
Developer options (useful when working on FFmpeg itself):
230
  --disable-debug          disable debugging symbols
231
  --enable-debug=LEVEL     set the debug level [$debuglevel]
232
  --enable-gprof           enable profiling with gprof [$gprof]
233
  --disable-optimizations  disable compiler optimizations
234
  --enable-extra-warnings  enable more compiler warnings
235
  --disable-stripping      disable stripping of executables and shared libraries
236

    
237
NOTE: Object files are built at the place where configure is launched.
238
EOF
239
  exit 0
240
}
241

    
242
log(){
243
    echo "$@" >> $logfile
244
}
245

    
246
log_file(){
247
    log BEGIN $1
248
    pr -n -t $1 >> $logfile
249
    log END $1
250
}
251

    
252
echolog(){
253
    log "$@"
254
    echo "$@"
255
}
256

    
257
die(){
258
    echolog "$@"
259
    cat <<EOF
260

    
261
If you think configure made a mistake, make sure you are using the latest
262
version from SVN.  If the latest version fails, report the problem to the
263
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
264
EOF
265
    if disabled logging; then
266
        cat <<EOF
267
Rerun configure with logging enabled (do not use --disable-logging), and
268
include the log this produces with your report.
269
EOF
270
    else
271
cat <<EOF
272
Include the log file "$logfile" produced by configure as this will help
273
solving the problem.
274
EOF
275
    fi
276
    exit 1
277
}
278

    
279
# Avoid locale weirdness, besides we really just want to translate ASCII.
280
toupper(){
281
    echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
282
}
283

    
284
tolower(){
285
    echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
286
}
287

    
288
c_escape(){
289
    echo "$*" | sed 's/["\\]/\\\0/g'
290
}
291

    
292
sh_quote(){
293
    v=$(echo "$1" | sed "s/'/'\\\\''/g")
294
    test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
295
    echo "$v"
296
}
297

    
298
filter(){
299
    pat=$1
300
    shift
301
    for v; do
302
        eval "case $v in $pat) echo $v ;; esac"
303
    done
304
}
305

    
306
set_all(){
307
    value=$1
308
    shift
309
    for var in $*; do
310
        eval $var=$value
311
    done
312
}
313

    
314
set_weak(){
315
    value=$1
316
    shift
317
    for var; do
318
        eval : \${$var:=$value}
319
    done
320
}
321

    
322
pushvar(){
323
    for var in $*; do
324
        eval level=\${${var}_level:=0}
325
        eval ${var}_${level}="\$$var"
326
        eval ${var}_level=$(($level+1))
327
    done
328
}
329

    
330
popvar(){
331
    for var in $*; do
332
        eval level=\${${var}_level:-0}
333
        test $level = 0 && continue
334
        eval level=$(($level-1))
335
        eval $var="\${${var}_${level}}"
336
        eval ${var}_level=$level
337
        eval unset ${var}_${level}
338
    done
339
}
340

    
341
enable(){
342
    set_all yes $*
343
}
344

    
345
disable(){
346
    set_all no $*
347
}
348

    
349
enable_weak(){
350
    set_weak yes $*
351
}
352

    
353
disable_weak(){
354
    set_weak no $*
355
}
356

    
357
enable_safe(){
358
    for var; do
359
        enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
360
    done
361
}
362

    
363
disable_safe(){
364
    for var; do
365
        disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
366
    done
367
}
368

    
369
do_enable_deep(){
370
    for var; do
371
        enabled $var && continue
372
        eval sel="\$${var}_select"
373
        eval sgs="\$${var}_suggest"
374
        pushvar var sgs
375
        enable_deep $sel
376
        popvar sgs
377
        enable_deep_weak $sgs
378
        popvar var
379
    done
380
}
381

    
382
enable_deep(){
383
    do_enable_deep $*
384
    enable $*
385
}
386

    
387
enable_deep_weak(){
388
    do_enable_deep $*
389
    enable_weak $*
390
}
391

    
392
enabled(){
393
    test "${1#!}" = "$1" && op== || op=!=
394
    eval test "x\$${1#!}" $op "xyes"
395
}
396

    
397
disabled(){
398
    test "${1#!}" = "$1" && op== || op=!=
399
    eval test "x\$${1#!}" $op "xno"
400
}
401

    
402
enabled_all(){
403
    for opt; do
404
        enabled $opt || return 1
405
    done
406
}
407

    
408
disabled_all(){
409
    for opt; do
410
        disabled $opt || return 1
411
    done
412
}
413

    
414
enabled_any(){
415
    for opt; do
416
        enabled $opt && return 0
417
    done
418
}
419

    
420
disabled_any(){
421
    for opt; do
422
        disabled $opt && return 0
423
    done
424
    return 1
425
}
426

    
427
set_default(){
428
    for opt; do
429
        eval : \${$opt:=\$${opt}_default}
430
    done
431
}
432

    
433
is_in(){
434
    value=$1
435
    shift
436
    for var in $*; do
437
        [ $var = $value ] && return 0
438
    done
439
    return 1
440
}
441

    
442
check_deps(){
443
    for cfg; do
444
        cfg="${cfg#!}"
445
        enabled ${cfg}_checking && die "Circular dependency for $cfg."
446
        disabled ${cfg}_checking && continue
447
        enable ${cfg}_checking
448

    
449
        eval dep_all="\$${cfg}_deps"
450
        eval dep_any="\$${cfg}_deps_any"
451
        eval dep_sel="\$${cfg}_select"
452
        eval dep_sgs="\$${cfg}_suggest"
453
        eval dep_ifa="\$${cfg}_if"
454
        eval dep_ifn="\$${cfg}_if_any"
455

    
456
        pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
457
        check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
458
        popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
459

    
460
        [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
461
        [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
462
        enabled_all  $dep_all || disable $cfg
463
        enabled_any  $dep_any || disable $cfg
464
        disabled_any $dep_sel && disable $cfg
465

    
466
        if enabled $cfg; then
467
            eval dep_extralibs="\$${cfg}_extralibs"
468
            test -n "$dep_extralibs" && add_extralibs $dep_extralibs
469
            enable_deep $dep_sel
470
            enable_deep_weak $dep_sgs
471
        fi
472

    
473
        disable ${cfg}_checking
474
    done
475
}
476

    
477
print_config(){
478
    pfx=$1
479
    header=$2
480
    makefile=$3
481
    shift 3
482
    for cfg; do
483
        ucname="$(toupper $cfg)"
484
        if enabled $cfg; then
485
            echo "#define ${pfx}${ucname} 1" >> $header
486
            echo "${pfx}${ucname}=yes" >> $makefile
487
        else
488
            echo "#define ${pfx}${ucname} 0" >> $header
489
            echo "!${pfx}${ucname}=yes" >> $makefile
490
        fi
491
    done
492
}
493

    
494
flags_saved(){
495
    (: ${SAVE_CFLAGS?}) 2> /dev/null
496
}
497

    
498
save_flags(){
499
    flags_saved && return
500
    SAVE_CFLAGS="$CFLAGS"
501
    SAVE_LDFLAGS="$LDFLAGS"
502
    SAVE_extralibs="$extralibs"
503
}
504

    
505
restore_flags(){
506
    flags_saved || return
507
    CFLAGS="$SAVE_CFLAGS"
508
    LDFLAGS="$SAVE_LDFLAGS"
509
    extralibs="$SAVE_extralibs"
510
    unset SAVE_CFLAGS
511
    unset SAVE_LDFLAGS
512
    unset SAVE_extralibs
513
}
514

    
515
temp_cflags(){
516
    save_flags
517
    CFLAGS="$CFLAGS $*"
518
}
519

    
520
temp_ldflags(){
521
    save_flags
522
    LDFLAGS="$LDFLAGS $*"
523
}
524

    
525
temp_extralibs(){
526
    save_flags
527
    extralibs="$extralibs $*"
528
}
529

    
530
append(){
531
    var=$1
532
    shift
533
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
534
    eval "$var=\"\$$var $*\""
535
}
536

    
537
add_cppflags(){
538
    append CPPFLAGS $($filter_cppflags "$@")
539
}
540

    
541
add_cflags(){
542
    append CFLAGS $($filter_cflags "$@")
543
}
544

    
545
add_asflags(){
546
    append ASFLAGS $($filter_asflags "$@")
547
}
548

    
549
add_ldflags(){
550
    append LDFLAGS "$@"
551
}
552

    
553
add_extralibs(){
554
    append extralibs "$@"
555
}
556

    
557
check_cmd(){
558
    log "$@"
559
    "$@" >> $logfile 2>&1
560
}
561

    
562
check_cc(){
563
    log check_cc "$@"
564
    cat > $TMPC
565
    log_file $TMPC
566
    check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
567
}
568

    
569
check_cpp(){
570
    log check_cpp "$@"
571
    cat > $TMPC
572
    log_file $TMPC
573
    check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
574
}
575

    
576
check_as(){
577
    log check_as "$@"
578
    cat > $TMPC
579
    log_file $TMPC
580
    check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
581
}
582

    
583
check_asm(){
584
    log check_asm "$@"
585
    name="$1"
586
    asm="$2"
587
    shift 2
588
    disable $name
589
    check_as "$@" <<EOF && enable $name
590
void foo(void){ __asm__ volatile($asm); }
591
EOF
592
}
593

    
594
check_yasm(){
595
    log check_yasm "$@"
596
    echo "$1" > $TMPS
597
    log_file $TMPS
598
    shift 1
599
    check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
600
}
601

    
602
check_ld(){
603
    log check_ld "$@"
604
    check_cc || return
605
    flags=''
606
    libs=''
607
    for f; do
608
        test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
609
    done
610
    check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
611
}
612

    
613
check_cppflags(){
614
    log check_cppflags "$@"
615
    set -- $($filter_cppflags "$@")
616
    check_cc "$@" <<EOF && append CPPFLAGS "$@"
617
int x;
618
EOF
619
}
620

    
621
check_cflags(){
622
    log check_cflags "$@"
623
    set -- $($filter_cflags "$@")
624
    check_cc "$@" <<EOF && append CFLAGS "$@"
625
int x;
626
EOF
627
}
628

    
629
check_ldflags(){
630
    log check_ldflags "$@"
631
    check_ld "$@" <<EOF && add_ldflags "$@"
632
int main(void){ return 0; }
633
EOF
634
}
635

    
636
check_header(){
637
    log check_header "$@"
638
    header=$1
639
    shift
640
    disable_safe $header
641
    check_cpp "$@" <<EOF && enable_safe $header
642
#include <$header>
643
int x;
644
EOF
645
}
646

    
647
check_func(){
648
    log check_func "$@"
649
    func=$1
650
    shift
651
    disable $func
652
    check_ld "$@" <<EOF && enable $func
653
extern int $func();
654
int main(void){ $func(); }
655
EOF
656
}
657

    
658
check_func_headers(){
659
    log check_func_headers "$@"
660
    headers=$1
661
    func=$2
662
    shift 2
663
    disable $func
664
    incs=""
665
    for hdr in $headers; do
666
        incs="$incs
667
#include <$hdr>"
668
    done
669
    check_ld "$@" <<EOF && enable $func && enable_safe $headers
670
$incs
671
int main(int argc, char **argv){
672
    return (long) $func;
673
}
674
EOF
675
}
676

    
677
check_cpp_condition(){
678
    log check_cpp_condition "$@"
679
    header=$1
680
    condition=$2
681
    check_cpp <<EOF
682
#include <$header>
683
#if !($condition)
684
#error "unsatisfied condition: $condition"
685
#endif
686
EOF
687
}
688

    
689
check_lib(){
690
    log check_lib "$@"
691
    header="$1"
692
    func="$2"
693
    shift 2
694
    temp_extralibs "$@"
695
    check_header $header && check_func $func && add_extralibs "$@"
696
    err=$?
697
    restore_flags
698
    return $err
699
}
700

    
701
check_lib2(){
702
    log check_lib2 "$@"
703
    headers="$1"
704
    func="$2"
705
    shift 2
706
    temp_extralibs "$@"
707
    check_func_headers "$headers" $func && add_extralibs "$@"
708
    err=$?
709
    restore_flags
710
    return $err
711
}
712

    
713
check_exec(){
714
    check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
715
}
716

    
717
check_exec_crash(){
718
    code=$(cat)
719

    
720
    # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
721
    # are safe but may not be available everywhere.  Thus we use
722
    # raise(SIGTERM) instead.  The check is run in a subshell so we
723
    # can redirect the "Terminated" message from the shell.  SIGBUS
724
    # is not defined by standard C so it is used conditionally.
725

    
726
    (check_exec "$@") >> $logfile 2>&1 <<EOF
727
#include <signal.h>
728
static void sighandler(int sig){
729
    raise(SIGTERM);
730
}
731
int main(void){
732
    signal(SIGILL, sighandler);
733
    signal(SIGFPE, sighandler);
734
    signal(SIGSEGV, sighandler);
735
#ifdef SIGBUS
736
    signal(SIGBUS, sighandler);
737
#endif
738
    { $code }
739
}
740
EOF
741
}
742

    
743
check_type(){
744
    log check_type "$@"
745
    headers=$1
746
    type=$2
747
    shift 2
748
    disable_safe "$type"
749
    incs=""
750
    for hdr in $headers; do
751
        incs="$incs
752
#include <$hdr>"
753
    done
754
    check_cc "$@" <<EOF && enable_safe "$type"
755
$incs
756
$type v;
757
EOF
758
}
759

    
760
require(){
761
    name="$1"
762
    header="$2"
763
    func="$3"
764
    shift 3
765
    check_lib $header $func "$@" || die "ERROR: $name not found"
766
}
767

    
768
require2(){
769
    name="$1"
770
    headers="$2"
771
    func="$3"
772
    shift 3
773
    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
774
}
775

    
776
check_foo_config(){
777
    cfg=$1
778
    pkg=$2
779
    header=$3
780
    func=$4
781
    shift 4
782
    disable $cfg
783
    check_cmd ${pkg}-config --version
784
    err=$?
785
    if test "$err" = 0; then
786
        temp_cflags $(${pkg}-config --cflags)
787
        temp_extralibs $(${pkg}-config --libs)
788
        check_lib "$@" $header $func && enable $cfg
789
    fi
790
    return $err
791
}
792

    
793
check_host_cc(){
794
    log check_host_cc "$@"
795
    cat > $TMPC
796
    log_file $TMPC
797
    check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
798
}
799

    
800
check_host_cflags(){
801
    log check_host_cflags "$@"
802
    check_host_cc "$@" <<EOF && append host_cflags "$@"
803
int x;
804
EOF
805
}
806

    
807
apply(){
808
    file=$1
809
    shift
810
    "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
811
}
812

    
813
# CONFIG_LIST contains configurable options, while HAVE_LIST is for
814
# system-dependent things.
815

    
816
COMPONENT_LIST="
817
    bsfs
818
    decoders
819
    demuxers
820
    encoders
821
    filters
822
    hwaccels
823
    indevs
824
    muxers
825
    outdevs
826
    parsers
827
    protocols
828
"
829

    
830
CONFIG_LIST="
831
    $COMPONENT_LIST
832
    aandct
833
    avfilter
834
    avfilter_lavf
835
    avisynth
836
    beos_netserver
837
    bzlib
838
    doc
839
    fastdiv
840
    ffmpeg
841
    ffplay
842
    ffserver
843
    fft
844
    golomb
845
    gpl
846
    gprof
847
    gray
848
    hardcoded_tables
849
    ipv6
850
    libdc1394
851
    libdirac
852
    libfaac
853
    libfaad
854
    libfaadbin
855
    libgsm
856
    libmp3lame
857
    libnut
858
    libopencore_amrnb
859
    libopencore_amrwb
860
    libopenjpeg
861
    libschroedinger
862
    libspeex
863
    libtheora
864
    libvorbis
865
    libx264
866
    libxvid
867
    lpc
868
    mdct
869
    memalign_hack
870
    mlib
871
    mpegaudio_hp
872
    network
873
    nonfree
874
    pic
875
    postproc
876
    powerpc_perf
877
    rdft
878
    runtime_cpudetect
879
    shared
880
    small
881
    static
882
    swscale_alpha
883
    vaapi
884
    vdpau
885
    version3
886
    x11grab
887
    zlib
888
"
889

    
890
THREADS_LIST='
891
    beosthreads
892
    os2threads
893
    pthreads
894
    w32threads
895
'
896

    
897
ARCH_LIST='
898
    alpha
899
    arm
900
    avr32
901
    avr32_ap
902
    avr32_uc
903
    bfin
904
    ia64
905
    m68k
906
    mips
907
    mips64
908
    parisc
909
    ppc
910
    ppc64
911
    s390
912
    sh4
913
    sparc
914
    sparc64
915
    x86
916
    x86_32
917
    x86_64
918
'
919

    
920
ARCH_EXT_LIST='
921
    altivec
922
    amd3dnow
923
    amd3dnowext
924
    armv5te
925
    armv6
926
    armv6t2
927
    armvfp
928
    iwmmxt
929
    mmi
930
    mmx
931
    mmx2
932
    neon
933
    ppc4xx
934
    sse
935
    ssse3
936
    vis
937
'
938

    
939
HAVE_LIST="
940
    $ARCH_EXT_LIST
941
    $THREADS_LIST
942
    alsa_asoundlib_h
943
    altivec_h
944
    arpa_inet_h
945
    attribute_packed
946
    bigendian
947
    bswap
948
    closesocket
949
    cmov
950
    conio_h
951
    dcbzl
952
    dev_bktr_ioctl_bt848_h
953
    dev_bktr_ioctl_meteor_h
954
    dev_ic_bt8xx_h
955
    dev_video_meteor_ioctl_meteor_h
956
    dev_video_bktr_ioctl_bt848_h
957
    dlfcn_h
958
    dlopen
959
    dos_paths
960
    ebp_available
961
    ebx_available
962
    exp2
963
    exp2f
964
    fast_64bit
965
    fast_cmov
966
    fast_unaligned
967
    fork
968
    getaddrinfo
969
    gethrtime
970
    GetProcessTimes
971
    getrusage
972
    inet_aton
973
    inline_asm
974
    isatty
975
    ldbrx
976
    libdc1394_1
977
    libdc1394_2
978
    llrint
979
    log2
980
    log2f
981
    loongson
982
    lrint
983
    lrintf
984
    lzo1x_999_compress
985
    machine_ioctl_bt848_h
986
    machine_ioctl_meteor_h
987
    malloc_h
988
    memalign
989
    mkstemp
990
    pld
991
    posix_memalign
992
    round
993
    roundf
994
    sdl
995
    sdl_video_size
996
    setmode
997
    socklen_t
998
    soundcard_h
999
    poll_h
1000
    struct_addrinfo
1001
    struct_sockaddr_storage
1002
    sys_mman_h
1003
    sys_resource_h
1004
    sys_select_h
1005
    sys_soundcard_h
1006
    sys_videoio_h
1007
    ten_operands
1008
    termios_h
1009
    threads
1010
    truncf
1011
    vfp_args
1012
    VirtualAlloc
1013
    winsock2_h
1014
    xform_asm
1015
    yasm
1016
"
1017

    
1018
# options emitted with CONFIG_ prefix but not available on command line
1019
CONFIG_EXTRA="
1020
    gplv3
1021
    lgplv3
1022
"
1023

    
1024
CMDLINE_SELECT="
1025
    $ARCH_EXT_LIST
1026
    $CONFIG_LIST
1027
    $THREADS_LIST
1028
    cross_compile
1029
    debug
1030
    extra_warnings
1031
    logging
1032
    optimizations
1033
    stripping
1034
    yasm
1035
"
1036

    
1037
PATHS_LIST='
1038
    bindir
1039
    datadir
1040
    incdir
1041
    libdir
1042
    mandir
1043
    prefix
1044
    shlibdir
1045
'
1046

    
1047
CMDLINE_SET="
1048
    $PATHS_LIST
1049
    arch
1050
    as
1051
    build_suffix
1052
    cc
1053
    cpu
1054
    cross_prefix
1055
    dep_cc
1056
    extra_version
1057
    host_cc
1058
    host_cflags
1059
    host_ldflags
1060
    host_libs
1061
    host_os
1062
    ld
1063
    logfile
1064
    nm
1065
    source_path
1066
    sysinclude
1067
    sysroot
1068
    target_exec
1069
    target_os
1070
    target_path
1071
"
1072

    
1073
CMDLINE_APPEND="
1074
    extra_cflags
1075
"
1076

    
1077
# code dependency declarations
1078

    
1079
# architecture extensions
1080
altivec_deps="ppc"
1081
amd3dnow_deps="mmx"
1082
amd3dnowext_deps="amd3dnow"
1083
armv5te_deps="arm"
1084
armv6_deps="arm"
1085
armv6t2_deps="arm"
1086
armvfp_deps="arm"
1087
iwmmxt_deps="arm"
1088
mmi_deps="mips"
1089
mmx_deps="x86"
1090
mmx2_deps="mmx"
1091
neon_deps="arm"
1092
ppc4xx_deps="ppc"
1093
sse_deps="mmx"
1094
ssse3_deps="sse"
1095
vis_deps="sparc"
1096

    
1097
need_memalign="altivec neon sse"
1098
inline_asm_deps="!tms470"
1099

    
1100
# decoders / encoders / hardware accelerators
1101
aac_decoder_select="fft mdct aac_parser"
1102
aac_encoder_select="fft mdct"
1103
ac3_decoder_select="fft mdct ac3_parser"
1104
alac_encoder_select="lpc"
1105
atrac3_decoder_select="fft mdct"
1106
cavs_decoder_select="golomb"
1107
cook_decoder_select="fft mdct"
1108
cscd_decoder_suggest="zlib"
1109
dca_decoder_select="fft mdct"
1110
dnxhd_encoder_select="aandct"
1111
dxa_decoder_select="zlib"
1112
eac3_decoder_select="ac3_decoder"
1113
eamad_decoder_select="aandct"
1114
eatgq_decoder_select="aandct"
1115
eatqi_decoder_select="aandct"
1116
ffv1_decoder_select="golomb"
1117
flac_decoder_select="golomb"
1118
flac_encoder_select="golomb lpc"
1119
flashsv_decoder_select="zlib"
1120
flashsv_encoder_select="zlib"
1121
flv_decoder_select="h263_decoder"
1122
flv_encoder_select="h263_encoder"
1123
h261_encoder_select="aandct"
1124
h263_decoder_select="h263_parser"
1125
h263_encoder_select="aandct"
1126
h263_vaapi_hwaccel_deps="va_va_h"
1127
h263_vaapi_hwaccel_select="vaapi h263_decoder"
1128
h263i_decoder_select="h263_decoder"
1129
h263p_encoder_select="h263_encoder"
1130
h264_decoder_select="golomb"
1131
h264_vaapi_hwaccel_deps="va_va_h"
1132
h264_vaapi_hwaccel_select="vaapi"
1133
h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1134
h264_vdpau_decoder_select="vdpau h264_decoder"
1135
imc_decoder_select="fft mdct"
1136
jpegls_decoder_select="golomb"
1137
jpegls_encoder_select="golomb"
1138
ljpeg_encoder_select="aandct"
1139
loco_decoder_select="golomb"
1140
mjpeg_encoder_select="aandct"
1141
mlp_decoder_select="mlp_parser"
1142
mpeg1video_encoder_select="aandct"
1143
mpeg2video_encoder_select="aandct"
1144
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1145
mpeg4_encoder_select="h263_encoder"
1146
mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1147
mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1148
mpeg1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1149
mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1150
mpeg2_vaapi_hwaccel_deps="va_va_h"
1151
mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1152
mpeg4_vaapi_hwaccel_deps="va_va_h"
1153
mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1154
mpeg4_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1155
mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1156
mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1157
mpeg_xvmc_decoder_select="mpegvideo_decoder"
1158
msmpeg4v1_decoder_select="h263_decoder"
1159
msmpeg4v1_encoder_select="h263_encoder"
1160
msmpeg4v2_decoder_select="h263_decoder"
1161
msmpeg4v2_encoder_select="h263_encoder"
1162
msmpeg4v3_decoder_select="h263_decoder"
1163
msmpeg4v3_encoder_select="h263_encoder"
1164
nellymoser_decoder_select="fft mdct"
1165
nellymoser_encoder_select="fft mdct"
1166
png_decoder_select="zlib"
1167
png_encoder_select="zlib"
1168
qdm2_decoder_select="fft mdct rdft"
1169
rv10_decoder_select="h263_decoder"
1170
rv10_encoder_select="h263_encoder"
1171
rv20_decoder_select="h263_decoder"
1172
rv20_encoder_select="h263_encoder"
1173
rv30_decoder_select="golomb"
1174
rv40_decoder_select="golomb"
1175
shorten_decoder_select="golomb"
1176
sonic_decoder_select="golomb"
1177
sonic_encoder_select="golomb"
1178
sonic_ls_encoder_select="golomb"
1179
svq3_decoder_select="golomb"
1180
svq3_decoder_suggest="zlib"
1181
theora_decoder_select="vp3_decoder"
1182
tiff_decoder_suggest="zlib"
1183
tiff_encoder_suggest="zlib"
1184
truehd_decoder_select="mlp_decoder"
1185
tscc_decoder_select="zlib"
1186
vc1_decoder_select="h263_decoder"
1187
vc1_vaapi_hwaccel_deps="va_va_h"
1188
vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1189
vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1190
vc1_vdpau_decoder_select="vdpau vc1_decoder"
1191
vorbis_decoder_select="fft mdct"
1192
vorbis_encoder_select="fft mdct"
1193
vp6a_decoder_select="vp6_decoder"
1194
vp6f_decoder_select="vp6_decoder"
1195
wmav1_decoder_select="fft mdct"
1196
wmav1_encoder_select="fft mdct"
1197
wmav2_decoder_select="fft mdct"
1198
wmav2_encoder_select="fft mdct"
1199
wmv1_decoder_select="h263_decoder"
1200
wmv1_encoder_select="h263_encoder"
1201
wmv2_decoder_select="h263_decoder"
1202
wmv2_encoder_select="h263_encoder"
1203
wmv3_decoder_select="vc1_decoder"
1204
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1205
wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1206
zlib_decoder_select="zlib"
1207
zlib_encoder_select="zlib"
1208
zmbv_decoder_select="zlib"
1209
zmbv_encoder_select="zlib"
1210

    
1211
# parsers
1212
h264_parser_select="golomb"
1213

    
1214
# bitstream_filters
1215
aac_adtstoasc_bsf_select="aac_parser"
1216

    
1217
# external libraries
1218
libdirac_decoder_deps="libdirac !libschroedinger"
1219
libdirac_encoder_deps="libdirac"
1220
libfaac_encoder_deps="libfaac"
1221
libfaad_decoder_deps="libfaad"
1222
libfaadbin_decoder_extralibs='$ldl'
1223
libgsm_decoder_deps="libgsm"
1224
libgsm_encoder_deps="libgsm"
1225
libgsm_ms_decoder_deps="libgsm"
1226
libgsm_ms_encoder_deps="libgsm"
1227
libmp3lame_encoder_deps="libmp3lame"
1228
libopencore_amrnb_decoder_deps="libopencore_amrnb"
1229
libopencore_amrnb_encoder_deps="libopencore_amrnb"
1230
libopencore_amrwb_decoder_deps="libopencore_amrwb"
1231
libopenjpeg_decoder_deps="libopenjpeg"
1232
libschroedinger_decoder_deps="libschroedinger"
1233
libschroedinger_encoder_deps="libschroedinger"
1234
libspeex_decoder_deps="libspeex"
1235
libtheora_encoder_deps="libtheora"
1236
libvorbis_encoder_deps="libvorbis"
1237
libx264_encoder_deps="libx264"
1238
libxvid_encoder_deps="libxvid"
1239

    
1240
# demuxers / muxers
1241
ac3_demuxer_deps="ac3_parser"
1242
asf_stream_muxer_select="asf_muxer"
1243
avisynth_demuxer_deps="avisynth"
1244
dirac_demuxer_deps="dirac_parser"
1245
eac3_demuxer_select="ac3_parser"
1246
ipod_muxer_select="mov_muxer"
1247
libnut_demuxer_deps="libnut"
1248
libnut_muxer_deps="libnut"
1249
matroska_audio_muxer_select="matroska_muxer"
1250
matroska_demuxer_suggest="zlib bzlib"
1251
mov_demuxer_suggest="zlib"
1252
mp3_demuxer_deps="mpegaudio_parser"
1253
mp4_muxer_select="mov_muxer"
1254
mpegtsraw_demuxer_select="mpegts_demuxer"
1255
mxf_d10_muxer_select="mxf_muxer"
1256
ogg_demuxer_select="golomb"
1257
psp_muxer_select="mov_muxer"
1258
rtsp_demuxer_deps="sdp_demuxer"
1259
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
1260
spdif_muxer_select="aac_parser"
1261
tg2_muxer_select="mov_muxer"
1262
tgp_muxer_select="mov_muxer"
1263
w64_demuxer_deps="wav_demuxer"
1264

    
1265
# indevs / outdevs
1266
alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
1267
alsa_indev_extralibs="-lasound"
1268
alsa_outdev_deps="alsa_asoundlib_h"
1269
alsa_outdev_extralibs="-lasound"
1270
audio_beos_indev_deps="audio_beos"
1271
audio_beos_indev_extralibs="-lmedia -lbe"
1272
audio_beos_outdev_deps="audio_beos"
1273
audio_beos_outdev_extralibs="-lmedia -lbe"
1274
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1275
dv1394_indev_deps="dv1394 dv_demuxer"
1276
jack_indev_deps="jack_jack_h"
1277
jack_indev_extralibs="-ljack"
1278
libdc1394_indev_deps="libdc1394"
1279
oss_indev_deps_any="soundcard_h sys_soundcard_h"
1280
oss_outdev_deps_any="soundcard_h sys_soundcard_h"
1281
v4l_indev_deps="linux_videodev_h"
1282
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
1283
vfwcap_indev_deps="capCreateCaptureWindow"
1284
vfwcap_indev_extralibs="-lvfw32"
1285
x11_grab_device_indev_deps="x11grab XShmCreateImage"
1286
x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
1287

    
1288
# protocols
1289
gopher_protocol_deps="network"
1290
http_protocol_deps="network"
1291
rtmp_protocol_deps="tcp_protocol"
1292
rtp_protocol_deps="udp_protocol"
1293
tcp_protocol_deps="network"
1294
udp_protocol_deps="network"
1295

    
1296
# filters
1297
movie_filter_deps="avfilter_lavf"
1298

    
1299
# programs
1300
ffplay_deps="sdl"
1301
ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
1302
ffserver_extralibs='$ldl'
1303

    
1304
doc_deps="texi2html"
1305

    
1306
# default parameters
1307

    
1308
logfile="config.err"
1309

    
1310
# installation paths
1311
prefix_default="/usr/local"
1312
bindir_default='${prefix}/bin'
1313
datadir_default='${prefix}/share/ffmpeg'
1314
incdir_default='${prefix}/include'
1315
libdir_default='${prefix}/lib'
1316
mandir_default='${prefix}/share/man'
1317
shlibdir_default="$libdir_default"
1318

    
1319
# toolchain
1320
ar="ar"
1321
cc_default="gcc"
1322
cc_version=\"unknown\"
1323
host_cc_default="gcc"
1324
ln_s="ln -sf"
1325
nm_default="nm"
1326
objformat="elf"
1327
ranlib="ranlib"
1328
strip="strip"
1329
yasmexe="yasm"
1330

    
1331
# machine
1332
arch=$(uname -m)
1333
cpu="generic"
1334

    
1335
# OS
1336
target_os=$(tolower $(uname -s))
1337
host_os=$target_os
1338

    
1339
# configurable options
1340
enable debug
1341
enable doc
1342
enable fastdiv
1343
enable ffmpeg
1344
enable ffplay
1345
enable ffserver
1346
enable ipv6
1347
enable mpegaudio_hp
1348
enable network
1349
enable optimizations
1350
enable protocols
1351
enable static
1352
enable stripping
1353
enable swscale_alpha
1354

    
1355
# build settings
1356
SHFLAGS='-shared -Wl,-soname,$$(@F)'
1357
FFSERVERLDFLAGS=-Wl,-E
1358
LIBPREF="lib"
1359
LIBSUF=".a"
1360
FULLNAME='$(NAME)$(BUILDSUF)'
1361
LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1362
SLIBPREF="lib"
1363
SLIBSUF=".so"
1364
SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1365
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1366
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1367
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1368

    
1369
CC_O='-o $@'
1370

    
1371
host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
1372
host_libs='-lm'
1373

    
1374
target_path='.'
1375

    
1376
# gcc stupidly only outputs the basename of targets with -MM, but we need the
1377
# full relative path for objects in subdirectories for non-recursive Make.
1378
DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
1379
DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
1380

    
1381
# find source path
1382
source_path="$(dirname "$0")"
1383
enable source_path_used
1384
if test -f configure; then
1385
    source_path="$(pwd)"
1386
    disable source_path_used
1387
else
1388
    source_path="$(cd "$source_path"; pwd)"
1389
    echo "$source_path" | grep -q '[[:blank:]]' &&
1390
        die "Out of tree builds are impossible with whitespace in source path."
1391
    test -e "$source_path/config.h" &&
1392
        die "Out of tree builds are impossible with config.h in source dir."
1393
fi
1394

    
1395
for v in "$@"; do
1396
    r=${v#*=}
1397
    l=${v%"$r"}
1398
    r=$(sh_quote "$r")
1399
    FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
1400
done
1401

    
1402
find_things(){
1403
    thing=$1
1404
    pattern=$2
1405
    file=$source_path/$3
1406
    sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1407
}
1408

    
1409
ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
1410
DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
1411
HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
1412
PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
1413
BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
1414
MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
1415
DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
1416
OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
1417
INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
1418
PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1419
FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
1420

    
1421
enable $ARCH_EXT_LIST \
1422
       $DECODER_LIST \
1423
       $ENCODER_LIST \
1424
       $HWACCEL_LIST \
1425
       $PARSER_LIST \
1426
       $BSF_LIST \
1427
       $DEMUXER_LIST \
1428
       $MUXER_LIST \
1429
       $FILTER_LIST \
1430
       $PROTOCOL_LIST \
1431
       $INDEV_LIST \
1432
       $OUTDEV_LIST \
1433

    
1434
die_unknown(){
1435
    echo "Unknown option \"$1\"."
1436
    echo "See $0 --help for available options."
1437
    exit 1
1438
}
1439

    
1440
show_list() {
1441
    suffix=_$1
1442
    shift
1443
    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1444
    exit 0
1445
}
1446

    
1447
for opt do
1448
    optval="${opt#*=}"
1449
    case "$opt" in
1450
    --extra-ldflags=*) add_ldflags $optval
1451
    ;;
1452
    --extra-libs=*) add_extralibs $optval
1453
    ;;
1454
    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1455
    ;;
1456
    --enable-debug=*) debuglevel="$optval"
1457
    ;;
1458
    --enable-*=*|--disable-*=*)
1459
    eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1460
    is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1461
    eval list=\$$(toupper $thing)_LIST
1462
    name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1463
    $action $(filter "$name" $list)
1464
    ;;
1465
    --enable-?*|--disable-?*)
1466
    eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1467
    if is_in $option $COMPONENT_LIST; then
1468
        test $action = disable && action=unset
1469
        eval $action \$$(toupper ${option%s})_LIST
1470
    elif is_in $option $CMDLINE_SELECT; then
1471
        $action $option
1472
    else
1473
        die_unknown $opt
1474
    fi
1475
    ;;
1476
    --list-*)
1477
        NAME="${opt#--list-}"
1478
        is_in $NAME $COMPONENT_LIST || die_unknown $opt
1479
        NAME=${NAME%s}
1480
        eval show_list $NAME \$$(toupper $NAME)_LIST
1481
    ;;
1482
    --help|-h) show_help
1483
    ;;
1484
    *)
1485
    optname="${opt%%=*}"
1486
    optname="${optname#--}"
1487
    optname=$(echo "$optname" | sed 's/-/_/g')
1488
    if is_in $optname $CMDLINE_SET; then
1489
        eval $optname='$optval'
1490
    elif is_in $optname $CMDLINE_APPEND; then
1491
        append $optname "$optval"
1492
    else
1493
         die_unknown $opt
1494
    fi
1495
    ;;
1496
    esac
1497
done
1498

    
1499
disabled logging && logfile=/dev/null
1500

    
1501
echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
1502
set >> $logfile
1503

    
1504
test -n "$cross_prefix" && enable cross_compile
1505

    
1506
ar="${cross_prefix}${ar}"
1507
cc_default="${cross_prefix}${cc_default}"
1508
nm_default="${cross_prefix}${nm_default}"
1509
ranlib="${cross_prefix}${ranlib}"
1510
strip="${cross_prefix}${strip}"
1511

    
1512
sysinclude_default="${sysroot}/usr/include"
1513

    
1514
set_default cc nm sysinclude
1515
enabled cross_compile || host_cc_default=$cc
1516
set_default host_cc
1517

    
1518
exesuf() {
1519
    case $1 in
1520
        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
1521
    esac
1522
}
1523

    
1524
EXESUF=$(exesuf $target_os)
1525
HOSTEXESUF=$(exesuf $host_os)
1526

    
1527
# set temporary file name
1528
: ${TMPDIR:=$TEMPDIR}
1529
: ${TMPDIR:=$TMP}
1530
: ${TMPDIR:=/tmp}
1531

    
1532
if ! check_cmd type mktemp; then
1533
    # simple replacement for missing mktemp
1534
    # NOT SAFE FOR GENERAL USE
1535
    mktemp(){
1536
        echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
1537
    }
1538
fi
1539

    
1540
tmpfile(){
1541
    tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1542
        (set -C; exec > $tmp) 2>/dev/null ||
1543
        die "Unable to create temporary file in $TMPDIR."
1544
    append TMPFILES $tmp
1545
    eval $1=$tmp
1546
}
1547

    
1548
trap 'rm -f -- $TMPFILES' EXIT
1549
trap exit HUP INT TERM
1550

    
1551
tmpfile TMPC  .c
1552
tmpfile TMPE  $EXESUF
1553
tmpfile TMPH  .h
1554
tmpfile TMPO  .o
1555
tmpfile TMPS  .S
1556
tmpfile TMPSH .sh
1557

    
1558
unset -f mktemp
1559

    
1560
# make sure we can execute files in $TMPDIR
1561
cat > $TMPSH 2>> $logfile <<EOF
1562
#! /bin/sh
1563
EOF
1564
chmod +x $TMPSH >> $logfile 2>&1
1565
if ! $TMPSH >> $logfile 2>&1; then
1566
    cat <<EOF
1567
Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
1568
variable to another directory and make sure that it is not mounted noexec.
1569
EOF
1570
    die "Sanity test failed."
1571
fi
1572

    
1573
filter_cflags=echo
1574
filter_cppflags=echo
1575
filter_asflags=echo
1576

    
1577
if   $cc -v 2>&1 | grep -qi ^gcc; then
1578
    cc_type=gcc
1579
    cc_version=__VERSION__
1580
    if ! $cc -dumpversion | grep -q '^2\.'; then
1581
        CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1582
        AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
1583
    fi
1584
elif $cc --version 2>/dev/null | grep -q Intel; then
1585
    cc_type=icc
1586
    cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
1587
    CC_DEPFLAGS='-MMD'
1588
    AS_DEPFLAGS='-MMD'
1589
elif $cc -v 2>&1 | grep -q xlc; then
1590
    cc_type=xlc
1591
    cc_version="AV_STRINGIFY(__IBMC__)"
1592
elif $cc -V 2>/dev/null | grep -q Compaq; then
1593
    cc_type=ccc
1594
    cc_version="AV_STRINGIFY(__DECC_VER)"
1595
    DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
1596
    debuglevel=3
1597
    add_ldflags -Wl,-z,now # calls to libots crash without this
1598
elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
1599
    test -d "$sysroot" || die "No valid sysroot specified."
1600
    cc_type=armcc
1601
    cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
1602
    armcc_conf="$PWD/armcc.conf"
1603
    $cc --arm_linux_configure                 \
1604
        --arm_linux_config_file="$armcc_conf" \
1605
        --configure_sysroot="$sysroot"        \
1606
        --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
1607
        die "Error creating armcc configuration file."
1608
    cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
1609
    as_default="${cross_prefix}gcc"
1610
    CC_DEPFLAGS='-MMD'
1611
    AS_DEPFLAGS='-MMD'
1612
elif $cc -version 2>/dev/null | grep -q TMS470; then
1613
    cc_type=tms470
1614
    cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
1615
    cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
1616
    CC_O='-fr=$(@D)'
1617
    as_default="${cross_prefix}gcc"
1618
    ld_default="${cross_prefix}gcc"
1619
    TMPO=$(basename $TMPC .c).o
1620
    append TMPFILES $TMPO
1621
    add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
1622
    CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
1623
    AS_DEPFLAGS='-MMD'
1624
    filter_cflags=tms470_flags
1625
    tms470_flags(){
1626
        for flag; do
1627
            case $flag in
1628
                -march=*|-mcpu=*)
1629
                    case "${flag#*=}" in
1630
                        armv7-a|cortex-a*)      echo -mv=7a8 ;;
1631
                        armv7-r|cortex-r*)      echo -mv=7r4 ;;
1632
                        armv7-m|cortex-m*)      echo -mv=7m3 ;;
1633
                        armv6*|arm11*)          echo -mv=6   ;;
1634
                        armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
1635
                                                echo -mv=5e  ;;
1636
                        armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
1637
                    esac
1638
                    ;;
1639
                -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
1640
                -mfpu=vfp)      echo --float_support=vfpv2        ;;
1641
                -msoft-float)   echo --float_support=vfplib       ;;
1642
                -Os)            echo -O3 -mf=2                    ;;
1643
                -O[0-3])        echo $flag -mf=5                  ;;
1644
                -g)             echo -g -mn                       ;;
1645
            esac
1646
        done
1647
    }
1648
elif $cc -v 2>&1 | grep -q clang; then
1649
    cc_type=clang
1650
    cc_version=__VERSION__
1651
    CC_DEPFLAGS='-MMD'
1652
    AS_DEPFLAGS='-MMD'
1653
elif $cc -V 2>&1 | grep -q Sun; then
1654
    cc_type=suncc
1655
    cc_version="AV_STRINGIFY(__SUNPRO_C)"
1656
    DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
1657
    DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
1658
    filter_cflags=suncc_flags
1659
    suncc_flags(){
1660
        for flag; do
1661
            case $flag in
1662
                -march=*|-mcpu=*)
1663
                    case "${flag#*=}" in
1664
                        native)                   echo -xtarget=native       ;;
1665
                        v9)                       echo -xarch=sparc          ;;
1666
                        ultrasparc)               echo -xarch=sparcvis       ;;
1667
                        ultrasparc3|niagara*)     echo -xarch=sparcvis2      ;;
1668
                        i586|pentium)             echo -xchip=pentium        ;;
1669
                        i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
1670
                        pentium3*|c3-2)           echo -xtarget=pentium3     ;;
1671
                        pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
1672
                        pentium4*)          echo -xtarget=pentium4           ;;
1673
                        prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
1674
                        *-sse3)             echo -xarch=sse3                 ;;
1675
                        core2)              echo -xarch=ssse3 -xchip=core2   ;;
1676
                        amdfam10|barcelona)       echo -xarch=sse4_1         ;;
1677
                        athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
1678
                        k8|opteron|athlon64|athlon-fx)
1679
                                                  echo -xarch=sse2a          ;;
1680
                        athlon*)                  echo -xarch=pentium_proa   ;;
1681
                    esac
1682
                    ;;
1683
                -std=c99)             echo -xc99              ;;
1684
                -fomit-frame-pointer) echo -xregs=frameptr    ;;
1685
                -fPIC)                echo -KPIC -xcode=pic32 ;;
1686
                -Os)                  echo -O5 -xspace        ;;
1687
                -W*,*)                echo $flag              ;;
1688
                -f*-*|-W*)                                    ;;
1689
                *)                    echo $flag              ;;
1690
            esac
1691
        done
1692
    }
1693
fi
1694

    
1695
test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
1696

    
1697
: ${as_default:=$cc}
1698
: ${dep_cc_default:=$cc}
1699
: ${ld_default:=$cc}
1700
set_default as dep_cc ld
1701

    
1702
test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
1703
test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
1704

    
1705
add_cflags $extra_cflags
1706
add_asflags $extra_cflags
1707

    
1708
if test -n "$sysroot"; then
1709
    case "$cc_type" in
1710
        gcc)
1711
            add_cppflags --sysroot="$sysroot"
1712
            add_ldflags --sysroot="$sysroot"
1713
        ;;
1714
        tms470)
1715
            add_cppflags -I"$sysinclude"
1716
            add_ldflags  --sysroot="$sysroot"
1717
        ;;
1718
        clang)
1719
            add_cppflags -isysroot="$sysroot"
1720
            add_ldflags -isysroot="$sysroot"
1721
        ;;
1722
    esac
1723
fi
1724

    
1725
if test "$cpu" = host; then
1726
    enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
1727

    
1728
    case "$cc_type" in
1729
        gcc)
1730
            check_native(){
1731
                $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
1732
                awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
1733
            }
1734
            cpu=$(check_native -march || check_native -mcpu)
1735
        ;;
1736
    esac
1737

    
1738
    test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
1739
fi
1740

    
1741
# Add processor-specific flags
1742
case $cpu in
1743
    601|ppc601|PowerPC601)
1744
        cpuflags="-mcpu=601"
1745
    ;;
1746
    603*|ppc603*|PowerPC603*)
1747
        cpuflags="-mcpu=603"
1748
    ;;
1749
    604*|ppc604*|PowerPC604*)
1750
        cpuflags="-mcpu=604"
1751
    ;;
1752
    G3|g3|75*|ppc75*|PowerPC75*)
1753
        cpuflags="-mcpu=750 -mpowerpc-gfxopt"
1754
    ;;
1755
    G4|g4|745*|ppc745*|PowerPC745*)
1756
        cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
1757
    ;;
1758
    74*|ppc74*|PowerPC74*)
1759
        cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
1760
    ;;
1761
    G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1762
        cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1763
    ;;
1764
    Cell|CELL|cell)
1765
        cpuflags="-mcpu=cell"
1766
        enable ldbrx
1767
    ;;
1768
    # targets that do NOT support conditional mov (cmov)
1769
    i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1770
        cpuflags="-march=$cpu"
1771
        disable cmov
1772
    ;;
1773
    # targets that do support conditional mov (cmov)
1774
    i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
1775
        cpuflags="-march=$cpu"
1776
        enable cmov
1777
        enable fast_cmov
1778
    ;;
1779
    # targets that do support conditional mov but on which it's slow
1780
    pentium4|pentium4m|prescott|nocona)
1781
        cpuflags="-march=$cpu"
1782
        enable cmov
1783
        disable fast_cmov
1784
    ;;
1785
    sparc64)
1786
        cpuflags="-mcpu=v9"
1787
    ;;
1788
    arm11*|cortex*)
1789
        cpuflags="-mcpu=$cpu"
1790
        enable fast_unaligned
1791
    ;;
1792
    armv[67]*)
1793
        cpuflags="-march=$cpu"
1794
        enable fast_unaligned
1795
    ;;
1796
    armv*)
1797
        cpuflags="-march=$cpu"
1798
    ;;
1799
    arm*)
1800
        cpuflags="-mcpu=$cpu"
1801
    ;;
1802
    ev4|ev45|ev5|ev56|pca56|ev6|ev67)
1803
        enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
1804
    ;;
1805
    bf*)
1806
        cpuflags="-mcpu=$cpu"
1807
    ;;
1808
    mips*|[45]k*|[237]4k*|m4k|r*000|loongson2[ef])
1809
        cpuflags="-march=$cpu"
1810
    ;;
1811
    ap7[02]0[0-2])
1812
        subarch="avr32_ap"
1813
        cpuflags="-mpart=$cpu"
1814
    ;;
1815
    ap)
1816
        subarch="avr32_ap"
1817
        cpuflags="-march=$cpu"
1818
    ;;
1819
    uc3[ab]*)
1820
        subarch="avr32_uc"
1821
        cpuflags="-mcpu=$cpu"
1822
    ;;
1823
    uc)
1824
        subarch="avr32_uc"
1825
        cpuflags="-march=$cpu"
1826
    ;;
1827
    generic)
1828
    ;;
1829
    *)
1830
        echo "WARNING: Unknown CPU \"$cpu\", ignored."
1831
    ;;
1832
esac
1833

    
1834
add_cflags $cpuflags
1835
add_asflags $cpuflags
1836

    
1837
# compiler sanity check
1838
check_exec <<EOF
1839
int main(void){ return 0; }
1840
EOF
1841
if test "$?" != 0; then
1842
    echo "$cc is unable to create an executable file."
1843
    if test -z "$cross_prefix" && ! enabled cross_compile ; then
1844
        echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1845
        echo "Only do this if you know what cross compiling means."
1846
    fi
1847
    die "C compiler test failed."
1848
fi
1849

    
1850
add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
1851
check_cflags -std=c99
1852
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
1853
#include <stdlib.h>
1854
EOF
1855
check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
1856
#include <stdlib.h>
1857
EOF
1858

    
1859
check_host_cflags -std=c99
1860

    
1861
case "$arch" in
1862
    alpha)
1863
        arch="alpha"
1864
        enable fast_64bit
1865
        check_cflags -mieee
1866
        spic=$shared
1867
    ;;
1868
    arm|armv[4567]*l)
1869
        arch="arm"
1870
    ;;
1871
    avr32)
1872
    ;;
1873
    bfin)
1874
        arch="bfin"
1875
    ;;
1876
    ia64)
1877
        arch="ia64"
1878
        enable fast_64bit
1879
        spic=$shared
1880
        # HACK: currently fails to build if .bss is > 4MB and shared libs are built
1881
        enabled shared && enable_weak hardcoded_tables
1882
    ;;
1883
    m68k)
1884
        arch="m68k"
1885
    ;;
1886
    mips|mipsel|IP*)
1887
        arch="mips"
1888
        spic=$shared
1889
    ;;
1890
    mips64)
1891
        arch="mips"
1892
        subarch="mips64"
1893
        enable fast_64bit
1894
        spic=$shared
1895
    ;;
1896
    parisc|hppa)
1897
        arch="parisc"
1898
        spic=$shared
1899
    ;;
1900
    parisc64|hppa64)
1901
        arch="parisc"
1902
        enable fast_64bit
1903
        spic=$shared
1904
    ;;
1905
    "Power Macintosh"|ppc|powerpc)
1906
        arch="ppc"
1907
        enable fast_unaligned
1908
    ;;
1909
    ppc64)
1910
        arch="ppc"
1911
        subarch="ppc64"
1912
        enable fast_64bit
1913
        enable fast_unaligned
1914
    ;;
1915
    s390|s390x)
1916
        arch="s390"
1917
    ;;
1918
    sh4|sh)
1919
        arch="sh4"
1920
    ;;
1921
    sparc)
1922
        arch="sparc"
1923
        spic=$shared
1924
    ;;
1925
    sun4u|sparc64)
1926
        arch="sparc"
1927
        subarch="sparc64"
1928
        enable fast_64bit
1929
        spic=$shared
1930
    ;;
1931
    i386|i486|i586|i686|i86pc|BePC|x86_64|amd64)
1932
        arch="x86"
1933
        subarch="x86_32"
1934
        enable fast_unaligned
1935
        check_cc <<EOF && enable fast_64bit && subarch="x86_64" && spic=$shared
1936
        int test[(int)sizeof(char*) - 7];
1937
EOF
1938
        if test "$subarch" = "x86_64"; then
1939
            enable cmov
1940
            enable fast_cmov
1941
        fi
1942
    ;;
1943
    *)
1944
        arch="unknown"
1945
    ;;
1946
esac
1947

    
1948
enable $arch $subarch
1949
enabled spic && enable pic
1950
check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
1951

    
1952
# OS specific
1953
case $target_os in
1954
    beos|haiku|zeta)
1955
        prefix_default="$HOME/config"
1956
        # 3 gcc releases known for BeOS, each with ugly bugs
1957
        gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
1958
        case "$gcc_version" in
1959
          2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1960
            disable mmx
1961
            ;;
1962
          *20010315*) echo "BeBits gcc"
1963
            add_cflags -fno-expensive-optimizations
1964
            ;;
1965
        esac
1966
        SHFLAGS=-nostart
1967
        # enable BeOS things
1968
        enable audio_beos
1969
        # no need for libm, but the inet stuff
1970
        # Check for BONE
1971
        # XXX: actually should check for NOT net_server
1972
        if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1973
            network_extralibs="-lbind -lsocket"
1974
        else
1975
            enable beos_netserver
1976
            network_extralibs="-lnet"
1977
        fi ;;
1978
    sunos)
1979
        FFSERVERLDFLAGS=""
1980
        SHFLAGS='-shared -Wl,-h,$$(@F)'
1981
        enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
1982
        network_extralibs="-lsocket -lnsl"
1983
        add_cppflags -D__EXTENSIONS__
1984
        ;;
1985
    netbsd)
1986
        oss_indev_extralibs="-lossaudio"
1987
        oss_outdev_extralibs="-lossaudio"
1988
        ;;
1989
    openbsd)
1990
        enable malloc_aligned
1991
        # On OpenBSD 4.5. the compiler does not use PIC unless
1992
        # explicitly using -fPIC. FFmpeg builds fine without PIC,
1993
        # however the generated executable will not do anything
1994
        # (simply quits with exit-code 1, no crash, no output).
1995
        # Thus explicitly enable PIC here.
1996
        enable pic
1997
        SHFLAGS='-shared'
1998
        oss_indev_extralibs="-lossaudio"
1999
        oss_outdev_extralibs="-lossaudio"
2000
        ;;
2001
    freebsd|dragonfly)
2002
        enable malloc_aligned
2003
        ;;
2004
    bsd/os)
2005
        osextralibs="-lpoll -lgnugetopt"
2006
        strip="strip -d"
2007
        ;;
2008
    darwin)
2009
        enable malloc_aligned
2010
        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
2011
        strip="strip -x"
2012
        FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
2013
        SLIBSUF=".dylib"
2014
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
2015
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
2016
        FFSERVERLDFLAGS=-Wl,-bind_at_load
2017
        objformat="macho"
2018
        enabled x86_64 && objformat="macho64"
2019
        enabled_any pic shared ||
2020
            { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
2021
        ;;
2022
    mingw32*)
2023
        if test $target_os = "mingw32ce"; then
2024
            disable network
2025
        else
2026
            target_os=mingw32
2027
        fi
2028
        LIBTARGET=i386
2029
        if enabled x86_64; then
2030
            enable malloc_aligned
2031
            LIBTARGET=x64
2032
        elif enabled arm; then
2033
            LIBTARGET=arm
2034
        fi
2035
        shlibdir_default="$bindir_default"
2036
        disable ffserver
2037
        SLIBPREF=""
2038
        SLIBSUF=".dll"
2039
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2040
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2041
        SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
2042
        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
2043
            install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
2044
            install -d "$(LIBDIR)"; \
2045
            install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
2046
        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
2047
        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'
2048
        objformat="win32"
2049
        enable dos_paths
2050
        check_cflags -fno-common
2051
        if ! enabled x86_64; then
2052
            check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
2053
                die "ERROR: MinGW runtime version must be >= 3.15."
2054
            enabled_any avisynth vfwcap_indev &&
2055
                { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
2056
                  die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
2057
            fi
2058
        ;;
2059
    cygwin*)
2060
        target_os=cygwin
2061
        shlibdir_default="$bindir_default"
2062
        SLIBPREF="cyg"
2063
        SLIBSUF=".dll"
2064
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2065
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2066
        SHFLAGS='-shared -Wl,--enable-auto-image-base'
2067
        objformat="win32"
2068
        enable dos_paths
2069
        check_cflags -fno-common
2070
        ;;
2071
    *-dos|freedos|opendos)
2072
        disable ffplay ffserver
2073
        disable $INDEV_LIST $OUTDEV_LIST
2074
        network_extralibs="-lsocket"
2075
        objformat="coff"
2076
        enable dos_paths
2077
        ;;
2078
    linux)
2079
        enable dv1394
2080
        ;;
2081
    irix*)
2082
        target_os=irix
2083
        ranlib="echo ignoring ranlib"
2084
        ;;
2085
    os/2*)
2086
        strip="lxlite"
2087
        ln_s="cp -f"
2088
        FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
2089
        SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
2090
        FFSERVERLDFLAGS=""
2091
        LIBSUF="_s.a"
2092
        SLIBPREF=""
2093
        SLIBSUF=".dll"
2094
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
2095
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
2096
        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
2097
          echo PROTMODE >> $(SUBDIR)$(NAME).def; \
2098
          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
2099
          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
2100
          echo EXPORTS >> $(SUBDIR)$(NAME).def; \
2101
          emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
2102
        SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
2103
          emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
2104
        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
2105
        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
2106
        enable dos_paths
2107
        ;;
2108
    gnu/kfreebsd)
2109
        ;;
2110
    gnu)
2111
        ;;
2112

    
2113
    *)
2114
        die "Unknown OS '$target_os'."
2115
        ;;
2116
esac
2117

    
2118
set_default $PATHS_LIST
2119

    
2120
add_extralibs $osextralibs
2121

    
2122
# Combine FFLDFLAGS and the LDFLAGS environment variable.
2123
LDFLAGS="$FFLDFLAGS $LDFLAGS"
2124

    
2125
# we need to build at least one lib type
2126
if ! enabled_any static shared; then
2127
    cat <<EOF
2128
At least one library type must be built.
2129
Specify --enable-static to build the static libraries or --enable-shared to
2130
build the shared libraries as well. To only build the shared libraries specify
2131
--disable-static in addition to --enable-shared.
2132
EOF
2133
    exit 1;
2134
fi
2135

    
2136
disabled static && LIBNAME=""
2137

    
2138
if enabled_any libfaad libfaadbin ; then
2139
    if check_header faad.h; then
2140
        check_cc <<EOF
2141
#include <faad.h>
2142
#ifndef FAAD2_VERSION
2143
ok faad1
2144
#endif
2145
int main(void) { return 0; }
2146
EOF
2147
        test $? = 0 && enable libfaad2
2148
    else
2149
        die "FAAD test failed."
2150
    fi
2151
fi
2152

    
2153

    
2154
die_license_disabled() {
2155
    enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2156
}
2157

    
2158
die_license_disabled gpl libfaad2
2159
die_license_disabled gpl libx264
2160
die_license_disabled gpl libxvid
2161
die_license_disabled gpl postproc
2162
die_license_disabled gpl x11grab
2163

    
2164
die_license_disabled nonfree libfaac
2165

    
2166
die_license_disabled version3 libopencore_amrnb
2167
die_license_disabled version3 libopencore_amrwb
2168

    
2169
enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2170

    
2171
check_deps $ARCH_EXT_LIST
2172

    
2173
disabled optimizations || check_cflags -fomit-frame-pointer
2174

    
2175
enable_pic() {
2176
    enable pic
2177
    add_cppflags -DPIC
2178
    add_cflags   -fPIC
2179
    add_asflags  -fPIC
2180
}
2181

    
2182
enabled pic && enable_pic
2183

    
2184
check_cc <<EOF || die "Symbol mangling check failed."
2185
int ff_extern;
2186
EOF
2187
sym=$($nm -P -g $TMPO | grep ff_extern)
2188
extern_prefix=${sym%%ff_extern*}
2189

    
2190
check_cc <<EOF && enable inline_asm
2191
void foo(void) { __asm__ volatile ("" ::); }
2192
EOF
2193

    
2194
_restrict=
2195
for restrict_keyword in restrict __restrict__ __restrict; do
2196
    check_cc <<EOF && _restrict=$restrict_keyword && break
2197
void foo(char * $restrict_keyword p);
2198
EOF
2199
done
2200

    
2201
check_cc <<EOF && enable attribute_packed
2202
struct { int x; } __attribute__((packed)) x;
2203
EOF
2204

    
2205
check_cc <<EOF || die "endian test failed"
2206
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2207
EOF
2208
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
2209

    
2210
if enabled arm; then
2211

    
2212
    check_cflags -marm
2213

    
2214
    check_ld <<EOF && enable vfp_args
2215
__asm__ (".eabi_attribute 28, 1");
2216
int main(void) { return 0; }
2217
EOF
2218

    
2219
    # We have to check if pld is a nop and disable it.
2220
    check_asm pld '"pld [r0]"'
2221

    
2222
    enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2223
    enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
2224
    enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2225
    enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
2226
    enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
2227
    enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
2228

    
2229
    enabled_all armv6t2 shared !pic && enable_pic
2230

    
2231
elif enabled mips; then
2232

    
2233
    check_asm loongson '"dmult.g $1, $2, $3"'
2234
    enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
2235

    
2236
elif enabled ppc; then
2237

    
2238
    check_asm dcbzl     '"dcbzl 0, 1"'
2239
    check_asm ppc4xx    '"maclhw r10, r11, r12"'
2240
    check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2241

    
2242
    # AltiVec flags: The FSF version of GCC differs from the Apple version
2243
    if enabled altivec; then
2244
        check_cflags -maltivec -mabi=altivec &&
2245
        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2246
        check_cflags -faltivec
2247

    
2248
        # check if our compiler supports Motorola AltiVec C API
2249
        check_cc <<EOF || disable altivec
2250
$inc_altivec_h
2251
int main(void) {
2252
    vector signed int v1, v2, v3;
2253
    v1 = vec_add(v2,v3);
2254
    return 0;
2255
}
2256
EOF
2257

    
2258
        # check if our compiler supports braces for vector declarations
2259
        check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2260
$inc_altivec_h
2261
int main (void) { (vector int) {1}; return 0; }
2262
EOF
2263
    fi
2264

    
2265
elif enabled sparc; then
2266

    
2267
    enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2268
        add_cflags -mcpu=ultrasparc -mtune=ultrasparc
2269

    
2270
elif enabled x86; then
2271

    
2272
    # check whether EBP is available on x86
2273
    # As 'i' is stored on the stack, this program will crash
2274
    # if the base pointer is used to access it because the
2275
    # base pointer is cleared in the inline assembly code.
2276
    check_exec_crash <<EOF && enable ebp_available
2277
    volatile int i=0;
2278
    __asm__ volatile (
2279
        "xorl %%ebp, %%ebp"
2280
    ::: "%ebp");
2281
    return i;
2282
EOF
2283

    
2284
    # check whether EBX is available on x86
2285
    check_asm ebx_available '""::"b"(0)' &&
2286
        check_asm ebx_available '"":::"%ebx"'
2287

    
2288
    # check whether more than 10 operands are supported
2289
    check_cc <<EOF && enable ten_operands
2290
int main(void) {
2291
    int x=0;
2292
    __asm__ volatile(
2293
        ""
2294
        :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
2295
    );
2296
    return 0;
2297
}
2298
EOF
2299

    
2300
    # check whether binutils is new enough to compile SSSE3/MMX2
2301
    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
2302
    enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
2303

    
2304
    check_asm bswap '"bswap %%eax" ::: "%eax"'
2305

    
2306
    YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
2307
    enabled     x86_64        && append YASMFLAGS "-m amd64"
2308
    enabled     pic           && append YASMFLAGS "-DPIC"
2309
    test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
2310
    case "$objformat" in
2311
        elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
2312
    esac
2313
    disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
2314

    
2315
fi
2316

    
2317
if check_func dlopen; then
2318
    ldl=
2319
elif check_func dlopen -ldl; then
2320
    ldl=-ldl
2321
fi
2322

    
2323
# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2324
check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2325

    
2326
check_func  fork
2327
check_func  getaddrinfo $network_extralibs
2328
check_func  gethrtime
2329
check_func  getrusage
2330
check_func  inet_aton $network_extralibs
2331
check_func  isatty
2332
check_func  memalign
2333
check_func  mkstemp
2334
check_func  posix_memalign
2335
check_func_headers io.h setmode
2336
check_func_headers lzo/lzo1x.h lzo1x_999_compress
2337
check_func_headers windows.h GetProcessTimes
2338
check_func_headers windows.h VirtualAlloc
2339

    
2340
check_header conio.h
2341
check_header dlfcn.h
2342
check_header malloc.h
2343
check_header poll.h
2344
check_header sys/mman.h
2345
check_header sys/resource.h
2346
check_header sys/select.h
2347
check_header termios.h
2348
check_header vdpau/vdpau.h
2349
check_header vdpau/vdpau_x11.h
2350
check_header X11/extensions/XvMClib.h
2351

    
2352
if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
2353
     enabled_any $need_memalign ; then
2354
    die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
2355
fi
2356

    
2357
disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
2358
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
2359

    
2360
# check for some common methods of building with pthread support
2361
# do this before the optional library checks as some of them require pthreads
2362
if enabled pthreads; then
2363
    if check_func pthread_create; then
2364
        :
2365
    elif check_func pthread_create -pthread; then
2366
        add_cflags -pthread
2367
        add_extralibs -pthread
2368
    elif check_func pthread_create -pthreads; then
2369
        add_cflags -pthreads
2370
        add_extralibs -pthreads
2371
    elif check_func pthread_create -lpthreadGC2; then
2372
        add_extralibs -lpthreadGC2
2373
    elif ! check_lib pthread.h pthread_create -lpthread; then
2374
        die "ERROR: can't find pthreads library"
2375
    fi
2376
fi
2377

    
2378
for thread in $THREADS_LIST; do
2379
    if enabled $thread; then
2380
        test -n "$thread_type" &&
2381
            die "ERROR: Only one thread type must be selected." ||
2382
            thread_type="$thread"
2383
    fi
2384
done
2385

    
2386
check_lib math.h sin -lm
2387
check_lib va/va.h vaInitialize -lva
2388

    
2389
check_func exp2
2390
check_func exp2f
2391
check_func llrint
2392
check_func log2
2393
check_func log2f
2394
check_func lrint
2395
check_func lrintf
2396
check_func round
2397
check_func roundf
2398
check_func truncf
2399

    
2400
# these are off by default, so fail if requested and not available
2401
enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
2402
enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
2403
                      require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
2404
                      require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
2405
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
2406
enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
2407
enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
2408
enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
2409
enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
2410
enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
2411
enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
2412
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
2413
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
2414
                           require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
2415
enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
2416
enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
2417
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
2418
enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
2419
                      { check_cpp_condition x264.h "X264_BUILD >= 79" ||
2420
                        die "ERROR: libx264 version must be >= 0.79."; }
2421
enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
2422
enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
2423

    
2424
# libdc1394 check
2425
if enabled libdc1394; then
2426
    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2427
        enable libdc1394_2; } ||
2428
    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2429
        enable libdc1394_1; } ||
2430
    die "ERROR: No version of libdc1394 found "
2431
fi
2432

    
2433
disable sdl_too_old
2434
disable sdl
2435
SDL_CONFIG="${cross_prefix}sdl-config"
2436
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
2437
    sdl_cflags=$("${SDL_CONFIG}" --cflags)
2438
    sdl_libs=$("${SDL_CONFIG}" --libs)
2439
    temp_cflags $sdl_cflags
2440
    temp_extralibs $sdl_libs
2441
    if check_lib2 SDL.h SDL_Init; then
2442
        _sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
2443
        if test "$_sdlversion" -lt 121 ; then
2444
            enable sdl_too_old
2445
        else
2446
            enable sdl
2447
            check_cc $sdl_cflags <<EOF && enable sdl_video_size
2448
#include <SDL.h>
2449
int main(int argc, char **argv){
2450
    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
2451
    int w = vi->current_w;
2452
    return 0;
2453
}
2454
EOF
2455
        fi
2456
    fi
2457
    restore_flags
2458
fi
2459

    
2460
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
2461

    
2462
if enabled network; then
2463
    check_type "sys/types.h sys/socket.h" socklen_t
2464
    check_type netdb.h "struct addrinfo"
2465
    check_type sys/socket.h "struct sockaddr_storage"
2466
    # Prefer arpa/inet.h over winsock2
2467
    if check_header arpa/inet.h ; then
2468
        check_func closesocket
2469
    elif check_header winsock2.h ; then
2470
        check_func_headers winsock2.h closesocket -lws2 && \
2471
            network_extralibs="-lws2" || \
2472
        { check_func_headers winsock2.h closesocket -lws2_32 && \
2473
            network_extralibs="-lws2_32"; }
2474
        check_type ws2tcpip.h socklen_t
2475
        check_type ws2tcpip.h "struct addrinfo"
2476
        check_type ws2tcpip.h "struct sockaddr_storage"
2477
    else
2478
        disable network
2479
    fi
2480
fi
2481

    
2482
enabled_all network ipv6 && check_ld <<EOF || disable ipv6
2483
#include <sys/types.h>
2484
#include <sys/socket.h>
2485
#include <netinet/in.h>
2486
#include <netdb.h>
2487
int main(void) {
2488
    struct sockaddr_storage saddr;
2489
    struct ipv6_mreq mreq6;
2490
    getaddrinfo(0,0,0,0);
2491
    getnameinfo(0,0,0,0,0,0,0);
2492
    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
2493
}
2494
EOF
2495

    
2496
check_header linux/videodev.h
2497
check_header linux/videodev2.h
2498
check_header sys/videoio.h
2499

    
2500
check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
2501

    
2502
# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
2503
{ check_header dev/bktr/ioctl_meteor.h &&
2504
  check_header dev/bktr/ioctl_bt848.h; } ||
2505
{ check_header machine/ioctl_meteor.h &&
2506
  check_header machine/ioctl_bt848.h; } ||
2507
{ check_header dev/video/meteor/ioctl_meteor.h &&
2508
  check_header dev/video/bktr/ioctl_bt848.h; } ||
2509
check_header dev/ic/bt8xx.h
2510

    
2511
check_header sys/soundcard.h
2512
check_header soundcard.h
2513

    
2514
enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
2515

    
2516
enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
2517

    
2518
enabled x11grab                         &&
2519
check_header X11/Xlib.h                 &&
2520
check_header X11/extensions/XShm.h      &&
2521
check_header X11/extensions/Xfixes.h    &&
2522
check_func XOpenDisplay -lX11           &&
2523
check_func XShmCreateImage -lX11 -lXext &&
2524
check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
2525

    
2526
if enabled vdpau_vdpau_h; then
2527
check_cpp_condition \
2528
    vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
2529
    { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
2530
      disable vdpau; }
2531
fi
2532

    
2533
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
2534

    
2535
# add some useful compiler flags if supported
2536
check_cflags -Wdeclaration-after-statement
2537
check_cflags -Wall
2538
check_cflags -Wno-switch
2539
check_cflags -Wdisabled-optimization
2540
check_cflags -Wpointer-arith
2541
check_cflags -Wredundant-decls
2542
check_cflags -Wno-pointer-sign
2543
check_cflags -Wcast-qual
2544
check_cflags -Wwrite-strings
2545
check_cflags -Wtype-limits
2546
check_cflags -Wundef
2547
enabled extra_warnings && check_cflags -Winline
2548

    
2549
# add some linker flags
2550
check_ldflags -Wl,--warn-common
2551
check_ldflags -Wl,--as-needed
2552
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'
2553
check_ldflags -Wl,-Bsymbolic
2554

    
2555
if enabled small; then
2556
    check_cflags -Os            # not all compilers support -Os
2557
    optimizations="small"
2558
elif enabled optimizations; then
2559
    if enabled xlc; then
2560
        add_cflags  -O5
2561
        add_ldflags -O5
2562
    elif enabled suncc; then
2563
        add_cflags -O5
2564
    elif enabled ccc; then
2565
        add_cflags -fast
2566
    else
2567
        add_cflags -O3
2568
    fi
2569
fi
2570
check_cflags -fno-math-errno
2571
check_cflags -fno-signed-zeros
2572

    
2573
if enabled icc; then
2574
    # Just warnings, no remarks
2575
    check_cflags -w1
2576
    # -wd: Disable following warnings
2577
    # 144, 167, 556: -Wno-pointer-sign
2578
    # 10006: ignoring unknown option -fno-signed-zeros
2579
    # 10156: ignoring option '-W'; no argument required
2580
    check_cflags -wd144,167,556,10006,10156
2581
    # 11030: Warning unknown option --as-needed
2582
    # 10156: ignoring option '-export'; no argument required
2583
    check_ldflags -wd10156,11030
2584
    # Allow to compile with optimizations
2585
    check_ldflags -march=$cpu
2586
    # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
2587
    enable ebp_available
2588
elif enabled ccc; then
2589
    # disable some annoying warnings
2590
    add_cflags -msg_disable cvtu32to64
2591
    add_cflags -msg_disable embedcomment
2592
    add_cflags -msg_disable needconstext
2593
    add_cflags -msg_disable nomainieee
2594
    add_cflags -msg_disable ptrmismatch1
2595
    add_cflags -msg_disable unreachcode
2596
elif enabled gcc; then
2597
    check_cflags -fno-tree-vectorize
2598
elif enabled clang; then
2599
    check_cflags -Qunused-arguments
2600
fi
2601

    
2602
if enabled gprof; then
2603
    add_cflags  -p
2604
    add_ldflags -p
2605
fi
2606

    
2607
# Find out if the .align argument is a power of two or not.
2608
check_asm asmalign_pot '".align 3"'
2609

    
2610
enabled_any $DECODER_LIST      && enable decoders
2611
enabled_any $ENCODER_LIST      && enable encoders
2612
enabled_any $HWACCEL_LIST      && enable hwaccels
2613
enabled_any $BSF_LIST          && enable bsfs
2614
enabled_any $DEMUXER_LIST      && enable demuxers
2615
enabled_any $MUXER_LIST        && enable muxers
2616
enabled_any $FILTER_LIST       && enable filters
2617
enabled_any $INDEV_LIST        && enable indevs
2618
enabled_any $OUTDEV_LIST       && enable outdevs
2619
enabled_any $PROTOCOL_LIST     && enable protocols
2620

    
2621
enabled_any $THREADS_LIST      && enable threads
2622

    
2623
check_deps $CONFIG_LIST       \
2624
           $CONFIG_EXTRA      \
2625
           $HAVE_LIST         \
2626
           $DECODER_LIST      \
2627
           $ENCODER_LIST      \
2628
           $HWACCEL_LIST      \
2629
           $PARSER_LIST       \
2630
           $BSF_LIST          \
2631
           $DEMUXER_LIST      \
2632
           $MUXER_LIST        \
2633
           $FILTER_LIST       \
2634
           $INDEV_LIST        \
2635
           $OUTDEV_LIST       \
2636
           $PROTOCOL_LIST     \
2637

    
2638
echo "install prefix            $prefix"
2639
echo "source path               $source_path"
2640
echo "C compiler                $cc"
2641
echo ".align is power-of-two    $asmalign_pot"
2642
echo "ARCH                      $arch ($cpu)"
2643
if test "$build_suffix" != ""; then
2644
    echo "build suffix              $build_suffix"
2645
fi
2646
if test "$extra_version" != ""; then
2647
    echo "version string suffix     $extra_version"
2648
fi
2649
echo "big-endian                ${bigendian-no}"
2650
echo "runtime cpu detection     ${runtime_cpudetect-no}"
2651
if enabled x86; then
2652
    echo "yasm                      ${yasm-no}"
2653
    echo "MMX enabled               ${mmx-no}"
2654
    echo "MMX2 enabled              ${mmx2-no}"
2655
    echo "3DNow! enabled            ${amd3dnow-no}"
2656
    echo "3DNow! extended enabled   ${amd3dnowext-no}"
2657
    echo "SSE enabled               ${sse-no}"
2658
    echo "SSSE3 enabled             ${ssse3-no}"
2659
    echo "CMOV enabled              ${cmov-no}"
2660
    echo "CMOV is fast              ${fast_cmov-no}"
2661
    echo "EBX available             ${ebx_available-no}"
2662
    echo "EBP available             ${ebp_available-no}"
2663
    echo "10 operands supported     ${ten_operands-no}"
2664
fi
2665
if enabled arm; then
2666
    echo "ARMv5TE enabled           ${armv5te-no}"
2667
    echo "ARMv6 enabled             ${armv6-no}"
2668
    echo "ARMv6T2 enabled           ${armv6t2-no}"
2669
    echo "ARM VFP enabled           ${armvfp-no}"
2670
    echo "IWMMXT enabled            ${iwmmxt-no}"
2671
    echo "NEON enabled              ${neon-no}"
2672
fi
2673
if enabled mips; then
2674
    echo "MMI enabled               ${mmi-no}"
2675
fi
2676
if enabled ppc; then
2677
    echo "AltiVec enabled           ${altivec-no}"
2678
    echo "PPC 4xx optimizations     ${ppc4xx-no}"
2679
    echo "dcbzl available           ${dcbzl-no}"
2680
    echo "performance report        ${powerpc_perf-no}"
2681
fi
2682
if enabled sparc; then
2683
    echo "VIS enabled               ${vis-no}"
2684
fi
2685
echo "gprof enabled             ${gprof-no}"
2686
echo "debug symbols             ${debug-no}"
2687
echo "strip symbols             ${stripping-no}"
2688
echo "optimizations             ${optimizations-no}"
2689
echo "static                    ${static-no}"
2690
echo "shared                    ${shared-no}"
2691
echo "postprocessing support    ${postproc-no}"
2692
echo "new filter support        ${avfilter-no}"
2693
echo "filters using lavformat   ${avfilter_lavf-no}"
2694
echo "network support           ${network-no}"
2695
if enabled network; then
2696
    echo "IPv6 support              ${ipv6-no}"
2697
fi
2698
echo "threading support         ${thread_type-no}"
2699
echo "SDL support               ${sdl-no}"
2700
if enabled sdl_too_old; then
2701
    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
2702
fi
2703
echo "Sun medialib support      ${mlib-no}"
2704
echo "AVISynth enabled          ${avisynth-no}"
2705
echo "libdc1394 support         ${libdc1394-no}"
2706
echo "libdirac enabled          ${libdirac-no}"
2707
echo "libfaac enabled           ${libfaac-no}"
2708
echo "libfaad enabled           ${libfaad-no}"
2709
echo "libfaad dlopened          ${libfaadbin-no}"
2710
echo "libgsm enabled            ${libgsm-no}"
2711
echo "libmp3lame enabled        ${libmp3lame-no}"
2712
echo "libnut enabled            ${libnut-no}"
2713
echo "libopencore-amrnb support ${libopencore_amrnb-no}"
2714
echo "libopencore-amrwb support ${libopencore_amrwb-no}"
2715
echo "libopenjpeg enabled       ${libopenjpeg-no}"
2716
echo "libschroedinger enabled   ${libschroedinger-no}"
2717
echo "libspeex enabled          ${libspeex-no}"
2718
echo "libtheora enabled         ${libtheora-no}"
2719
echo "libvorbis enabled         ${libvorbis-no}"
2720
echo "libx264 enabled           ${libx264-no}"
2721
echo "libxvid enabled           ${libxvid-no}"
2722
echo "zlib enabled              ${zlib-no}"
2723
echo "bzlib enabled             ${bzlib-no}"
2724
echo
2725

    
2726
for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
2727
    echo "Enabled ${type}s:"
2728
    eval list=\$$(toupper $type)_LIST
2729
    for part in $list; do
2730
        enabled $part && echo ${part%_*}
2731
    done | sort | pr -3 -t
2732
    echo
2733
done
2734

    
2735
license="LGPL version 2.1 or later"
2736
if enabled nonfree; then
2737
    license="nonfree and unredistributable"
2738
elif enabled gplv3; then
2739
    license="GPL version 3 or later"
2740
elif enabled lgplv3; then
2741
    license="LGPL version 3 or later"
2742
elif enabled gpl; then
2743
    license="GPL version 2 or later"
2744
fi
2745

    
2746
echo "License: $license"
2747

    
2748
echo "Creating config.mak and config.h..."
2749

    
2750
enabled stripping || strip="echo skipping strip"
2751

    
2752
cat > config.mak <<EOF
2753
# Automatically generated by configure - do not modify!
2754
ifndef FFMPEG_CONFIG_MAK
2755
FFMPEG_CONFIG_MAK=1
2756
FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
2757
prefix=$prefix
2758
LIBDIR=\$(DESTDIR)$libdir
2759
SHLIBDIR=\$(DESTDIR)$shlibdir
2760
INCDIR=\$(DESTDIR)$incdir
2761
BINDIR=\$(DESTDIR)$bindir
2762
DATADIR=\$(DESTDIR)$datadir
2763
MANDIR=\$(DESTDIR)$mandir
2764
SRC_PATH="$source_path"
2765
SRC_PATH_BARE=$source_path
2766
BUILD_ROOT="$PWD"
2767
ARCH=$arch
2768
CC=$cc
2769
AS=$as
2770
LD=$ld
2771
DEPCC=$dep_cc
2772
YASM=$yasmexe
2773
AR=$ar
2774
RANLIB=$ranlib
2775
LN_S=$ln_s
2776
STRIP=$strip
2777
CPPFLAGS=$CPPFLAGS
2778
CFLAGS=$CFLAGS
2779
ASFLAGS=$ASFLAGS
2780
CC_O=$CC_O
2781
LDFLAGS=$LDFLAGS
2782
FFSERVERLDFLAGS=$FFSERVERLDFLAGS
2783
SHFLAGS=$SHFLAGS
2784
YASMFLAGS=$YASMFLAGS
2785
BUILDSUF=$build_suffix
2786
FULLNAME=$FULLNAME
2787
LIBPREF=$LIBPREF
2788
LIBSUF=$LIBSUF
2789
LIBNAME=$LIBNAME
2790
SLIBPREF=$SLIBPREF
2791
SLIBSUF=$SLIBSUF
2792
EXESUF=$EXESUF
2793
EXTRA_VERSION=$extra_version
2794
DEPFLAGS=$DEPFLAGS
2795
CCDEP=$CCDEP
2796
ASDEP=$ASDEP
2797
CC_DEPFLAGS=$CC_DEPFLAGS
2798
AS_DEPFLAGS=$AS_DEPFLAGS
2799
HOSTCC=$host_cc
2800
HOSTCFLAGS=$host_cflags
2801
HOSTEXESUF=$HOSTEXESUF
2802
HOSTLDFLAGS=$host_ldflags
2803
HOSTLIBS=$host_libs
2804
TARGET_EXEC=$target_exec
2805
TARGET_PATH=$target_path
2806
SDL_LIBS=$sdl_libs
2807
SDL_CFLAGS=$sdl_cflags
2808
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
2809
EXTRALIBS=$extralibs
2810
EOF
2811

    
2812
get_version(){
2813
    name=$1
2814
    file=$source_path/$2
2815
    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2816
    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2817
    lcname=$(tolower $name)
2818
    eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2819
    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2820
}
2821

    
2822
get_version LIBSWSCALE  libswscale/swscale.h
2823
get_version LIBPOSTPROC libpostproc/postprocess.h
2824
get_version LIBAVCODEC  libavcodec/avcodec.h
2825
get_version LIBAVDEVICE libavdevice/avdevice.h
2826
get_version LIBAVFORMAT libavformat/avformat.h
2827
get_version LIBAVUTIL   libavutil/avutil.h
2828
get_version LIBAVFILTER libavfilter/avfilter.h
2829

    
2830
enabled shared && cat >> config.mak <<EOF
2831
LIBTARGET=${LIBTARGET}
2832
SLIBNAME=${SLIBNAME}
2833
SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
2834
SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
2835
SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
2836
SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
2837
SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
2838
SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
2839
EOF
2840

    
2841
enabled asmalign_pot || align_shift="1 <<"
2842

    
2843
cat > $TMPH <<EOF
2844
/* Automatically generated by configure - do not modify! */
2845
#ifndef FFMPEG_CONFIG_H
2846
#define FFMPEG_CONFIG_H
2847
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
2848
#define FFMPEG_LICENSE "$(c_escape $license)"
2849
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
2850
#define CC_TYPE "$cc_type"
2851
#define CC_VERSION $cc_version
2852
#define restrict $_restrict
2853
#define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
2854
#define EXTERN_PREFIX "${extern_prefix}"
2855
#define EXTERN_ASM ${extern_prefix}
2856
EOF
2857

    
2858
if enabled small || disabled optimizations; then
2859
    echo "#define av_always_inline"  >> $TMPH
2860
fi
2861

    
2862
print_config ARCH_   $TMPH config.mak $ARCH_LIST
2863
print_config HAVE_   $TMPH config.mak $HAVE_LIST
2864
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
2865
                                      $CONFIG_EXTRA      \
2866
                                      $DECODER_LIST      \
2867
                                      $ENCODER_LIST      \
2868
                                      $HWACCEL_LIST      \
2869
                                      $PARSER_LIST       \
2870
                                      $BSF_LIST          \
2871
                                      $DEMUXER_LIST      \
2872
                                      $MUXER_LIST        \
2873
                                      $FILTER_LIST       \
2874
                                      $PROTOCOL_LIST     \
2875
                                      $INDEV_LIST        \
2876
                                      $OUTDEV_LIST       \
2877

    
2878
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2879
echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
2880

    
2881
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2882
cmp -s $TMPH config.h &&
2883
    echo "config.h is unchanged" ||
2884
    mv -f $TMPH config.h
2885

    
2886
# build tree in object directory if source path is different from current one
2887
if enabled source_path_used; then
2888
    DIRS="
2889
        doc
2890
        libavcodec
2891
        libavcodec/$arch
2892
        libavdevice
2893
        libavfilter
2894
        libavformat
2895
        libavutil
2896
        libavutil/$arch
2897
        libpostproc
2898
        libswscale
2899
        libswscale/$arch
2900
        tests
2901
        tools
2902
    "
2903
    FILES="
2904
        Makefile
2905
        common.mak
2906
        subdir.mak
2907
        doc/texi2pod.pl
2908
        libavcodec/Makefile
2909
        libavdevice/Makefile
2910
        libavfilter/Makefile
2911
        libavformat/Makefile
2912
        libavutil/Makefile
2913
        libpostproc/Makefile
2914
        libswscale/Makefile
2915
    "
2916
    for dir in $DIRS ; do
2917
        mkdir -p $dir
2918
    done
2919
    for f in $FILES ; do
2920
        $ln_s "$source_path/$f" $f
2921
    done
2922
fi
2923

    
2924

    
2925
# build pkg-config files
2926

    
2927
pkgconfig_generate(){
2928
name=$1
2929
shortname=${name#lib}${build_suffix}
2930
comment=$2
2931
version=$3
2932
libs=$4
2933
requires=$5
2934
cat <<EOF > $name/$name.pc
2935
prefix=$prefix
2936
exec_prefix=\${prefix}
2937
libdir=$libdir
2938
includedir=$incdir
2939

    
2940
Name: $name
2941
Description: $comment
2942
Version: $version
2943
Requires: $(enabled shared || echo $requires)
2944
Requires.private: $(enabled shared && echo $requires)
2945
Conflicts:
2946
Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
2947
Libs.private: $(enabled shared && echo $libs)
2948
Cflags: -I\${includedir}
2949
EOF
2950
cat <<EOF > $name/$name-uninstalled.pc
2951
prefix=
2952
exec_prefix=
2953
libdir=\${pcfiledir}
2954
includedir=${source_path}
2955

    
2956
Name: $name
2957
Description: $comment
2958
Version: $version
2959
Requires: $requires
2960
Conflicts:
2961
Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2962
Cflags: -I\${includedir}
2963
EOF
2964
}
2965

    
2966
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2967
pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
2968
pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
2969
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
2970
enabled avfilter &&
2971
    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
2972
enabled postproc &&
2973
    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2974
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"