Statistics
| Branch: | Revision:

ffmpeg / configure @ b4e806b2

History | View | Annotate | Download (63.1 KB)

1 aeb29222 Måns Rullgård
#!/bin/sh
2 0f3cb305 Fabrice Bellard
#
3 f57620d5 Måns Rullgård
# FFmpeg configure script
4
#
5
# Copyright (c) 2000, 2001, 2002 Fabrice Bellard
6
# Copyright (c) 2005-2006 Diego Biurrun
7
# Copyright (c) 2005-2006 Mans Rullgard
8 0f3cb305 Fabrice Bellard
#
9 cf9d24ad Dan Christiansen
10 cde2d79a Måns Rullgård
# make sure we are running under a compatible shell
11 c21d6325 Måns Rullgård
# try to make this part work with most shells
12
13
try_exec(){
14 0dbe81bb Måns Rullgård
    echo "Trying shell $1"
15 c21d6325 Måns Rullgård
    type "$1" >/dev/null 2>&1 && exec "$@"
16
}
17
18 5237ce67 Måns Rullgård
unset foo
19 0dbe81bb Måns Rullgård
(: ${foo%%bar}) 2>/dev/null
20
E1="$?"
21
22
(: ${foo?}) 2>/dev/null
23
E2="$?"
24
25
if test "$E1" != 0 || test "$E2" = 0; then
26
    echo "Broken shell detected.  Trying alternatives."
27 c21d6325 Måns Rullgård
    export FF_CONF_EXEC
28
    if test "0$FF_CONF_EXEC" -lt 1; then
29
        FF_CONF_EXEC=1
30
        try_exec bash "$0" "$@"
31
    fi
32
    if test "0$FF_CONF_EXEC" -lt 2; then
33
        FF_CONF_EXEC=2
34
        try_exec ksh "$0" "$@"
35
    fi
36
    if test "0$FF_CONF_EXEC" -lt 3; then
37
        FF_CONF_EXEC=3
38
        try_exec /usr/xpg4/bin/sh "$0" "$@"
39 cde2d79a Måns Rullgård
    fi
40
    echo "No compatible shell script interpreter found."
41 fc53da20 Diego Biurrun
    echo "This configure script requires a POSIX-compatible shell"
42 c21d6325 Måns Rullgård
    echo "such as bash or ksh."
43 505dfb09 Diego Biurrun
    echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
44
    echo "Instead, install a working POSIX-compatible shell."
45
    echo "Disabling this configure test will create a broken FFmpeg."
46 c21d6325 Måns Rullgård
    if test "$BASH_VERSION" = '2.04.0(1)-release'; then
47
        echo "This bash version ($BASH_VERSION) is broken on your platform."
48
        echo "Upgrade to a later version if available."
49
    fi
50 cde2d79a Måns Rullgård
    exit 1
