Statistics
| Branch: | Revision:

ffmpeg / configure @ 470bce2b

History | View | Annotate | Download (71.4 KB)

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