Statistics
| Branch: | Revision:

ffmpeg / configure @ 886e89d0

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