51
fi
52
53 74c53c2d Måns Rullgård
show_help(){
54
  echo "Usage: configure [options]"
55
  echo "Options: [defaults in brackets after descriptions]"
56
  echo
57
  echo "Standard options:"
58
  echo "  --help                   print this message"
59 2ba042a7 Måns Rullgård
  echo "  --log[=FILE|yes|no]      log tests and output to FILE [config.err]"
60 2266e085 Diego Biurrun
  echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
61 74c53c2d Måns Rullgård
  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
62 84c22efd Diego Biurrun
  echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
63 5341d856 Diego Biurrun
  echo "  --incdir=DIR             install includes in DIR [PREFIX/include]"
64 4ca5ece5 Stefano Sabatini
  echo "  --mandir=DIR             install man page in DIR [PREFIX/share/man]"
65 74c53c2d Måns Rullgård
  echo "  --enable-static          build static libraries [default=yes]"
66
  echo "  --disable-static         do not build static libraries [default=no]"
67
  echo "  --enable-shared          build shared libraries [default=no]"
68
  echo "  --disable-shared         do not build shared libraries [default=yes]"
69 0a622b98 Måns Rullgård
  echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
70
  echo "                           and ffmpeg will be under GPL [default=no]"
71 3fe142e2 Diego Biurrun
  echo "  --enable-nonfree         allow use of nonfree code, the resulting libav*"
72
  echo "                           and ffmpeg will be unredistributable [default=no]"
73 4a24ab64 Diego Biurrun
  echo "  --enable-postproc        enable GPLed postprocessing support [default=no]"
74 13ca50f3 Diego Biurrun
  echo "  --enable-swscale         software scaler support [default=no]"
75 f7679c54 Vitor Sessak
  echo "  --enable-avfilter        video filter support (replaces vhook) [default=no]"
76
  echo "  --enable-avfilter-lavf   video filters dependant on avformat [default=no]"
77 e5f94c2b Ramiro Polla
  echo "  --enable-beosthreads     use BeOS threads [default=no]"
78 d22e8442 Dave Yeo
  echo "  --enable-os2threads      use OS/2 threads [default=no]"
79 74c53c2d Måns Rullgård
  echo "  --enable-pthreads        use pthreads [default=no]"
80 eb113804 Diego Biurrun
  echo "  --enable-w32threads      use Win32 threads [default=no]"
81 56a059ac Diego Biurrun
  echo "  --enable-x11grab         enable X11 grabbing [default=no]"
82 0a622b98 Måns Rullgård
  echo
83
  echo "External library support:"
84
  echo "  --enable-sunmlib         use Sun medialib [default=no]"
85 e2745046 Måns Rullgård
  echo "  --enable-liba52          enable GPLed liba52 support [default=no]"
86
  echo "  --enable-liba52bin       open liba52.so.0 at runtime [default=no]"
87 8ac17293 Steve L'Homme
  echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
88 f5a756ef Diego Biurrun
  echo "  --enable-libamr-nb       enable libamr-nb floating point audio codec"
89
  echo "  --enable-libamr-wb       enable libamr-wb floating point audio codec"
90 f7b8bffe Ramiro Polla
  echo "  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394"
91
  echo "                           and libraw1394 [default=no]"
92 e2745046 Måns Rullgård
  echo "  --enable-libfaac         enable FAAC support via libfaac [default=no]"
93
  echo "  --enable-libfaad         enable FAAD support via libfaad [default=no]"
94 06f32b26 Diego Biurrun
  echo "  --enable-libfaadbin      open libfaad.so.0 at runtime [default=no]"
95 dc922953 Diego Biurrun
  echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
96 e2745046 Måns Rullgård
  echo "  --enable-libmp3lame      enable MP3 encoding via libmp3lame [default=no]"
97 31235134 Diego Biurrun
  echo "  --enable-libnut          enable NUT (de)muxing via libnut,"
98
  echo "                           native demuxer exists [default=no]"
99 71757822 Diego Biurrun
  echo "  --enable-libtheora       enable Theora encoding via libtheora [default=no]"
100 f9def9cc Diego Biurrun
  echo "  --enable-libvorbis       enable Vorbis encoding via libvorbis,"
101
  echo "                           native implementation exists [default=no]"
102 1cc60c47 Diego Biurrun
  echo "  --enable-libx264         enable H.264 encoding via x264 [default=no]"
103
  echo "  --enable-libxvid         enable Xvid encoding via xvidcore,"
104 31235134 Diego Biurrun
  echo "                           native MPEG-4/Xvid encoder exists [default=no]"
105 74c53c2d Måns Rullgård
  echo ""
106
  echo "Advanced options (experts only):"
107
  echo "  --source-path=PATH       path to source code [$source_path]"
108
  echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
109 fac252f9 Måns Rullgård
  echo "  --cross-compile          assume a cross-compiler is used"
110 abcd6d60 Måns Rullgård
  echo "  --target-os=OS           compiler targets OS [$targetos]"
111 74c53c2d Måns Rullgård
  echo "  --cc=CC                  use C compiler CC [$cc]"
112
  echo "  --make=MAKE              use specified make [$make]"
113
  echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
114
  echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
115
  echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
116
  echo "  --build-suffix=SUFFIX    suffix for application specific build []"
117 cc6a90dd Guillaume Poirier
  echo "  --arch=ARCH              select architecture  [$arch]"
118 7c758d33 Diego Biurrun
  echo "  --cpu=CPU                selects the minimum cpu required (affects"
119
  echo "                           instruction selection, may crash on older CPUs)"
120 2b4c3615 Måns Rullgård
  echo "  --enable-powerpc-perf    enable performance report on PPC"
121 74c53c2d Måns Rullgård
  echo "                           (requires enabling PMC)"
122
  echo "  --disable-mmx            disable MMX usage"
123 064df5a9 Panagiotis Issaris
  echo "  --disable-mmx2           disable MMX2 usage"
124
  echo "  --disable-ssse3          disable SSSE3 usage"
125 1839e854 Siarhei Siamashka
  echo "  --disable-armv5te        disable armv5te usage"
126 edab3048 Måns Rullgård
  echo "  --disable-armv6          disable armv6 usage"
127 74c53c2d Måns Rullgård
  echo "  --disable-iwmmxt         disable iwmmxt usage"
128
  echo "  --disable-altivec        disable AltiVec usage"
129
  echo "  --disable-network        disable network support [default=no]"
130 0c7bb0e5 Luca Barbato
  echo "  --disable-ipv6           disable ipv6 support [default=no]"
131 74c53c2d Måns Rullgård
  echo "  --disable-zlib           disable zlib [default=no]"
132
  echo "  --disable-vhook          disable video hooking support"
133
  echo "  --disable-debug          disable debugging symbols"
134
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
135
  echo "                           MPEG audio decoding [default=no]"
136 cde9e780 Michael Niedermayer
  echo "  --enable-gray            enable full grayscale support (slower color)"
137 786b30af Diego Biurrun
  echo "  --disable-ffmpeg         disable ffmpeg build"
138 74c53c2d Måns Rullgård
  echo "  --disable-ffserver       disable ffserver build"
139
  echo "  --disable-ffplay         disable ffplay build"
140
  echo "  --enable-small           optimize for size instead of speed"
141 3abe5fbd Aurelien Jacobs
  echo "  --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
142 74c53c2d Måns Rullgård
  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
143
  echo "  --disable-encoder=NAME   disables encoder NAME"
144
  echo "  --enable-encoder=NAME    enables encoder NAME"
145
  echo "  --disable-decoder=NAME   disables decoder NAME"
146
  echo "  --enable-decoder=NAME    enables decoder NAME"
147
  echo "  --disable-encoders       disables all encoders"
148
  echo "  --disable-decoders       disables all decoders"
149 ff70e601 Måns Rullgård
  echo "  --disable-muxer=NAME     disables muxer NAME"
150
  echo "  --enable-muxer=NAME      enables muxer NAME"
151 74c53c2d Måns Rullgård
  echo "  --disable-muxers         disables all muxers"
152 ff70e601 Måns Rullgård
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
153
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
154 74c53c2d Måns Rullgård
  echo "  --disable-demuxers       disables all demuxers"
155 af9e7d18 Måns Rullgård
  echo "  --enable-parser=NAME     enables parser NAME"
156
  echo "  --disable-parser=NAME    disables parser NAME"
157
  echo "  --disable-parsers        disables all parsers"
158 cd61e407 Jason Millard
  echo "  --enable-bsf=NAME        enables bitstream filter NAME"
159
  echo "  --disable-bsf=NAME       disables bitstream filter NAME"
160
  echo "  --disable-bsfs           disables all bitstream filters"
161 c08fb000 Alex Beregszaszi
  echo "  --enable-protocol=NAME   enables protocol NAME"
162
  echo "  --disable-protocol=NAME  disables protocol NAME"
163
  echo "  --disable-protocols      disables all protocols"
164 10d46dd0 Diego Biurrun
  echo "  --disable-devices        disables all devices"
165 794f8e97 Panagiotis Issaris
  echo "  --list-decoders          show all available decoders"
166
  echo "  --list-encoders          show all available encoders"
167
  echo "  --list-muxers            show all available muxers"
168
  echo "  --list-demuxers          show all available demuxers"
169
  echo "  --list-parsers           show all available parsers"
170
  echo "  --list-protocols         show all available protocols"
171
  echo "  --list-bsfs              show all available bitstream filters"
172 c552605c Diego Biurrun
  echo "  --list-indevs            show all available input devices"
173
  echo "  --list-outdevs           show all available output devices"
174 0a622b98 Måns Rullgård
  echo
175
  echo "Developer options (useful when working on FFmpeg itself):"
176
  echo "  --enable-gprof           enable profiling with gprof [$gprof]"
177 d2bbb2f7 Diego Biurrun
  echo "  --disable-optimizations  disable compiler optimizations"
178 0a622b98 Måns Rullgård
  echo "  --enable-extra-warnings  enable more compiler warnings"
179
  echo "  --disable-strip          disable stripping of executables and shared libraries"
180 74c53c2d Måns Rullgård
  echo ""
181
  echo "NOTE: Object files are built at the place where configure is launched."
182
  exit 1
183
}
184 cf9d24ad Dan Christiansen
185 57bd82d4 Måns Rullgård
log(){
186
    echo "$@" >>$logfile
187
}
188
189 720c69da Måns Rullgård
log_file(){
190 c8e9f801 Måns Rullgård
    log BEGIN $1
191 6b324648 Måns Rullgård
    pr -n -t $1 >>$logfile
192 c8e9f801 Måns Rullgård
    log END $1
193
}
194
195 2ba042a7 Måns Rullgård
echolog(){
196 c8e9f801 Måns Rullgård
    log "$@"
197 57bd82d4 Måns Rullgård
    echo "$@"
198 2ba042a7 Måns Rullgård
}
199
200
die(){
201
    echolog "$@"
202
    cat <<EOF
203
If you think configure made a mistake, make sure you are using the latest
204
version from SVN.  If the latest version fails, report the problem to the
205 e5d8ccd7 Måns Rullgård
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
206 2ba042a7 Måns Rullgård
EOF
207 720c69da Måns Rullgård
    if enabled logging; then
208 2ba042a7 Måns Rullgård
        cat <<EOF
209
Include the log file "$logfile" produced by configure as this will help
210
solving the problem.
211
EOF
212
    else
213
cat <<EOF
214
Rerun configure with logging enabled (do not use --log=no), and include the
215
log this produces with your report.
216
EOF
217
    fi
218 57bd82d4 Måns Rullgård
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
219
    exit 1
220
}
221
222 6c6007d6 Diego Biurrun
# Avoid locale weirdness, besides we really just want to translate ASCII.
223 44161118 Måns Rullgård
toupper(){
224 6c6007d6 Diego Biurrun
    echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
225 44161118 Måns Rullgård
}
226
227 4a5444db Måns Rullgård
tolower(){
228 6c6007d6 Diego Biurrun
    echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
229 4a5444db Måns Rullgård
}
230
231 a8d04fba Måns Rullgård
set_all(){
232
    value=$1
233
    shift
234
    for var in $*; do
235
        eval $var=$value
236
    done
237
}
238
239 799c9e9b Måns Rullgård
pushvar(){
240
    for var in $*; do
241
        eval level=\${${var}_level:=0}
242
        eval ${var}_${level}="\$$var"
243
        eval ${var}_level=$(($level+1))
244
    done
245
}
246
247
popvar(){
248
    for var in $*; do
249
        eval level=\${${var}_level:-0}
250
        test $level = 0 && continue
251
        eval level=$(($level-1))
252
        eval $var="\${${var}_${level}}"
253
        eval ${var}_level=$level
254
        eval unset ${var}_${level}
255
    done
256
}
257
258 a8d04fba Måns Rullgård
enable(){
259
    set_all yes $*
260
}
261
262
disable(){
263
    set_all no $*
264
}
265
266 57bd82d4 Måns Rullgård
enabled(){
267 44161118 Måns Rullgård
    eval test "x\$$1" = "xyes"
268
}
269
270 37970ebf Ramiro Polla
disabled(){
271
    eval test "x\$$1" = "xno"
272
}
273
274 44161118 Måns Rullgård
enabled_all(){
275
    for opt; do
276
        enabled $opt || return 1
277
    done
278
}
279
280 85bca2c5 Diego Biurrun
disabled_all(){
281
    for opt; do
282
        disabled $opt || return 1
283
    done
284
}
285
286 44161118 Måns Rullgård
enabled_any(){
287
    for opt; do
288
        enabled $opt && return 0
289
    done
290
}
291
292 85bca2c5 Diego Biurrun
disabled_any(){
293
    for opt; do
294
        disabled $opt && return 0
295
    done
296
}
297
298 4a0d6686 Aurelien Jacobs
is_in(){
299
    value=$1
300
    shift
301
    for var in $*; do
302
        [ $var = $value ] && return 0
303
    done
304
    return 1
305
}
306
307 30fd06be Måns Rullgård
check_deps(){
308
    for cfg; do
309 799c9e9b Måns Rullgård
        enabled ${cfg}_checking && die "Circular dependency for $cfg."
310
        disabled ${cfg}_checking && continue
311
        enable ${cfg}_checking
312
313 30fd06be Måns Rullgård
        eval dep_all="\$${cfg}_deps"
314
        eval dep_any="\$${cfg}_deps_any"
315 799c9e9b Måns Rullgård
316
        pushvar cfg dep_all dep_any
317
        check_deps $dep_all $dep_any
318
        popvar cfg dep_all dep_any
319
320 30fd06be Måns Rullgård
        enabled_all $dep_all || disable $cfg
321
        enabled_any $dep_any || disable $cfg
322 799c9e9b Måns Rullgård
323 4ec45764 Ramiro Polla
        if enabled $cfg; then
324
            eval dep_extralibs="\$${cfg}_extralibs"
325
            test -n "$dep_extralibs" && add_extralibs $dep_extralibs
326
        fi
327
328 799c9e9b Måns Rullgård
        disable ${cfg}_checking
329 30fd06be Måns Rullgård
    done
330
}
331
332 44161118 Måns Rullgård
print_config(){
333
    pfx=$1
334
    header=$2
335
    makefile=$3
336
    shift 3
337
    for cfg; do
338 3d907e22 Måns Rullgård
        ucname="`toupper $cfg`"
339 44161118 Måns Rullgård
        if enabled $cfg; then
340 3d907e22 Måns Rullgård
            echo "#define ${pfx}${ucname} 1" >> $header
341
            echo "#define ENABLE_${ucname} 1" >> $header
342
            echo "${pfx}${ucname}=yes" >> $makefile
343
        else
344
            echo "#define ENABLE_${ucname} 0" >> $header
345 44161118 Måns Rullgård
        fi
346
    done
347 57bd82d4 Måns Rullgård
}
348
349
flags_saved(){
350
    (: ${SAVE_CFLAGS?}) 2>/dev/null
351
}
352
353 dcd479c0 Måns Rullgård
save_flags(){
354 57bd82d4 Måns Rullgård
    flags_saved && return
355 dcd479c0 Måns Rullgård
    SAVE_CFLAGS="$CFLAGS"
356
    SAVE_LDFLAGS="$LDFLAGS"
357
    SAVE_extralibs="$extralibs"
358
}
359
360
restore_flags(){
361 f5d28d10 Måns Rullgård
    flags_saved || return
362 dcd479c0 Måns Rullgård
    CFLAGS="$SAVE_CFLAGS"
363
    LDFLAGS="$SAVE_LDFLAGS"
364
    extralibs="$SAVE_extralibs"
365
    unset SAVE_CFLAGS
366
    unset SAVE_LDFLAGS
367
    unset SAVE_extralibs
368
}
369
370
temp_cflags(){
371
    save_flags
372
    CFLAGS="$CFLAGS $*"
373
}
374
375
temp_ldflags(){
376
    save_flags
377
    LDFLAGS="$LDFLAGS $*"
378
}
379
380
temp_extralibs(){
381
    save_flags
382
    extralibs="$extralibs $*"
383
}
384
385 57bd82d4 Måns Rullgård
append(){
386
    var=$1
387
    shift
388
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
389
    eval "$var=\"\$$var $*\""
390
}
391
392
add_cflags(){
393
    append CFLAGS "$@"
394
}
395
396
add_ldflags(){
397
    append LDFLAGS "$@"
398
}
399
400
add_extralibs(){
401
    append extralibs "$@"
402
}
403
404 b0cfb663 Måns Rullgård
check_cmd(){
405 b3cb5d51 Måns Rullgård
    log "$@"
406 9b4f605c Måns Rullgård
    "$@" >>$logfile 2>&1
407 b0cfb663 Måns Rullgård
}
408
409 dcd479c0 Måns Rullgård
check_cc(){
410 57bd82d4 Måns Rullgård
    log check_cc "$@"
411
    cat >$TMPC
412 720c69da Måns Rullgård
    log_file $TMPC
413 b0cfb663 Måns Rullgård
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
414 57bd82d4 Måns Rullgård
}
415
416
check_cpp(){
417
    log check_cpp "$@"
418 dcd479c0 Måns Rullgård
    cat >$TMPC
419 720c69da Måns Rullgård
    log_file $TMPC
420 b0cfb663 Måns Rullgård
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
421 dcd479c0 Måns Rullgård
}
422
423 940f335a Måns Rullgård
check_asm(){
424
    log check_asm "$@"
425
    name="$1"
426
    asm="$2"
427
    shift 2
428
    check_cc "$@" <<EOF && enable $name || disable $name
429
int foo(void){
430
    asm volatile($asm);
431
}
432
EOF
433
}
434
435 dcd479c0 Måns Rullgård
check_ld(){
436 57bd82d4 Måns Rullgård
    log check_ld "$@"
437 0607887f Måns Rullgård
    check_cc || return
438 3155a644 Måns Rullgård
    flags=''
439
    libs=''
440
    for f; do
441
        test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
442
    done
443
    check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
444 dcd479c0 Måns Rullgård
}
445
446
check_cflags(){
447 57bd82d4 Måns Rullgård
    log check_cflags "$@"
448
    check_cc "$@" <<EOF && add_cflags "$@"
449 dcd479c0 Måns Rullgård
int x;
450
EOF
451
}
452
453
check_ldflags(){
454 57bd82d4 Måns Rullgård
    log check_ldflags "$@"
455
    check_ld "$@" <<EOF && add_ldflags "$@"
456 e5af4a11 Diego Biurrun
int main(void){
457 57bd82d4 Måns Rullgård
    return 0;
458
}
459 dcd479c0 Måns Rullgård
EOF
460
}
461
462
check_header(){
463 57bd82d4 Måns Rullgård
    log check_header "$@"
464 dcd479c0 Måns Rullgård
    header=$1
465
    shift
466 d8bc5f06 Måns Rullgård
    var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
467
    disable $var
468
    check_cpp "$@" <<EOF && enable $var
469 dcd479c0 Måns Rullgård
#include <$header>
470
int x;
471
EOF
472
}
473
474
check_func(){
475 57bd82d4 Måns Rullgård
    log check_func "$@"
476 dcd479c0 Måns Rullgård
    func=$1
477
    shift
478 d8bc5f06 Måns Rullgård
    disable $func
479
    check_ld "$@" <<EOF && enable $func
480 dcd479c0 Måns Rullgård
extern int $func();
481 e5af4a11 Diego Biurrun
int main(void){
482 dcd479c0 Måns Rullgård
    $func();
483
}
484
EOF
485
}
486
487 f8d7b072 Måns Rullgård
check_func2(){
488
    log check_func2 "$@"
489
    headers=$1
490
    func=$2
491
    shift 2
492
    disable $func
493
    incs=""
494
    for hdr in $headers; do
495
        incs="$incs
496
#include <$hdr>"
497
    done
498
    check_ld "$@" <<EOF && enable $func
499
$incs
500 d6773f56 Diego Biurrun
int main(int argc, char **argv){
501 f8d7b072 Måns Rullgård
    (void) $func;
502
    return 0;
503
}
504
EOF
505
}
506
507 57bd82d4 Måns Rullgård
check_lib(){
508
    log check_lib "$@"
509
    header="$1"
510
    func="$2"
511
    shift 2
512 fcfcde17 Måns Rullgård
    temp_extralibs "$@"
513
    check_header $header && check_func $func && add_extralibs "$@"
514
    err=$?
515
    restore_flags
516
    return $err
517 57bd82d4 Måns Rullgård
}
518
519 f8d7b072 Måns Rullgård
check_lib2(){
520
    log check_lib2 "$@"
521
    headers="$1"
522
    func="$2"
523
    shift 2
524
    temp_extralibs "$@"
525
    check_func2 "$headers" $func && add_extralibs "$@"
526
    err=$?
527
    restore_flags
528
    return $err
529
}
530
531 dcd479c0 Måns Rullgård
check_exec(){
532 90be59ef Ramiro Polla
    check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
533 57bd82d4 Måns Rullgård
}
534
535 7dfef245 Måns Rullgård
check_exec_crash(){
536
    code=`cat`
537
538
    # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
539
    # are safe but may not be available everywhere.  Thus we use
540
    # raise(SIGTERM) instead.  The check is run in a subshell so we
541
    # can redirect the "Terminated" message from the shell.  SIGBUS
542
    # is not defined by standard C so it is used conditionally.
543
544
    (check_exec "$@") >>$logfile 2>&1 <<EOF
545
#include <signal.h>
546
static void sighandler(int sig){
547
    raise(SIGTERM);
548
}
549 e5af4a11 Diego Biurrun
int main(void){
550 7dfef245 Måns Rullgård
    signal(SIGILL, sighandler);
551
    signal(SIGFPE, sighandler);
552
    signal(SIGSEGV, sighandler);
553
#ifdef SIGBUS
554
    signal(SIGBUS, sighandler);
555
#endif
556
    { $code }
557
}
558
EOF
559
}
560
561 72be9e73 Dave Yeo
check_type(){
562
    log check_type "$@"
563
    headers=$1
564
    type=$2
565
    shift 2
566
    disable $type
567
    incs=""
568
    for hdr in $headers; do
569
        incs="$incs
570
#include <$hdr>"
571
    done
572
    check_cc "$@" <<EOF && enable $type
573
$incs
574
$type v;
575
EOF
576
}
577
578 57bd82d4 Måns Rullgård
require(){
579
    name="$1"
580
    header="$2"
581
    func="$3"
582
    shift 3
583
    check_lib $header $func "$@" || die "ERROR: $name not found"
584 dcd479c0 Måns Rullgård
}
585
586 f8d7b072 Måns Rullgård
require2(){
587
    name="$1"
588
    headers="$2"
589
    func="$3"
590
    shift 3
591
    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
592
}
593
594 eea50282 Måns Rullgård
check_foo_config(){
595
    cfg=$1
596
    pkg=$2
597
    header=$3
598
    func=$4
599
    shift 4
600
    disable $cfg
601
    check_cmd ${pkg}-config --version
602
    err=$?
603
    if test "$err" = 0; then
604
        temp_cflags `${pkg}-config --cflags`
605
        temp_extralibs `${pkg}-config --libs`
606
        check_lib "$@" $header $func && enable $cfg
607
    fi
608
    return $err
609
}
610
611 c505dd31 Måns Rullgård
apply(){
612
    file=$1
613
    shift
614
    "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
615
}
616
617 4a0d6686 Aurelien Jacobs
COMPONENT_LIST="
618
    bsfs
