Statistics
| Branch: | Revision:

ffmpeg / configure @ 8d072dd2

History | View | Annotate | Download (84.3 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
    flags=''
605
    libs=''
606
    for f; do
607
        test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
608
    done
609
    check_cc $($filter_cflags $flags) || return
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
test_ldflags(){
630
    log test_ldflags "$@"
631
    check_ld "$@" <<EOF
632
int main(void){ return 0; }
633
EOF
634
}
635

    
636
check_ldflags(){
637
    log check_ldflags "$@"
638
    test_ldflags "$@" && add_ldflags "$@"
639
}
640

    
641
check_header(){
642
    log check_header "$@"
643
    header=$1
644
    shift
645
    disable_safe $header
646
    check_cpp "$@" <<EOF && enable_safe $header
647
#include <$header>
648
int x;
649
EOF
650
}
651

    
652
check_func(){
653
    log check_func "$@"
654
    func=$1
655
    shift
656
    disable $func
657
    check_ld "$@" <<EOF && enable $func
658
extern int $func();
659
int main(void){ $func(); }
660
EOF
661
}
662

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

    
682
check_cpp_condition(){
683
    log check_cpp_condition "$@"
684
    header=$1
685
    condition=$2
686
    shift 2
687
    check_cpp $($filter_cppflags "$@") <<EOF
688
#include <$header>
689
#if !($condition)
690
#error "unsatisfied condition: $condition"
691
#endif
692
EOF
693
}
694

    
695
check_lib(){
696
    log check_lib "$@"
697
    header="$1"
698
    func="$2"
699
    shift 2
700
    temp_extralibs "$@"
701
    check_header $header && check_func $func && add_extralibs "$@"
702
    err=$?
703
    restore_flags
704
    return $err
705
}
706

    
707
check_lib2(){
708
    log check_lib2 "$@"
709
    headers="$1"
710
    func="$2"
711
    shift 2
712
    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
713
}
714

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

    
719
check_exec_crash(){
720
    code=$(cat)
721

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

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

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

    
762
check_struct(){
763
    log check_type "$@"
764
    headers=$1
765
    struct=$2
766
    member=$3
767
    shift 3
768
    disable_safe "${struct}_${member}"
769
    incs=""
770
    for hdr in $headers; do
771
        incs="$incs
772
#include <$hdr>"
773
    done
774
    check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
775
$incs
776
const void *p = &(($struct *)0)->$member;
777
EOF
778
}
779

    
780
require(){
781
    name="$1"
782
    header="$2"
783
    func="$3"
784
    shift 3
785
    check_lib $header $func "$@" || die "ERROR: $name not found"
786
}
787

    
788
require2(){
789
    name="$1"
790
    headers="$2"
791
    func="$3"
792
    shift 3
793
    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
794
}
795

    
796
check_foo_config(){
797
    cfg=$1
798
    pkg=$2
799
    header=$3
800
    func=$4
801
    shift 4
802
    disable $cfg
803
    check_cmd ${pkg}-config --version
804
    err=$?
805
    if test "$err" = 0; then
806
        temp_cflags $(${pkg}-config --cflags)
807
        temp_extralibs $(${pkg}-config --libs)
808
        check_lib "$@" $header $func && enable $cfg
809
    fi
810
    return $err
811
}
812

    
813
check_host_cc(){
814
    log check_host_cc "$@"
815
    cat > $TMPC
816
    log_file $TMPC
817
    check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
818
}
819

    
820
check_host_cflags(){
821
    log check_host_cflags "$@"
822
    check_host_cc "$@" <<EOF && append host_cflags "$@"
823
int x;
824
EOF
825
}
826

    
827
apply(){
828
    file=$1
829
    shift
830
    "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
831
}
832

    
833
# CONFIG_LIST contains configurable options, while HAVE_LIST is for
834
# system-dependent things.
835

    
836
COMPONENT_LIST="
837
    bsfs
838
    decoders
839
    demuxers
840
    encoders
841
    filters
842
    hwaccels
843
    indevs
844
    muxers
845
    outdevs
846
    parsers
847
    protocols
848
"
849

    
850
CONFIG_LIST="
851
    $COMPONENT_LIST
852
    aandct
853
    avfilter
854
    avfilter_lavf
855
    avisynth
856
    beos_netserver
857
    bzlib
858
    doc
859
    fastdiv
860
    ffmpeg
861
    ffplay
862
    ffserver
863
    fft
864
    golomb
865
    gpl
866
    gprof
867
    gray
868
    hardcoded_tables
869
    ipv6
870
    libdc1394
871
    libdirac
872
    libfaac
873
    libfaad
874
    libfaadbin
875
    libgsm
876
    libmp3lame
877
    libnut
878
    libopencore_amrnb
879
    libopencore_amrwb
880
    libopenjpeg
881
    libschroedinger
882
    libspeex
883
    libtheora
884
    libvorbis
885
    libx264
886
    libxvid
887
    lpc
888
    mdct
889
    memalign_hack
890
    mlib
891
    mpegaudio_hp
892
    network
893
    nonfree
894
    pic
895
    postproc
896
    powerpc_perf
897
    rdft
898
    runtime_cpudetect
899
    shared
900
    small
901
    static
902
    swscale_alpha
903
    vaapi
904
    vdpau
905
    version3
906
    x11grab
907
    zlib
908
"
909

    
910
THREADS_LIST='
911
    beosthreads
912
    os2threads
913
    pthreads
914
    w32threads
915
'
916

    
917
ARCH_LIST='
918
    alpha
919
    arm
920
    avr32
921
    avr32_ap
922
    avr32_uc
923
    bfin
924
    ia64
925
    m68k
926
    mips
927
    mips64
928
    parisc
929
    ppc
930
    ppc64
931
    s390
932
    sh4
933
    sparc
934
    sparc64
935
    x86
936
    x86_32
937
    x86_64
938
'
939

    
940
ARCH_EXT_LIST='
941
    altivec
942
    amd3dnow
943
    amd3dnowext
944
    armv5te
945
    armv6
946
    armv6t2
947
    armvfp
948
    iwmmxt
949
    mmi
950
    mmx
951
    mmx2
952
    neon
953
    ppc4xx
954
    sse
955
    ssse3
956
    vis
957
'
958

    
959
HAVE_LIST="
960
    $ARCH_EXT_LIST
961
    $THREADS_LIST
962
    alsa_asoundlib_h
963
    altivec_h
964
    arpa_inet_h
965
    attribute_packed
966
    bigendian
967
    bswap
968
    closesocket
969
    cmov
970
    conio_h
971
    dcbzl
972
    dev_bktr_ioctl_bt848_h
973
    dev_bktr_ioctl_meteor_h
974
    dev_ic_bt8xx_h
975
    dev_video_meteor_ioctl_meteor_h
976
    dev_video_bktr_ioctl_bt848_h
977
    dlfcn_h
978
    dlopen
979
    dos_paths
980
    ebp_available
981
    ebx_available
982
    exp2
983
    exp2f
984
    fast_64bit
985
    fast_clz
986
    fast_cmov
987
    fast_unaligned
988
    fork
989
    getaddrinfo
990
    gethrtime
991
    GetProcessTimes
992
    getrusage
993
    inet_aton
994
    inline_asm
995
    isatty
996
    ldbrx
997
    libdc1394_1
998
    libdc1394_2
999
    llrint
1000
    log2
1001
    log2f
1002
    loongson
1003
    lrint
1004
    lrintf
1005
    lzo1x_999_compress
1006
    machine_ioctl_bt848_h
1007
    machine_ioctl_meteor_h
1008
    malloc_h
1009
    memalign
1010
    mkstemp
1011
    pld
1012
    posix_memalign
1013
    round
1014
    roundf
1015
    sdl
1016
    sdl_video_size
1017
    setmode
1018
    socklen_t
1019
    soundcard_h
1020
    poll_h
1021
    struct_addrinfo
1022
    struct_sockaddr_storage
1023
    sys_mman_h
1024
    sys_resource_h
1025
    sys_select_h
1026
    sys_soundcard_h
1027
    sys_videoio_h
1028
    ten_operands
1029
    termios_h
1030
    threads
1031
    truncf
1032
    vfp_args
1033
    VirtualAlloc
1034
    winsock2_h
1035
    xform_asm
1036
    yasm
1037
"
1038

    
1039
# options emitted with CONFIG_ prefix but not available on command line
1040
CONFIG_EXTRA="
1041
    gplv3
1042
    lgplv3
1043
"
1044

    
1045
CMDLINE_SELECT="
1046
    $ARCH_EXT_LIST
1047
    $CONFIG_LIST
1048
    $THREADS_LIST
1049
    cross_compile
1050
    debug
1051
    extra_warnings
1052
    logging
1053
    optimizations
1054
    stripping
1055
    yasm
1056
"
1057

    
1058
PATHS_LIST='
1059
    bindir
1060
    datadir
1061
    incdir
1062
    libdir
1063
    mandir
1064
    prefix
1065
    shlibdir
1066
'
1067

    
1068
CMDLINE_SET="
1069
    $PATHS_LIST
1070
    arch
1071
    as
1072
    build_suffix
1073
    cc
1074
    cpu
1075
    cross_prefix
1076
    dep_cc
1077
    extra_version
1078
    host_cc
1079
    host_cflags
1080
    host_ldflags
1081
    host_libs
1082
    host_os
1083
    ld
1084
    logfile
1085
    nm
1086
    source_path
1087
    sysinclude
1088
    sysroot
1089
    target_exec
1090
    target_os
1091
    target_path
1092
"
1093

    
1094
CMDLINE_APPEND="
1095
    extra_cflags
1096
"
1097

    
1098
# code dependency declarations
1099

    
1100
# architecture extensions
1101
altivec_deps="ppc"
1102
amd3dnow_deps="mmx"
1103
amd3dnowext_deps="amd3dnow"
1104
armv5te_deps="arm"
1105
armv6_deps="arm"
1106
armv6t2_deps="arm"
1107
armvfp_deps="arm"
1108
iwmmxt_deps="arm"
1109
mmi_deps="mips"
1110
mmx_deps="x86"
1111
mmx2_deps="mmx"
1112
neon_deps="arm"
1113
ppc4xx_deps="ppc"
1114
sse_deps="mmx"
1115
ssse3_deps="sse"
1116
vis_deps="sparc"
1117

    
1118
fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
1119

    
1120
need_memalign="altivec neon sse"
1121
inline_asm_deps="!tms470"
1122

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

    
1234
# parsers
1235
h264_parser_select="golomb"
1236

    
1237
# bitstream_filters
1238
aac_adtstoasc_bsf_select="aac_parser"
1239

    
1240
# external libraries
1241
libdirac_decoder_deps="libdirac !libschroedinger"
1242
libdirac_encoder_deps="libdirac"
1243
libfaac_encoder_deps="libfaac"
1244
libfaad_decoder_deps="libfaad"
1245
libfaadbin_decoder_extralibs='$ldl'
1246
libgsm_decoder_deps="libgsm"
1247
libgsm_encoder_deps="libgsm"
1248
libgsm_ms_decoder_deps="libgsm"
1249
libgsm_ms_encoder_deps="libgsm"
1250
libmp3lame_encoder_deps="libmp3lame"
1251
libopencore_amrnb_decoder_deps="libopencore_amrnb"
1252
libopencore_amrnb_encoder_deps="libopencore_amrnb"
1253
libopencore_amrwb_decoder_deps="libopencore_amrwb"
1254
libopenjpeg_decoder_deps="libopenjpeg"
1255
libschroedinger_decoder_deps="libschroedinger"
1256
libschroedinger_encoder_deps="libschroedinger"
1257
libspeex_decoder_deps="libspeex"
1258
libtheora_encoder_deps="libtheora"
1259
libvorbis_encoder_deps="libvorbis"
1260
libx264_encoder_deps="libx264"
1261
libxvid_encoder_deps="libxvid"
1262

    
1263
# demuxers / muxers
1264
ac3_demuxer_deps="ac3_parser"
1265
asf_stream_muxer_select="asf_muxer"
1266
avisynth_demuxer_deps="avisynth"
1267
dirac_demuxer_deps="dirac_parser"
1268
eac3_demuxer_select="ac3_parser"
1269
ipod_muxer_select="mov_muxer"
1270
libnut_demuxer_deps="libnut"
1271
libnut_muxer_deps="libnut"
1272
matroska_audio_muxer_select="matroska_muxer"
1273
matroska_demuxer_suggest="zlib bzlib"
1274
mov_demuxer_suggest="zlib"
1275
mp3_demuxer_deps="mpegaudio_parser"
1276
mp4_muxer_select="mov_muxer"
1277
mpegtsraw_demuxer_select="mpegts_demuxer"
1278
mxf_d10_muxer_select="mxf_muxer"
1279
ogg_demuxer_select="golomb"
1280
psp_muxer_select="mov_muxer"
1281
rtsp_demuxer_deps="sdp_demuxer"
1282
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
1283
spdif_muxer_select="aac_parser"
1284
tg2_muxer_select="mov_muxer"
1285
tgp_muxer_select="mov_muxer"
1286
w64_demuxer_deps="wav_demuxer"
1287

    
1288
# indevs / outdevs
1289
alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
1290
alsa_indev_extralibs="-lasound"
1291
alsa_outdev_deps="alsa_asoundlib_h"
1292
alsa_outdev_extralibs="-lasound"
1293
audio_beos_indev_deps="audio_beos"
1294
audio_beos_indev_extralibs="-lmedia -lbe"
1295
audio_beos_outdev_deps="audio_beos"
1296
audio_beos_outdev_extralibs="-lmedia -lbe"
1297
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1298
dv1394_indev_deps="dv1394 dv_demuxer"
1299
jack_indev_deps="jack_jack_h"
1300
jack_indev_extralibs="-ljack"
1301
libdc1394_indev_deps="libdc1394"
1302
oss_indev_deps_any="soundcard_h sys_soundcard_h"
1303
oss_outdev_deps_any="soundcard_h sys_soundcard_h"
1304
v4l_indev_deps="linux_videodev_h"
1305
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
1306
vfwcap_indev_deps="capCreateCaptureWindow"
1307
vfwcap_indev_extralibs="-lvfw32"
1308
x11_grab_device_indev_deps="x11grab XShmCreateImage"
1309
x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
1310

    
1311
# protocols
1312
gopher_protocol_deps="network"
1313
http_protocol_deps="network"
1314
rtmp_protocol_deps="tcp_protocol"
1315
rtp_protocol_deps="udp_protocol"
1316
tcp_protocol_deps="network"
1317
udp_protocol_deps="network"
1318

    
1319
# filters
1320
movie_filter_deps="avfilter_lavf"
1321

    
1322
# programs
1323
ffplay_deps="sdl"
1324
ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
1325
ffserver_extralibs='$ldl'
1326

    
1327
doc_deps="texi2html"
1328

    
1329
# default parameters
1330

    
1331
logfile="config.err"
1332

    
1333
# installation paths
1334
prefix_default="/usr/local"
1335
bindir_default='${prefix}/bin'
1336
datadir_default='${prefix}/share/ffmpeg'
1337
incdir_default='${prefix}/include'
1338
libdir_default='${prefix}/lib'
1339
mandir_default='${prefix}/share/man'
1340
shlibdir_default="$libdir_default"
1341

    
1342
# toolchain
1343
ar="ar"
1344
cc_default="gcc"
1345
cc_version=\"unknown\"
1346
host_cc_default="gcc"
1347
ln_s="ln -sf"
1348
nm_default="nm"
1349
objformat="elf"
1350
ranlib="ranlib"
1351
strip="strip"
1352
yasmexe="yasm"
1353

    
1354
# machine
1355
arch=$(uname -m)
1356
cpu="generic"
1357

    
1358
# OS
1359
target_os=$(tolower $(uname -s))
1360
host_os=$target_os
1361

    
1362
# configurable options
1363
enable debug
1364
enable doc
1365
enable fastdiv
1366
enable ffmpeg
1367
enable ffplay
1368
enable ffserver
1369
enable ipv6
1370
enable mpegaudio_hp
1371
enable network
1372
enable optimizations
1373
enable protocols
1374
enable static
1375
enable stripping
1376
enable swscale_alpha
1377

    
1378
# build settings
1379
SHFLAGS='-shared -Wl,-soname,$$(@F)'
1380
FFSERVERLDFLAGS=-Wl,-E
1381
LIBPREF="lib"
1382
LIBSUF=".a"
1383
FULLNAME='$(NAME)$(BUILDSUF)'
1384
LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1385
SLIBPREF="lib"
1386
SLIBSUF=".so"
1387
SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1388
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1389
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1390
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1391

    
1392
CC_O='-o $@'
1393

    
1394
host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
1395
host_libs='-lm'
1396

    
1397
target_path='.'
1398

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

    
1404
# find source path
1405
source_path="$(dirname "$0")"
1406
enable source_path_used
1407
if test -f configure; then
1408
    source_path="$(pwd)"
1409
    disable source_path_used
1410
else
1411
    source_path="$(cd "$source_path"; pwd)"
1412
    echo "$source_path" | grep -q '[[:blank:]]' &&
1413
        die "Out of tree builds are impossible with whitespace in source path."
1414
    test -e "$source_path/config.h" &&
1415
        die "Out of tree builds are impossible with config.h in source dir."
1416
fi
1417

    
1418
for v in "$@"; do
1419
    r=${v#*=}
1420
    l=${v%"$r"}
1421
    r=$(sh_quote "$r")
1422
    FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
1423
done
1424

    
1425
find_things(){
1426
    thing=$1
1427
    pattern=$2
1428
    file=$source_path/$3
1429
    sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1430
}
1431

    
1432
ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
1433
DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
1434
HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
1435
PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
1436
BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
1437
MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
1438
DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
1439
OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
1440
INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
1441
PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1442
FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
1443

    
1444
enable $ARCH_EXT_LIST \
1445
       $DECODER_LIST \
1446
       $ENCODER_LIST \
1447
       $HWACCEL_LIST \
1448
       $PARSER_LIST \
1449
       $BSF_LIST \
1450
       $DEMUXER_LIST \
1451
       $MUXER_LIST \
1452
       $FILTER_LIST \
1453
       $PROTOCOL_LIST \
1454
       $INDEV_LIST \
1455
       $OUTDEV_LIST \
1456

    
1457
die_unknown(){
1458
    echo "Unknown option \"$1\"."
1459
    echo "See $0 --help for available options."
1460
    exit 1
1461
}
1462

    
1463
show_list() {
1464
    suffix=_$1
1465
    shift
1466
    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1467
    exit 0
1468
}
1469

    
1470
for opt do
1471
    optval="${opt#*=}"
1472
    case "$opt" in
1473
    --extra-ldflags=*) add_ldflags $optval
1474
    ;;
1475
    --extra-libs=*) add_extralibs $optval
1476
    ;;
1477
    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1478
    ;;
1479
    --enable-debug=*) debuglevel="$optval"