619
    decoders
620
    demuxers
621
    encoders
622 3cde40aa Vitor Sessak
    filters
623 c552605c Diego Biurrun
    indevs
624 4a0d6686 Aurelien Jacobs
    muxers
625 c552605c Diego Biurrun
    outdevs
626 4a0d6686 Aurelien Jacobs
    parsers
627
    protocols
628
"
629
630
CONFIG_LIST="
631
    $COMPONENT_LIST
632 f7679c54 Vitor Sessak
    avfilter
633
    avfilter_lavf
634 c88f5d72 Måns Rullgård
    avisynth
635
    beos_netserver
636
    ffmpeg
637
    ffplay
638
    ffserver
639
    gpl
640 ecfc4f44 Måns Rullgård
    gprof
641 d8d0d0b2 Michael Niedermayer
    gray
642 3abe5fbd Aurelien Jacobs
    hardcoded_tables
643 c88f5d72 Måns Rullgård
    ipv6
644 7bc5f2a8 Diego Biurrun
    liba52
645 f8904fd9 Diego Biurrun
    liba52bin
646 f5a756ef Diego Biurrun
    libamr_nb
647
    libamr_wb
648 f7b8bffe Ramiro Polla
    libdc1394
649 2eed5a46 Diego Biurrun
    libfaac
650
    libfaad
651
    libfaadbin
652 c88f5d72 Måns Rullgård
    libgsm
653 6ebe07fb Diego Biurrun
    libmp3lame
654 c88f5d72 Måns Rullgård
    libnut
655 150d2772 Diego Biurrun
    libtheora
656 c88f5d72 Måns Rullgård
    libvorbis
657 1cc60c47 Diego Biurrun
    libx264
658
    libxvid
659 c88f5d72 Måns Rullgård
    memalign_hack
660
    mpegaudio_hp
661
    network
662 3fe142e2 Diego Biurrun
    nonfree
663 4a24ab64 Diego Biurrun
    postproc
664 2b4c3615 Måns Rullgård
    powerpc_perf
665 bd2216e4 Måns Rullgård
    small
666 13ca50f3 Diego Biurrun
    swscale
667 c88f5d72 Måns Rullgård
    vhook
668 56a059ac Diego Biurrun
    x11grab
669 c88f5d72 Måns Rullgård
    zlib
670 4a0d6686 Aurelien Jacobs
"
671 c88f5d72 Måns Rullgård
672 8eee7025 Diego Biurrun
THREADS_LIST='
673
    beosthreads
674 d22e8442 Dave Yeo
    os2threads
675 8eee7025 Diego Biurrun
    pthreads
676
    w32threads
677
'
678
679 3f5b56e5 Måns Rullgård
ARCH_LIST='
680
    alpha
681
    armv4l
682
    bfin
683
    ia64
684
    m68k
685
    mips
686
    parisc
687
    powerpc
688
    s390
689
    sh4
690
    sparc
691
    sparc64
692
    x86
693
    x86_32
694
    x86_64
695
'
696
697
ARCH_EXT_LIST='
698 1ac9331a Måns Rullgård
    altivec
699
    armv5te
700 edab3048 Måns Rullgård
    armv6
701 3f5b56e5 Måns Rullgård
    iwmmxt
702
    mmi
703
    mmx
704 d7f0920b Alexander Strange
    mmx2
705 9eeed841 Måns Rullgård
    ssse3
706 bd9d34a0 Diego Biurrun
    vis
707 3f5b56e5 Måns Rullgård
'
708
709
HAVE_LIST="
710
    $ARCH_EXT_LIST
711
    $THREADS_LIST
712
    altivec_h
713 c9fdab0d François Revol
    arpa_inet_h
714 6bd859d6 Måns Rullgård
    bswap
715 c88f5d72 Måns Rullgård
    byteswap_h
716 ecf97f22 Alex Beregszaszi
    closesocket
717 1ac9331a Måns Rullgård
    cmov
718 e16e49ac Ramiro Polla
    conio_h
719 c88f5d72 Måns Rullgård
    dcbzl
720 f8aa696f Diego Biurrun
    dev_bktr_ioctl_bt848_h
721
    dev_bktr_ioctl_meteor_h
722
    dev_ic_bt8xx_h
723
    dev_video_meteor_ioctl_meteor_h
724
    dev_video_bktr_ioctl_bt848_h
725 18b67ae5 Måns Rullgård
    dlfcn_h
726 c88f5d72 Måns Rullgård
    dlopen
727 245626d0 Diego Biurrun
    ebp_available
728
    ebx_available
729 c2a29455 Aurelien Jacobs
    fast_64bit
730 7073e9fc Måns Rullgård
    fast_cmov
731 7b829d2a Ramiro Polla
    fast_unaligned
732 9d99cc5a Måns Rullgård
    fork
733 c88f5d72 Måns Rullgård
    freetype2
734 da9e86f8 Roman Shaposhnik
    gethrtime
735 4e68cb8a Roman Shaposhnik
    GetProcessTimes
736 66be5b45 Ramiro Polla
    getrusage
737 c88f5d72 Måns Rullgård
    imlib2
738 2e1913b1 Måns Rullgård
    inet_aton
739 61d251db Måns Rullgård
    inline_asm
740 0b4a1821 Alessandro Sappia
    libdc1394_1
741
    libdc1394_2
742 a33cab3a Michael Kostylev
    llrint
743
    lrint
744 c88f5d72 Måns Rullgård
    lrintf
745 f8aa696f Diego Biurrun
    machine_ioctl_bt848_h
746
    machine_ioctl_meteor_h
747 c88f5d72 Måns Rullgård
    malloc_h
748
    memalign
749 6ffa87d3 Ramiro Polla
    mkstemp
750 c88f5d72 Måns Rullgård
    mlib
751 b4e806b2 Matthieu Castet
    pld
752 9cafbd6c Måns Rullgård
    ppc64
753 a33cab3a Michael Kostylev
    round
754
    roundf
755 c88f5d72 Måns Rullgård
    sdl
756
    sdl_video_size
757 72be9e73 Dave Yeo
    socklen_t
758 deb29777 Måns Rullgård
    soundcard_h
759 f8cda19e Luca Abeni
    poll_h
760 b58412f1 Alexander Strange
    sys_mman_h
761 81644c2e Michael Kostylev
    sys_select_h
762 deb29777 Måns Rullgård
    sys_soundcard_h
763 e16e49ac Ramiro Polla
    termios_h
764 b265431e Måns Rullgård
    threads
765 6ff3f3e7 Ramiro Polla
    winsock2_h
766 0cb78cef Diego Biurrun
"
767 44161118 Måns Rullgård
768 520cc7f1 Måns Rullgård
CMDLINE_SELECT="
769 3f5b56e5 Måns Rullgård
    $ARCH_EXT_LIST
770 520cc7f1 Måns Rullgård
    $CONFIG_LIST
771 8eee7025 Diego Biurrun
    $THREADS_LIST
772 520cc7f1 Måns Rullgård
    debug
773
    extra_warnings
774 d2bbb2f7 Diego Biurrun
    optimizations
775 520cc7f1 Måns Rullgård
    shared
776
    static
777
"
778
779 912f3148 Diego Biurrun
# code dependency declarations
780
781 9eeed841 Måns Rullgård
# architecture extensions
782
altivec_deps="powerpc"
783
armv5te_deps="armv4l"
784
armv6_deps="armv4l"
785
iwmmxt_deps="armv4l"
786 e241ba14 Diego Biurrun
mmi_deps="mips"
787 9eeed841 Måns Rullgård
mmx_deps="x86"
788 d7f0920b Alexander Strange
mmx2_deps="x86"
789 9eeed841 Måns Rullgård
ssse3_deps="x86"
790 bd9d34a0 Diego Biurrun
vis_deps="sparc"
791 9eeed841 Måns Rullgård
792 912f3148 Diego Biurrun
# decoders / encoders
793 6ea67bbb Justin Ruggles
ac3_decoder_deps="gpl"
794 33a0dd37 Kostya Shishkov
dxa_decoder_deps="zlib"
795 30fd06be Måns Rullgård
flashsv_decoder_deps="zlib"
796 773be23a Aurelien Jacobs
flashsv_encoder_deps="zlib"
797 30fd06be Måns Rullgård
mpeg_xvmc_decoder_deps="xvmc"
798
png_decoder_deps="zlib"
799
png_encoder_deps="zlib"
800
zmbv_decoder_deps="zlib"
801
zmbv_encoder_deps="zlib"
802
803 912f3148 Diego Biurrun
# external libraries
804 7bc5f2a8 Diego Biurrun
liba52_decoder_deps="liba52"
805 4ec45764 Ramiro Polla
liba52bin_decoder_extralibs='$ldl'
806 f5a756ef Diego Biurrun
libamr_nb_decoder_deps="libamr_nb"
807
libamr_nb_encoder_deps="libamr_nb"
808
libamr_wb_decoder_deps="libamr_wb"
809
libamr_wb_encoder_deps="libamr_wb"
810 c9171a83 Diego Biurrun
libfaac_encoder_deps="libfaac"
811 69ddbd1d Diego Biurrun
libfaad_decoder_deps="libfaad"
812 4ec45764 Ramiro Polla
libfaadbin_decoder_extralibs='$ldl'
813 299c77d5 Måns Rullgård
libgsm_decoder_deps="libgsm"
814
libgsm_encoder_deps="libgsm"
815 8ffed8d8 Måns Rullgård
libgsm_ms_decoder_deps="libgsm"
816
libgsm_ms_encoder_deps="libgsm"
817 1cc60c47 Diego Biurrun
libmp3lame_encoder_deps="libmp3lame"
818 150d2772 Diego Biurrun
libtheora_encoder_deps="libtheora"
819 b0caf888 Diego Biurrun
libvorbis_encoder_deps="libvorbis"
820 1cc60c47 Diego Biurrun
libx264_encoder_deps="libx264"
821
libxvid_encoder_deps="libxvid"
822 13566c31 Diego Biurrun
mpeg4aac_decoder_deps="libfaad"
823 30fd06be Måns Rullgård
824 912f3148 Diego Biurrun
# demuxers / muxers
825 03a76ba9 Diego Biurrun
ac3_demuxer_deps="ac3_parser"
826 50383e88 Ramiro Polla
audio_beos_demuxer_deps="audio_beos"
827 4ec45764 Ramiro Polla
audio_beos_demuxer_extralibs="-lmedia -lbe"
828 50383e88 Ramiro Polla
audio_beos_muxer_deps="audio_beos"
829 4ec45764 Ramiro Polla
audio_beos_muxer_extralibs="-lmedia -lbe"
830 53b73365 Ramiro Polla
avisynth_demuxer_deps="avisynth"
831 73483024 Ramiro Polla
bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
832 fe9bb347 Diego Biurrun
dv1394_demuxer_deps="dv1394 dv_demuxer"
833 f7b8bffe Ramiro Polla
libdc1394_demuxer_deps="libdc1394"
834 d7c59247 Diego Biurrun
libnut_demuxer_deps="libnut"
835
libnut_muxer_deps="libnut"
836 4bd8e17c Aurelien Jacobs
mp3_demuxer_deps="mpegaudio_parser"
837 c7682de0 Ramiro Polla
oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
838
oss_muxer_deps_any="soundcard_h sys_soundcard_h"
839 30fd06be Måns Rullgård
redir_demuxer_deps="network"
840 8eb793c4 Luca Abeni
rtp_muxer_deps="network rtp_protocol"
841 95c21842 Luca Abeni
rtsp_demuxer_deps="sdp_demuxer"
842
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
843 06e31011 Ramiro Polla
v4l2_demuxer_deps="linux_videodev2_h"
844
v4l_demuxer_deps="linux_videodev_h"
845 c2345207 Ramiro Polla
vfwcap_demuxer_deps="capCreateCaptureWindow"
846
vfwcap_demuxer_extralibs="-lvfw32"
847 06eab4ba Ramiro Polla
x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
848 4ec45764 Ramiro Polla
x11_grab_device_demuxer_extralibs="-lX11 -lXext"
849 30fd06be Måns Rullgård
850 912f3148 Diego Biurrun
# protocols
851 c08fb000 Alex Beregszaszi
http_protocol_deps="network"
852
rtp_protocol_deps="udp_protocol"
853
tcp_protocol_deps="network"
854
udp_protocol_deps="network"
855
856 f7679c54 Vitor Sessak
# filters
857 81124ba0 Vitor Sessak
movie_filter_deps="avfilter_lavf"
858 f7679c54 Vitor Sessak
859 912f3148 Diego Biurrun
# programs
860 fa859b4d Måns Rullgård
ffplay_deps="sdl"
861 6ad42348 Ramiro Polla
ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
862 4ec45764 Ramiro Polla
ffserver_extralibs='$ldl'
863
vhook_extralibs='$ldl'
864 a2830dca Måns Rullgård
865 912f3148 Diego Biurrun
866 0f3cb305 Fabrice Bellard
# set temporary file name
867 57514323 Zdenek Kabelac
if test ! -z "$TMPDIR" ; then
868 0f3cb305 Fabrice Bellard
    TMPDIR1="${TMPDIR}"
869 57514323 Zdenek Kabelac
elif test ! -z "$TEMPDIR" ; then
870 0f3cb305 Fabrice Bellard
    TMPDIR1="${TEMPDIR}"
871 3d204385 Nick Kurshev
else
872 0f3cb305 Fabrice Bellard
    TMPDIR1="/tmp"