1480
    ;;
1481
    --enable-*=*|--disable-*=*)
1482
    eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1483
    is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1484
    eval list=\$$(toupper $thing)_LIST
1485
    name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1486
    $action $(filter "$name" $list)
1487
    ;;
1488
    --enable-?*|--disable-?*)
1489
    eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1490
    if is_in $option $COMPONENT_LIST; then
1491
        test $action = disable && action=unset
1492
        eval $action \$$(toupper ${option%s})_LIST
1493
    elif is_in $option $CMDLINE_SELECT; then
1494
        $action $option
1495
    else
1496
        die_unknown $opt
1497
    fi
1498
    ;;
1499
    --list-*)
1500
        NAME="${opt#--list-}"
1501
        is_in $NAME $COMPONENT_LIST || die_unknown $opt
1502
        NAME=${NAME%s}
1503
        eval show_list $NAME \$$(toupper $NAME)_LIST
1504
    ;;
1505
    --help|-h) show_help
1506
    ;;
1507
    *)
1508
    optname="${opt%%=*}"
1509
    optname="${optname#--}"
1510
    optname=$(echo "$optname" | sed 's/-/_/g')
1511
    if is_in $optname $CMDLINE_SET; then
1512
        eval $optname='$optval'
1513
    elif is_in $optname $CMDLINE_APPEND; then
1514
        append $optname "$optval"
1515
    else
1516
         die_unknown $opt
1517
    fi
1518
    ;;
1519
    esac
1520
done
1521

    
1522
disabled logging && logfile=/dev/null
1523

    
1524
echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
1525
set >> $logfile
1526

    
1527
test -n "$cross_prefix" && enable cross_compile
1528

    
1529
ar="${cross_prefix}${ar}"
1530
cc_default="${cross_prefix}${cc_default}"
1531
nm_default="${cross_prefix}${nm_default}"
1532
ranlib="${cross_prefix}${ranlib}"
1533
strip="${cross_prefix}${strip}"
1534

    
1535
sysinclude_default="${sysroot}/usr/include"
1536

    
1537
set_default cc nm sysinclude
1538
enabled cross_compile || host_cc_default=$cc
1539
set_default host_cc
1540

    
1541
exesuf() {
1542
    case $1 in
1543
        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
1544
    esac
1545
}
1546

    
1547
EXESUF=$(exesuf $target_os)
1548
HOSTEXESUF=$(exesuf $host_os)
1549

    
1550
# set temporary file name
1551
: ${TMPDIR:=$TEMPDIR}
1552
: ${TMPDIR:=$TMP}
1553
: ${TMPDIR:=/tmp}
1554

    
1555
if ! check_cmd type mktemp; then
1556
    # simple replacement for missing mktemp