873 3d204385 Nick Kurshev
fi
874
875 0f3cb305 Fabrice Bellard
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
876
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
877 f3ec2d46 Slavik Gnatenko
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
878 0f3cb305 Fabrice Bellard
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
879
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
880
881 de6d9b64 Fabrice Bellard
# default parameters
882 8a608357 Måns Rullgård
883 497237c7 Ramiro Polla
enable logging
884 2ba042a7 Måns Rullgård
logfile="config.err"
885 8a608357 Måns Rullgård
886
# installation paths
887 2266e085 Diego Biurrun
PREFIX="/usr/local"
888 c75560ae Diego Biurrun
libdir='$(PREFIX)/lib'
889 84c22efd Diego Biurrun
shlibdir="$libdir"
890 76a448ed Måns Rullgård
incdir='$(PREFIX)/include'
891 4ca5ece5 Stefano Sabatini
mandir='$(PREFIX)/share/man'
892 c75560ae Diego Biurrun
bindir='$(PREFIX)/bin'
893 8a608357 Måns Rullgård
894
# toolchain
895 de6d9b64 Fabrice Bellard
cc="gcc"
896
ar="ar"
897 503d5b58 Michael Kostylev
nm="nm"
898 be7109c1 Michael Niedermayer
ranlib="ranlib"
899 4a908fbc Alex Beregszaszi
make="make"
900 0f3cb305 Fabrice Bellard
strip="strip"
901 8a608357 Måns Rullgård
asmalign_pot="unknown"
902 20369773 Dave Yeo
ln_s="ln -sf"
903 8a608357 Måns Rullgård
904
# machine
905 cc6a90dd Guillaume Poirier
arch=`uname -m`
906 38d0a8aa Guillaume Poirier
cpu="generic"
907 8a608357 Måns Rullgård
908
# OS
909 b9663405 Diego Biurrun
targetos=$(tolower $(uname -s))
910 8a608357 Måns Rullgård
911
# libraries
912 497237c7 Ramiro Polla
enable zlib
913 8a608357 Måns Rullgård
914
# configurable options
915 497237c7 Ramiro Polla
enable debug
916
enable dostrip
917
enable ffmpeg
918
enable ffplay
919
enable ffserver
920
enable ipv6
921
enable static
922
enable mpegaudio_hp
923
enable network
924 8400d6b8 Diego Biurrun
enable optimizations
925 497237c7 Ramiro Polla
enable protocols
926 8a608357 Måns Rullgård
vhook="default"
927
928
# build settings
929 baa3a937 Måns Rullgård
SHFLAGS='-shared -Wl,-soname,$@'
930 cab3ef82 Diego Biurrun
VHOOKSHFLAGS='$(SHFLAGS)'
931 e240ee67 Luca Barbato
LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
932 c536cb09 Diego Biurrun
FFSERVERLDFLAGS=-Wl,-E
933 f3ec2d46 Slavik Gnatenko
LIBPREF="lib"
934
LIBSUF=".a"
935 c5f14466 Ramiro Polla
FULLNAME='$(NAME)$(BUILDSUF)'
936
LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
937 f3ec2d46 Slavik Gnatenko
SLIBPREF="lib"
938
SLIBSUF=".so"
939 c5f14466 Ramiro Polla
SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
940 b29bddab Diego Biurrun
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
941
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
942 24743a76 Diego Biurrun
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
943 ef0bc4c9 François Revol
944 315c741d Diego Biurrun
# gcc stupidly only outputs the basename of targets with -MM
945 abe39c0f Diego Biurrun
DEPEND_CMD='$(CC) -MM $(CFLAGS) $(filter-out %.h,$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,"'
946
VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
947 315c741d Diego Biurrun
948 c597172e Måns Rullgård
# find source path
949
source_path="`dirname \"$0\"`"
950 497237c7 Ramiro Polla
enable source_path_used
951 c597172e Måns Rullgård
if test -z "$source_path" -o "$source_path" = "." ; then
952
    source_path="`pwd`"
953 497237c7 Ramiro Polla
    disable source_path_used
954 c597172e Måns Rullgård
else
955
    source_path="`cd \"$source_path\"; pwd`"
956
    echo "$source_path" | grep -q '[[:blank:]]' &&
957 7483e694 Diego Biurrun
        die "Out of tree builds are impossible with whitespace in source path."
958 c597172e Måns Rullgård
fi
959
960
FFMPEG_CONFIGURATION="$@"
961
962 73ef8980 Måns Rullgård
find_things(){
963
    thing=$1
964
    pattern=$2
965
    file=$source_path/$3
966 932ccf39 Måns Rullgård
    sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
967 73ef8980 Måns Rullgård
}
968
969
ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
970
DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
971
PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
972
BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
973
MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
974
DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
975
OUTDEV_LIST=$(find_things   muxer    _MUX     libavdevice/alldevices.c)
976
INDEV_LIST=$(find_things    demuxer  DEMUX    libavdevice/alldevices.c)
977
PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
978 81124ba0 Vitor Sessak
FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
979 c597172e Måns Rullgård
980 7483e694 Diego Biurrun
enable $ARCH_EXT_LIST \
981
       $DECODER_LIST \
982
       $ENCODER_LIST \
983
       $PARSER_LIST \
984
       $BSF_LIST \
985
       $DEMUXER_LIST \
986
       $MUXER_LIST \
987 f7679c54 Vitor Sessak
       $FILTER_LIST \
988 7483e694 Diego Biurrun
       $PROTOCOL_LIST \
989
       $INDEV_LIST \
990
       $OUTDEV_LIST \
991 c597172e Måns Rullgård
992
die_unknown(){
993
    echo "Unknown option \"$1\"."
994
    echo "See $0 --help for available options."
995
    exit 1
996
}
997
998 794f8e97 Panagiotis Issaris
show_list() {
999 bf0c4afa Ramiro Polla
    suffix=_$1
1000
    shift
1001
    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1002 794f8e97 Panagiotis Issaris
    exit 0
1003
}
1004
1005 c597172e Måns Rullgård
for opt do
1006 7483e694 Diego Biurrun
    optval="${opt#*=}"
1007
    case "$opt" in
1008
    --log)
1009
    ;;
1010
    --log=*) logging="$optval"
1011
    ;;
1012
    --prefix=*) PREFIX="$optval"
1013
    ;;
1014
    --libdir=*) libdir="$optval"
1015
    ;;
1016
    --shlibdir=*) shlibdir="$optval"
1017
    ;;
1018
    --incdir=*) incdir="$optval"
1019
    ;;
1020
    --mandir=*) mandir="$optval"
1021
    ;;
1022
    --source-path=*) source_path="$optval"
1023
    ;;
1024
    --cross-prefix=*) cross_prefix="$optval"
1025
    ;;
1026
    --cross-compile) enable cross_compile
1027
    ;;
1028
    --target-os=*) targetos="$optval"
1029
    ;;
1030
    --cc=*) cc="$optval"
1031
    ;;
1032
    --make=*) make="$optval"
1033
    ;;
1034
    --extra-cflags=*) add_cflags "$optval"
1035
    ;;
1036
    --extra-ldflags=*) add_ldflags "$optval"
1037
    ;;
1038
    --extra-libs=*) add_extralibs "$optval"
1039
    ;;
1040
    --build-suffix=*) BUILDSUF="$optval"
1041
    ;;
1042
    --arch=*) arch="$optval"
1043
    ;;
1044
    --cpu=*) cpu="$optval"
1045
    ;;
1046
    --enable-sunmlib) enable mlib
1047
    ;;
1048
    --disable-strip) disable dostrip
1049
    ;;
1050 8fb1cb58 Diego Biurrun
    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1051 9aa8ed9d Panagiotis Issaris
    ;;
1052 40bcf4c7 Benjamin Larsson
    --enable-debug=*) debuglevel="$optval"
1053
    ;;
1054 7483e694 Diego Biurrun
    --enable-*=*|--disable-*=*)
1055
    eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
1056
    case "$thing" in
1057 81124ba0 Vitor Sessak
        encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
1058 7483e694 Diego Biurrun
        *) die_unknown "$opt" ;;
1059
    esac
1060
    ;;
1061
    --enable-?*|--disable-?*)
1062
    eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
1063 e3773a55 Måns Rullgård
    if is_in $option $COMPONENT_LIST; then
1064
        eval $action \$$(toupper ${option%s})_LIST
1065
    elif is_in $option $CMDLINE_SELECT; then
1066
        $action $option
1067
    else
1068
        die_unknown $opt
1069
    fi
1070 7483e694 Diego Biurrun
    ;;
1071
    --list-*)
1072
        NAME="${opt#--list-}"
1073
        is_in $NAME $COMPONENT_LIST || die_unknown $opt
1074
        NAME=${NAME%s}
1075
        eval show_list $NAME \$$(toupper $NAME)_LIST
1076
    ;;
1077
    --help|-h) show_help
1078
    ;;
1079
    *)
1080
    die_unknown $opt
1081
    ;;
1082
    esac
1083 c597172e Måns Rullgård
done
1084
1085 270739bb Måns Rullgård
case "$arch" in
1086 7483e694 Diego Biurrun
    i386|i486|i586|i686|i86pc|BePC)
1087
        arch="x86_32"
1088
        enable fast_unaligned
1089
    ;;
1090
    x86_64|amd64)
1091
        arch="x86_32"
1092
        enable fast_unaligned
1093
        canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
1094
        if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
1095 6fce7591 Diego Biurrun
            if ! echo $CFLAGS | grep -q -- -m32; then
1096 7483e694 Diego Biurrun
                arch="x86_64"
1097
                enable fast_64bit
1098
            fi
1099
        fi
1100
    ;;
1101
    # armv4l is a subset of armv[567]*l
1102
    arm|armv[4567]*l)
1103
        arch="armv4l"
1104
    ;;
1105
    alpha)
1106
        arch="alpha"
1107
        enable fast_64bit
1108
    ;;
1109
    "Power Macintosh"|ppc|powerpc)
1110
        arch="powerpc"
1111
    ;;
1112
    ppc64)
1113
        arch="powerpc"
1114 c2a29455 Aurelien Jacobs
        enable fast_64bit
1115 d474299a Måns Rullgård
    ;;
1116 7483e694 Diego Biurrun
    mips|mipsel|IP*)
1117
        arch="mips"
1118 d474299a Måns Rullgård
    ;;
1119 7483e694 Diego Biurrun
    sun4u|sparc64)
1120
        arch="sparc64"
1121
        enable fast_64bit
1122 d474299a Måns Rullgård
    ;;
1123 7483e694 Diego Biurrun
    sparc)
1124
        arch="sparc"
1125 d474299a Måns Rullgård
    ;;
1126 7483e694 Diego Biurrun
    sh4)
1127
        arch="sh4"
1128 d474299a Måns Rullgård
    ;;
1129 7483e694 Diego Biurrun
    parisc)
1130
        arch="parisc"
1131 d474299a Måns Rullgård
    ;;
1132 7483e694 Diego Biurrun
    parisc64)
1133
        arch="parisc"
1134
        enable fast_64bit
1135 d474299a Måns Rullgård
    ;;
1136 7483e694 Diego Biurrun
    s390|s390x)
1137
        arch="s390"
1138 d474299a Måns Rullgård
    ;;
1139 7483e694 Diego Biurrun
    m68k)
1140
        arch="m68k"
1141 d474299a Måns Rullgård
    ;;
1142 7483e694 Diego Biurrun
    ia64)
1143
        arch="ia64"
1144
        enable fast_64bit
1145 d474299a Måns Rullgård
    ;;
1146 7483e694 Diego Biurrun
    bfin)
1147
        arch="bfin"
1148
    ;;
1149
    *)
1150
        arch="unknown"
1151 d474299a Måns Rullgård
    ;;
1152 ef0bc4c9 François Revol
esac
1153 de6d9b64 Fabrice Bellard
1154 7483e694 Diego Biurrun
enable $arch
1155
enabled_any x86_32 x86_64 && enable x86
1156
enabled     sparc64       && enable sparc
1157
1158
# OS specific
1159
case $targetos in
1160
    beos|haiku|zeta)
1161
        PREFIX="$HOME/config"
1162
        # helps building libavcodec
1163
        add_cflags "-DPIC -fomit-frame-pointer"
1164
        # 3 gcc releases known for BeOS, each with ugly bugs
1165
        gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1166
        case "$gcc_version" in
1167
          2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1168
            disable mmx
1169
            ;;
1170
          *20010315*) echo "BeBits gcc"
1171
            add_cflags "-fno-expensive-optimizations"
1172
            ;;
1173
        esac
1174
        SHFLAGS=-nostart
1175
        # enable BeOS things
1176
        enable audio_beos
1177
        # no need for libm, but the inet stuff
1178
        # Check for BONE
1179
        # XXX: actually should check for NOT net_server
1180 78fe7631 Diego Biurrun
        if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1181 7483e694 Diego Biurrun
            network_extralibs="-lbind -lsocket"
1182
        else
1183
            enable beos_netserver
1184
            network_extralibs="-lnet"
1185
        fi ;;
1186
    sunos)
1187
        FFSERVERLDFLAGS=""
1188
        SHFLAGS='-shared -Wl,-h,$@'
1189
        network_extralibs="-lsocket -lnsl"
1190
        ;;
1191
    netbsd)
1192
        oss_demuxer_extralibs="-lossaudio"
1193
        oss_muxer_extralibs="-lossaudio"
1194
        ;;
1195
    openbsd)
1196
        disable need_memalign
1197
        LIBOBJFLAGS='$(PIC)'
1198
        SHFLAGS='-shared'
1199
        SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
1200
        SLIBNAME_WITH_VERSION='$(SLIBNAME)'
1201
        SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
1202
        oss_demuxer_extralibs="-lossaudio"
1203
        oss_muxer_extralibs="-lossaudio"
1204
        ;;
1205
    freebsd)
1206
        disable need_memalign
1207
        ;;
1208
    bsd/os)
1209
        osextralibs="-lpoll -lgnugetopt"
1210
        strip="strip -d"
1211
        ;;
1212
    darwin)
1213
        disable need_memalign
1214 0138c54e Diego Biurrun
        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
1215 7483e694 Diego Biurrun
        VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$@'
1216
        strip="strip -x"
1217
        FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
1218
        SLIBSUF=".dylib"
1219
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
1220
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
1221
        FFSERVERLDFLAGS=-Wl,-bind_at_load
1222
        ;;
1223
    mingw32*)
1224
        targetos=mingw32
1225
        shlibdir="$bindir"
1226
        VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1227
        VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1228 13ca50f3 Diego Biurrun
        if enabled swscale; then
1229 7483e694 Diego Biurrun
            VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1230
            VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1231
        fi
1232
        disable ffserver
1233
        SLIBPREF=""
1234
        SLIBSUF=".dll"
1235
        EXESUF=".exe"
1236
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1237
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1238
        SLIB_EXTRA_CMD='-lib /machine:i386 /def:$(@:$(SLIBSUF)=.def)'
1239
        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1240
        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1241
        SHFLAGS='-shared -Wl,--output-def,$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1242
        ;;
1243
    cygwin*)
1244
        targetos=cygwin
1245
        shlibdir="$bindir"
1246
        VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1247
        VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1248 13ca50f3 Diego Biurrun
        if enabled swscale; then
1249 7483e694 Diego Biurrun
            VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1250
            VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1251
        fi
1252
        EXESUF=".exe"
1253
        SLIBPREF="cyg"
1254
        SLIBSUF=".dll"
1255
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1256
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1257
        SHFLAGS='-shared -Wl,--enable-auto-image-base'
1258
        ;;
1259 4f365f37 Michael Kostylev
    *-dos|freedos|opendos)
1260
        disable ffplay ffserver vhook
1261
        disable $INDEV_LIST $OUTDEV_LIST
1262
        network_extralibs="-lsocket"
1263
        EXESUF=".exe"
1264
        ;;
1265 7483e694 Diego Biurrun
    linux)
1266
        LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
1267
        enable dv1394
1268
        ;;
1269
    irix*)
1270
        targetos=irix
1271
        ranlib="echo ignoring ranlib"
1272
        ;;
1273 d22e8442 Dave Yeo
    os/2*)
1274
        strip="lxlite"
1275
        ln_s="cp -f"
1276
        EXESUF=".exe"
1277
        FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
1278
        SHFLAGS='$(NAME).def -Zdll -Zomf'
1279
        FFSERVERLDFLAGS=""
1280 287d3b13 Dave Yeo
        LIBSUF="_s.a"
1281 d22e8442 Dave Yeo
        SLIBPREF=""
1282
        SLIBSUF=".dll"
1283
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1284
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
1285
        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(NAME).def; \
1286
          echo PROTMODE >> $(NAME).def; \
1287
          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \
1288
          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \
1289
          echo EXPORTS >> $(NAME).def; \
1290
          emxexp -o $(OBJS) >> $(NAME).def'
1291
        SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \
1292
          emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;'
1293
        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1294
        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1295 c6eed369 Ramiro Polla
        disable vhook
1296 d22e8442 Dave Yeo
        ;;
1297 269820f1 Peter Ross
    interix)
1298
        disable vhook
1299
        ;;
1300 d22e8442 Dave Yeo
1301 7483e694 Diego Biurrun
    *)
1302
        targetos="${targetos}-UNKNOWN"
1303
        ;;
1304
esac
1305
1306 c597172e Måns Rullgård
add_extralibs $osextralibs
1307 de6d9b64 Fabrice Bellard
1308 e3c00e34 Diego Biurrun
if ! disabled logging ; then
1309 90be59ef Ramiro Polla
    enabled logging || logfile="$logging"
1310 57bd82d4 Måns Rullgård
    echo "# $0 $@" >$logfile
1311
    set >>$logfile
1312 2ba042a7 Måns Rullgård
else
1313
    logfile=/dev/null
1314 57bd82d4 Måns Rullgård
fi
1315 e89b8b0a Diego Biurrun
1316 28d8e661 Diego Biurrun
# Combine FFLDFLAGS and the LDFLAGS environment variable.
1317
LDFLAGS="$FFLDFLAGS $LDFLAGS"
1318 e89b8b0a Diego Biurrun
1319 497237c7 Ramiro Polla
test -n "$cross_prefix" && enable cross_compile
1320 1ea46bed Måns Rullgård
cc="${cross_prefix}${cc}"
1321
ar="${cross_prefix}${ar}"
1322 503d5b58 Michael Kostylev
nm="${cross_prefix}${nm}"
1323 1ea46bed Måns Rullgård
ranlib="${cross_prefix}${ranlib}"
1324
strip="${cross_prefix}${strip}"
1325
1326 320d060a Diego Biurrun
# we need to build at least one lib type
1327 93b3c083 Måns Rullgård
if ! enabled_any static shared; then
1328 320d060a Diego Biurrun
    cat <<EOF
1329
At least one library type must be built.
1330
Specify --enable-static to build the static libraries or --enable-shared to
1331
build the shared libraries as well. To only build the shared libraries specify
1332
--disable-static in addition to --enable-shared.
1333
EOF
1334
    exit 1;
1335
fi
1336
1337 abc4e572 Diego Biurrun
disabled static && LIBNAME=""
1338 2a320695 Ramiro Polla
1339 a2234ceb Ramiro Polla
if enabled_any libfaad libfaadbin ; then
1340
    if check_header faad.h; then
1341
        check_cc << EOF
1342
#include <faad.h>
1343
#ifndef FAAD2_VERSION
1344
ok faad1
1345
#endif
1346 db817cf3 Diego Biurrun
int main(void) { return 0; }
1347 a2234ceb Ramiro Polla
EOF
1348
        test $? = 0 && enable libfaad2
1349
    else
1350 ff3dac65 Diego Biurrun
        die "FAAD test failed."
1351 a2234ceb Ramiro Polla
    fi
1352
fi
1353
1354
1355 93b3c083 Måns Rullgård
if ! enabled gpl; then
1356 54118497 Ramiro Polla
    die_gpl_disabled(){
1357
        name=$1
1358
        shift
1359
        enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
1360
    }
1361 4a24ab64 Diego Biurrun
    die_gpl_disabled "The Postprocessing code" postproc
1362 7bc5f2a8 Diego Biurrun
    die_gpl_disabled "liba52"                  liba52
1363 1cc60c47 Diego Biurrun
    die_gpl_disabled "libx264"                 libx264
1364
    die_gpl_disabled "libxvidcore"             libxvid
1365 54118497 Ramiro Polla
    die_gpl_disabled "FAAD2"                   libfaad2
1366
    die_gpl_disabled "The X11 grabber"         x11grab
1367 13ca50f3 Diego Biurrun
    die_gpl_disabled "The software scaler"     swscale
1368 ebb810d9 Ramiro Polla
fi
1369 b2e3c528 Michael Niedermayer
1370 3fe142e2 Diego Biurrun
if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
1371
    die "libamr is nonfree and --enable-nonfree is not specified."
1372
fi
1373
1374 9eeed841 Måns Rullgård
check_deps $ARCH_EXT_LIST
1375 0f3cb305 Fabrice Bellard
1376 5d323602 Måns Rullgård
test -z "$need_memalign" && need_memalign="$mmx"
1377
1378 cf9d24ad Dan Christiansen
#Darwin CC versions
1379 ced75d92 Diego Biurrun
if test $targetos = darwin; then
1380 3dddba4b Diego Biurrun
    if $cc -v 2>&1 | grep -q xlc; then
1381 30a3e5d4 Nigel Pearson
        add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1382 cf9d24ad Dan Christiansen
    else
1383 8541cc27 İsmail Dönmez
        add_cflags "-pipe"
1384 26c1b3be Diego Biurrun
        check_cflags "-force_cpusubtype_ALL"
1385
        check_cflags "-Wno-sign-compare"
1386 8b83d568 Alexander Strange
        enabled shared || add_cflags -mdynamic-no-pic
1387 cf9d24ad Dan Christiansen
    fi
1388 2a1a6b64 Michael Niedermayer
fi
1389
1390 8400d6b8 Diego Biurrun
disabled optimizations || add_cflags -fomit-frame-pointer
1391 cf9d24ad Dan Christiansen
1392 a4adb608 Michael Niedermayer
# Add processor-specific flags
1393 38d0a8aa Guillaume Poirier
if test $cpu != "generic"; then
1394 bc8ec47b Måns Rullgård
    warn_altivec(){
1395
        $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
1396 1658bc4f Diego Biurrun
    }
1397 38d0a8aa Guillaume Poirier
    case $cpu in
1398 bb270c08 Diego Biurrun
        601|ppc601|PowerPC601)
1399 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=601"
1400 bc8ec47b Måns Rullgård
            warn_altivec enabled PPC601
1401 bb270c08 Diego Biurrun
        ;;
1402
        603*|ppc603*|PowerPC603*)
1403 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=603"
1404 bc8ec47b Måns Rullgård
            warn_altivec enabled PPC603
1405 bb270c08 Diego Biurrun
        ;;
1406
        604*|ppc604*|PowerPC604*)
1407 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=604"
1408 bc8ec47b Måns Rullgård
            warn_altivec enabled PPC604
1409 bb270c08 Diego Biurrun
        ;;
1410
        G3|g3|75*|ppc75*|PowerPC75*)
1411 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1412 bc8ec47b Måns Rullgård
            warn_altivec enabled PPC75x
1413 bb270c08 Diego Biurrun
        ;;
1414
        G4|g4|745*|ppc745*|PowerPC745*)
1415 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1416 bc8ec47b Måns Rullgård
            warn_altivec disabled PPC745x
1417 bb270c08 Diego Biurrun
        ;;
1418
        74*|ppc74*|PowerPC74*)
1419 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1420 bc8ec47b Måns Rullgård
            warn_altivec disabled PPC74xx
1421 bb270c08 Diego Biurrun
        ;;
1422
        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1423 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1424 bc8ec47b Måns Rullgård
            warn_altivec disabled PPC970
1425 9cafbd6c Måns Rullgård
            enable ppc64
1426 bb270c08 Diego Biurrun
        ;;
1427 e07e357d Luca Barbato
        Cell|CELL|cell)
1428
            add_cflags "-mcpu=cell"
1429
            warn_altivec disabled Cell
1430 9cafbd6c Måns Rullgård
            enable ppc64
1431 e07e357d Luca Barbato
        ;;
1432 e7768fc5 Guillaume Poirier
        # targets that do NOT support conditional mov (cmov)
1433
        i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1434 38d0a8aa Guillaume Poirier
            add_cflags "-march=$cpu"
1435 497237c7 Ramiro Polla
            disable cmov
1436 e7768fc5 Guillaume Poirier
        ;;
1437
        # targets that do support conditional mov (cmov)
1438 416519dd Måns Rullgård
        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
1439 e7768fc5 Guillaume Poirier
            add_cflags "-march=$cpu"
1440 497237c7 Ramiro Polla
            enable cmov
1441
            enable fast_cmov
1442 94e4c3a3 Guillaume Poirier
        ;;
1443
        # targets that do support conditional mov but on which it's slow
1444 800a5a19 Igor Mozolevsky
        pentium4|pentium4m|prescott|nocona)
1445 94e4c3a3 Guillaume Poirier
            add_cflags "-march=$cpu"
1446 497237c7 Ramiro Polla
            enable cmov
1447
            disable fast_cmov
1448 bb270c08 Diego Biurrun
        ;;
1449 d7b34d08 Diego Biurrun
        sparc64)
1450 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=v9"
1451 d7b34d08 Diego Biurrun
        ;;
1452 6b19786b Måns Rullgård
        arm*)
1453
            add_cflags "-mcpu=$cpu"
1454
        ;;
1455 bb270c08 Diego Biurrun
        *)
1456 7483e694 Diego Biurrun
            echo "WARNING: Unknown CPU \"$cpu\", ignored."
1457 bb270c08 Diego Biurrun
        ;;
1458 a4adb608 Michael Niedermayer
    esac
1459
fi
1460
1461 412c1562 Måns Rullgård
gnu_make(){
1462
    $1 --version 2>&1 | grep -q GNU
1463
}
1464
1465
if ! gnu_make $make; then
1466
    gnu_make gmake && make=gmake || die "GNU make not found."
1467
fi
1468
1469 be0d52ab Måns Rullgård
# make sure we can execute files in $TMPDIR
1470
cat >$TMPE 2>>$logfile <<EOF
1471
#! /bin/sh
1472
EOF
1473
chmod +x $TMPE >>$logfile 2>&1
1474
if ! $TMPE >>$logfile 2>&1; then
1475
    cat <<EOF
1476
Unable to create and execute files in $TMPDIR1.  Set the TMPDIR environment
1477 68300911 Diego Biurrun
variable to another directory and make sure that $TMPDIR1 is not mounted
1478
noexec.
1479 be0d52ab Måns Rullgård
EOF
1480
    die "Sanity test failed."
1481
fi
1482 0244f743 Måns Rullgård
rm $TMPE
1483 be0d52ab Måns Rullgård
1484 1a268acc Måns Rullgård
# compiler sanity check
1485
check_exec <<EOF
1486 e5af4a11 Diego Biurrun
int main(void){
1487 1a268acc Måns Rullgård
    return 0;
1488
}
1489
EOF
1490
if test "$?" != 0; then
1491
    echo "$cc is unable to create an executable file."