1557
    # NOT SAFE FOR GENERAL USE
1558
    mktemp(){
1559
        echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
1560
    }
1561
fi
1562

    
1563
tmpfile(){
1564
    tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
1565
        (set -C; exec > $tmp) 2>/dev/null ||
1566
        die "Unable to create temporary file in $TMPDIR."
1567
    append TMPFILES $tmp
1568
    eval $1=$tmp
1569
}
1570

    
1571
trap 'rm -f -- $TMPFILES' EXIT
1572
trap exit HUP INT TERM
1573

    
1574
tmpfile TMPC  .c
1575
tmpfile TMPE  $EXESUF
1576
tmpfile TMPH  .h
1577
tmpfile TMPO  .o
1578
tmpfile TMPS  .S
1579
tmpfile TMPV  .ver
1580
tmpfile TMPSH .sh
1581

    
1582
unset -f mktemp
1583

    
1584
# make sure we can execute files in $TMPDIR
1585
cat > $TMPSH 2>> $logfile <<EOF
1586
#! /bin/sh
1587
EOF
1588
chmod +x $TMPSH >> $logfile 2>&1
1589
if ! $TMPSH >> $logfile 2>&1; then
1590
    cat <<EOF
1591
Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
1592
variable to another directory and make sure that it is not mounted noexec.
1593
EOF
1594
    die "Sanity test failed."
1595
fi
1596

    
1597
filter_cflags=echo
1598
filter_cppflags=echo
1599
filter_asflags=echo
1600

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

    
1719
test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
1720

    
1721
: ${as_default:=$cc}
1722
: ${dep_cc_default:=$cc}
1723
: ${ld_default:=$cc}
1724
set_default as dep_cc ld
1725

    
1726
test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
1727
test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
1728

    
1729
add_cflags $extra_cflags
1730
add_asflags $extra_cflags
1731

    
1732
if test -n "$sysroot"; then
1733
    case "$cc_type" in
1734
        gcc)
1735
            add_cppflags --sysroot="$sysroot"
1736
            add_ldflags --sysroot="$sysroot"
1737
        ;;
1738
        tms470)
1739
            add_cppflags -I"$sysinclude"
1740
            add_ldflags  --sysroot="$sysroot"
1741
        ;;
1742
        clang)
1743
            add_cppflags -isysroot="$sysroot"
1744
            add_ldflags -isysroot="$sysroot"
1745
        ;;
1746
    esac
1747
fi
1748

    
1749
if test "$cpu" = host; then
1750
    enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
1751

    
1752
    case "$cc_type" in
1753
        gcc)
1754
            check_native(){
1755
                $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
1756
                awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
1757
            }
1758
            cpu=$(check_native -march || check_native -mcpu)
1759
        ;;
1760
    esac
1761

    
1762
    test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
1763
fi
1764

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

    
1862
add_cflags $cpuflags
1863
add_asflags $cpuflags
1864

    
1865
# compiler sanity check
1866
check_exec <<EOF
1867
int main(void){ return 0; }
1868
EOF
1869
if test "$?" != 0; then
1870
    echo "$cc is unable to create an executable file."
1871
    if test -z "$cross_prefix" && ! enabled cross_compile ; then
1872
        echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1873
        echo "Only do this if you know what cross compiling means."
1874
    fi
1875
    die "C compiler test failed."
1876
fi
1877

    
1878
add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
1879
check_cflags -std=c99
1880
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
1881
#include <stdlib.h>
1882
EOF
1883
check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
1884
#include <stdlib.h>
1885
EOF
1886

    
1887
check_host_cflags -std=c99
1888

    
1889
case "$arch" in
1890
    alpha)
1891
        arch="alpha"
1892
        enable fast_64bit
1893
        check_cflags -mieee
1894
        spic=$shared
1895
    ;;
1896
    arm|armv[4567]*l)
1897
        arch="arm"
1898
    ;;
1899
    avr32)
1900
    ;;
1901
    bfin)
1902
        arch="bfin"
1903
    ;;
1904
    ia64)
1905
        arch="ia64"
1906
        enable fast_64bit
1907
        spic=$shared
1908
        # HACK: currently fails to build if .bss is > 4MB and shared libs are built
1909
        enabled shared && enable_weak hardcoded_tables
1910
    ;;
1911
    m68k)
1912
        arch="m68k"
1913
    ;;
1914
    mips|mipsel|IP*)
1915
        arch="mips"
1916
        spic=$shared
1917
    ;;
1918
    mips64)
1919
        arch="mips"
1920
        subarch="mips64"
1921
        enable fast_64bit
1922
        spic=$shared
1923
    ;;
1924
    parisc|hppa)
1925
        arch="parisc"
1926
        spic=$shared
1927
    ;;
1928
    parisc64|hppa64)
1929
        arch="parisc"
1930
        enable fast_64bit
1931
        spic=$shared
1932
    ;;
1933
    "Power Macintosh"|ppc|powerpc)
1934
        arch="ppc"
1935
        enable fast_unaligned
1936
    ;;
1937
    ppc64)
1938
        arch="ppc"
1939
        subarch="ppc64"
1940
        enable fast_64bit
1941
        enable fast_unaligned
1942
    ;;
1943
    s390|s390x)
1944
        arch="s390"
1945
    ;;
1946
    sh4|sh)
1947
        arch="sh4"
1948
    ;;
1949
    sparc)
1950
        arch="sparc"
1951
        spic=$shared
1952
    ;;