1492 93b3c083 Måns Rullgård
    if test -z "$cross_prefix" && ! enabled cross_compile ; then
1493 1a268acc Måns Rullgård
        echo "If $cc is a cross-compiler, use the --cross-compile option."
1494 c7ae6345 Måns Rullgård
        echo "Only do this if you know what cross compiling means."
1495 1a268acc Måns Rullgård
    fi
1496
    die "C compiler test failed."
1497
fi
1498
1499 b4d96ba2 Måns Rullgård
check_cc <<EOF || die "Symbol mangling check failed."
1500
int ff_extern;
1501
EOF
1502 503d5b58 Michael Kostylev
sym=$($nm -P -g $TMPO)
1503 b4d96ba2 Måns Rullgård
extern_prefix=${sym%%ff_extern*}
1504
1505 61d251db Måns Rullgård
check_asm inline_asm '""'
1506
1507 9eeed841 Måns Rullgård
if enabled x86; then
1508 44965991 Panagiotis Issaris
    # check whether EBP is available on x86
1509
    # As 'i' is stored on the stack, this program will crash
1510
    # if the base pointer is used to access it because the
1511
    # base pointer is cleared in the inline assembly code.
1512 7dfef245 Måns Rullgård
    check_exec_crash <<EOF && enable ebp_available
1513 44965991 Panagiotis Issaris
    volatile int i=0;
1514
    asm volatile (
1515
        "xorl %%ebp, %%ebp"
1516
    ::: "%ebp");
1517
    return i;
1518
EOF
1519
1520
    # check wether EBX is available on x86
1521 940f335a Måns Rullgård
    check_asm ebx_available '"":::"%ebx"'
1522 8e380710 Loren Merritt
1523 d7f0920b Alexander Strange
    # check whether binutils is new enough to compile SSSE3/MMX2
1524 940f335a Måns Rullgård
    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
1525 d7f0920b Alexander Strange
    enabled mmx2  && check_asm mmx2  '"movss %xmm0, %xmm0"'
1526 6bd859d6 Måns Rullgård
1527
    check_asm bswap '"bswap %%eax" ::: "%eax"'
1528 44965991 Panagiotis Issaris
fi
1529
1530 87ea51e0 Luca Barbato
# check for assembler specific support
1531
1532 cc6a90dd Guillaume Poirier
if test $arch = "powerpc"; then
1533 497237c7 Ramiro Polla
check_cc <<EOF && enable dcbzl
1534 87ea51e0 Luca Barbato
int main(void) {
1535
    register long zero = 0;
1536
    char data[1024];
1537
    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1538
return 0;
1539
}
1540
EOF
1541
fi
1542
1543 57bd82d4 Måns Rullgård
# check for SIMD availability
1544
1545 115329f1 Diego Biurrun
# AltiVec flags: The FSF version of GCC differs from the Apple version
1546 9eeed841 Måns Rullgård
if enabled altivec; then
1547 4477b9f4 Diego Biurrun
    check_cflags -maltivec -mabi=altivec &&
1548
        check_header altivec.h ||
1549
        check_cflags -faltivec
1550 b6e52719 Magnus Damm
1551 0182fee8 Måns Rullgård
    # check if our compiler supports Motorola AltiVec C API
1552 3ae3b721 Ramiro Polla
    enabled altivec_h &&
1553
        inc_altivec_h="#include <altivec.h>" ||
1554 f25fc9b1 Måns Rullgård
        inc_altivec_h=
1555 497237c7 Ramiro Polla
    check_cc <<EOF || disable altivec
1556 dcd479c0 Måns Rullgård
$inc_altivec_h
1557 a9a07762 Michael Niedermayer
int main(void) {
1558
    vector signed int v1, v2, v3;
1559
    v1 = vec_add(v2,v3);
1560
    return 0;
1561
}
1562
EOF
1563
fi
1564 ab6c65f6 Brian Foley
1565 b4e806b2 Matthieu Castet
# We have to check if pld is a nop and disable it.
1566
enabled armv4l  && check_asm pld     '"pld [r0]"'
1567 940f335a Måns Rullgård
enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
1568
enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
1569
enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
1570
enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
1571
enabled vis     && check_asm vis     '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
1572 bd9d34a0 Diego Biurrun
1573 8b03def6 Diego Biurrun
enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
1574
1575 57bd82d4 Måns Rullgård
# ---
1576
# big/little-endian test
1577 9eebe687 Måns Rullgård
check_cc <<EOF || die "endian test failed"
1578
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
1579 a3999908 Michael Niedermayer
EOF
1580 d04d9e16 Måns Rullgård
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
1581 487a54d7 Fabrice Bellard
1582 a3999908 Michael Niedermayer
# ---
1583 3d204385 Nick Kurshev
# check availability of some header files
1584
1585 a98bb16d Ramiro Polla
if check_func dlopen; then
1586
    ldl=
1587
elif check_func dlopen -ldl; then
1588
    ldl=-ldl
1589 8bf5d58f Michael Niedermayer
fi
1590
1591 7483e694 Diego Biurrun
check_func  fork
1592
check_func  gethrtime
1593
check_func  getrusage
1594 094c09bb Michael Kostylev
check_func  inet_aton $network_extralibs
1595 7483e694 Diego Biurrun
check_func  memalign
1596
check_func  mkstemp
1597 a98bb16d Ramiro Polla
check_func2 windows.h GetProcessTimes
1598 6ffa87d3 Ramiro Polla
1599 a98bb16d Ramiro Polla
check_header byteswap.h
1600 e16e49ac Ramiro Polla
check_header conio.h
1601 a98bb16d Ramiro Polla
check_header dlfcn.h
1602
check_header malloc.h
1603 b58412f1 Alexander Strange
check_header sys/mman.h
1604 a98bb16d Ramiro Polla
check_header termios.h
1605
1606
if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
1607
    die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1608
fi
1609 e16e49ac Ramiro Polla
1610 497237c7 Ramiro Polla
enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
1611 57bd82d4 Måns Rullgård
1612 b0c858d8 François Revol
# ffserver uses poll(),
1613
# if it's not found we can emulate it using select().
1614
if enabled ffserver; then
1615 f8cda19e Luca Abeni
    check_header poll.h
1616 81644c2e Michael Kostylev
    check_header sys/select.h
1617 b0c858d8 François Revol
fi
1618
1619 57bd82d4 Måns Rullgård
# check for some common methods of building with pthread support
1620
# do this before the optional library checks as some of them require pthreads
1621
if enabled pthreads; then
1622 9e7fd101 Måns Rullgård
    if check_func pthread_create; then
1623
        :
1624
    elif check_func pthread_create -pthread; then
1625
        add_cflags -pthread
1626 afc9aee2 Diego Biurrun
        add_extralibs -pthread
1627 9e7fd101 Måns Rullgård
    elif check_func pthread_create -pthreads; then
1628
        add_cflags -pthreads
1629 afc9aee2 Diego Biurrun
        add_extralibs -pthreads
1630 9e7fd101 Måns Rullgård
    elif ! check_lib pthread.h pthread_create -lpthread; then
1631
        die "ERROR: can't find pthreads library"
1632
    fi
1633 57bd82d4 Måns Rullgård
fi
1634
1635 8eee7025 Diego Biurrun
for thread in $THREADS_LIST; do
1636 e5f94c2b Ramiro Polla
    if enabled $thread; then
1637 3ae3b721 Ramiro Polla
        test -n "$thread_type" &&
1638
            die "ERROR: Only one thread type must be selected." ||
1639 e5f94c2b Ramiro Polla
            thread_type="$thread"
1640
    fi
1641
done
1642
1643 fdf88598 Måns Rullgård
check_lib math.h sin -lm
1644
1645 a33cab3a Michael Kostylev
# test for C99 functions in math.h
1646
for func in llrint lrint lrintf round roundf; do
1647
    check_exec <<EOF && enable $func || disable $func
1648 f32adb22 Måns Rullgård
#define _ISOC9X_SOURCE  1
1649
#include <math.h>
1650 a33cab3a Michael Kostylev
int main(void) { return ($func(3.999f) > 0)?0:1; }
1651 f32adb22 Måns Rullgård
EOF
1652 a33cab3a Michael Kostylev
done
1653 f32adb22 Måns Rullgård
1654 57bd82d4 Måns Rullgård
# these are off by default, so fail if requested and not available
1655 79fda097 Diego Biurrun
enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1656 7483e694 Diego Biurrun
enabled liba52     && require  liba52 a52dec/a52.h a52_init -la52
1657
enabled libamr_nb  && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
1658
enabled libamr_wb  && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
1659 79fda097 Diego Biurrun
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1660
enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
1661 7483e694 Diego Biurrun
enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
1662
enabled libmp3lame && require  LAME lame/lame.h lame_init -lmp3lame -lm
1663
enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
1664
enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
1665
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
1666 18ee626c Diego Biurrun
enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
1667 7483e694 Diego Biurrun
enabled libxvid    && require  Xvid xvid.h xvid_global -lxvidcore
1668
enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1669 8ac17293 Steve L'Homme
1670 6ea67bbb Justin Ruggles
# disable the native AC-3 decoder if liba52 is enabled
1671
enabled liba52 && disable ac3_decoder
1672
1673 0b4a1821 Alessandro Sappia
# libdc1394 check
1674
if enabled libdc1394; then
1675
    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
1676
        enable libdc1394_2; } ||
1677
    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
1678
        enable libdc1394_1; } ||
1679
    die "ERROR: No version of libdc1394 found "
1680
fi
1681
1682
1683 c13e1abd Falk Hüffner
_restrict=
1684
for restrict_keyword in restrict __restrict__ __restrict; do
1685 57bd82d4 Måns Rullgård
    check_cc <<EOF && _restrict=$restrict_keyword && break
1686 dcd479c0 Måns Rullgård
void foo(char * $restrict_keyword p);
1687
EOF
1688 c13e1abd Falk Hüffner
done
1689
1690 703afd07 Måns Rullgård
test "$vhook" = "default" && vhook="$dlopen"
1691 a8721c09 Fabrice Bellard
1692 b0268cc0 Ramiro Polla
if test "$targetos" = cygwin -o "$targetos" = mingw32 && enabled_all static vhook ; then
1693 497237c7 Ramiro Polla
    disable vhook
1694 fbb9d104 Víctor Paesa
    echo
1695 b0268cc0 Ramiro Polla
    echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
1696 fbb9d104 Víctor Paesa
    echo "Patches welcome."
1697
    echo
1698
fi
1699
1700 8d923001 Måns Rullgård
if enabled vhook; then
1701
    check_ldflags -rdynamic
1702
    check_ldflags -export-dynamic
1703
fi
1704 bfd2edeb Michael Niedermayer
1705 eea50282 Måns Rullgård
check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1706
check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1707 04511d53 Philip Gladstone
1708 a86b921c Fabrice Bellard
##########################################
1709 29799f8b Diego Biurrun
# SDL check
1710 a86b921c Fabrice Bellard
1711 497237c7 Ramiro Polla
disable sdl_too_old
1712
disable sdl
1713 6a1a892f Frantisek Dvorak
SDL_CONFIG="${cross_prefix}sdl-config"
1714 225e21ef Måns Rullgård
if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
1715
    sdl_cflags=`"${SDL_CONFIG}" --cflags`
1716
    temp_cflags $sdl_cflags
1717 dcd479c0 Måns Rullgård
    temp_extralibs `"${SDL_CONFIG}" --libs`
1718 1ca5d97f KO Myung-Hun
    if check_lib2 SDL.h SDL_Init; then
1719 dcd479c0 Måns Rullgård
        _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1720 29f3b38a Måns Rullgård
        if test "$_sdlversion" -lt 121 ; then
1721 497237c7 Ramiro Polla
            enable sdl_too_old
1722 dcd479c0 Måns Rullgård
        else
1723 497237c7 Ramiro Polla
            enable sdl
1724 225e21ef Måns Rullgård
            check_cc $sdl_cflags <<EOF && enable sdl_video_size
1725 29f3b38a Måns Rullgård
#include <SDL.h>
1726 d6773f56 Diego Biurrun
int main(int argc, char **argv){
1727 29f3b38a Måns Rullgård
    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1728
    int w = vi->current_w;
1729
    return 0;
1730
}
1731
EOF
1732 dcd479c0 Måns Rullgård
        fi
1733
    fi
1734 29f3b38a Måns Rullgård
    restore_flags
1735 c3f6b472 Michael Niedermayer
fi
1736 57bd82d4 Måns Rullgård
1737 d5697779 Måns Rullgård
texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html
1738 146ea952 Nicolas Boos
1739 72be9e73 Dave Yeo
check_type sys/socket.h socklen_t
1740
1741 7a91333f Hans Zandbelt
##########################################
1742 73b46a95 Ramiro Polla
# Network check
1743
1744
if enabled network; then
1745
    # Prefer arpa/inet.h over winsock2
1746
    if check_header arpa/inet.h ; then
1747
        check_func closesocket
1748
    elif check_header winsock2.h ; then
1749 ea10ddde Ramiro Polla
        network_extralibs="-lws2_32"
1750 72be9e73 Dave Yeo
        check_type ws2tcpip.h socklen_t
1751 73b46a95 Ramiro Polla
        check_func2 winsock2.h closesocket
1752
    fi