1953
    sun4u|sparc64)
1954
        arch="sparc"
1955
        subarch="sparc64"
1956
        enable fast_64bit
1957
        spic=$shared
1958
    ;;
1959
    i386|i486|i586|i686|i86pc|BePC|x86_64|amd64)
1960
        arch="x86"
1961
        subarch="x86_32"
1962
        enable fast_unaligned
1963
        check_cc <<EOF && enable fast_64bit && subarch="x86_64" && spic=$shared
1964
        int test[(int)sizeof(char*) - 7];
1965
EOF
1966
        if test "$subarch" = "x86_64"; then
1967
            enable cmov
1968
            enable fast_cmov
1969
        fi
1970
    ;;
1971
    *)
1972
        arch="unknown"
1973
    ;;
1974
esac
1975

    
1976
enable $arch $subarch
1977
enabled spic && enable pic
1978
check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
1979

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

    
2143
    *)
2144
        die "Unknown OS '$target_os'."
2145
        ;;
2146
esac
2147

    
2148
set_default $PATHS_LIST
2149

    
2150
add_extralibs $osextralibs
2151

    
2152
# Combine FFLDFLAGS and the LDFLAGS environment variable.
2153
LDFLAGS="$FFLDFLAGS $LDFLAGS"
2154

    
2155
# we need to build at least one lib type
2156
if ! enabled_any static shared; then
2157
    cat <<EOF
2158
At least one library type must be built.
2159
Specify --enable-static to build the static libraries or --enable-shared to
2160
build the shared libraries as well. To only build the shared libraries specify
2161
--disable-static in addition to --enable-shared.
2162
EOF
2163
    exit 1;
2164
fi
2165

    
2166
disabled static && LIBNAME=""
2167

    
2168
if enabled_any libfaad libfaadbin ; then
2169
    if check_header faad.h; then
2170
        check_cc <<EOF
2171
#include <faad.h>
2172
#ifndef FAAD2_VERSION
2173
ok faad1
2174
#endif
2175
int main(void) { return 0; }
2176
EOF
2177
        test $? = 0 && enable libfaad2
2178
    else
2179
        die "FAAD test failed."
2180
    fi
2181
fi
2182

    
2183

    
2184
die_license_disabled() {
2185
    enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
2186
}
2187

    
2188
die_license_disabled gpl libfaad2
2189
die_license_disabled gpl libx264
2190
die_license_disabled gpl libxvid
2191
die_license_disabled gpl postproc
2192
die_license_disabled gpl x11grab
2193

    
2194
die_license_disabled nonfree libfaac
2195

    
2196
die_license_disabled version3 libopencore_amrnb
2197
die_license_disabled version3 libopencore_amrwb
2198

    
2199
enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2200

    
2201
check_deps $ARCH_EXT_LIST
2202

    
2203
disabled optimizations || check_cflags -fomit-frame-pointer
2204

    
2205
enable_pic() {
2206
    enable pic
2207
    add_cppflags -DPIC
2208
    add_cflags   -fPIC
2209
    add_asflags  -fPIC
2210
}
2211

    
2212
enabled pic && enable_pic
2213

    
2214
check_cc <<EOF || die "Symbol mangling check failed."
2215
int ff_extern;
2216
EOF
2217
sym=$($nm -P -g $TMPO | grep ff_extern)
2218
extern_prefix=${sym%%ff_extern*}
2219

    
2220
check_cc <<EOF && enable inline_asm
2221
void foo(void) { __asm__ volatile ("" ::); }
2222
EOF
2223

    
2224
_restrict=
2225
for restrict_keyword in restrict __restrict__ __restrict; do
2226
    check_cc <<EOF && _restrict=$restrict_keyword && break
2227
void foo(char * $restrict_keyword p);
2228
EOF
2229
done
2230

    
2231
check_cc <<EOF && enable attribute_packed
2232
struct { int x; } __attribute__((packed)) x;
2233
EOF
2234

    
2235
check_cc <<EOF || die "endian test failed"
2236
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
2237
EOF
2238
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
2239

    
2240
if enabled arm; then
2241

    
2242
    check_cflags -marm
2243

    
2244
    check_ld <<EOF && enable vfp_args
2245
__asm__ (".eabi_attribute 28, 1");
2246
int main(void) { return 0; }
2247
EOF
2248

    
2249
    # We have to check if pld is a nop and disable it.
2250
    check_asm pld '"pld [r0]"'
2251

    
2252
    enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
2253
    enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
2254
    enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
2255
    enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
2256
    enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
2257
    enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
2258

    
2259
    enabled_all armv6t2 shared !pic && enable_pic
2260

    
2261
elif enabled mips; then
2262

    
2263
    check_asm loongson '"dmult.g $1, $2, $3"'
2264
    enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
2265

    
2266
elif enabled ppc; then
2267

    
2268
    check_asm dcbzl     '"dcbzl 0, 1"'
2269
    check_asm ppc4xx    '"maclhw r10, r11, r12"'
2270
    check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2271

    
2272
    # AltiVec flags: The FSF version of GCC differs from the Apple version
2273
    if enabled altivec; then
2274
        check_cflags -maltivec -mabi=altivec &&
2275
        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
2276
        check_cflags -faltivec
2277

    
2278
        # check if our compiler supports Motorola AltiVec C API
2279
        check_cc <<EOF || disable altivec
2280
$inc_altivec_h
2281
int main(void) {
2282
    vector signed int v1, v2, v3;
2283
    v1 = vec_add(v2,v3);
2284
    return 0;
2285
}
2286
EOF
2287

    
2288
        # check if our compiler supports braces for vector declarations
2289
        check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
2290
$inc_altivec_h
2291
int main (void) { (vector int) {1}; return 0; }
2292
EOF
2293
    fi
2294

    
2295
elif enabled sparc; then
2296

    
2297
    enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
2298
        add_cflags -mcpu=ultrasparc -mtune=ultrasparc
2299

    
2300
elif enabled x86; then
2301

    
2302
    # check whether EBP is available on x86
2303
    # As 'i' is stored on the stack, this program will crash
2304
    # if the base pointer is used to access it because the
2305
    # base pointer is cleared in the inline assembly code.
2306
    check_exec_crash <<EOF && enable ebp_available
2307
    volatile int i=0;
2308
    __asm__ volatile (
2309
        "xorl %%ebp, %%ebp"
2310
    ::: "%ebp");
2311
    return i;
2312
EOF
2313

    
2314
    # check whether EBX is available on x86
2315
    check_asm ebx_available '""::"b"(0)' &&
2316
        check_asm ebx_available '"":::"%ebx"'
2317

    
2318
    # check whether more than 10 operands are supported
2319
    check_cc <<EOF && enable ten_operands
2320
int main(void) {
2321
    int x=0;
2322
    __asm__ volatile(
2323
        ""
2324
        :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
2325
    );
2326
    return 0;
2327
}
2328
EOF
2329

    
2330
    # check whether binutils is new enough to compile SSSE3/MMX2
2331
    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
2332
    enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
2333

    
2334
    check_asm bswap '"bswap %%eax" ::: "%eax"'
2335

    
2336
    YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
2337
    enabled     x86_64        && append YASMFLAGS "-m amd64"
2338
    enabled     pic           && append YASMFLAGS "-DPIC"
2339
    test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
2340
    case "$objformat" in
2341
        elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
2342
    esac
2343
    disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
2344

    
2345
    case "$cpu" in
2346
        athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
2347
            disable fast_clz
2348
        ;;
2349
    esac
2350

    
2351
fi
2352

    
2353
if check_func dlopen; then
2354
    ldl=
2355
elif check_func dlopen -ldl; then
2356
    ldl=-ldl
2357
fi
2358

    
2359
# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
2360
check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
2361

    
2362
check_func  fork
2363
check_func  getaddrinfo $network_extralibs
2364
check_func  gethrtime
2365
check_func  getrusage
2366
check_func  inet_aton $network_extralibs
2367
check_func  isatty
2368
check_func  memalign
2369
check_func  mkstemp
2370
check_func  posix_memalign
2371
check_func_headers io.h setmode
2372
check_func_headers lzo/lzo1x.h lzo1x_999_compress
2373
check_func_headers windows.h GetProcessTimes
2374
check_func_headers windows.h VirtualAlloc
2375

    
2376
check_header conio.h
2377
check_header dlfcn.h
2378
check_header malloc.h
2379
check_header poll.h
2380
check_header sys/mman.h
2381
check_header sys/resource.h
2382
check_header sys/select.h
2383
check_header termios.h
2384
check_header vdpau/vdpau.h
2385
check_header vdpau/vdpau_x11.h
2386
check_header X11/extensions/XvMClib.h
2387

    
2388
if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
2389
     enabled_any $need_memalign ; then
2390
    die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
2391
fi
2392

    
2393
disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
2394
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
2395

    
2396
# check for some common methods of building with pthread support
2397
# do this before the optional library checks as some of them require pthreads
2398
if enabled pthreads; then
2399
    if check_func pthread_create; then
2400
        :
2401
    elif check_func pthread_create -pthread; then
2402
        add_cflags -pthread
2403
        add_extralibs -pthread
2404
    elif check_func pthread_create -pthreads; then
2405
        add_cflags -pthreads
2406
        add_extralibs -pthreads
2407
    elif check_func pthread_create -lpthreadGC2; then
2408
        add_extralibs -lpthreadGC2
2409
    elif ! check_lib pthread.h pthread_create -lpthread; then
2410
        die "ERROR: can't find pthreads library"
2411
    fi
2412
fi
2413

    
2414
for thread in $THREADS_LIST; do
2415
    if enabled $thread; then
2416
        test -n "$thread_type" &&
2417
            die "ERROR: Only one thread type must be selected." ||
2418
            thread_type="$thread"
2419
    fi
2420
done
2421

    
2422
check_lib math.h sin -lm
2423
check_lib va/va.h vaInitialize -lva
2424

    
2425
check_func exp2
2426
check_func exp2f
2427
check_func llrint
2428
check_func log2
2429
check_func log2f
2430
check_func lrint
2431
check_func lrintf
2432
check_func round
2433
check_func roundf
2434
check_func truncf
2435

    
2436
# these are off by default, so fail if requested and not available
2437
enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
2438
enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
2439
                      require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
2440
                      require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
2441
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
2442
enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
2443
enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
2444
enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
2445
enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
2446
enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
2447
enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
2448
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
2449
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
2450
                           require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
2451
enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
2452
enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
2453
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
2454
enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
2455
                      { check_cpp_condition x264.h "X264_BUILD >= 79" ||
2456
                        die "ERROR: libx264 version must be >= 0.79."; }
2457
enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
2458
enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
2459

    
2460
# libdc1394 check
2461
if enabled libdc1394; then
2462
    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2463
        enable libdc1394_2; } ||
2464
    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2465
        enable libdc1394_1; } ||
2466
    die "ERROR: No version of libdc1394 found "
2467
fi
2468

    
2469
SDL_CONFIG="${cross_prefix}sdl-config"
2470
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
2471
    sdl_cflags=$("${SDL_CONFIG}" --cflags)
2472
    sdl_libs=$("${SDL_CONFIG}" --libs)
2473
    check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
2474
    check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
2475
    enable sdl &&
2476
    check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
2477
fi
2478

    
2479
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
2480

    
2481
if enabled network; then
2482
    check_type "sys/types.h sys/socket.h" socklen_t
2483
    check_type netdb.h "struct addrinfo"
2484
    check_type sys/socket.h "struct sockaddr_storage"
2485
    # Prefer arpa/inet.h over winsock2
2486
    if check_header arpa/inet.h ; then
2487
        check_func closesocket
2488
    elif check_header winsock2.h ; then
2489
        check_func_headers winsock2.h closesocket -lws2 && \
2490
            network_extralibs="-lws2" || \
2491
        { check_func_headers winsock2.h closesocket -lws2_32 && \
2492
            network_extralibs="-lws2_32"; }
2493
        check_type ws2tcpip.h socklen_t
2494
        check_type ws2tcpip.h "struct addrinfo"
2495
        check_type ws2tcpip.h "struct sockaddr_storage"
2496
    else
2497
        disable network
2498
    fi
2499
fi
2500

    
2501
enabled_all network ipv6 && check_ld <<EOF || disable ipv6
2502
#include <sys/types.h>
2503
#include <sys/socket.h>
2504
#include <netinet/in.h>
2505
#include <netdb.h>
2506
int main(void) {
2507
    struct sockaddr_storage saddr;
2508
    struct ipv6_mreq mreq6;
2509
    getaddrinfo(0,0,0,0);
2510
    getnameinfo(0,0,0,0,0,0,0);
2511
    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
2512
}
2513
EOF
2514

    
2515
check_header linux/videodev.h
2516
check_header linux/videodev2.h
2517
check_header sys/videoio.h
2518

    
2519
check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
2520

    
2521
# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
2522
{ check_header dev/bktr/ioctl_meteor.h &&
2523
  check_header dev/bktr/ioctl_bt848.h; } ||
2524
{ check_header machine/ioctl_meteor.h &&
2525
  check_header machine/ioctl_bt848.h; } ||
2526
{ check_header dev/video/meteor/ioctl_meteor.h &&
2527
  check_header dev/video/bktr/ioctl_bt848.h; } ||