1753
fi
1754
1755
##########################################
1756 29799f8b Diego Biurrun
# IPv6 check
1757 7a91333f Hans Zandbelt
1758 497237c7 Ramiro Polla
enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
1759 7a91333f Hans Zandbelt
#include <sys/types.h>
1760
#include <sys/socket.h>
1761
#include <netinet/in.h>
1762
#include <netdb.h>
1763 db817cf3 Diego Biurrun
int main(void) {
1764 7483e694 Diego Biurrun
    struct sockaddr_storage saddr;
1765
    struct ipv6_mreq mreq6;
1766
    getaddrinfo(0,0,0,0);
1767
    getnameinfo(0,0,0,0,0,0,0);
1768
    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1769 7a91333f Hans Zandbelt
}
1770
EOF
1771
1772 06e31011 Ramiro Polla
check_header linux/videodev.h
1773
check_header linux/videodev2.h
1774 47f38850 Luca Abeni
1775 c2345207 Ramiro Polla
check_func2 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
1776
1777 f8aa696f Diego Biurrun
# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1778 1c915f83 Ramiro Polla
{ check_header dev/bktr/ioctl_meteor.h &&
1779
  check_header dev/bktr/ioctl_bt848.h; } ||
1780
{ check_header machine/ioctl_meteor.h &&
1781
  check_header machine/ioctl_bt848.h; } ||
1782
{ check_header dev/video/meteor/ioctl_meteor.h &&
1783
  check_header dev/video/bktr/ioctl_bt848.h; } ||
1784
check_header dev/ic/bt8xx.h
1785 f8aa696f Diego Biurrun
1786 c7682de0 Ramiro Polla
check_header sys/soundcard.h
1787
check_header soundcard.h
1788 deb29777 Måns Rullgård
1789 7483e694 Diego Biurrun
# deal with the X11 frame grabber
1790 56a059ac Diego Biurrun
enabled x11grab                         &&
1791 f58f4ce1 Guillaume Poirier
check_header X11/Xlib.h                 &&
1792
check_header X11/extensions/XShm.h      &&
1793
check_func XOpenDisplay -lX11           &&
1794 06eab4ba Ramiro Polla
check_func XShmCreateImage -lX11 -lXext
1795 f58f4ce1 Guillaume Poirier
1796 40bcf4c7 Benjamin Larsson
enabled debug && add_cflags -g"$debuglevel"
1797 57bd82d4 Måns Rullgård
1798
# add some useful compiler flags if supported
1799
check_cflags -Wdeclaration-after-statement
1800 dcd479c0 Måns Rullgård
check_cflags -Wall
1801
check_cflags -Wno-switch
1802 c07bd6a9 Michael Niedermayer
check_cflags -Wdisabled-optimization
1803
check_cflags -Wpointer-arith
1804
check_cflags -Wredundant-decls
1805 cc1fb623 Måns Rullgård
check_cflags -Wno-pointer-sign
1806 f4929996 Michael Niedermayer
check_cflags -Wcast-qual
1807 9aceb3cf Michael Niedermayer
check_cflags -Wwrite-strings
1808 652a5bf6 Michael Niedermayer
check_cflags -Wtype-limits
1809 5af4e0cc Måns Rullgård
enabled extra_warnings && check_cflags -Winline
1810 cf9d24ad Dan Christiansen
1811 57bd82d4 Måns Rullgård
# add some linker flags
1812 5c0e9479 Måns Rullgård
check_ldflags -Wl,--warn-common
1813 e240ee67 Luca Barbato
check_ldflags $LDLATEFLAGS
1814 c2fd6530 Måns Rullgård
check_ldflags -Wl,-Bsymbolic
1815 94a3401e Fabrice Bellard
1816 bd2216e4 Måns Rullgård
if enabled small; then
1817
    check_cflags -Os            # not all compilers support -Os
1818 8400d6b8 Diego Biurrun
    optimizations="small"
1819
elif enabled optimizations; then
1820 3dddba4b Diego Biurrun
    if $cc -v 2>&1 | grep -q xlc; then
1821 30a3e5d4 Nigel Pearson
        add_cflags  "-O5"
1822
        add_ldflags "-O5"
1823 cf9d24ad Dan Christiansen
    else
1824 30a3e5d4 Nigel Pearson
        add_cflags "-O3"
1825 cf9d24ad Dan Christiansen
    fi
1826 cddf3f45 Glenn Maynard
fi
1827 11fdbc44 Michael Niedermayer
check_cflags -fno-math-errno
1828 b2eb2ff0 Michael Niedermayer
check_cflags -fno-signed-zeros
1829 cddf3f45 Glenn Maynard
1830 80581e98 Michael Niedermayer
# PIC flags for shared library objects where they are needed
1831 5af4e0cc Måns Rullgård
if enabled shared; then
1832 569cb218 Måns Rullgård
    # LIBOBJFLAGS may have already been set in the OS configuration
1833
    if test -z "$LIBOBJFLAGS" ; then
1834
        case "$arch" in
1835
            x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS='$(PIC)' ;;
1836
        esac
1837
    fi
1838 80581e98 Michael Niedermayer
fi
1839
1840 90be59ef Ramiro Polla
if enabled gprof; then
1841 30a3e5d4 Nigel Pearson
    add_cflags  "-p"
1842
    add_ldflags "-p"
1843 1db54e20 Diego Biurrun
fi
1844
1845 3b26ee47 Måns Rullgård
VHOOKCFLAGS="-fPIC"
1846 18451f7d Måns Rullgård
1847 7f3c02fc Diego Biurrun
# Find out if the .align argument is a power of two or not.
1848 4454dc1b John Dalgliesh
if test $asmalign_pot = "unknown"; then
1849 497237c7 Ramiro Polla
    disable asmalign_pot
1850
    echo 'asm (".align 3");' | check_cc && enable asmalign_pot
1851 4454dc1b John Dalgliesh
fi
1852
1853 7483e694 Diego Biurrun
enabled_any $DECODER_LIST      && enable decoders
1854
enabled_any $ENCODER_LIST      && enable encoders
1855
enabled_any $BSF_LIST          && enable bsfs
1856
enabled_any $DEMUXER_LIST      && enable demuxers
1857
enabled_any $MUXER_LIST        && enable muxers
1858 f7679c54 Vitor Sessak
enabled_any $FILTER_LIST       && enable filters
1859 7483e694 Diego Biurrun
enabled_any $INDEV_LIST        && enable demuxers
1860
enabled_any $OUTDEV_LIST       && enable muxers
1861
enabled_any $PROTOCOL_LIST     && enable protocols
1862
1863
enabled_any $THREADS_LIST      && enable threads
1864
1865
check_deps $CONFIG_LIST       \
1866
           $HAVE_LIST         \
1867
           $DECODER_LIST      \
1868
           $ENCODER_LIST      \
1869
           $PARSER_LIST       \
1870
           $BSF_LIST          \
1871
           $DEMUXER_LIST      \
1872
           $MUXER_LIST        \
1873 f7679c54 Vitor Sessak
           $FILTER_LIST       \
1874 7483e694 Diego Biurrun
           $INDEV_LIST        \
1875
           $OUTDEV_LIST       \
1876
           $PROTOCOL_LIST     \
1877 f70f03f6 Måns Rullgård
1878 f7b8bffe Ramiro Polla
enabled libdc1394 && append pkg_requires "libraw1394"
1879 fb2ce7d9 Måns Rullgård
enabled libtheora && append pkg_requires "theora"
1880 f9def9cc Diego Biurrun
enabled libvorbis && append pkg_requires "vorbisenc"
1881 fb2ce7d9 Måns Rullgård
1882 f36958f8 Diego Biurrun
echo "install prefix            $PREFIX"
1883
echo "source path               $source_path"
1884
echo "C compiler                $cc"
1885
echo "make                      $make"
1886 bfd5afd8 Diego Biurrun
echo ".align is power-of-two    $asmalign_pot"
1887 f36958f8 Diego Biurrun
echo "ARCH                      $arch ($cpu)"
1888 eb94aca9 Charles Yates
if test "$BUILDSUF" != ""; then
1889 f36958f8 Diego Biurrun
    echo "build suffix              $BUILDSUF"
1890 eb94aca9 Charles Yates
fi
1891 0db2ce77 Måns Rullgård
echo "big-endian                ${bigendian-no}"
1892 419b8784 Diego Biurrun
if test $arch = "x86_32" -o $arch = "x86_64"; then
1893 0db2ce77 Måns Rullgård
    echo "MMX enabled               ${mmx-no}"
1894
    echo "CMOV enabled              ${cmov-no}"
1895
    echo "CMOV is fast              ${fast_cmov-no}"
1896 971cc990 Michael Niedermayer
    echo "EBX available             ${ebx_available-no}"
1897
    echo "EBP available             ${ebp_available-no}"
1898 e41e8342 Fabrice Bellard
fi
1899 cc6a90dd Guillaume Poirier
if test $arch = "armv4l"; then
1900 0db2ce77 Måns Rullgård
    echo "ARMv5TE enabled           ${armv5te-no}"
1901
    echo "ARMv6 enabled             ${armv6-no}"
1902
    echo "IWMMXT enabled            ${iwmmxt-no}"
1903 eba9ae3c Gildas Bazin
fi
1904 e241ba14 Diego Biurrun
if test $arch = "mips"; then
1905 0db2ce77 Måns Rullgård
    echo "MMI enabled               ${mmi-no}"
1906 e41e8342 Fabrice Bellard
fi
1907 cc6a90dd Guillaume Poirier
if test $arch = "powerpc"; then
1908 0db2ce77 Måns Rullgård
    echo "AltiVec enabled           ${altivec-no}"
1909
    echo "dcbzl available           ${dcbzl-no}"
1910 e41e8342 Fabrice Bellard
fi
1911 0db2ce77 Måns Rullgård
echo "gprof enabled             ${gprof-no}"
1912
echo "debug symbols             ${debug-no}"
1913
echo "strip symbols             ${dostrip-no}"
1914 8400d6b8 Diego Biurrun
echo "optimizations             ${optimizations-no}"
1915 0db2ce77 Måns Rullgård
echo "static                    ${static-no}"
1916
echo "shared                    ${shared-no}"
1917 4a24ab64 Diego Biurrun
echo "postprocessing support    ${postproc-no}"
1918 13ca50f3 Diego Biurrun
echo "software scaler enabled   ${swscale-no}"
1919 f7679c54 Vitor Sessak
echo "new filter support        ${avfilter-no}"
1920 81124ba0 Vitor Sessak
echo "filters using lavformat   ${avfilter_lavf-no}"
1921 0db2ce77 Måns Rullgård
echo "video hooking             ${vhook-no}"
1922 90be59ef Ramiro Polla
if enabled vhook; then
1923 0db2ce77 Måns Rullgård
    echo "Imlib2 support            ${imlib2-no}"
1924
    echo "FreeType support          ${freetype2-no}"
1925 68892110 Philip Gladstone
fi
1926 0db2ce77 Måns Rullgård
echo "network support           ${network-no}"
1927 90be59ef Ramiro Polla
if enabled network; then
1928 0db2ce77 Måns Rullgård
    echo "IPv6 support              ${ipv6-no}"
1929 bfd5afd8 Diego Biurrun
fi
1930 0db2ce77 Måns Rullgård
echo "threading support         ${thread_type-no}"
1931
echo "SDL support               ${sdl-no}"
1932 90be59ef Ramiro Polla
if enabled sdl_too_old; then
1933 bfd5afd8 Diego Biurrun
    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1934
fi
1935 0db2ce77 Måns Rullgård
echo "Sun medialib support      ${mlib-no}"
1936
echo "AVISynth enabled          ${avisynth-no}"
1937
echo "liba52 support            ${liba52-no}"
1938
echo "liba52 dlopened           ${liba52bin-no}"
1939
echo "libamr-nb support         ${libamr_nb-no}"
1940
echo "libamr-wb support         ${libamr_wb-no}"
1941 f7b8bffe Ramiro Polla
echo "libdc1394 support         ${libdc1394-no}"
1942 0db2ce77 Måns Rullgård
echo "libfaac enabled           ${libfaac-no}"
1943
echo "libfaad enabled           ${libfaad-no}"
1944 7e0871a7 Diego Biurrun
echo "libfaad dlopened          ${libfaadbin-no}"
1945 0db2ce77 Måns Rullgård
echo "libgsm enabled            ${libgsm-no}"
1946
echo "libmp3lame enabled        ${libmp3lame-no}"
1947
echo "libnut enabled            ${libnut-no}"
1948
echo "libtheora enabled         ${libtheora-no}"
1949
echo "libvorbis enabled         ${libvorbis-no}"
1950
echo "x264 enabled              ${libx264-no}"
1951
echo "XviD enabled              ${libxvid-no}"
1952
echo "zlib enabled              ${zlib-no}"
1953 2c62e737 Diego Biurrun
echo
1954 de6d9b64 Fabrice Bellard
1955 f7679c54 Vitor Sessak
for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
1956 8138b9db Ramiro Polla
    echo "Enabled ${type}s:"
1957 f65c9da1 Måns Rullgård
    eval list=\$$(toupper $type)_LIST
1958 8138b9db Ramiro Polla
    for part in $list; do
1959 f65c9da1 Måns Rullgård
        enabled $part && echo ${part%_*}
1960
    done | sort | pr -3 -t
1961
    echo
1962 8138b9db Ramiro Polla
done
1963
1964 3fe142e2 Diego Biurrun
enabled nonfree &&
1965
    echo "License: unredistributable" ||
1966
    (enabled gpl &&
1967
        echo "License: GPL" ||
1968
        echo "License: LGPL")