2528
check_header dev/ic/bt8xx.h
2529

    
2530
check_header sys/soundcard.h
2531
check_header soundcard.h
2532

    
2533
enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
2534

    
2535
enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
2536

    
2537
enabled x11grab                         &&
2538
check_header X11/Xlib.h                 &&
2539
check_header X11/extensions/XShm.h      &&
2540
check_header X11/extensions/Xfixes.h    &&
2541
check_func XOpenDisplay -lX11           &&
2542
check_func XShmCreateImage -lX11 -lXext &&
2543
check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
2544

    
2545
if ! disabled vdpau && enabled vdpau_vdpau_h; then
2546
check_cpp_condition \
2547
    vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
2548
    { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
2549
      disable vdpau; }
2550
fi
2551

    
2552
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
2553

    
2554
# add some useful compiler flags if supported
2555
check_cflags -Wdeclaration-after-statement
2556
check_cflags -Wall
2557
check_cflags -Wno-switch
2558
check_cflags -Wdisabled-optimization
2559
check_cflags -Wpointer-arith
2560
check_cflags -Wredundant-decls
2561
check_cflags -Wno-pointer-sign
2562
check_cflags -Wcast-qual
2563
check_cflags -Wwrite-strings
2564
check_cflags -Wtype-limits
2565
check_cflags -Wundef
2566
enabled extra_warnings && check_cflags -Winline
2567

    
2568
# add some linker flags
2569
check_ldflags -Wl,--warn-common
2570
check_ldflags -Wl,--as-needed
2571
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'
2572
check_ldflags -Wl,-Bsymbolic
2573

    
2574
echo "X{};" > $TMPV
2575
test_ldflags -Wl,--version-script,$TMPV &&
2576
    append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
2577

    
2578
if enabled small; then
2579
    check_cflags -Os            # not all compilers support -Os
2580
    optimizations="small"
2581
elif enabled optimizations; then
2582
    if enabled xlc; then
2583
        add_cflags  -O5
2584
        add_ldflags -O5
2585
    elif enabled suncc; then
2586
        add_cflags -O5
2587
    elif enabled ccc; then
2588
        add_cflags -fast
2589
    else
2590
        add_cflags -O3
2591
    fi
2592
fi
2593
check_cflags -fno-math-errno
2594
check_cflags -fno-signed-zeros
2595

    
2596
if enabled icc; then
2597
    # Just warnings, no remarks
2598
    check_cflags -w1
2599
    # -wd: Disable following warnings
2600
    # 144, 167, 556: -Wno-pointer-sign
2601
    # 10006: ignoring unknown option -fno-signed-zeros
2602
    # 10156: ignoring option '-W'; no argument required
2603
    check_cflags -wd144,167,556,10006,10156
2604
    # 11030: Warning unknown option --as-needed
2605
    # 10156: ignoring option '-export'; no argument required
2606
    check_ldflags -wd10156,11030
2607
    # Allow to compile with optimizations
2608
    check_ldflags -march=$cpu
2609
    # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
2610
    enable ebp_available
2611
elif enabled ccc; then
2612
    # disable some annoying warnings
2613
    add_cflags -msg_disable cvtu32to64
2614
    add_cflags -msg_disable embedcomment
2615
    add_cflags -msg_disable needconstext
2616
    add_cflags -msg_disable nomainieee
2617
    add_cflags -msg_disable ptrmismatch1
2618
    add_cflags -msg_disable unreachcode
2619
elif enabled gcc; then
2620
    check_cflags -fno-tree-vectorize
2621
elif enabled clang; then
2622
    check_cflags -Qunused-arguments
2623
fi
2624

    
2625
if enabled gprof; then
2626
    add_cflags  -p
2627
    add_ldflags -p
2628
fi
2629

    
2630
# Find out if the .align argument is a power of two or not.
2631
check_asm asmalign_pot '".align 3"'
2632

    
2633
enabled_any $DECODER_LIST      && enable decoders
2634
enabled_any $ENCODER_LIST      && enable encoders
2635
enabled_any $HWACCEL_LIST      && enable hwaccels
2636
enabled_any $BSF_LIST          && enable bsfs
2637
enabled_any $DEMUXER_LIST      && enable demuxers
2638
enabled_any $MUXER_LIST        && enable muxers
2639
enabled_any $FILTER_LIST       && enable filters
2640
enabled_any $INDEV_LIST        && enable indevs
2641
enabled_any $OUTDEV_LIST       && enable outdevs
2642
enabled_any $PROTOCOL_LIST     && enable protocols
2643

    
2644
enabled_any $THREADS_LIST      && enable threads
2645

    
2646
check_deps $CONFIG_LIST       \
2647
           $CONFIG_EXTRA      \
2648
           $HAVE_LIST         \
2649
           $DECODER_LIST      \
2650
           $ENCODER_LIST      \
2651
           $HWACCEL_LIST      \
2652
           $PARSER_LIST       \
2653
           $BSF_LIST          \
2654
           $DEMUXER_LIST      \
2655
           $MUXER_LIST        \
2656
           $FILTER_LIST       \
2657
           $INDEV_LIST        \
2658
           $OUTDEV_LIST       \
2659
           $PROTOCOL_LIST     \
2660

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

    
2746
for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
2747
    echo "Enabled ${type}s:"
2748
    eval list=\$$(toupper $type)_LIST
2749
    for part in $list; do
2750
        enabled $part && echo ${part%_*}
2751
    done | sort | pr -3 -t
2752
    echo
2753
done
2754

    
2755
license="LGPL version 2.1 or later"
2756
if enabled nonfree; then
2757
    license="nonfree and unredistributable"
2758
elif enabled gplv3; then
2759
    license="GPL version 3 or later"
2760
elif enabled lgplv3; then
2761
    license="LGPL version 3 or later"
2762
elif enabled gpl; then
2763
    license="GPL version 2 or later"
2764
fi
2765

    
2766
echo "License: $license"
2767

    
2768
echo "Creating config.mak and config.h..."
2769

    
2770
enabled stripping || strip="echo skipping strip"
2771

    
2772
cat > config.mak <<EOF
2773
# Automatically generated by configure - do not modify!
2774
ifndef FFMPEG_CONFIG_MAK
2775
FFMPEG_CONFIG_MAK=1
2776
FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
2777
prefix=$prefix
2778
LIBDIR=\$(DESTDIR)$libdir
2779
SHLIBDIR=\$(DESTDIR)$shlibdir
2780
INCDIR=\$(DESTDIR)$incdir
2781
BINDIR=\$(DESTDIR)$bindir
2782
DATADIR=\$(DESTDIR)$datadir
2783
MANDIR=\$(DESTDIR)$mandir
2784
SRC_PATH="$source_path"
2785
SRC_PATH_BARE=$source_path
2786
BUILD_ROOT="$PWD"
2787
ARCH=$arch
2788
CC=$cc
2789
AS=$as
2790
LD=$ld
2791
DEPCC=$dep_cc
2792
YASM=$yasmexe
2793
AR=$ar
2794
RANLIB=$ranlib
2795
LN_S=$ln_s
2796
STRIP=$strip
2797
CPPFLAGS=$CPPFLAGS
2798
CFLAGS=$CFLAGS
2799
ASFLAGS=$ASFLAGS
2800
CC_O=$CC_O
2801
LDFLAGS=$LDFLAGS
2802
FFSERVERLDFLAGS=$FFSERVERLDFLAGS
2803
SHFLAGS=$SHFLAGS
2804
YASMFLAGS=$YASMFLAGS
2805
BUILDSUF=$build_suffix
2806
FULLNAME=$FULLNAME
2807
LIBPREF=$LIBPREF
2808
LIBSUF=$LIBSUF
2809
LIBNAME=$LIBNAME
2810
SLIBPREF=$SLIBPREF
2811
SLIBSUF=$SLIBSUF
2812
EXESUF=$EXESUF
2813
EXTRA_VERSION=$extra_version
2814
DEPFLAGS=$DEPFLAGS
2815
CCDEP=$CCDEP
2816
ASDEP=$ASDEP
2817
CC_DEPFLAGS=$CC_DEPFLAGS
2818
AS_DEPFLAGS=$AS_DEPFLAGS
2819
HOSTCC=$host_cc
2820
HOSTCFLAGS=$host_cflags
2821
HOSTEXESUF=$HOSTEXESUF
2822
HOSTLDFLAGS=$host_ldflags
2823
HOSTLIBS=$host_libs
2824
TARGET_EXEC=$target_exec
2825
TARGET_PATH=$target_path
2826
SDL_LIBS=$sdl_libs
2827
SDL_CFLAGS=$sdl_cflags
2828
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
2829
EXTRALIBS=$extralibs
2830
EOF
2831

    
2832
get_version(){
2833
    name=$1
2834
    file=$source_path/$2
2835
    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2836
    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2837
    lcname=$(tolower $name)
2838
    eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2839
    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2840
}
2841

    
2842
get_version LIBSWSCALE  libswscale/swscale.h
2843
get_version LIBPOSTPROC libpostproc/postprocess.h
2844
get_version LIBAVCODEC  libavcodec/avcodec.h
2845
get_version LIBAVDEVICE libavdevice/avdevice.h
2846
get_version LIBAVFORMAT libavformat/avformat.h
2847
get_version LIBAVUTIL   libavutil/avutil.h
2848
get_version LIBAVFILTER libavfilter/avfilter.h
2849

    
2850
enabled shared && cat >> config.mak <<EOF
2851
LIBTARGET=${LIBTARGET}
2852
SLIBNAME=${SLIBNAME}
2853
SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
2854
SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
2855
SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
2856
SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
2857
SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
2858
SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
2859
EOF
2860

    
2861
enabled asmalign_pot || align_shift="1 <<"
2862

    
2863
cat > $TMPH <<EOF
2864
/* Automatically generated by configure - do not modify! */
2865
#ifndef FFMPEG_CONFIG_H
2866
#define FFMPEG_CONFIG_H
2867
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
2868
#define FFMPEG_LICENSE "$(c_escape $license)"
2869
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
2870
#define CC_TYPE "$cc_type"
2871
#define CC_VERSION $cc_version
2872
#define restrict $_restrict
2873
#define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
2874
#define EXTERN_PREFIX "${extern_prefix}"
2875
#define EXTERN_ASM ${extern_prefix}
2876
EOF
2877

    
2878
if enabled small || disabled optimizations; then
2879
    echo "#define av_always_inline"  >> $TMPH
2880
fi
2881

    
2882
print_config ARCH_   $TMPH config.mak $ARCH_LIST
2883
print_config HAVE_   $TMPH config.mak $HAVE_LIST
2884
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
2885
                                      $CONFIG_EXTRA      \
2886
                                      $DECODER_LIST      \
2887
                                      $ENCODER_LIST      \
2888
                                      $HWACCEL_LIST      \
2889
                                      $PARSER_LIST       \
2890
                                      $BSF_LIST          \
2891
                                      $DEMUXER_LIST      \
2892
                                      $MUXER_LIST        \
2893
                                      $FILTER_LIST       \
2894
                                      $PROTOCOL_LIST     \
2895
                                      $INDEV_LIST        \
2896
                                      $OUTDEV_LIST       \
2897

    
2898
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2899
echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
2900

    
2901
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2902
cmp -s $TMPH config.h &&
2903
    echo "config.h is unchanged" ||
2904
    mv -f $TMPH config.h
2905

    
2906
# build tree in object directory if source path is different from current one
2907
if enabled source_path_used; then
2908
    DIRS="
2909
        doc
2910
        libavcodec
2911
        libavcodec/$arch
2912
        libavdevice
2913
        libavfilter
2914
        libavformat
2915
        libavutil
2916
        libavutil/$arch
2917
        libpostproc
2918
        libswscale
2919
        libswscale/$arch
2920
        tests
2921
        tools
2922
    "
2923
    FILES="
2924
        Makefile
2925
        common.mak
2926
        subdir.mak
2927
        doc/texi2pod.pl
2928
        libavcodec/Makefile
2929
        libavdevice/Makefile
2930
        libavfilter/Makefile
2931
        libavformat/Makefile
2932
        libavutil/Makefile
2933
        libpostproc/Makefile
2934
        libswscale/Makefile
2935
    "
2936
    for dir in $DIRS ; do
2937
        mkdir -p $dir
2938
    done
2939
    for f in $FILES ; do
2940
        $ln_s "$source_path/$f" $f
2941
    done
2942
fi
2943

    
2944

    
2945
# build pkg-config files
2946

    
2947
pkgconfig_generate(){
2948
name=$1
2949
shortname=${name#lib}${build_suffix}
2950
comment=$2
2951
version=$3
2952
libs=$4
2953
requires=$5
2954
cat <<EOF > $name/$name.pc
2955
prefix=$prefix
2956
exec_prefix=\${prefix}
2957
libdir=$libdir
2958
includedir=$incdir
2959

    
2960
Name: $name
2961
Description: $comment
2962
Version: $version
2963
Requires: $(enabled shared || echo $requires)
2964
Requires.private: $(enabled shared && echo $requires)
2965
Conflicts:
2966
Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
2967
Libs.private: $(enabled shared && echo $libs)
2968
Cflags: -I\${includedir}
2969
EOF
2970
cat <<EOF > $name/$name-uninstalled.pc
2971
prefix=
2972
exec_prefix=
2973
libdir=\${pcfiledir}
2974
includedir=${source_path}
2975

    
2976
Name: $name
2977
Description: $comment
2978
Version: $version
2979
Requires: $requires
2980
Conflicts:
2981
Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2982
Cflags: -I\${includedir}
2983
EOF
2984
}
2985

    
2986
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2987
pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
2988
pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
2989
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
2990
enabled avfilter &&
2991
    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
2992
enabled postproc &&
2993
    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2994
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"