1969 ca5323af Roberto Togni
1970 cf1392e9 Diego Biurrun
echo "Creating config.mak and config.h..."
1971
1972 29799f8b Diego Biurrun
echo "# Automatically generated by configure - do not modify!" > config.mak
1973
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1974 9c05103f Diego Biurrun
echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
1975
echo "#define FFMPEG_CONFIG_H" >> $TMPH
1976 0fd12426 Diego Biurrun
echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
1977 de6d9b64 Fabrice Bellard
1978 2266e085 Diego Biurrun
echo "PREFIX=$PREFIX" >> config.mak
1979 c75560ae Diego Biurrun
echo "prefix=\$(DESTDIR)\$(PREFIX)" >> config.mak
1980 22a324da Diego Biurrun
echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
1981
echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
1982
echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
1983
echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
1984
echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
1985 4a908fbc Alex Beregszaszi
echo "MAKE=$make" >> config.mak
1986 980fc7b8 Fabrice Bellard
echo "CC=$cc" >> config.mak
1987
echo "AR=$ar" >> config.mak
1988 be7109c1 Michael Niedermayer
echo "RANLIB=$ranlib" >> config.mak
1989 20369773 Dave Yeo
echo "LN_S=$ln_s" >> config.mak
1990 3ae3b721 Ramiro Polla
enabled dostrip &&
1991
    echo "STRIP=$strip" >> config.mak ||
1992 f25fc9b1 Måns Rullgård
    echo "STRIP=echo ignoring strip" >> config.mak
1993 75388c74 Michael Niedermayer
1994 a9b3f630 Nick Kurshev
echo "OPTFLAGS=$CFLAGS" >> config.mak
1995 408382a4 Diego Biurrun
echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
1996 0f3cb305 Fabrice Bellard
echo "LDFLAGS=$LDFLAGS" >> config.mak
1997 c536cb09 Diego Biurrun
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
1998 e1707f52 Michael Niedermayer
echo "SHFLAGS=$SHFLAGS" >> config.mak
1999 408382a4 Diego Biurrun
echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
2000 fbb9d104 Víctor Paesa
echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
2001 80581e98 Michael Niedermayer
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
2002 5af4e0cc Måns Rullgård
echo "BUILD_STATIC=$static" >> config.mak
2003 eb94aca9 Charles Yates
echo "BUILDSUF=$BUILDSUF" >> config.mak
2004 c5f14466 Ramiro Polla
echo "FULLNAME=$FULLNAME" >> config.mak
2005 f3ec2d46 Slavik Gnatenko
echo "LIBPREF=$LIBPREF" >> config.mak
2006 c5f14466 Ramiro Polla
echo "LIBSUF=$LIBSUF" >> config.mak
2007 24743a76 Diego Biurrun
echo "LIBNAME=$LIBNAME" >> config.mak
2008 f3ec2d46 Slavik Gnatenko
echo "SLIBPREF=$SLIBPREF" >> config.mak
2009 c5f14466 Ramiro Polla
echo "SLIBSUF=$SLIBSUF" >> config.mak
2010
echo "EXESUF=$EXESUF" >> config.mak
2011 315c741d Diego Biurrun
echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
2012 08c4e395 Diego Biurrun
echo "VHOOK_DEPEND_CMD=$VHOOK_DEPEND_CMD" >> config.mak
2013 4dc62701 Måns Rullgård
2014 90be59ef Ramiro Polla
if enabled bigendian; then
2015 7483e694 Diego Biurrun
    echo "WORDS_BIGENDIAN=yes" >> config.mak
2016
    echo "#define WORDS_BIGENDIAN 1" >> $TMPH
2017 91d1f1a4 Nick Kurshev
fi
2018 44161118 Måns Rullgård
2019 90be59ef Ramiro Polla
if enabled sdl; then
2020 7483e694 Diego Biurrun
    echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
2021
    echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
2022 a86b921c Fabrice Bellard
fi
2023 90be59ef Ramiro Polla
if enabled texi2html; then
2024 7483e694 Diego Biurrun
    echo "BUILD_DOC=yes" >> config.mak
2025 146ea952 Nicolas Boos
fi
2026 5a872801 Luca Barbato
2027 719c8e00 Måns Rullgård
get_version(){
2028
    name=$1
2029
    file=$source_path/$2
2030 147e7692 Måns Rullgård
    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2031
    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2032 0e32c8c6 Måns Rullgård
    lcname=$(tolower $name)
2033
    eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2034
    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2035 719c8e00 Måns Rullgård
}
2036
2037 147e7692 Måns Rullgård
get_version LIBSWSCALE  libswscale/swscale.h
2038
get_version LIBPOSTPROC libpostproc/postprocess.h
2039
get_version LIBAVCODEC  libavcodec/avcodec.h
2040
get_version LIBAVDEVICE libavdevice/avdevice.h
2041
get_version LIBAVFORMAT libavformat/avformat.h
2042
get_version LIBAVUTIL   libavutil/avutil.h
2043 a6601d69 Måns Rullgård
get_version LIBAVFILTER libavfilter/avfilter.h
2044 5a872801 Luca Barbato
2045 5af4e0cc Måns Rullgård
if enabled shared; then
2046 7483e694 Diego Biurrun
    echo "BUILD_SHARED=yes" >> config.mak
2047
    echo "PIC=-fPIC -DPIC" >> config.mak
2048
    echo "SLIBNAME=${SLIBNAME}" >> config.mak
2049
    echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
2050
    echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
2051 d22e8442 Dave Yeo
    echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
2052 7483e694 Diego Biurrun
    echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
2053
    echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
2054
    echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
2055 0319c531 Nick Kurshev
fi
2056 d7e27559 Diego Biurrun
echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
2057 ef0bc4c9 François Revol
echo "EXTRALIBS=$extralibs" >> config.mak
2058 d2845d68 Diego Biurrun
2059 3d907e22 Måns Rullgård
print_config ARCH_   $TMPH config.mak $ARCH_LIST
2060
print_config HAVE_   $TMPH config.mak $HAVE_LIST
2061 7483e694 Diego Biurrun
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
2062
                                      $DECODER_LIST      \
2063
                                      $ENCODER_LIST      \
2064
                                      $PARSER_LIST       \
2065
                                      $BSF_LIST          \
2066
                                      $DEMUXER_LIST      \
2067
                                      $MUXER_LIST        \
2068 f7679c54 Vitor Sessak
                                      $FILTER_LIST       \
2069 7483e694 Diego Biurrun
                                      $PROTOCOL_LIST     \
2070
                                      $INDEV_LIST        \
2071
                                      $OUTDEV_LIST       \
2072 8ac17293 Steve L'Homme
2073 c13e1abd Falk Hüffner
echo "#define restrict $_restrict" >> $TMPH
2074
2075 bd2216e4 Måns Rullgård
if enabled small; then
2076 7483e694 Diego Biurrun
    echo "#define av_always_inline"  >> $TMPH
2077 bb801c97 Michael Niedermayer
fi
2078
2079 997baf01 Måns Rullgård
echo "SRC_PATH=\"$source_path\"" >> config.mak
2080
echo "SRC_PATH_BARE=$source_path" >> config.mak
2081
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2082 0f3cb305 Fabrice Bellard
2083 8156056e John Dalgliesh
# Apparently it's not possible to portably echo a backslash.
2084 3ae3b721 Ramiro Polla
enabled asmalign_pot &&
2085 7483e694 Diego Biurrun
    printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
2086
    printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
2087 4454dc1b John Dalgliesh
2088 b4d96ba2 Måns Rullgård
echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
2089 bc634f6f Zdenek Kabelac
2090 9c05103f Diego Biurrun
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2091
2092 b7860763 Diego Biurrun
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2093 3ae3b721 Ramiro Polla
cmp -s $TMPH config.h &&
2094
    echo "config.h is unchanged" ||
2095
    mv -f $TMPH config.h
2096 3d204385 Nick Kurshev
2097 f3ec2d46 Slavik Gnatenko
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
2098 def4272a Aurelien Jacobs
2099 165af439 Måns Rullgård
# build tree in object directory if source path is different from current one
2100 90be59ef Ramiro Polla
if enabled source_path_used; then
2101 165af439 Måns Rullgård
    DIRS="\
2102 7483e694 Diego Biurrun
        doc               \
2103
        libavcodec        \
2104
        libavcodec/alpha  \
2105
        libavcodec/armv4l \
2106
        libavcodec/bfin   \
2107
        libavcodec/i386   \
2108
        libavcodec/mlib   \
2109
        libavcodec/ppc    \
2110
        libavcodec/sh4    \
2111
        libavcodec/sparc  \
2112 52a9cf34 Diego Biurrun
        libavdevice       \
2113 f7679c54 Vitor Sessak
        libavfilter       \
2114 7483e694 Diego Biurrun
        libavformat       \
2115
        libavutil         \
2116
        libpostproc       \
2117
        libswscale        \
2118
        tests             \
2119
        tools             \
2120
        vhook             \
2121
        "
2122 165af439 Måns Rullgård
    FILES="\
2123 7483e694 Diego Biurrun
        Makefile             \
2124
        common.mak           \
2125
        doc/texi2pod.pl      \
2126
        libavcodec/Makefile  \
2127 52a9cf34 Diego Biurrun
        libavdevice/Makefile \
2128 f7679c54 Vitor Sessak
        libavfilter/Makefile \
2129 7483e694 Diego Biurrun
        libavformat/Makefile \
2130
        libavutil/Makefile   \
2131
        libpostproc/Makefile \
2132
        libswscale/Makefile  \
2133
        "
2134 165af439 Måns Rullgård
    for dir in $DIRS ; do
2135 7483e694 Diego Biurrun
        mkdir -p $dir
2136 165af439 Måns Rullgård
    done
2137
    for f in $FILES ; do
2138 20369773 Dave Yeo
        $ln_s "$source_path/$f" $f
2139 165af439 Måns Rullgård
    done
2140
fi
2141 def4272a Aurelien Jacobs
2142
2143 d0674868 Diego Biurrun
# build pkg-config files
2144 77aee36c Diego Biurrun
# FIXME: libdir and includedir are hardcoded and may differ from the real path.
2145 def4272a Aurelien Jacobs
2146 d0674868 Diego Biurrun
pkgconfig_generate(){
2147
name=$1
2148
comment=$2
2149
version=$3
2150
libs=$4
2151
requires=$5
2152
cat <<EOF >$name.pc
2153 2266e085 Diego Biurrun
prefix=$PREFIX
2154 a94e666c Diego Biurrun
exec_prefix=\${prefix}
2155 def4272a Aurelien Jacobs
libdir=\${exec_prefix}/lib
2156 a94e666c Diego Biurrun
includedir=\${prefix}/include
2157 def4272a Aurelien Jacobs
2158 d0674868 Diego Biurrun
Name: $name
2159
Description: $comment
2160
Version: $version
2161
Requires: $requires
2162 def4272a Aurelien Jacobs
Conflicts:
2163 d0674868 Diego Biurrun
Libs: -L\${libdir} $libs
2164 76a448ed Måns Rullgård
Cflags: -I\${includedir}
2165 def4272a Aurelien Jacobs
EOF
2166 d0674868 Diego Biurrun
}
2167 def4272a Aurelien Jacobs
2168 d0674868 Diego Biurrun
pkgconfig_generate_uninstalled(){
2169
name=$1
2170 9c476fd6 Måns Rullgård
shortname=${name#lib}
2171 d0674868 Diego Biurrun
comment=$2
2172
version=$3
2173
libs=$4
2174
requires=$5
2175
cat <<EOF >$name-uninstalled.pc
2176 def4272a Aurelien Jacobs
prefix=
2177
exec_prefix=
2178 d0674868 Diego Biurrun
libdir=\${pcfiledir}/$name
2179 76a448ed Måns Rullgård
includedir=\${pcfiledir}
2180 def4272a Aurelien Jacobs
2181 d0674868 Diego Biurrun
Name: $name
2182
Description: $comment
2183
Version: $version
2184
Requires: $requires
2185 def4272a Aurelien Jacobs
Conflicts:
2186 d0674868 Diego Biurrun
Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2187 def4272a Aurelien Jacobs
Cflags: -I\${includedir}
2188
EOF
2189 d0674868 Diego Biurrun
}
2190 def4272a Aurelien Jacobs
2191 f436a23e Måns Rullgård
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" -lavutil ""
2192
pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2193 def4272a Aurelien Jacobs
2194 f436a23e Måns Rullgård
pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "-lavcodec $extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2195
pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2196 def4272a Aurelien Jacobs
2197 f436a23e Måns Rullgård
pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "-lavformat $extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2198
pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2199 def4272a Aurelien Jacobs
2200 f436a23e Måns Rullgård
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "-lavdevice $extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2201
pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2202 4a24ab64 Diego Biurrun
if enabled postproc; then
2203 f436a23e Måns Rullgård
    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" -lpostproc ""
2204
    pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2205 2e3bcd38 Diego Biurrun
fi
2206 790c9ca7 Luca Abeni
2207 13ca50f3 Diego Biurrun
if enabled swscale; then
2208 f436a23e Måns Rullgård
    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" -lswscale "libavutil = $LIBAVUTIL_VERSION"
2209
    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
2210 6c0d0413 j@v2v.cc
else
2211 f436a23e Måns Rullgård
    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2212
    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2213 7483e694 Diego Biurrun
    apply libswscale.pc sed s/^Libs:.*$/Libs:/
2214
    apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/
2215 6c0d0413 j@v2v.cc
fi
2216 f7679c54 Vitor Sessak
2217
if enabled avfilter; then
2218 93420809 Måns Rullgård
  pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "-lavfilter $extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION" ffmpeg
2219
  pkgconfig_generate_uninstalled libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2220 f7679c54 Vitor Sessak
fi