Statistics
| Branch: | Revision:

ffmpeg / configure @ f956e129

History | View | Annotate | Download (63.7 KB)

1 de6d9b64 Fabrice Bellard
#!/bin/sh
2 0f3cb305 Fabrice Bellard
#
3 5cbcf02c Fabrice Bellard
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4 0f3cb305 Fabrice Bellard
#
5 cf9d24ad Dan Christiansen
6 cde2d79a Måns Rullgård
# make sure we are running under a compatible shell
7 5237ce67 Måns Rullgård
unset foo
8
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
9 cde2d79a Måns Rullgård
if test "$?" != 0; then
10
    if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
11
        FFMPEG_CONFIGURE_EXEC=1
12
        export FFMPEG_CONFIGURE_EXEC
13
        exec bash "$0" "$@"
14
        exec ksh "$0" "$@"
15
        exec /usr/xpg4/bin/sh "$0" "$@"
16
    fi
17
    echo "No compatible shell script interpreter found."
18
    exit 1
19
fi
20
21 74c53c2d Måns Rullgård
show_help(){
22
  echo "Usage: configure [options]"
23
  echo "Options: [defaults in brackets after descriptions]"
24
  echo
25
  echo "Standard options:"
26
  echo "  --help                   print this message"
27 2ba042a7 Måns Rullgård
  echo "  --log[=FILE|yes|no]      log tests and output to FILE [config.err]"
28 2266e085 Diego Biurrun
  echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
29 74c53c2d Måns Rullgård
  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
30 84c22efd Diego Biurrun
  echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
31 74c53c2d Måns Rullgård
  echo "  --incdir=DIR             install includes in DIR [PREFIX/include/ffmpeg]"
32
  echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
33
  echo "  --enable-mp3lame         enable MP3 encoding via libmp3lame [default=no]"
34 f956e129 Oded Shimon
  echo "  --enable-libnut          enable NUT support via libnut [default=no]"
35 74c53c2d Måns Rullgård
  echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
36
  echo "  --enable-vorbis          enable Vorbis support via libvorbis [default=no]"
37
  echo "  --enable-faad            enable FAAD support via libfaad [default=no]"
38
  echo "  --enable-faadbin         build FAAD support with runtime linking [default=no]"
39
  echo "  --enable-faac            enable FAAC support via libfaac [default=no]"
40
  echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
41
  echo "  --enable-xvid            enable XviD support via xvidcore [default=no]"
42
  echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
43
  echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
44
  echo "  --enable-mingwce         enable MinGW native/cross WinCE compile"
45
  echo "  --enable-a52             enable GPLed A52 support [default=no]"
46
  echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
47
  echo "  --enable-dts             enable GPLed DTS support [default=no]"
48
  echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
49
  echo "  --enable-static          build static libraries [default=yes]"
50
  echo "  --disable-static         do not build static libraries [default=no]"
51
  echo "  --enable-shared          build shared libraries [default=no]"
52
  echo "  --disable-shared         do not build shared libraries [default=yes]"
53
  echo "  --enable-amr_nb          enable amr_nb float audio codec"
54
  echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
55
  echo "  --enable-amr_wb          enable amr_wb float audio codec"
56
  echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
57
  echo "  --enable-sunmlib         use Sun medialib [default=no]"
58
  echo "  --enable-pthreads        use pthreads [default=no]"
59
  echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394"
60
  echo "                           and libraw1394 [default=no]"
61 790c9ca7 Luca Abeni
  echo "  --enable-swscaler        software scaler support [default=no]"
62 8ac17293 Steve L'Homme
  echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
63 74c53c2d Måns Rullgård
  echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
64
  echo "                           and ffmpeg will be under GPL [default=no]"
65
  echo ""
66
  echo "Advanced options (experts only):"
67
  echo "  --source-path=PATH       path to source code [$source_path]"
68
  echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
69 fac252f9 Måns Rullgård
  echo "  --cross-compile          assume a cross-compiler is used"
70 74c53c2d Måns Rullgård
  echo "  --cc=CC                  use C compiler CC [$cc]"
71
  echo "  --make=MAKE              use specified make [$make]"
72
  echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
73
  echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
74
  echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
75
  echo "  --build-suffix=SUFFIX    suffix for application specific build []"
76 cc6a90dd Guillaume Poirier
  echo "  --arch=ARCH              select architecture  [$arch]"
77 38d0a8aa Guillaume Poirier
  echo "  --cpu=CPU                selects the minimum cpu required (affects
78
                                   instruction selection, may crash on older CPUs)"
79 74c53c2d Måns Rullgård
  echo "  --powerpc-perf-enable    enable performance report on PPC"
80
  echo "                           (requires enabling PMC)"
81
  echo "  --disable-mmx            disable MMX usage"
82 1839e854 Siarhei Siamashka
  echo "  --disable-armv5te        disable armv5te usage"
83 74c53c2d Måns Rullgård
  echo "  --disable-iwmmxt         disable iwmmxt usage"
84
  echo "  --disable-altivec        disable AltiVec usage"
85
  echo "  --disable-audio-oss      disable OSS audio support [default=no]"
86
  echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
87
  echo "  --disable-v4l            disable video4linux grabbing [default=no]"
88
  echo "  --disable-v4l2           disable video4linux2 grabbing [default=no]"
89
  echo "  --disable-bktr           disable bktr video grabbing [default=no]"
90
  echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
91
  echo "  --disable-network        disable network support [default=no]"
92 0c7bb0e5 Luca Barbato
  echo "  --disable-ipv6           disable ipv6 support [default=no]"
93 74c53c2d Måns Rullgård
  echo "  --disable-zlib           disable zlib [default=no]"
94
  echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
95
  echo "  --disable-vhook          disable video hooking support"
96
  echo "  --enable-gprof           enable profiling with gprof [$gprof]"
97
  echo "  --disable-debug          disable debugging symbols"
98
  echo "  --disable-opts           disable compiler optimizations"
99 78fcba8f Måns Rullgård
  echo "  --enable-extra-warnings  enable more compiler warnings"
100 74c53c2d Måns Rullgård
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
101
  echo "                           MPEG audio decoding [default=no]"
102
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
103 786b30af Diego Biurrun
  echo "  --disable-ffmpeg         disable ffmpeg build"
104 74c53c2d Måns Rullgård
  echo "  --disable-ffserver       disable ffserver build"
105
  echo "  --disable-ffplay         disable ffplay build"
106
  echo "  --enable-small           optimize for size instead of speed"
107
  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
108
  echo "  --disable-strip          disable stripping of executables and shared libraries"
109
  echo "  --disable-encoder=NAME   disables encoder NAME"
110
  echo "  --enable-encoder=NAME    enables encoder NAME"
111
  echo "  --disable-decoder=NAME   disables decoder NAME"
112
  echo "  --enable-decoder=NAME    enables decoder NAME"
113
  echo "  --disable-encoders       disables all encoders"
114
  echo "  --disable-decoders       disables all decoders"
115 ff70e601 Måns Rullgård
  echo "  --disable-muxer=NAME     disables muxer NAME"
116
  echo "  --enable-muxer=NAME      enables muxer NAME"
117 74c53c2d Måns Rullgård
  echo "  --disable-muxers         disables all muxers"
118 ff70e601 Måns Rullgård
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
119
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
120 74c53c2d Måns Rullgård
  echo "  --disable-demuxers       disables all demuxers"
121 af9e7d18 Måns Rullgård
  echo "  --enable-parser=NAME     enables parser NAME"
122
  echo "  --disable-parser=NAME    disables parser NAME"
123
  echo "  --disable-parsers        disables all parsers"
124 74c53c2d Måns Rullgård
  echo ""
125
  echo "NOTE: Object files are built at the place where configure is launched."
126
  exit 1
127
}
128 cf9d24ad Dan Christiansen
129 57bd82d4 Måns Rullgård
log(){
130
    echo "$@" >>$logfile
131
}
132
133 720c69da Måns Rullgård
log_file(){
134 c8e9f801 Måns Rullgård
    log BEGIN $1
135
    cat -n $1 >>$logfile
136
    log END $1
137
}
138
139 2ba042a7 Måns Rullgård
echolog(){
140 c8e9f801 Måns Rullgård
    log "$@"
141 57bd82d4 Måns Rullgård
    echo "$@"
142 2ba042a7 Måns Rullgård
}
143
144
die(){
145
    echolog "$@"
146
    cat <<EOF
147
If you think configure made a mistake, make sure you are using the latest
148
version from SVN.  If the latest version fails, report the problem to the
149
ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
150
EOF
151 720c69da Måns Rullgård
    if enabled logging; then
152 2ba042a7 Måns Rullgård
        cat <<EOF
153
Include the log file "$logfile" produced by configure as this will help
154
solving the problem.
155
EOF
156
    else
157
cat <<EOF
158
Rerun configure with logging enabled (do not use --log=no), and include the
159
log this produces with your report.
160
EOF
161
    fi
162 57bd82d4 Måns Rullgård
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
163
    exit 1
164
}
165
166
enabled(){
167
    eval test "\$$1" = "yes"
168
}
169
170
flags_saved(){
171
    (: ${SAVE_CFLAGS?}) 2>/dev/null
172
}
173
174 dcd479c0 Måns Rullgård
save_flags(){
175 57bd82d4 Måns Rullgård
    flags_saved && return
176 dcd479c0 Måns Rullgård
    SAVE_CFLAGS="$CFLAGS"
177
    SAVE_LDFLAGS="$LDFLAGS"
178
    SAVE_extralibs="$extralibs"
179
}
180
181
restore_flags(){
182
    CFLAGS="$SAVE_CFLAGS"
183
    LDFLAGS="$SAVE_LDFLAGS"
184
    extralibs="$SAVE_extralibs"
185
    unset SAVE_CFLAGS
186
    unset SAVE_LDFLAGS
187
    unset SAVE_extralibs
188
}
189
190
temp_cflags(){
191
    save_flags
192
    CFLAGS="$CFLAGS $*"
193
}
194
195
temp_ldflags(){
196
    save_flags
197
    LDFLAGS="$LDFLAGS $*"
198
}
199
200
temp_extralibs(){
201
    save_flags
202
    extralibs="$extralibs $*"
203
}
204
205 57bd82d4 Måns Rullgård
append(){
206
    var=$1
207
    shift
208
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
209
    eval "$var=\"\$$var $*\""
210
}
211
212
add_cflags(){
213
    append CFLAGS "$@"
214
}
215
216
add_ldflags(){
217
    append LDFLAGS "$@"
218
}
219
220
add_extralibs(){
221
    append extralibs "$@"
222
}
223
224 b0cfb663 Måns Rullgård
check_cmd(){
225 b3cb5d51 Måns Rullgård
    log "$@"
226 9b4f605c Måns Rullgård
    "$@" >>$logfile 2>&1
227 b0cfb663 Måns Rullgård
}
228
229 dcd479c0 Måns Rullgård
check_cc(){
230 57bd82d4 Måns Rullgård
    log check_cc "$@"
231
    cat >$TMPC
232 720c69da Måns Rullgård
    log_file $TMPC
233 b0cfb663 Måns Rullgård
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
234 57bd82d4 Måns Rullgård
}
235
236
check_cpp(){
237
    log check_cpp "$@"
238 dcd479c0 Måns Rullgård
    cat >$TMPC
239 720c69da Måns Rullgård
    log_file $TMPC
240 b0cfb663 Måns Rullgård
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
241 dcd479c0 Måns Rullgård
}
242
243
check_ld(){
244 57bd82d4 Måns Rullgård
    log check_ld "$@"
245 0607887f Måns Rullgård
    check_cc || return
246 b0cfb663 Måns Rullgård
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
247 dcd479c0 Måns Rullgård
}
248
249
check_cflags(){
250 57bd82d4 Måns Rullgård
    log check_cflags "$@"
251
    check_cc "$@" <<EOF && add_cflags "$@"
252 dcd479c0 Måns Rullgård
int x;
253
EOF
254
}
255
256
check_ldflags(){
257 57bd82d4 Måns Rullgård
    log check_ldflags "$@"
258
    check_ld "$@" <<EOF && add_ldflags "$@"
259
int main(){
260
    return 0;
261
}
262 dcd479c0 Måns Rullgård
EOF
263
}
264
265
check_header(){
266 57bd82d4 Måns Rullgård
    log check_header "$@"
267 dcd479c0 Måns Rullgård
    header=$1
268
    shift
269 57bd82d4 Måns Rullgård
    check_cpp "$@" <<EOF
270 dcd479c0 Måns Rullgård
#include <$header>
271
int x;
272
EOF
273
}
274
275
check_func(){
276 57bd82d4 Måns Rullgård
    log check_func "$@"
277 dcd479c0 Måns Rullgård
    func=$1
278
    shift
279
    check_ld "$@" <<EOF
280
extern int $func();
281
int main(){
282
    $func();
283
}
284
EOF
285
}
286
287 57bd82d4 Måns Rullgård
check_lib(){
288
    log check_lib "$@"
289
    header="$1"
290
    func="$2"
291
    shift 2
292
    temp_extralibs "$@"
293
    check_header $header && check_func $func && add_extralibs "$@"
294
    err=$?
295
    restore_flags
296
    return $err
297
}
298
299 dcd479c0 Måns Rullgård
check_exec(){
300 bd4700b1 Måns Rullgård
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
301 57bd82d4 Måns Rullgård
}
302
303
require(){
304
    name="$1"
305
    header="$2"
306
    func="$3"
307
    shift 3
308
    check_lib $header $func "$@" || die "ERROR: $name not found"
309 dcd479c0 Måns Rullgård
}
310
311 3dc7174e Måns Rullgård
filter_out(){
312
    pattern="$1"
313
    shift
314
    echo "$@" | sed "s%\\<$pattern\\>%%g"
315
}
316
317 0f3cb305 Fabrice Bellard
# set temporary file name
318 57514323 Zdenek Kabelac
if test ! -z "$TMPDIR" ; then
319 0f3cb305 Fabrice Bellard
    TMPDIR1="${TMPDIR}"
320 57514323 Zdenek Kabelac
elif test ! -z "$TEMPDIR" ; then
321 0f3cb305 Fabrice Bellard
    TMPDIR1="${TEMPDIR}"
322 3d204385 Nick Kurshev
else
323 0f3cb305 Fabrice Bellard
    TMPDIR1="/tmp"
324 3d204385 Nick Kurshev
fi
325
326 0f3cb305 Fabrice Bellard
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
327
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
328 f3ec2d46 Slavik Gnatenko
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
329 0f3cb305 Fabrice Bellard
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
330
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
331
332 de6d9b64 Fabrice Bellard
# default parameters
333 720c69da Måns Rullgård
logging="yes"
334 2ba042a7 Måns Rullgård
logfile="config.err"
335 2266e085 Diego Biurrun
PREFIX="/usr/local"
336
libdir='${PREFIX}/lib'
337 84c22efd Diego Biurrun
shlibdir="$libdir"
338 2266e085 Diego Biurrun
incdir='${PREFIX}/include/ffmpeg'
339
mandir='${PREFIX}/man'
340
bindir='${PREFIX}/bin'
341 0f3cb305 Fabrice Bellard
cross_prefix=""
342 fac252f9 Måns Rullgård
cross_compile="no"
343 de6d9b64 Fabrice Bellard
cc="gcc"
344
ar="ar"
345 be7109c1 Michael Niedermayer
ranlib="ranlib"
346 4a908fbc Alex Beregszaszi
make="make"
347 0f3cb305 Fabrice Bellard
strip="strip"
348 cc6a90dd Guillaume Poirier
arch=`uname -m`
349 38d0a8aa Guillaume Poirier
cpu="generic"
350 e45a2872 Romain Dolbeau
powerpc_perf="no"
351 0f3cb305 Fabrice Bellard
mmx="default"
352 e7768fc5 Guillaume Poirier
cmov="no"
353 94e4c3a3 Guillaume Poirier
cmov_is_fast="no"
354 1839e854 Siarhei Siamashka
armv5te="default"
355 eba9ae3c Gildas Bazin
iwmmxt="default"
356 ab6c65f6 Brian Foley
altivec="default"
357 87ea51e0 Luca Barbato
dcbzl="no"
358 d46aba26 Leon van Stuivenberg
mmi="default"
359 cc6a90dd Guillaume Poirier
case "$arch" in
360 ef0bc4c9 François Revol
  i386|i486|i586|i686|i86pc|BePC)
361 419b8784 Diego Biurrun
    arch="x86_32"
362 de6d9b64 Fabrice Bellard
  ;;
363 7bf9648e Jacob Meuser
  x86_64|amd64)
364 a63e5f1c Diego Biurrun
    arch="x86_32"
365 32255f6c Reimar Döffinger
    canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
366 7bf9648e Jacob Meuser
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
367
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
368 cc6a90dd Guillaume Poirier
        arch="x86_64"
369 7bf9648e Jacob Meuser
      fi
370 053dea12 Aurelien Jacobs
    fi
371
  ;;
372 6dc7b6b3 Diego Biurrun
  # armv4l is a subset of armv[567]*l
373
  arm|armv[4567]*l)
374 cc6a90dd Guillaume Poirier
    arch="armv4l"
375 6ed7422a Fabrice Bellard
  ;;
376 91d1f1a4 Nick Kurshev
  alpha)
377 cc6a90dd Guillaume Poirier
    arch="alpha"
378 91d1f1a4 Nick Kurshev
  ;;
379 2645e80f Guillaume Poirier
  "Power Macintosh"|ppc|ppc64|powerpc)
380 cc6a90dd Guillaume Poirier
    arch="powerpc"
381 90cee0c3 Michael Niedermayer
  ;;
382 b028a866 Diego Biurrun
  mips|mipsel|IP*)
383 cc6a90dd Guillaume Poirier
    arch="mips"
384 d46aba26 Leon van Stuivenberg
  ;;
385 bb476ff3 James Morrison
  sun4u|sparc64)
386 cc6a90dd Guillaume Poirier
    arch="sparc64"
387 a7beab73 Roman Shaposhnik
  ;;
388 bb476ff3 James Morrison
  sparc)
389 cc6a90dd Guillaume Poirier
    arch="sparc"
390 bb476ff3 James Morrison
  ;;
391 bdb2e37c Alex Beregszaszi
  sh4)
392 cc6a90dd Guillaume Poirier
    arch="sh4"
393 bdb2e37c Alex Beregszaszi
  ;;
394 67860b26 Sam Hocevar
  parisc|parisc64)
395 cc6a90dd Guillaume Poirier
    arch="parisc"
396 67860b26 Sam Hocevar
  ;;
397
  s390|s390x)
398 cc6a90dd Guillaume Poirier
    arch="s390"
399 67860b26 Sam Hocevar
  ;;
400
  m68k)
401 cc6a90dd Guillaume Poirier
    arch="m68k"
402 67860b26 Sam Hocevar
  ;;
403
  ia64)
404 cc6a90dd Guillaume Poirier
    arch="ia64"
405 67860b26 Sam Hocevar
  ;;
406 81a9b052 Michael Benjamin
  bfin)
407 cc6a90dd Guillaume Poirier
    arch="bfin"
408 81a9b052 Michael Benjamin
  ;;
409 de6d9b64 Fabrice Bellard
  *)
410 cc6a90dd Guillaume Poirier
    arch="unknown"
411 de6d9b64 Fabrice Bellard
  ;;
412
esac
413
gprof="no"
414 5cbcf02c Fabrice Bellard
v4l="yes"
415 0a7b514f Luca Abeni
v4l2="yes"
416 6beefa40 Michael Niedermayer
bktr="no"
417 5cbcf02c Fabrice Bellard
audio_oss="yes"
418 dfdfa47c François Revol
audio_beos="no"
419 8aa3ee32 Max Krasnyansky
dv1394="yes"
420 f02be79d Roman Shaposhnik
dc1394="no"
421 5cbcf02c Fabrice Bellard
network="yes"
422 0c7bb0e5 Luca Barbato
ipv6="yes"
423 0147f198 François Revol
zlib="yes"
424 bb4c2140 Michael Niedermayer
libgsm="no"
425 a6741398 Juanjo
mp3lame="no"
426 f956e129 Oded Shimon
libnut="no"
427 9146ca37 Måns Rullgård
libogg="no"
428 81e0d0b4 Mark Hills
vorbis="no"
429 0fc50e58 Zdenek Kabelac
faad="no"
430
faadbin="no"
431 29d48296 Michael Niedermayer
faac="no"
432 1ddadfa9 Adam Thayer
xvid="no"
433 6662ec29 Michael Niedermayer
x264="no"
434 ba9261e5 Michael Niedermayer
a52="no"
435 57514323 Zdenek Kabelac
a52bin="no"
436 23c99253 Michael Niedermayer
dts="no"
437 ba9261e5 Michael Niedermayer
pp="no"
438 732d9245 Bill Eldridge
mingw32="no"
439 ac44871c Gildas Bazin
mingwce="no"
440 f3ec2d46 Slavik Gnatenko
os2="no"
441 320d060a Diego Biurrun
lstatic="yes"
442 83286d2a Zdenek Kabelac
lshared="no"
443 cddf3f45 Glenn Maynard
optimize="yes"
444
debug="yes"
445 78fcba8f Måns Rullgård
extrawarnings="no"
446 65d1bea2 Michel Bardiaux
dostrip="yes"
447 da186ae2 Steven M. Schultz
installstrip="-s"
448 ef0bc4c9 François Revol
extralibs="-lm"
449 c02dbee1 Michael Niedermayer
simpleidct="yes"
450 0f3cb305 Fabrice Bellard
bigendian="no"
451 7f965c1c Chris Flerackers
inttypes="yes"
452 b5c950c4 Michael Niedermayer
emu_fast_int="no"
453 a8721c09 Fabrice Bellard
vhook="default"
454 8ac17293 Steve L'Homme
avisynth="no"
455 adbc0510 Philip Gladstone
dlfcn="no"
456
dlopen="no"
457 1eb2212e Fabrice Bellard
mpegaudio_hp="yes"
458 baa3a937 Måns Rullgård
SHFLAGS='-shared -Wl,-soname,$@'
459 cab3ef82 Diego Biurrun
VHOOKSHFLAGS='$(SHFLAGS)'
460 26b35efb François Revol
netserver="no"
461 4baca069 Philip Gladstone
need_inet_aton="no"
462 04f46ced Gildas Bazin
protocols="yes"
463 786b30af Diego Biurrun
ffmpeg="yes"
464 8154d2e0 Fabrice Bellard
ffserver="yes"
465 a86b921c Fabrice Bellard
ffplay="yes"
466 80581e98 Michael Niedermayer
LIBOBJFLAGS=""
467 e89b8b0a Diego Biurrun
FFLDFLAGS=-Wl,--warn-common
468 e240ee67 Luca Barbato
LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
469 c536cb09 Diego Biurrun
FFSERVERLDFLAGS=-Wl,-E
470 f39e56a8 Jacob Meuser
LDCONFIG="ldconfig"
471 f3ec2d46 Slavik Gnatenko
LIBPREF="lib"
472
LIBSUF=".a"
473 4bdd05e7 Diego Biurrun
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
474 f3ec2d46 Slavik Gnatenko
SLIBPREF="lib"
475
SLIBSUF=".so"
476 4bdd05e7 Diego Biurrun
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
477 b29bddab Diego Biurrun
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
478
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
479 951bf3e6 Fabrice Bellard
EXESUF=""
480 eb94aca9 Charles Yates
BUILDSUF=""
481 891f64b3 joca@rixmail.se
amr_nb="no"
482 d663a1fd Michael Niedermayer
amr_wb="no"
483 bc634f6f Zdenek Kabelac
amr_nb_fixed="no"
484 2a515c08 Torsten Martinsen
amr_if2="no"
485 f80f7964 Roman Shaposhnik
sunmlib="no"
486 9c3d33d6 Michael Niedermayer
pthreads="no"
487 790c9ca7 Luca Abeni
swscaler="no"
488 b2e3c528 Michael Niedermayer
gpl="no"
489 da9b170c Michael Niedermayer
memalignhack="no"
490 4454dc1b John Dalgliesh
asmalign_pot="unknown"
491 d4596ae3 Diego Biurrun
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
492 ef0bc4c9 François Revol
493
# OS specific
494
targetos=`uname -s`
495
case $targetos in
496
BeOS)
497 2266e085 Diego Biurrun
PREFIX="/boot/home/config"
498 ef0bc4c9 François Revol
# helps building libavcodec
499 30a3e5d4 Nigel Pearson
add_cflags "-DPIC -fomit-frame-pointer"
500 31ba0b4d François Revol
# 3 gcc releases known for BeOS, each with ugly bugs
501 b2924696 Roman Shaposhnik
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
502 31ba0b4d François Revol
case "$gcc_version" in
503
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
504
mmx="no"
505
;;
506
*20010315*) echo "BeBits gcc"
507 30a3e5d4 Nigel Pearson
add_cflags "-fno-expensive-optimizations"
508 31ba0b4d François Revol
;;
509
esac
510 e1707f52 Michael Niedermayer
SHFLAGS=-nostart
511 29799f8b Diego Biurrun
# disable Linux things
512 e1707f52 Michael Niedermayer
audio_oss="no"
513 5cbcf02c Fabrice Bellard
v4l="no"
514 0a7b514f Luca Abeni
v4l2="no"
515 8aa3ee32 Max Krasnyansky
dv1394="no"
516 29799f8b Diego Biurrun
# enable BeOS things
517 dfdfa47c François Revol
audio_beos="yes"
518 ef0bc4c9 François Revol
# no need for libm, but the inet stuff
519
# Check for BONE
520
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
521
extralibs="-lbind -lsocket"
522
else
523 26b35efb François Revol
netserver="yes"
524 4baca069 Philip Gladstone
need_inet_aton="yes"
525 26b35efb François Revol
extralibs="-lnet"
526 ef0bc4c9 François Revol
fi ;;
527 4baca069 Philip Gladstone
SunOS)
528
v4l="no"
529 0a7b514f Luca Abeni
v4l2="no"
530 4baca069 Philip Gladstone
audio_oss="no"
531 8aa3ee32 Max Krasnyansky
dv1394="no"
532 4baca069 Philip Gladstone
make="gmake"
533 e89b8b0a Diego Biurrun
FFLDFLAGS=""
534 c536cb09 Diego Biurrun
FFSERVERLDFLAGS=""
535 813457e5 Måns Rullgård
SHFLAGS="-shared -Wl,-h,\$@"
536 4baca069 Philip Gladstone
need_inet_aton="yes"
537 30a3e5d4 Nigel Pearson
add_extralibs "-lsocket -lnsl"
538 4baca069 Philip Gladstone
;;
539 b7aa4a59 Steven M. Schultz
NetBSD)
540
v4l="no"
541 0a7b514f Luca Abeni
v4l2="no"
542 6beefa40 Michael Niedermayer
bktr="yes"
543 b7aa4a59 Steven M. Schultz
audio_oss="yes"
544
dv1394="no"
545
make="gmake"
546 30a3e5d4 Nigel Pearson
add_extralibs "-lossaudio"
547 b7aa4a59 Steven M. Schultz
;;
548 8c802695 Jacob Meuser
OpenBSD)
549
v4l="no"
550 0a7b514f Luca Abeni
v4l2="no"
551 6beefa40 Michael Niedermayer
bktr="yes"
552 8c802695 Jacob Meuser
audio_oss="yes"
553
dv1394="no"
554
make="gmake"
555 80581e98 Michael Niedermayer
LIBOBJFLAGS="\$(PIC)"
556 a1309f8f Diego Biurrun
LDCONFIG="ldconfig -m \$(shlibdir)"
557 30a3e5d4 Nigel Pearson
add_extralibs "-lossaudio"
558 8c802695 Jacob Meuser
;;
559 9c938e77 Philip Gladstone
FreeBSD)
560
v4l="no"
561 0a7b514f Luca Abeni
v4l2="no"
562 6beefa40 Michael Niedermayer
bktr="yes"
563 9c938e77 Philip Gladstone
audio_oss="yes"
564 8aa3ee32 Max Krasnyansky
dv1394="no"
565 9c938e77 Philip Gladstone
make="gmake"
566 30a3e5d4 Nigel Pearson
add_cflags "-pthread"
567 9c938e77 Philip Gladstone
;;
568 38f0d3ce Diego Biurrun
GNU/kFreeBSD)
569
v4l="no"
570
v4l2="no"
571
bktr="yes"
572
audio_oss="yes"
573
dv1394="no"
574 30a3e5d4 Nigel Pearson
add_cflags "-pthread"
575 38f0d3ce Diego Biurrun
;;
576 4a908fbc Alex Beregszaszi
BSD/OS)
577 5cbcf02c Fabrice Bellard
v4l="no"
578 0a7b514f Luca Abeni
v4l2="no"
579 6beefa40 Michael Niedermayer
bktr="yes"
580 6063bce7 Fabrice Bellard
audio_oss="yes"
581 8aa3ee32 Max Krasnyansky
dv1394="no"
582 4a908fbc Alex Beregszaszi
extralibs="-lpoll -lgnugetopt -lm"
583
make="gmake"
584 1db68540 Steven M. Schultz
strip="strip -d"
585
installstrip=""
586 4a908fbc Alex Beregszaszi
;;
587 90cee0c3 Michael Niedermayer
Darwin)
588 a43bd1d7 Heliodoro Tammaro
cc="cc"
589 90cee0c3 Michael Niedermayer
v4l="no"
590 0a7b514f Luca Abeni
v4l2="no"
591 90cee0c3 Michael Niedermayer
audio_oss="no"
592 8aa3ee32 Max Krasnyansky
dv1394="no"
593 a1309f8f Diego Biurrun
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
594 408382a4 Diego Biurrun
VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
595 90cee0c3 Michael Niedermayer
extralibs=""
596 47930f09 Philip Gladstone
strip="strip -x"
597 da186ae2 Steven M. Schultz
installstrip=""
598 e89b8b0a Diego Biurrun
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
599 4e159595 Diego Biurrun
SLIBSUF=".dylib"
600 f3b60109 Diego Biurrun
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
601
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
602 c536cb09 Diego Biurrun
FFSERVERLDFLAGS=-Wl,-bind_at_load
603 d4596ae3 Diego Biurrun
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
604 90cee0c3 Michael Niedermayer
;;
605 732d9245 Bill Eldridge
MINGW32*)
606 951bf3e6 Fabrice Bellard
# Note: the rest of the mingw32 config is done afterwards as mingw32
607 29799f8b Diego Biurrun
# can be forced on the command line for Linux cross compilation.
608 732d9245 Bill Eldridge
mingw32="yes"
609
;;
610 3f027ca7 Felix Bünemann
CYGWIN*)
611 b2828252 Diego Biurrun
targetos=CYGWIN
612 4581fdff Víctor Paesa
shlibdir='${PREFIX}/bin'
613 3f027ca7 Felix Bünemann
v4l="no"
614 0a7b514f Luca Abeni
v4l2="no"
615 3f027ca7 Felix Bünemann
audio_oss="yes"
616 8aa3ee32 Max Krasnyansky
dv1394="no"
617 07a1b05e Diego Biurrun
VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
618 fbb9d104 Víctor Paesa
VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
619 3f027ca7 Felix Bünemann
extralibs=""
620 487c2fad Michael Niedermayer
EXESUF=".exe"
621 4581fdff Víctor Paesa
SLIBPREF="cyg"
622
SLIBSUF=".dll"
623
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
624
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
625
SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
626 3f027ca7 Felix Bünemann
;;
627 b55e4ef4 Philip Gladstone
Linux)
628 e240ee67 Luca Barbato
LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
629 b55e4ef4 Philip Gladstone
;;
630 99614dd4 Michel Bardiaux
IRIX*)
631 b2828252 Diego Biurrun
targetos=IRIX
632 99614dd4 Michel Bardiaux
ranlib="echo ignoring ranlib"
633
v4l="no"
634 0a7b514f Luca Abeni
v4l2="no"
635 99614dd4 Michel Bardiaux
audio_oss="no"
636
make="gmake"
637
;;
638 f3ec2d46 Slavik Gnatenko
OS/2)
639
TMPE=$TMPE".exe"
640 3ca4b654 Michael Niedermayer
ar="emxomfar -p128"
641 69db4e10 Slavik Gnatenko
ranlib="echo ignoring ranlib"
642
strip="echo ignoring strip"
643 30a3e5d4 Nigel Pearson
add_cflags "-Zomf"
644 e89b8b0a Diego Biurrun
FFLDFLAGS="-Zomf -Zstack 16384 -s"
645 3ca4b654 Michael Niedermayer
SHFLAGS="-Zdll -Zomf"
646 c536cb09 Diego Biurrun
FFSERVERLDFLAGS=""
647 f3ec2d46 Slavik Gnatenko
LIBPREF=""
648
LIBSUF=".lib"
649
SLIBPREF=""
650
SLIBSUF=".dll"
651 951bf3e6 Fabrice Bellard
EXESUF=".exe"
652 f3ec2d46 Slavik Gnatenko
extralibs=""
653 c99dd233 j@v2v.cc
pkg_requires=""
654 f3ec2d46 Slavik Gnatenko
v4l="no"
655 0a7b514f Luca Abeni
v4l2="no"
656 f3ec2d46 Slavik Gnatenko
audio_oss="no"
657 8aa3ee32 Max Krasnyansky
dv1394="no"
658 f3ec2d46 Slavik Gnatenko
ffserver="no"
659 3ca4b654 Michael Niedermayer
vhook="no"
660 f3ec2d46 Slavik Gnatenko
os2="yes"
661 3ca4b654 Michael Niedermayer
662 f3ec2d46 Slavik Gnatenko
;;
663 b2828252 Diego Biurrun
*)
664
targetos="${targetos}-UNKNOWN"
665
;;
666 ef0bc4c9 François Revol
esac
667 de6d9b64 Fabrice Bellard
668 0f3cb305 Fabrice Bellard
# find source path
669 997baf01 Måns Rullgård
source_path="`dirname \"$0\"`"
670 0f3cb305 Fabrice Bellard
source_path_used="yes"
671
if test -z "$source_path" -o "$source_path" = "." ; then
672 997baf01 Måns Rullgård
    source_path="`pwd`"
673 0f3cb305 Fabrice Bellard
    source_path_used="no"
674 e7a4dafb Måns Rullgård
else
675
    source_path="`cd \"$source_path\"; pwd`"
676 997baf01 Måns Rullgård
    echo "$source_path" | grep -q '[[:blank:]]' &&
677
      die "Out of tree builds are impossible with whitespace in source path."
678 de6d9b64 Fabrice Bellard
fi
679
680 7d6ed4aa Måns Rullgård
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
681
    show_help
682
fi
683
684 f255e0ab Michel Bardiaux
FFMPEG_CONFIGURATION=" "
685
for opt do
686
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
687
done
688
689 13638ea9 Steve L'Homme
ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
690
DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
691
PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
692
MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
693
DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
694 009cf97d Michael Niedermayer
695 de6d9b64 Fabrice Bellard
for opt do
696 fce53524 Måns Rullgård
  optval="${opt#*=}"
697 de6d9b64 Fabrice Bellard
  case "$opt" in
698 2ba042a7 Måns Rullgård
  --log)
699
  ;;
700 fce53524 Måns Rullgård
  --log=*) logging="$optval"
701 57bd82d4 Måns Rullgård
  ;;
702 2266e085 Diego Biurrun
  --prefix=*) PREFIX="$optval"; force_prefix=yes
703 de6d9b64 Fabrice Bellard
  ;;
704 fce53524 Måns Rullgård
  --libdir=*) libdir="$optval"; force_libdir=yes
705 cc973ecb Luca Barbato
  ;;
706 84c22efd Diego Biurrun
  --shlibdir=*) shlibdir="$optval"
707
  ;;
708 fce53524 Måns Rullgård
  --incdir=*) incdir="$optval"
709 1d67a1d4 Diego Biurrun
  ;;
710 fce53524 Måns Rullgård
  --mandir=*) mandir="$optval"
711 23a65308 Fabrice Bellard
  ;;
712 fce53524 Måns Rullgård
  --source-path=*) source_path="$optval"
713 0f3cb305 Fabrice Bellard
  ;;
714 fce53524 Måns Rullgård
  --cross-prefix=*) cross_prefix="$optval"
715 0f3cb305 Fabrice Bellard
  ;;
716 fac252f9 Måns Rullgård
  --cross-compile) cross_compile=yes
717
  ;;
718 fce53524 Måns Rullgård
  --cc=*) cc="$optval"
719 de6d9b64 Fabrice Bellard
  ;;
720 fce53524 Måns Rullgård
  --make=*) make="$optval"
721 4a908fbc Alex Beregszaszi
  ;;
722 30a3e5d4 Nigel Pearson
  --extra-cflags=*) add_cflags "$optval"
723 0f3cb305 Fabrice Bellard
  ;;
724 28d8e661 Diego Biurrun
  --extra-ldflags=*) add_ldflags "$optval"
725 0f3cb305 Fabrice Bellard
  ;;
726 28d8e661 Diego Biurrun
  --extra-libs=*) add_extralibs "$optval"
727 0f3cb305 Fabrice Bellard
  ;;
728 fce53524 Måns Rullgård
  --build-suffix=*) BUILDSUF="$optval"
729 eb94aca9 Charles Yates
  ;;
730 cc6a90dd Guillaume Poirier
  --arch=*) arch="$optval"
731 de6d9b64 Fabrice Bellard
  ;;
732 38d0a8aa Guillaume Poirier
  --cpu=*) cpu="$optval"
733 a4adb608 Michael Niedermayer
  ;;
734 e45a2872 Romain Dolbeau
  --powerpc-perf-enable) powerpc_perf="yes"
735
  ;;
736 de6d9b64 Fabrice Bellard
  --disable-mmx) mmx="no"
737
  ;;
738 1839e854 Siarhei Siamashka
  --disable-armv5te) armv5te="no"
739
  ;;
740 eba9ae3c Gildas Bazin
  --disable-iwmmxt) iwmmxt="no"
741
  ;;
742 ab6c65f6 Brian Foley
  --disable-altivec) altivec="no"
743
  ;;
744 de6d9b64 Fabrice Bellard
  --enable-gprof) gprof="yes"
745
  ;;
746 5cbcf02c Fabrice Bellard
  --disable-v4l) v4l="no"
747
  ;;
748 0a7b514f Luca Abeni
  --disable-v4l2) v4l2="no"
749
  ;;
750 6beefa40 Michael Niedermayer
  --disable-bktr) bktr="no"
751
  ;;
752 5cbcf02c Fabrice Bellard
  --disable-audio-oss) audio_oss="no"
753
  ;;
754 dfdfa47c François Revol
  --disable-audio-beos) audio_beos="no"
755
  ;;
756 8aa3ee32 Max Krasnyansky
  --disable-dv1394) dv1394="no"
757
  ;;
758 ffc0ef96 Luca Abeni
  --disable-network) network="no"; ffserver="no"
759 5cbcf02c Fabrice Bellard
  ;;
760 0c7bb0e5 Luca Barbato
  --disable-ipv6) ipv6="no";
761
  ;;
762 0147f198 François Revol
  --disable-zlib) zlib="no"
763
  ;;
764 ba9261e5 Michael Niedermayer
  --enable-a52) a52="yes"
765 6ed7422a Fabrice Bellard
  ;;
766 bfd2edeb Michael Niedermayer
  --enable-a52bin) a52bin="yes"
767 57514323 Zdenek Kabelac
  ;;
768 c99dd233 j@v2v.cc
  --enable-dts) dts="yes"
769 23c99253 Michael Niedermayer
  ;;
770 ba9261e5 Michael Niedermayer
  --enable-pp) pp="yes"
771 bba9b16c Michael Niedermayer
  ;;
772 bb4c2140 Michael Niedermayer
  --enable-libgsm) libgsm="yes"
773
  ;;
774 c99dd233 j@v2v.cc
  --enable-mp3lame) mp3lame="yes"
775 a6741398 Juanjo
  ;;
776 f956e129 Oded Shimon
  --enable-libnut) libnut="yes"
777
  ;;
778 9146ca37 Måns Rullgård
  --enable-libogg) libogg="yes"
779 c99dd233 j@v2v.cc
    pkg_requires="$pkg_requires ogg >= 1.1"
780 5c5dea3f Nilesh Bansal
  ;;
781 81e0d0b4 Mark Hills
  --enable-vorbis) vorbis="yes"
782 c99dd233 j@v2v.cc
    pkg_requires="$pkg_requires vorbis vorbisenc"
783 81e0d0b4 Mark Hills
  ;;
784 445ad18d Zdenek Kabelac
  --enable-faad) faad="yes"
785
  ;;
786
  --enable-faadbin) faadbin="yes"
787
  ;;
788 c99dd233 j@v2v.cc
  --enable-faac) faac="yes"
789 29d48296 Michael Niedermayer
  ;;
790 1ddadfa9 Adam Thayer
  --enable-xvid) xvid="yes"
791
  ;;
792 c99dd233 j@v2v.cc
  --enable-x264) x264="yes"
793 6662ec29 Michael Niedermayer
  ;;
794 8ac17293 Steve L'Homme
  --enable-avisynth) avisynth="yes";
795
  ;;
796 f02be79d Roman Shaposhnik
  --enable-dc1394) dc1394="yes"
797 c99dd233 j@v2v.cc
    pkg_requires="$pkg_requires libraw1394"
798 f02be79d Roman Shaposhnik
  ;;
799 68892110 Philip Gladstone
  --disable-vhook) vhook="no"
800
  ;;
801 c02dbee1 Michael Niedermayer
  --disable-simple_idct) simpleidct="no"
802 045ed63f Zdenek Kabelac
  ;;
803 732d9245 Bill Eldridge
  --enable-mingw32) mingw32="yes"
804
  ;;
805 ac44871c Gildas Bazin
  --enable-mingwce) mingwce="yes"
806
  ;;
807 320d060a Diego Biurrun
  --enable-static) lstatic="yes"
808
  ;;
809
  --disable-static) lstatic="no"
810
  ;;
811 83286d2a Zdenek Kabelac
  --enable-shared) lshared="yes"
812 0319c531 Nick Kurshev
  ;;
813 320d060a Diego Biurrun
  --disable-shared) lshared="no"
814
  ;;
815 cddf3f45 Glenn Maynard
  --disable-debug) debug="no"
816
  ;;
817
  --disable-opts) optimize="no"
818
  ;;
819 78fcba8f Måns Rullgård
  --enable-extra-warnings) extrawarnings="yes"
820
  ;;
821 1eb2212e Fabrice Bellard
  --disable-mpegaudio-hp) mpegaudio_hp="no"
822
  ;;
823 04f46ced Gildas Bazin
  --disable-protocols) protocols="no"; network="no"; ffserver="no"
824
  ;;
825 786b30af Diego Biurrun
  --disable-ffmpeg) ffmpeg="no"
826
  ;;
827 8154d2e0 Fabrice Bellard
  --disable-ffserver) ffserver="no"
828
  ;;
829 a86b921c Fabrice Bellard
  --disable-ffplay) ffplay="no"
830
  ;;
831 cddf3f45 Glenn Maynard
  --enable-small) optimize="small"
832 553a6284 Michael Niedermayer
  ;;
833 60827a1a Diego Biurrun
  --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
834 891f64b3 joca@rixmail.se
  ;;
835 60827a1a Diego Biurrun
  --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
836 bc634f6f Zdenek Kabelac
  ;;
837 60827a1a Diego Biurrun
  --enable-amr_wb) amr="yes"; amr_wb="yes"
838 115329f1 Diego Biurrun
  ;;
839 60827a1a Diego Biurrun
  --enable-amr_if2) amr="yes"; amr_if2="yes"
840 2a515c08 Torsten Martinsen
  ;;
841 f80f7964 Roman Shaposhnik
  --enable-sunmlib) sunmlib="yes"
842
  ;;
843 9c3d33d6 Michael Niedermayer
  --enable-pthreads) pthreads="yes"
844
  ;;
845 790c9ca7 Luca Abeni
  --enable-swscaler) swscaler="yes"
846
  ;;
847 b2e3c528 Michael Niedermayer
  --enable-gpl) gpl="yes"
848
  ;;
849 da9b170c Michael Niedermayer
  --enable-memalign-hack) memalignhack="yes"
850
  ;;
851 65d1bea2 Michel Bardiaux
  --disable-strip) dostrip="no"
852
  ;;
853 fce53524 Måns Rullgård
  --enable-encoder=*) ENCODER_LIST="$ENCODER_LIST ${optval}_encoder"
854 009cf97d Michael Niedermayer
  ;;
855 fce53524 Måns Rullgård
  --enable-decoder=*) DECODER_LIST="$DECODER_LIST ${optval}_decoder"
856 f593b273 Diego Biurrun
  ;;
857 3dc7174e Måns Rullgård
  --disable-encoder=*) ENCODER_LIST="`filter_out ${optval}_encoder $ENCODER_LIST`"
858 f593b273 Diego Biurrun
  ;;
859 3dc7174e Måns Rullgård
  --disable-decoder=*) DECODER_LIST="`filter_out ${optval}_decoder $DECODER_LIST`"
860 009cf97d Michael Niedermayer
  ;;
861 55006fc0 Diego Biurrun
  --disable-encoders) ENCODER_LIST=""
862 009cf97d Michael Niedermayer
  ;;
863 55006fc0 Diego Biurrun
  --disable-decoders) DECODER_LIST=""
864 b4cad537 Emiliano Parasassi
  ;;
865 fce53524 Måns Rullgård
  --enable-muxer=*) MUXER_LIST="$MUXER_LIST ${optval}_muxer"
866 a9e35095 Diego Biurrun
  ;;
867 3dc7174e Måns Rullgård
  --disable-muxer=*) MUXER_LIST="`filter_out ${optval}_muxer $MUXER_LIST`"
868 ff70e601 Måns Rullgård
  ;;
869
  --disable-muxers) MUXER_LIST=""; ffserver="no"
870
  ;;
871 fce53524 Måns Rullgård
  --enable-demuxer=*) DEMUXER_LIST="$DEMUXER_LIST ${optval}_demuxer"
872 ff70e601 Måns Rullgård
  ;;
873 3dc7174e Måns Rullgård
  --disable-demuxer=*) DEMUXER_LIST="`filter_out ${optval}_demuxer $DEMUXER_LIST`"
874 ff70e601 Måns Rullgård
  ;;
875
  --disable-demuxers) DEMUXER_LIST=""
876 a9e35095 Diego Biurrun
  ;;
877 fce53524 Måns Rullgård
  --enable-parser=*) PARSER_LIST="$PARSER_LIST ${optval}_parser"
878 af9e7d18 Måns Rullgård
  ;;
879 3dc7174e Måns Rullgård
  --disable-parser=*) PARSER_LIST="`filter_out ${optval}_parser $PARSER_LIST`"
880 af9e7d18 Måns Rullgård
  ;;
881
  --disable-parsers) PARSER_LIST=""
882
  ;;
883 74c53c2d Måns Rullgård
  --help) show_help
884
  ;;
885 b34c63f7 Diego Biurrun
  *)
886
  echo "Unknown option \"$opt\"."
887
  echo "See $0 --help for available options."
888
  exit 1
889
  ;;
890 de6d9b64 Fabrice Bellard
  esac
891
done
892
893 720c69da Måns Rullgård
if test "$logging" != no; then
894
    test "$logging" = yes || logfile="$logging"
895 57bd82d4 Måns Rullgård
    echo "# $0 $@" >$logfile
896
    set >>$logfile
897 2ba042a7 Måns Rullgård
else
898
    logfile=/dev/null
899 57bd82d4 Måns Rullgård
fi
900 e89b8b0a Diego Biurrun
901 e67bcdd9 Diego Biurrun
if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
902
    if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
903
        cat <<EOF
904
You can only build one library type at once on MinGW.
905
Specify --disable-static --enable-shared to only build
906
the shared libraries. To build only the static libraries
907
you do not need to pass additional options.
908
EOF
909
        exit 1
910
    fi
911
    v4l="no"
912
    v4l2="no"
913
    bktr="no"
914
    audio_oss="no"
915
    dv1394="no"
916
    dc1394="no"
917
    ffserver="no"
918
    network="no"
919
    if test "$mingwce" = "yes"; then
920
        protocols="no"
921
    fi
922
    SLIBPREF=""
923
    SLIBSUF=".dll"
924
    EXESUF=".exe"
925 d6a07a13 Diego Biurrun
    SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
926
    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
927 dfeb80a5 Diego Biurrun
    SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
928 b89c8f58 Ramiro Polla
    SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
929 2266e085 Diego Biurrun
    if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
930 1066a995 Diego Biurrun
    if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
931
    shlibdir='${PREFIX}'
932 e67bcdd9 Diego Biurrun
fi
933
934 28d8e661 Diego Biurrun
# Combine FFLDFLAGS and the LDFLAGS environment variable.
935
LDFLAGS="$FFLDFLAGS $LDFLAGS"
936 e89b8b0a Diego Biurrun
937 fac252f9 Måns Rullgård
test -n "$cross_prefix" && cross_compile=yes
938 1ea46bed Måns Rullgård
cc="${cross_prefix}${cc}"
939
ar="${cross_prefix}${ar}"
940
ranlib="${cross_prefix}${ranlib}"
941
strip="${cross_prefix}${strip}"
942
943 320d060a Diego Biurrun
# we need to build at least one lib type
944
if test "$lstatic" = "no" && test "$lshared" = "no" ; then
945
    cat <<EOF
946
At least one library type must be built.
947
Specify --enable-static to build the static libraries or --enable-shared to
948
build the shared libraries as well. To only build the shared libraries specify
949
--disable-static in addition to --enable-shared.
950
EOF
951
    exit 1;
952
fi
953
954 5c5dea3f Nilesh Bansal
if test "$vorbis" = "yes" ; then
955 9146ca37 Måns Rullgård
    if test "$libogg" = "no"; then
956 29799f8b Diego Biurrun
        echo "libogg must be enabled to enable Vorbis."
957 5c5dea3f Nilesh Bansal
        fail="yes"
958
    fi
959
fi
960
961 b2e3c528 Michael Niedermayer
if test "$gpl" != "yes"; then
962 ba64106a Diego Biurrun
    if test "$pp" != "no"; then
963 29799f8b Diego Biurrun
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
964 b2e3c528 Michael Niedermayer
        fail="yes"
965
    fi
966
967
    if test "$a52" != "no" -o "$a52bin" != "no"; then
968 29799f8b Diego Biurrun
        echo "liba52 is under GPL and --enable-gpl is not specified."
969 b2e3c528 Michael Niedermayer
        fail="yes"
970
    fi
971 23c99253 Michael Niedermayer
972 1ddadfa9 Adam Thayer
    if test "$xvid" != "no"; then
973 29799f8b Diego Biurrun
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
974 1ddadfa9 Adam Thayer
        fail="yes"
975
    fi
976
977 6662ec29 Michael Niedermayer
    if test "$x264" != "no"; then
978 29799f8b Diego Biurrun
        echo "x264 is under GPL and --enable-gpl is not specified."
979 6662ec29 Michael Niedermayer
        fail="yes"
980
    fi
981
982 23c99253 Michael Niedermayer
    if test "$dts" != "no"; then
983 29799f8b Diego Biurrun
        echo "libdts is under GPL and --enable-gpl is not specified."
984 23c99253 Michael Niedermayer
        fail="yes"
985
    fi
986 115329f1 Diego Biurrun
987 b2e3c528 Michael Niedermayer
    if test "$faad" != "no" -o "$faadbin" != "no"; then
988 dcd479c0 Måns Rullgård
        if check_header faad.h; then
989
            check_cc << EOF
990 b2e3c528 Michael Niedermayer
                #include <faad.h>
991
                #ifndef FAAD2_VERSION
992
                ok faad1
993
                #endif
994
                int main( void ) { return 0; }
995
EOF
996 dcd479c0 Måns Rullgård
            if test $? = 0 ; then
997 29799f8b Diego Biurrun
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
998 b2e3c528 Michael Niedermayer
                fail="yes"
999
            fi
1000
        else
1001
            faad="no"
1002
            faadbin="no"
1003 29799f8b Diego Biurrun
            echo "FAAD test failed."
1004 b2e3c528 Michael Niedermayer
        fi
1005
    fi
1006 115329f1 Diego Biurrun
1007 790c9ca7 Luca Abeni
    if test "$swscaler" != "no"; then
1008
        echo "The software scaler is under GPL and --enable-gpl is not specified."
1009
        fail="yes"
1010
    fi
1011 ebb810d9 Ramiro Polla
fi
1012 b2e3c528 Michael Niedermayer
1013 ebb810d9 Ramiro Polla
if test "$fail" = "yes"; then
1014
    exit 1
1015 b2e3c528 Michael Niedermayer
fi
1016
1017 29799f8b Diego Biurrun
# compute MMX state
1018 0f3cb305 Fabrice Bellard
if test $mmx = "default"; then
1019 419b8784 Diego Biurrun
    if test $arch = "x86_32" -o $arch = "x86_64"; then
1020 0f3cb305 Fabrice Bellard
        mmx="yes"
1021
    else
1022
        mmx="no"
1023
    fi
1024
fi
1025
1026 cf9d24ad Dan Christiansen
#Darwin CC versions
1027 75388c74 Michael Niedermayer
needmdynamicnopic="no"
1028 cf9d24ad Dan Christiansen
if test $targetos = Darwin; then
1029 b2924696 Roman Shaposhnik
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1030 30a3e5d4 Nigel Pearson
        add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1031 cf9d24ad Dan Christiansen
    else
1032 bb270c08 Diego Biurrun
        gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1033
        case "$gcc_version" in
1034
            *2.95*)
1035 30a3e5d4 Nigel Pearson
                add_cflags "-no-cpp-precomp -pipe"
1036 bb270c08 Diego Biurrun
                ;;
1037
            *[34].*)
1038 30a3e5d4 Nigel Pearson
                add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
1039 bb270c08 Diego Biurrun
                if test "$lshared" = no; then
1040
                   needmdynamicnopic="yes"
1041
                fi
1042
                ;;
1043
            *)
1044 30a3e5d4 Nigel Pearson
                add_cflags "-no-cpp-precomp -pipe"
1045 bb270c08 Diego Biurrun
                if test "$lshared" = no; then
1046
                   needmdynamicnopic="yes"
1047
                fi
1048
                ;;
1049
        esac
1050 cf9d24ad Dan Christiansen
    fi
1051 2a1a6b64 Michael Niedermayer
fi
1052
1053
if test $optimize != "no"; then
1054
    add_cflags "-fomit-frame-pointer"
1055 cf9d24ad Dan Christiansen
fi
1056
1057 ab6c65f6 Brian Foley
# Can only do AltiVec on PowerPC
1058
if test $altivec = "default"; then
1059 cc6a90dd Guillaume Poirier
    if test $arch = "powerpc"; then
1060 ab6c65f6 Brian Foley
        altivec="yes"
1061
    else
1062
        altivec="no"
1063
    fi
1064
fi
1065
1066 a4adb608 Michael Niedermayer
# Add processor-specific flags
1067
TUNECPU="generic"
1068 9007f514 Romain Dolbeau
POWERPCMODE="32bits"
1069 38d0a8aa Guillaume Poirier
if test $cpu != "generic"; then
1070
    case $cpu in
1071 bb270c08 Diego Biurrun
        601|ppc601|PowerPC601)
1072 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=601"
1073 bb270c08 Diego Biurrun
            if test $altivec = "yes"; then
1074
                echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
1075
            fi
1076
            TUNECPU=ppc601
1077
        ;;
1078
        603*|ppc603*|PowerPC603*)
1079 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=603"
1080 bb270c08 Diego Biurrun
            if test $altivec = "yes"; then
1081
                echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
1082
            fi
1083
            TUNECPU=ppc603
1084
        ;;
1085
        604*|ppc604*|PowerPC604*)
1086 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=604"
1087 bb270c08 Diego Biurrun
            if test $altivec = "yes"; then
1088
                echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
1089
            fi
1090
            TUNECPU=ppc604
1091
        ;;
1092
        G3|g3|75*|ppc75*|PowerPC75*)
1093 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1094 bb270c08 Diego Biurrun
            if test $altivec = "yes"; then
1095
                echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
1096
            fi
1097
            TUNECPU=ppc750
1098
        ;;
1099
        G4|g4|745*|ppc745*|PowerPC745*)
1100 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1101 bb270c08 Diego Biurrun
            if test $altivec = "no"; then
1102
                echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
1103
            fi
1104
            TUNECPU=ppc7450
1105
        ;;
1106
        74*|ppc74*|PowerPC74*)
1107 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1108 bb270c08 Diego Biurrun
            if test $altivec = "no"; then
1109
                echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
1110
            fi
1111
            TUNECPU=ppc7400
1112
        ;;
1113
        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1114 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1115 bb270c08 Diego Biurrun
            if test $altivec = "no"; then
1116
                echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
1117
            fi
1118
            TUNECPU=ppc970
1119 9007f514 Romain Dolbeau
            POWERPCMODE="64bits"
1120 bb270c08 Diego Biurrun
        ;;
1121 e7768fc5 Guillaume Poirier
        # targets that do NOT support conditional mov (cmov)
1122
        i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1123 38d0a8aa Guillaume Poirier
            add_cflags "-march=$cpu"
1124 e7768fc5 Guillaume Poirier
            cmov="no"
1125
        ;;
1126
        # targets that do support conditional mov (cmov)
1127 94e4c3a3 Guillaume Poirier
        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
1128 e7768fc5 Guillaume Poirier
            add_cflags "-march=$cpu"
1129 4c8d81fa Guillaume Poirier
            cmov="yes"
1130 94e4c3a3 Guillaume Poirier
            cmov_is_fast="yes"
1131
        ;;
1132
        # targets that do support conditional mov but on which it's slow
1133
        pentium4|prescott|nocona)
1134
            add_cflags "-march=$cpu"
1135
            cmov="yes"
1136
            cmov_is_fast="no"
1137 bb270c08 Diego Biurrun
        ;;
1138 d7b34d08 Diego Biurrun
        sparc64)
1139 1c5d830c Guillaume Poirier
            add_cflags "-mcpu=v9"
1140 d7b34d08 Diego Biurrun
        ;;
1141 bb270c08 Diego Biurrun
        *)
1142 38d0a8aa Guillaume Poirier
        echo "WARNING: Unknown CPU \"$cpu\", ignored."
1143 bb270c08 Diego Biurrun
        ;;
1144 a4adb608 Michael Niedermayer
    esac
1145
fi
1146
1147 be0d52ab Måns Rullgård
# make sure we can execute files in $TMPDIR
1148
cat >$TMPE 2>>$logfile <<EOF
1149
#! /bin/sh
1150
EOF
1151
chmod +x $TMPE >>$logfile 2>&1
1152
if ! $TMPE >>$logfile 2>&1; then
1153
    cat <<EOF
1154
Unable to create and execute files in $TMPDIR1.  Set the TMPDIR environment
1155 68300911 Diego Biurrun
variable to another directory and make sure that $TMPDIR1 is not mounted
1156
noexec.
1157 be0d52ab Måns Rullgård
EOF
1158
    die "Sanity test failed."
1159
fi
1160 0244f743 Måns Rullgård
rm $TMPE
1161 be0d52ab Måns Rullgård
1162 1a268acc Måns Rullgård
# compiler sanity check
1163
check_exec <<EOF
1164
int main(){
1165
    return 0;
1166
}
1167
EOF
1168
if test "$?" != 0; then
1169
    echo "$cc is unable to create an executable file."
1170
    if test -z "$cross_prefix" -a "$cross_compile" = no; then
1171
        echo "If $cc is a cross-compiler, use the --cross-compile option."
1172 c7ae6345 Måns Rullgård
        echo "Only do this if you know what cross compiling means."
1173 1a268acc Måns Rullgård
    fi
1174
    die "C compiler test failed."
1175
fi
1176
1177 87ea51e0 Luca Barbato
# check for assembler specific support
1178
1179 cc6a90dd Guillaume Poirier
if test $arch = "powerpc"; then
1180 87ea51e0 Luca Barbato
check_cc <<EOF && dcbzl=yes
1181
int main(void) {
1182
    register long zero = 0;
1183
    char data[1024];
1184
    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1185
return 0;
1186
}
1187
EOF
1188
fi
1189
1190 57bd82d4 Måns Rullgård
# check for SIMD availability
1191
1192 115329f1 Diego Biurrun
# AltiVec flags: The FSF version of GCC differs from the Apple version
1193 cc6a90dd Guillaume Poirier
if test $arch = "powerpc"; then
1194 b6e52719 Magnus Damm
    if test $altivec = "yes"; then
1195 b2924696 Roman Shaposhnik
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
1196 30a3e5d4 Nigel Pearson
            add_cflags "-faltivec"
1197 b6e52719 Magnus Damm
        else
1198 30a3e5d4 Nigel Pearson
            add_cflags "-maltivec -mabi=altivec"
1199 b6e52719 Magnus Damm
        fi
1200
    fi
1201
fi
1202
1203 dcd479c0 Måns Rullgård
check_header altivec.h && _altivec_h=yes || _altivec_h=no
1204 a9a07762 Michael Niedermayer
1205 29799f8b Diego Biurrun
# check if our compiler supports Motorola AltiVec C API
1206 ab6c65f6 Brian Foley
if test $altivec = "yes"; then
1207 f25fc9b1 Måns Rullgård
    if test $_altivec_h = "yes"; then
1208
        inc_altivec_h="#include <altivec.h>"
1209
    else
1210
        inc_altivec_h=
1211
    fi
1212
    check_cc <<EOF || altivec=no
1213 dcd479c0 Måns Rullgård
$inc_altivec_h
1214 a9a07762 Michael Niedermayer
int main(void) {
1215
    vector signed int v1, v2, v3;
1216
    v1 = vec_add(v2,v3);
1217
    return 0;
1218
}
1219
EOF
1220
fi
1221 ab6c65f6 Brian Foley
1222 854fdb51 Måns Rullgård
# check armv5te instructions support
1223 cc6a90dd Guillaume Poirier
if test $armv5te = "default" -a $arch = "armv4l"; then
1224 854fdb51 Måns Rullgård
    armv5te=no
1225
    check_cc <<EOF && armv5te=yes
1226
        int main(void) {
1227
        __asm__ __volatile__ ("qadd r0, r0, r0");
1228
        }
1229
EOF
1230
fi
1231
1232
# check iwmmxt support
1233 cc6a90dd Guillaume Poirier
if test $iwmmxt = "default" -a $arch = "armv4l"; then
1234 854fdb51 Måns Rullgård
    iwmmxt=no
1235
    check_cc <<EOF && iwmmxt=yes
1236
        int main(void) {
1237
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
1238
        }
1239
EOF
1240
fi
1241
1242 29799f8b Diego Biurrun
# mmi only available on mips
1243 d46aba26 Leon van Stuivenberg
if test $mmi = "default"; then
1244 cc6a90dd Guillaume Poirier
    if test $arch = "mips"; then
1245 d46aba26 Leon van Stuivenberg
        mmi="yes"
1246
    else
1247
        mmi="no"
1248
    fi
1249
fi
1250
1251 29799f8b Diego Biurrun
# check if our compiler supports mmi
1252 57bd82d4 Måns Rullgård
enabled mmi && check_cc <<EOF || mmi="no"
1253 d46aba26 Leon van Stuivenberg
int main(void) {
1254
    __asm__ ("lq \$2, 0(\$2)");
1255
    return 0;
1256
}
1257
EOF
1258 57bd82d4 Måns Rullgård
1259
# ---
1260
# big/little-endian test
1261 fac252f9 Måns Rullgård
if test "$cross_compile" = "no"; then
1262 57bd82d4 Måns Rullgård
    check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
1263 a3999908 Michael Niedermayer
#include <inttypes.h>
1264
int main(int argc, char ** argv){
1265 bb270c08 Diego Biurrun
        volatile uint32_t i=0x01234567;
1266
        return (*((uint8_t*)(&i))) == 0x67;
1267 a3999908 Michael Niedermayer
}
1268
EOF
1269 487a54d7 Fabrice Bellard
else
1270 f25fc9b1 Måns Rullgård
    # programs cannot be launched if cross compiling, so make a static guess
1271 cc6a90dd Guillaume Poirier
    if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
1272 f25fc9b1 Måns Rullgård
        bigendian="yes"
1273
    fi
1274 487a54d7 Fabrice Bellard
fi
1275
1276 a3999908 Michael Niedermayer
# ---
1277 7f965c1c Chris Flerackers
# *inttypes.h* test
1278 dcd479c0 Måns Rullgård
check_header inttypes.h || inttypes=no
1279 7f965c1c Chris Flerackers
1280
# ---
1281 b5c950c4 Michael Niedermayer
# *int_fast* test
1282 dcd479c0 Måns Rullgård
check_cc <<EOF || emu_fast_int=yes
1283 b5c950c4 Michael Niedermayer
#include <inttypes.h>
1284
int main(int argc, char ** argv){
1285 bb270c08 Diego Biurrun
        volatile uint_fast64_t i=0x01234567;
1286
        return 0;
1287 b5c950c4 Michael Niedermayer
}
1288
EOF
1289
1290
# ---
1291 3d204385 Nick Kurshev
# check availability of some header files
1292
1293
_memalign=no
1294
_malloc_h=no
1295 dcd479c0 Måns Rullgård
if check_header malloc.h; then
1296
    _malloc_h=yes
1297
    _memalign=yes
1298
    check_func memalign || _memalign="no"
1299 3d204385 Nick Kurshev
fi
1300
1301 8b3a43cf Diego Biurrun
if test "$_memalign" = "no" -a "$mmx" = "yes" -a \
1302 a9907393 Dennis Melentyev
        "$memalignhack" != "yes" -a "$targetos" != "Darwin" -a \
1303
        "$targetos" != "FreeBSD" ; then
1304 57bd82d4 Måns Rullgård
    die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1305 8bf5d58f Michael Niedermayer
fi
1306
1307 47d23bbf Måns Rullgård
check_header byteswap.h && byteswap_h=yes || byteswap_h=no
1308
1309 dcd479c0 Måns Rullgård
check_func localtime_r && localtime_r=yes || localtime_r=no
1310 57bd82d4 Måns Rullgård
enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1311
1312
# check for some common methods of building with pthread support
1313
# do this before the optional library checks as some of them require pthreads
1314
if enabled pthreads; then
1315
    { check_cflags -pthread && check_ldflags -pthread; } ||
1316
    { check_cflags -pthreads && check_ldflags -pthreads; } ||
1317
    check_lib pthread.h pthread_create -lpthread ||
1318
    check_func pthread_create ||
1319
    die "ERROR: can't find pthreads library"
1320
fi
1321
1322
# these are off by default, so fail if requested and not available
1323 4cbed916 Måns Rullgård
enabled dts     && require libdts dts.h dts_init -ldts -lm
1324 57bd82d4 Måns Rullgård
enabled libgsm  && require libgsm gsm.h gsm_create -lgsm
1325 4cbed916 Måns Rullgård
enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1326 8515d1c8 Måns Rullgård
enabled vorbis  && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
1327 aedf11f8 Måns Rullgård
enabled libogg  && require libogg ogg/ogg.h ogg_sync_init -logg
1328 f956e129 Oded Shimon
enabled libnut  && require libnut nut.h nut_demuxer_init -lnut
1329 57bd82d4 Måns Rullgård
enabled xvid    && require XviD xvid.h xvid_global -lxvidcore
1330
enabled x264    && require x264 x264.h x264_encoder_open -lx264
1331
enabled dc1394  && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1332
enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1333 e0f80bd7 Reimar Döffinger
1334 3b9bee88 Måns Rullgård
# Ugh, faac uses stdcall calling convention on win32 so we can't use
1335
# the generic test functions
1336
if enabled faac; then
1337
    save_flags
1338
    temp_extralibs -lfaac
1339
    check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1340
#include <stdint.h>
1341
#include <faac.h>
1342
int main(){
1343
    char *id, *cpr;
1344
    faacEncGetVersion(&id, &cpr);
1345
    return 0;
1346
}
1347
EOF
1348
    restore_flags
1349
fi
1350
1351 87f1c97e Måns Rullgård
# Ugh, recent faad2 versions have renamed all functions and #define the
1352
# old names in faad.h.  Generic tests won't work.
1353
if enabled faad; then
1354
    save_flags
1355
    temp_extralibs -lfaad
1356
    check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1357
#include <faad.h>
1358
int main(){
1359
    faacDecOpen();
1360
    return 0;
1361
}
1362
EOF
1363
    restore_flags
1364
fi
1365
1366 8ac17293 Steve L'Homme
# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1367
if enabled avisynth; then
1368
    save_flags
1369
    temp_extralibs -lvfw32
1370
    check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1371
#include <windows.h>
1372
#include <vfw.h>
1373
int main(){
1374
    AVIFileInit();
1375
    return 0;
1376
}
1377
EOF
1378
    restore_flags
1379
fi
1380
1381
1382 95e2ce4a Michael Niedermayer
# test for lrintf in math.h
1383 dcd479c0 Måns Rullgård
check_exec <<EOF && have_lrintf=yes || have_lrintf=no
1384 95e2ce4a Michael Niedermayer
#define _ISOC9X_SOURCE  1
1385
#include <math.h>
1386
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1387
EOF
1388
1389 c13e1abd Falk Hüffner
_restrict=
1390
for restrict_keyword in restrict __restrict__ __restrict; do
1391 57bd82d4 Måns Rullgård
    check_cc <<EOF && _restrict=$restrict_keyword && break
1392 dcd479c0 Måns Rullgård
void foo(char * $restrict_keyword p);
1393
EOF
1394 c13e1abd Falk Hüffner
done
1395
1396 a8721c09 Fabrice Bellard
# dlopen/dlfcn.h probing
1397
1398 dcd479c0 Måns Rullgård
check_header dlfcn.h && dlfcn=yes
1399 a8721c09 Fabrice Bellard
1400 dcd479c0 Måns Rullgård
temp_extralibs -ldl
1401
if check_func dlopen; then
1402
    dlopen=yes
1403
    ldl=-ldl
1404 a8721c09 Fabrice Bellard
fi
1405 dcd479c0 Måns Rullgård
restore_flags
1406 a8721c09 Fabrice Bellard
1407 dcd479c0 Måns Rullgård
if check_func dlopen; then
1408
    dlopen=yes
1409
    ldl=
1410 a8721c09 Fabrice Bellard
fi
1411
1412 f25fc9b1 Måns Rullgård
if test "$vhook" = "default"; then
1413
    vhook="$dlopen"
1414 a8721c09 Fabrice Bellard
fi
1415
1416 bfd2edeb Michael Niedermayer
if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
1417 57bd82d4 Måns Rullgård
    add_extralibs $ldl
1418 bfd2edeb Michael Niedermayer
fi
1419
1420 fbb9d104 Víctor Paesa
if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1421
    vhook="no"
1422
    echo
1423
    echo "At the moment vhooks don't work on Cygwin static builds."
1424
    echo "Patches welcome."
1425
    echo
1426
fi
1427
1428 8d923001 Måns Rullgård
if enabled vhook; then
1429
    check_ldflags -rdynamic
1430
    check_ldflags -export-dynamic
1431
fi
1432 bfd2edeb Michael Niedermayer
1433 a86b921c Fabrice Bellard
##########################################
1434 29799f8b Diego Biurrun
# imlib check
1435 a86b921c Fabrice Bellard
1436 dcd479c0 Måns Rullgård
temp_extralibs -lImlib2
1437
check_ld <<EOF && imlib2=yes || imlib2=no
1438 a8721c09 Fabrice Bellard
#include <X11/Xlib.h>
1439
#include <Imlib2.h>
1440
int main( void ) { return (int) imlib_load_font("foo"); }
1441
EOF
1442 dcd479c0 Måns Rullgård
restore_flags
1443 52b41d7f Fabrice Bellard
1444 a86b921c Fabrice Bellard
##########################################
1445 29799f8b Diego Biurrun
# FreeType check
1446 a86b921c Fabrice Bellard
1447 04511d53 Philip Gladstone
freetype2=no
1448 e2a5fd20 Michael Niedermayer
if test "x$targetos" != "xBeOS"; then
1449 e2a3cd59 Roman Shaposhnik
  if (freetype-config --version) >/dev/null 2>&1 ; then
1450 dcd479c0 Måns Rullgård
      temp_cflags `freetype-config --cflags`
1451
      temp_extralibs `freetype-config --libs`
1452
      check_ld <<EOF && freetype2=yes
1453
#include <ft2build.h>
1454
int main( void ) { return (int) FT_Init_FreeType(0); }
1455
EOF
1456
      restore_flags
1457 dee076fc François Revol
  fi
1458 04511d53 Philip Gladstone
fi
1459
1460 a86b921c Fabrice Bellard
##########################################
1461 29799f8b Diego Biurrun
# SDL check
1462 a86b921c Fabrice Bellard
1463
sdl_too_old=no
1464
sdl=no
1465 6a1a892f Frantisek Dvorak
SDL_CONFIG="${cross_prefix}sdl-config"
1466
if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
1467 dcd479c0 Måns Rullgård
    temp_cflags `"${SDL_CONFIG}" --cflags`
1468
    temp_extralibs `"${SDL_CONFIG}" --libs`
1469
    check_ld <<EOF
1470
#include <SDL.h>
1471
#undef main /* We don't want SDL to override our main() */
1472
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1473
EOF
1474
    if test $? = 0; then
1475
        _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1476 29f3b38a Måns Rullgård
        if test "$_sdlversion" -lt 121 ; then
1477 dcd479c0 Måns Rullgård
            sdl_too_old=yes
1478
        else
1479
            sdl=yes
1480 29f3b38a Måns Rullgård
            check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
1481
#include <SDL.h>
1482
int main(void){
1483
    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1484
    int w = vi->current_w;
1485
    return 0;
1486
}
1487
EOF
1488 dcd479c0 Måns Rullgård
        fi
1489
    fi
1490 29f3b38a Måns Rullgård
    restore_flags
1491 c3f6b472 Michael Niedermayer
fi
1492 a86b921c Fabrice Bellard
1493 57bd82d4 Måns Rullgård
enabled sdl || ffplay=no
1494
1495 146ea952 Nicolas Boos
##########################################
1496 29799f8b Diego Biurrun
# texi2html check
1497 146ea952 Nicolas Boos
1498
texi2html=no
1499 e2a3cd59 Roman Shaposhnik
if (texi2html -version) >/dev/null 2>&1; then
1500 146ea952 Nicolas Boos
texi2html=yes
1501
fi
1502
1503 7a91333f Hans Zandbelt
##########################################
1504 29799f8b Diego Biurrun
# IPv6 check
1505 7a91333f Hans Zandbelt
1506 0c7bb0e5 Luca Barbato
enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
1507 7a91333f Hans Zandbelt
#include <sys/types.h>
1508
#include <sys/socket.h>
1509
#include <netinet/in.h>
1510
#include <netdb.h>
1511
int main( void ) {
1512
  struct sockaddr_storage saddr;
1513
  struct ipv6_mreq mreq6;
1514
  getaddrinfo(0,0,0,0);
1515
  getnameinfo(0,0,0,0,0,0,0);
1516 12fe88b4 Dan Villiom Podlaski Christiansen
  IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1517 7a91333f Hans Zandbelt
}
1518
EOF
1519
1520 47f38850 Luca Abeni
# check for video4linux2 --- V4L2_PIX_FMT_YUV420
1521 57bd82d4 Måns Rullgård
enabled v4l2 && check_cc <<EOF || v4l2="no"
1522 84fe9963 Alex Beregszaszi
#include <sys/time.h>
1523 f743a062 Luca Abeni
#include <asm/types.h>
1524
#include <linux/videodev2.h>
1525 47f38850 Luca Abeni
int dummy = V4L2_PIX_FMT_YUV420;
1526 490c189b Luca Abeni
struct v4l2_buffer dummy1;
1527 47f38850 Luca Abeni
EOF
1528
1529 57bd82d4 Måns Rullgård
enabled debug && add_cflags -g
1530
1531
# add some useful compiler flags if supported
1532
check_cflags -Wdeclaration-after-statement
1533 dcd479c0 Måns Rullgård
check_cflags -Wall
1534
check_cflags -Wno-switch
1535 c07bd6a9 Michael Niedermayer
check_cflags -Wdisabled-optimization
1536
check_cflags -Wpointer-arith
1537
check_cflags -Wredundant-decls
1538 78fcba8f Måns Rullgård
enabled extrawarnings && check_cflags -Winline
1539 cf9d24ad Dan Christiansen
1540 57bd82d4 Måns Rullgård
# add some linker flags
1541 e240ee67 Luca Barbato
check_ldflags $LDLATEFLAGS
1542 94a3401e Fabrice Bellard
1543 57bd82d4 Måns Rullgård
# not all compilers support -Os
1544
test "$optimize" = "small" && check_cflags -Os
1545 cddf3f45 Glenn Maynard
1546 57bd82d4 Måns Rullgård
if enabled optimize; then
1547 b2924696 Roman Shaposhnik
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1548 30a3e5d4 Nigel Pearson
        add_cflags  "-O5"
1549
        add_ldflags "-O5"
1550 cf9d24ad Dan Christiansen
    else
1551 30a3e5d4 Nigel Pearson
        add_cflags "-O3"
1552 cf9d24ad Dan Christiansen
    fi
1553 cddf3f45 Glenn Maynard
fi
1554
1555 80581e98 Michael Niedermayer
# PIC flags for shared library objects where they are needed
1556
if test "$lshared" = "yes" ; then
1557 f25fc9b1 Måns Rullgård
    # LIBOBJFLAGS may have already been set in the OS configuration
1558
    if test -z "$LIBOBJFLAGS" ; then
1559 cc6a90dd Guillaume Poirier
        case "$arch" in
1560 813457e5 Måns Rullgård
            x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1561
        esac
1562 80581e98 Michael Niedermayer
    fi
1563
fi
1564
1565 1db54e20 Diego Biurrun
if test "$gprof" = "yes" ; then
1566 30a3e5d4 Nigel Pearson
    add_cflags  "-p"
1567
    add_ldflags "-p"
1568 1db54e20 Diego Biurrun
fi
1569
1570 4454dc1b John Dalgliesh
# find if .align arg is power-of-two or not
1571
if test $asmalign_pot = "unknown"; then
1572
    asmalign_pot="no"
1573
    echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1574
fi
1575
1576 2266e085 Diego Biurrun
echo "install prefix   $PREFIX"
1577 29799f8b Diego Biurrun
echo "source path      $source_path"
1578 de6d9b64 Fabrice Bellard
echo "C compiler       $cc"
1579 4a908fbc Alex Beregszaszi
echo "make             $make"
1580 38d0a8aa Guillaume Poirier
echo "ARCH             $arch ($cpu)"
1581 eb94aca9 Charles Yates
if test "$BUILDSUF" != ""; then
1582 f25fc9b1 Måns Rullgård
    echo "build suffix     $BUILDSUF"
1583 eb94aca9 Charles Yates
fi
1584 29799f8b Diego Biurrun
echo "big-endian       $bigendian"
1585 7f965c1c Chris Flerackers
echo "inttypes.h       $inttypes"
1586 b5c950c4 Michael Niedermayer
echo "broken inttypes.h $emu_fast_int"
1587 419b8784 Diego Biurrun
if test $arch = "x86_32" -o $arch = "x86_64"; then
1588 f25fc9b1 Måns Rullgård
    echo "MMX enabled      $mmx"
1589 e7768fc5 Guillaume Poirier
    echo "CMOV enabled     $cmov"
1590 94e4c3a3 Guillaume Poirier
    echo "CMOV is fast     $cmov_is_fast"
1591 e41e8342 Fabrice Bellard
fi
1592 cc6a90dd Guillaume Poirier
if test $arch = "armv4l"; then
1593 1839e854 Siarhei Siamashka
    echo "ARMv5TE enabled  $armv5te"
1594 f25fc9b1 Måns Rullgård
    echo "IWMMXT enabled   $iwmmxt"
1595 eba9ae3c Gildas Bazin
fi
1596 cc6a90dd Guillaume Poirier
if test $arch = "mips"; then
1597 f25fc9b1 Måns Rullgård
    echo "MMI enabled      $mmi"
1598 e41e8342 Fabrice Bellard
fi
1599 cc6a90dd Guillaume Poirier
if test $arch = "powerpc"; then
1600 f25fc9b1 Måns Rullgård
    echo "AltiVec enabled  $altivec"
1601 87ea51e0 Luca Barbato
    echo "dcbzl available  $dcbzl"
1602 e41e8342 Fabrice Bellard
fi
1603 de6d9b64 Fabrice Bellard
echo "gprof enabled    $gprof"
1604 0147f198 François Revol
echo "zlib enabled     $zlib"
1605 bb4c2140 Michael Niedermayer
echo "libgsm enabled   $libgsm"
1606 a6741398 Juanjo
echo "mp3lame enabled  $mp3lame"
1607 f956e129 Oded Shimon
echo "libnut enabled   $libnut"
1608 9146ca37 Måns Rullgård
echo "libogg enabled   $libogg"
1609 29799f8b Diego Biurrun
echo "Vorbis enabled   $vorbis"
1610
echo "FAAD enabled     $faad"
1611 445ad18d Zdenek Kabelac
echo "faadbin enabled  $faadbin"
1612 29799f8b Diego Biurrun
echo "FAAC enabled     $faac"
1613
echo "XviD enabled     $xvid"
1614 6662ec29 Michael Niedermayer
echo "x264 enabled     $x264"
1615 5cbcf02c Fabrice Bellard
echo "a52 support      $a52"
1616 57514323 Zdenek Kabelac
echo "a52 dlopened     $a52bin"
1617 29799f8b Diego Biurrun
echo "DTS support      $dts"
1618 bba9b16c Michael Niedermayer
echo "pp support       $pp"
1619 790c9ca7 Luca Abeni
echo "Software Scaler enabled $swscaler"
1620 8ac17293 Steve L'Homme
echo "AVISynth enabled $avisynth"
1621 cddf3f45 Glenn Maynard
echo "debug symbols    $debug"
1622 65d1bea2 Michel Bardiaux
echo "strip symbols    $dostrip"
1623 cddf3f45 Glenn Maynard
echo "optimize         $optimize"
1624 320d060a Diego Biurrun
echo "static           $lstatic"
1625 1ddf5ba1 Diego Biurrun
echo "shared           $lshared"
1626 29799f8b Diego Biurrun
echo "video hooking    $vhook"
1627 a86b921c Fabrice Bellard
echo "SDL support      $sdl"
1628
if test $sdl_too_old = "yes"; then
1629 f25fc9b1 Måns Rullgård
    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1630 a86b921c Fabrice Bellard
fi
1631 68892110 Philip Gladstone
1632 f25fc9b1 Måns Rullgård
if test "$vhook" = "yes"; then
1633
    echo "Imlib2 support   $imlib2"
1634
    echo "FreeType support $freetype2"
1635 68892110 Philip Gladstone
fi
1636 f80f7964 Roman Shaposhnik
echo "Sun medialib support"  $sunmlib
1637 9c3d33d6 Michael Niedermayer
echo "pthreads support"      $pthreads
1638 bc634f6f Zdenek Kabelac
echo "AMR-NB float support"  $amr_nb
1639
echo "AMR-NB fixed support"  $amr_nb_fixed
1640 d663a1fd Michael Niedermayer
echo "AMR-WB float support"  $amr_wb
1641 2a515c08 Torsten Martinsen
echo "AMR-WB IF2 support"    $amr_if2
1642 7a91333f Hans Zandbelt
echo "network support      $network"
1643
if test "$network" = "yes" ; then
1644 f25fc9b1 Måns Rullgård
    echo "IPv6 support         $ipv6"
1645 7a91333f Hans Zandbelt
fi
1646 4454dc1b John Dalgliesh
echo ".align is power-of-two" $asmalign_pot
1647 b2e3c528 Michael Niedermayer
if test "$gpl" = "no" ; then
1648 f25fc9b1 Måns Rullgård
    echo "License: LGPL"
1649 b2e3c528 Michael Niedermayer
else
1650 f25fc9b1 Måns Rullgård
    echo "License: GPL"
1651 b2e3c528 Michael Niedermayer
fi
1652 de6d9b64 Fabrice Bellard
1653 29799f8b Diego Biurrun
echo "Creating config.mak and config.h..."
1654 de6d9b64 Fabrice Bellard
1655 f255e0ab Michel Bardiaux
date >> config.log
1656
echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1657 29799f8b Diego Biurrun
echo "# Automatically generated by configure - do not modify!" > config.mak
1658
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1659 f255e0ab Michel Bardiaux
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1660 de6d9b64 Fabrice Bellard
1661 2266e085 Diego Biurrun
echo "PREFIX=$PREFIX" >> config.mak
1662
echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
1663 9a695e98 Diego Biurrun
echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1664 84c22efd Diego Biurrun
echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1665 1d67a1d4 Diego Biurrun
echo "incdir=\$(DESTDIR)$incdir" >> config.mak
1666 9a695e98 Diego Biurrun
echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1667
echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1668 4a908fbc Alex Beregszaszi
echo "MAKE=$make" >> config.mak
1669 980fc7b8 Fabrice Bellard
echo "CC=$cc" >> config.mak
1670
echo "AR=$ar" >> config.mak
1671 be7109c1 Michael Niedermayer
echo "RANLIB=$ranlib" >> config.mak
1672 65d1bea2 Michel Bardiaux
if test "$dostrip" = "yes" ; then
1673 f25fc9b1 Måns Rullgård
    echo "STRIP=$strip" >> config.mak
1674
    echo "INSTALLSTRIP=$installstrip" >> config.mak
1675 65d1bea2 Michel Bardiaux
else
1676 f25fc9b1 Måns Rullgård
    echo "STRIP=echo ignoring strip" >> config.mak
1677
    echo "INSTALLSTRIP=" >> config.mak
1678 65d1bea2 Michel Bardiaux
fi
1679 75388c74 Michael Niedermayer
1680 408382a4 Diego Biurrun
VHOOKCFLAGS="-fPIC $CFLAGS"
1681 57bd82d4 Måns Rullgård
test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
1682 75388c74 Michael Niedermayer
1683 a9b3f630 Nick Kurshev
echo "OPTFLAGS=$CFLAGS" >> config.mak
1684 408382a4 Diego Biurrun
echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
1685 0f3cb305 Fabrice Bellard
echo "LDFLAGS=$LDFLAGS" >> config.mak
1686 f39e56a8 Jacob Meuser
echo "LDCONFIG=$LDCONFIG" >> config.mak
1687 c536cb09 Diego Biurrun
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
1688 e1707f52 Michael Niedermayer
echo "SHFLAGS=$SHFLAGS" >> config.mak
1689 408382a4 Diego Biurrun
echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
1690 fbb9d104 Víctor Paesa
echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
1691 80581e98 Michael Niedermayer
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
1692 b12f8273 Diego Biurrun
echo "BUILD_STATIC=$lstatic" >> config.mak
1693 eb94aca9 Charles Yates
echo "BUILDSUF=$BUILDSUF" >> config.mak
1694 f3ec2d46 Slavik Gnatenko
echo "LIBPREF=$LIBPREF" >> config.mak
1695 eb94aca9 Charles Yates
echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
1696 320d060a Diego Biurrun
if test "$lstatic" = "yes" ; then
1697
  echo "LIB=$LIB" >> config.mak
1698 1a44a8b6 Alexander Strasser
else # Some Make complain if this variable does not exist.
1699
  echo "LIB=" >> config.mak
1700 320d060a Diego Biurrun
fi
1701 f3ec2d46 Slavik Gnatenko
echo "SLIBPREF=$SLIBPREF" >> config.mak
1702 eb94aca9 Charles Yates
echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1703
echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
1704 b2828252 Diego Biurrun
echo "TARGET_OS=$targetos" >> config.mak
1705 419b8784 Diego Biurrun
if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then
1706 980fc7b8 Fabrice Bellard
  echo "TARGET_ARCH_X86=yes" >> config.mak
1707 045ed63f Zdenek Kabelac
  echo "#define ARCH_X86 1" >> $TMPH
1708 419b8784 Diego Biurrun
fi
1709
if test "$arch" = "x86_32" ; then
1710
  echo "TARGET_ARCH_X86_32=yes" >> config.mak
1711
  echo "#define ARCH_X86_32 1" >> $TMPH
1712 cc6a90dd Guillaume Poirier
elif test "$arch" = "x86_64" ; then
1713 053dea12 Aurelien Jacobs
  echo "TARGET_ARCH_X86_64=yes" >> config.mak
1714
  echo "#define ARCH_X86_64 1" >> $TMPH
1715 cc6a90dd Guillaume Poirier
elif test "$arch" = "armv4l" ; then
1716 6ed7422a Fabrice Bellard
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1717 045ed63f Zdenek Kabelac
  echo "#define ARCH_ARMV4L 1" >> $TMPH
1718 cc6a90dd Guillaume Poirier
elif test "$arch" = "alpha" ; then
1719 91d1f1a4 Nick Kurshev
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1720 045ed63f Zdenek Kabelac
  echo "#define ARCH_ALPHA 1" >> $TMPH
1721 cc6a90dd Guillaume Poirier
elif test "$arch" = "sparc64" ; then
1722 35fedfc3 Philip Gladstone
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1723
  echo "#define ARCH_SPARC64 1" >> $TMPH
1724 bb476ff3 James Morrison
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1725
  echo "#define ARCH_SPARC 1" >> $TMPH
1726 cc6a90dd Guillaume Poirier
elif test "$arch" = "sparc" ; then
1727 bb476ff3 James Morrison
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1728
  echo "#define ARCH_SPARC 1" >> $TMPH
1729 cc6a90dd Guillaume Poirier
elif test "$arch" = "powerpc" ; then
1730 0f3cb305 Fabrice Bellard
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1731
  echo "#define ARCH_POWERPC 1" >> $TMPH
1732 9007f514 Romain Dolbeau
  if test $POWERPCMODE = "32bits"; then
1733
    echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1734
  else
1735
    echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1736
  fi
1737 e45a2872 Romain Dolbeau
  if test "$powerpc_perf" = "yes"; then
1738
    echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1739
  fi
1740 cc6a90dd Guillaume Poirier
elif test "$arch" = "mips" ; then
1741 d46aba26 Leon van Stuivenberg
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
1742
  echo "#define ARCH_MIPS 1" >> $TMPH
1743 cc6a90dd Guillaume Poirier
elif test "$arch" = "sh4" ; then
1744 bdb2e37c Alex Beregszaszi
  echo "TARGET_ARCH_SH4=yes" >> config.mak
1745
  echo "#define ARCH_SH4 1" >> $TMPH
1746 cc6a90dd Guillaume Poirier
elif test "$arch" = "parisc" ; then
1747 67860b26 Sam Hocevar
  echo "TARGET_ARCH_PARISC=yes" >> config.mak
1748
  echo "#define ARCH_PARISC 1" >> $TMPH
1749 cc6a90dd Guillaume Poirier
elif test "$arch" = "s390" ; then
1750 67860b26 Sam Hocevar
  echo "TARGET_ARCH_S390=yes" >> config.mak
1751
  echo "#define ARCH_S390 1" >> $TMPH
1752 cc6a90dd Guillaume Poirier
elif test "$arch" = "m68k" ; then
1753 67860b26 Sam Hocevar
  echo "TARGET_ARCH_M68K=yes" >> config.mak
1754
  echo "#define ARCH_M68K 1" >> $TMPH
1755 cc6a90dd Guillaume Poirier
elif test "$arch" = "ia64" ; then
1756 67860b26 Sam Hocevar
  echo "TARGET_ARCH_IA64=yes" >> config.mak
1757
  echo "#define ARCH_IA64 1" >> $TMPH
1758 cc6a90dd Guillaume Poirier
elif test "$arch" = "bfin" ; then
1759 81a9b052 Michael Benjamin
  echo "TARGET_ARCH_BFIN=yes" >> config.mak
1760
  echo "#define ARCH_BFIN 1" >> $TMPH
1761 bdb2e37c Alex Beregszaszi
fi
1762 a4adb608 Michael Niedermayer
echo "#define TUNECPU $TUNECPU" >> $TMPH
1763 0f3cb305 Fabrice Bellard
if test "$bigendian" = "yes" ; then
1764
  echo "WORDS_BIGENDIAN=yes" >> config.mak
1765
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1766 91d1f1a4 Nick Kurshev
fi
1767 d2a9bddd Michael Niedermayer
if test "$inttypes" != "yes" ; then
1768
  echo "#define EMULATE_INTTYPES 1" >> $TMPH
1769 7f965c1c Chris Flerackers
fi
1770 b5c950c4 Michael Niedermayer
if test "$emu_fast_int" = "yes" ; then
1771 19d053c5 Roman Shaposhnik
  echo "#define EMULATE_FAST_INT 1" >> $TMPH
1772 b5c950c4 Michael Niedermayer
fi
1773 57514323 Zdenek Kabelac
if test "$mmx" = "yes" ; then
1774 980fc7b8 Fabrice Bellard
  echo "TARGET_MMX=yes" >> config.mak
1775 045ed63f Zdenek Kabelac
  echo "#define HAVE_MMX 1" >> $TMPH
1776 e82c5a8c Michael Niedermayer
  echo "#define __CPU__ 586" >> $TMPH
1777 de6d9b64 Fabrice Bellard
fi
1778 e7768fc5 Guillaume Poirier
if test "$cmov" = "yes" ; then
1779
  echo "TARGET_CMOV=yes" >> config.mak
1780
  echo "#define HAVE_CMOV 1" >> $TMPH
1781
fi
1782 94e4c3a3 Guillaume Poirier
if test "$cmov_is_fast" = "yes" ; then
1783
  echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
1784
  echo "#define CMOV_IS_FAST 1" >> $TMPH
1785
fi
1786 1839e854 Siarhei Siamashka
if test "$armv5te" = "yes" ; then
1787
  echo "TARGET_ARMV5TE=yes" >> config.mak
1788
  echo "#define HAVE_ARMV5TE 1" >> $TMPH
1789
fi
1790 eba9ae3c Gildas Bazin
if test "$iwmmxt" = "yes" ; then
1791
  echo "TARGET_IWMMXT=yes" >> config.mak
1792
  echo "#define HAVE_IWMMXT 1" >> $TMPH
1793
fi
1794 d46aba26 Leon van Stuivenberg
if test "$mmi" = "yes" ; then
1795
  echo "TARGET_MMI=yes" >> config.mak
1796
  echo "#define HAVE_MMI 1" >> $TMPH
1797
fi
1798 87ea51e0 Luca Barbato
1799
if test "$dcbzl" = "yes" ; then
1800
  echo "#define HAVE_DCBZL 1" >> $TMPH
1801
else
1802
  echo "#undef HAVE_DCBZL" >> $TMPH
1803
fi
1804
1805 ab6c65f6 Brian Foley
if test "$altivec" = "yes" ; then
1806
  echo "TARGET_ALTIVEC=yes" >> config.mak
1807
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
1808 a9a07762 Michael Niedermayer
  if test "$_altivec_h" = "yes" ; then
1809
    echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1810
  else
1811 e67e14d5 Alex Beregszaszi
    echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1812 a9a07762 Michael Niedermayer
  fi
1813 ab6c65f6 Brian Foley
fi
1814 57514323 Zdenek Kabelac
if test "$gprof" = "yes" ; then
1815 045ed63f Zdenek Kabelac
  echo "#define HAVE_GPROF 1" >> $TMPH
1816 de6d9b64 Fabrice Bellard
fi
1817 5e4639e2 Glenn Maynard
if test "$localtime_r" = "yes" ; then
1818
  echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1819
fi
1820 68892110 Philip Gladstone
if test "$imlib2" = "yes" ; then
1821
  echo "HAVE_IMLIB2=yes" >> config.mak
1822
fi
1823 04511d53 Philip Gladstone
if test "$freetype2" = "yes" ; then
1824
  echo "HAVE_FREETYPE2=yes" >> config.mak
1825
fi
1826 f80f7964 Roman Shaposhnik
if test "$sunmlib" = "yes" ; then
1827
  echo "HAVE_MLIB=yes" >> config.mak
1828
  echo "#define HAVE_MLIB 1" >> $TMPH
1829
fi
1830 9c3d33d6 Michael Niedermayer
if test "$pthreads" = "yes" ; then
1831
  echo "HAVE_PTHREADS=yes" >> config.mak
1832
  echo "#define HAVE_PTHREADS 1" >> $TMPH
1833 2450cff2 François Revol
  echo "#define HAVE_THREADS 1" >> $TMPH
1834 9c3d33d6 Michael Niedermayer
fi
1835 a86b921c Fabrice Bellard
if test "$sdl" = "yes" ; then
1836 c63b9a11 Måns Rullgård
  echo "HAVE_SDL=yes" >> config.mak
1837 6a1a892f Frantisek Dvorak
  echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
1838
  echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
1839 29f3b38a Måns Rullgård
  if test "$sdl_video_size" = "yes"; then
1840
    echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
1841
  fi
1842 a86b921c Fabrice Bellard
fi
1843 146ea952 Nicolas Boos
if test "$texi2html" = "yes"; then
1844
  echo "BUILD_DOC=yes" >> config.mak
1845
fi
1846 95e2ce4a Michael Niedermayer
if test "$have_lrintf" = "yes" ; then
1847
  echo "#define HAVE_LRINTF 1" >> $TMPH
1848
fi
1849 68892110 Philip Gladstone
if test "$vhook" = "yes" ; then
1850 d226c750 Måns Rullgård
  echo "CONFIG_VHOOK=yes" >> config.mak
1851
  echo "#define CONFIG_VHOOK 1" >> $TMPH
1852 68892110 Philip Gladstone
fi
1853 5a872801 Luca Barbato
1854 790c9ca7 Luca Abeni
sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
1855 6d9a2421 Diego Biurrun
pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
1856 5a872801 Luca Barbato
lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1857
lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1858
lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1859
1860
1861
1862 57514323 Zdenek Kabelac
if test "$lshared" = "yes" ; then
1863 320d060a Diego Biurrun
  echo "#define BUILD_SHARED_AV 1" >> $TMPH
1864 0319c531 Nick Kurshev
  echo "BUILD_SHARED=yes" >> config.mak
1865 97006039 Jacob Meuser
  echo "PIC=-fPIC -DPIC" >> config.mak
1866 39503a27 Diego Biurrun
  echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
1867 5a872801 Luca Barbato
  echo "SPPVERSION=$lavc_version" >> config.mak
1868 39503a27 Diego Biurrun
  echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
1869 5a872801 Luca Barbato
  echo "LAVCVERSION=$lavc_version" >> config.mak
1870 39503a27 Diego Biurrun
  echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
1871 5a872801 Luca Barbato
  echo "LAVFVERSION=$lavf_version" >> config.mak
1872 39503a27 Diego Biurrun
  echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
1873 5a872801 Luca Barbato
  echo "LAVUVERSION=$lavu_version" >> config.mak
1874 790c9ca7 Luca Abeni
  echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
1875
  echo "SWSVERSION=$sws_version" >> config.mak
1876 4bdd05e7 Diego Biurrun
  echo "SLIBNAME=${SLIBNAME}" >> config.mak
1877 f3b60109 Diego Biurrun
  echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1878
  echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
1879 5cb854e1 Diego Biurrun
  echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
1880 0319c531 Nick Kurshev
fi
1881 d7e27559 Diego Biurrun
echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
1882 ef0bc4c9 François Revol
echo "EXTRALIBS=$extralibs" >> config.mak
1883 d2845d68 Diego Biurrun
1884 29799f8b Diego Biurrun
# If you do not want to use encoders, disable them.
1885 55006fc0 Diego Biurrun
if echo "$ENCODER_LIST" | grep -q encoder; then
1886 6eefb6fd Måns Rullgård
    echo "#define CONFIG_ENCODERS 1" >> $TMPH
1887
    echo "CONFIG_ENCODERS=yes" >> config.mak
1888
fi
1889 d771bcae Fabrice Bellard
1890 29799f8b Diego Biurrun
# If you do not want to use decoders, disable them.
1891 55006fc0 Diego Biurrun
if echo "$DECODER_LIST" | grep -q decoder; then
1892 6eefb6fd Måns Rullgård
    echo "#define CONFIG_DECODERS 1" >> $TMPH
1893
    echo "CONFIG_DECODERS=yes" >> config.mak
1894
fi
1895 d771bcae Fabrice Bellard
1896 a9e35095 Diego Biurrun
# muxers
1897 ff70e601 Måns Rullgård
if echo "$MUXER_LIST" | grep -q muxer; then
1898 a9e35095 Diego Biurrun
  echo "#define CONFIG_MUXERS 1" >> $TMPH
1899
  echo "CONFIG_MUXERS=yes" >> config.mak
1900
fi
1901
1902
# demuxers
1903 ff70e601 Måns Rullgård
if echo "$DEMUXER_LIST" | grep -q demuxer; then
1904 a9e35095 Diego Biurrun
  echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1905
  echo "CONFIG_DEMUXERS=yes" >> config.mak
1906
fi
1907
1908 5cbcf02c Fabrice Bellard
# AC3
1909
if test "$a52" = "yes" ; then
1910
  echo "#define CONFIG_AC3 1" >> $TMPH
1911
  echo "CONFIG_AC3=yes" >> config.mak
1912 d771bcae Fabrice Bellard
1913 5cbcf02c Fabrice Bellard
  if test "$a52bin" = "yes" ; then
1914
    echo "#define CONFIG_A52BIN 1" >> $TMPH
1915
    echo "CONFIG_A52BIN=yes" >> config.mak
1916
  fi
1917
fi
1918
1919 23c99253 Michael Niedermayer
# DTS
1920
if test "$dts" = "yes" ; then
1921
  echo "#define CONFIG_DTS 1" >> $TMPH
1922
  echo "CONFIG_DTS=yes" >> config.mak
1923
fi
1924
1925 bba9b16c Michael Niedermayer
# PP
1926
if test "$pp" = "yes" ; then
1927
  echo "#define CONFIG_PP 1" >> $TMPH
1928
  echo "CONFIG_PP=yes" >> config.mak
1929
fi
1930
1931 790c9ca7 Luca Abeni
if test "$swscaler" = "yes" ; then
1932
  echo "#define CONFIG_SWSCALER 1" >> $TMPH
1933
  echo "CONFIG_SWSCALER=yes" >> config.mak
1934
fi
1935
1936 29799f8b Diego Biurrun
# MPEG audio high precision mode
1937 1eb2212e Fabrice Bellard
if test "$mpegaudio_hp" = "yes" ; then
1938
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1939
fi
1940
1941 5cbcf02c Fabrice Bellard
if test "$v4l" = "yes" ; then
1942
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1943
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1944
fi
1945
1946 0a7b514f Luca Abeni
if test "$v4l2" = "yes" ; then
1947
  echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
1948
  echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
1949
fi
1950
1951 6beefa40 Michael Niedermayer
if test "$bktr" = "yes" ; then
1952
  echo "#define CONFIG_BKTR 1" >> $TMPH
1953
  echo "CONFIG_BKTR=yes" >> config.mak
1954
fi
1955
1956 8aa3ee32 Max Krasnyansky
if test "$dv1394" = "yes" ; then
1957
  echo "#define CONFIG_DV1394 1" >> $TMPH
1958
  echo "CONFIG_DV1394=yes" >> config.mak
1959
fi
1960
1961 f02be79d Roman Shaposhnik
if test "$dc1394" = "yes" ; then
1962
  echo "#define CONFIG_DC1394 1" >> $TMPH
1963
  echo "CONFIG_DC1394=yes" >> config.mak
1964
fi
1965
1966 adbc0510 Philip Gladstone
if test "$dlopen" = "yes" ; then
1967
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1968
fi
1969
1970
if test "$dlfcn" = "yes" ; then
1971
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1972
fi
1973
1974 5cbcf02c Fabrice Bellard
if test "$audio_oss" = "yes" ; then
1975
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1976
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1977 57514323 Zdenek Kabelac
fi
1978
1979 dfdfa47c François Revol
if test "$audio_beos" = "yes" ; then
1980
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1981
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1982
fi
1983
1984 5cbcf02c Fabrice Bellard
if test "$network" = "yes" ; then
1985
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1986
  echo "CONFIG_NETWORK=yes" >> config.mak
1987 6ed7422a Fabrice Bellard
fi
1988 daf8e955 Fabrice Bellard
1989 7a91333f Hans Zandbelt
if test "$ipv6" = "yes" ; then
1990
  echo "#define CONFIG_IPV6 1" >> $TMPH
1991
fi
1992
1993 0147f198 François Revol
if test "$zlib" = "yes" ; then
1994
  echo "#define CONFIG_ZLIB 1" >> $TMPH
1995
  echo "CONFIG_ZLIB=yes" >> config.mak
1996
fi
1997
1998 bb4c2140 Michael Niedermayer
if test "$libgsm" = "yes" ; then
1999
  echo "#define CONFIG_LIBGSM 1" >> $TMPH
2000
  echo "CONFIG_LIBGSM=yes" >> config.mak
2001
fi
2002
2003 57514323 Zdenek Kabelac
if test "$mp3lame" = "yes" ; then
2004 045ed63f Zdenek Kabelac
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
2005 a6741398 Juanjo
  echo "CONFIG_MP3LAME=yes" >> config.mak
2006
fi
2007
2008 f956e129 Oded Shimon
if test "$libnut" = "yes" ; then
2009
  echo "#define CONFIG_LIBNUT 1" >> $TMPH
2010
  echo "CONFIG_LIBNUT=yes" >> config.mak
2011
fi
2012
2013 9146ca37 Måns Rullgård
if test "$libogg" = "yes" ; then
2014 5c5dea3f Nilesh Bansal
  echo "#define CONFIG_LIBOGG 1" >> $TMPH
2015
  echo "CONFIG_LIBOGG=yes" >> config.mak
2016
fi
2017
2018 81e0d0b4 Mark Hills
if test "$vorbis" = "yes" ; then
2019 5c5dea3f Nilesh Bansal
  echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
2020
  echo "CONFIG_LIBVORBIS=yes" >> config.mak
2021
fi
2022
2023 0fc50e58 Zdenek Kabelac
if test "$faad" = "yes" ; then
2024
  echo "#define CONFIG_FAAD 1" >> $TMPH
2025
  echo "CONFIG_FAAD=yes" >> config.mak
2026
fi
2027
2028
if test "$faadbin" = "yes" ; then
2029
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
2030 445ad18d Zdenek Kabelac
  echo "CONFIG_FAADBIN=yes" >> config.mak
2031 0fc50e58 Zdenek Kabelac
fi
2032
2033 29d48296 Michael Niedermayer
if test "$faac" = "yes" ; then
2034
  echo "#define CONFIG_FAAC 1" >> $TMPH
2035
  echo "CONFIG_FAAC=yes" >> config.mak
2036
fi
2037
2038 1ddadfa9 Adam Thayer
if test "$xvid" = "yes" ; then
2039
  echo "#define CONFIG_XVID 1" >> $TMPH
2040
  echo "CONFIG_XVID=yes" >> config.mak
2041
fi
2042
2043 6662ec29 Michael Niedermayer
if test "$x264" = "yes" ; then
2044
  echo "#define CONFIG_X264 1" >> $TMPH
2045
  echo "CONFIG_X264=yes" >> config.mak
2046
fi
2047
2048 8ac17293 Steve L'Homme
if test "$avisynth" = "yes" ; then
2049
  echo "#define CONFIG_AVISYNTH 1" >> $TMPH
2050
  echo "CONFIG_AVISYNTH=yes" >> config.mak
2051
fi
2052
2053 732d9245 Bill Eldridge
if test "$mingw32" = "yes" ; then
2054 2f30a81d Diego Biurrun
  echo "CONFIG_MINGW=yes" >> config.mak
2055 16806499 Michael Niedermayer
  echo "HAVE_W32THREADS=yes" >> config.mak
2056
  echo "#define HAVE_W32THREADS 1" >> $TMPH
2057 2450cff2 François Revol
  echo "#define HAVE_THREADS 1" >> $TMPH
2058 7eea5766 Fabrice Bellard
  echo "#ifndef __MINGW32__" >> $TMPH
2059 732d9245 Bill Eldridge
  echo "#define __MINGW32__ 1" >> $TMPH
2060 7eea5766 Fabrice Bellard
  echo "#endif" >> $TMPH
2061 3f027ca7 Felix Bünemann
fi
2062
2063 ac44871c Gildas Bazin
if test "$mingwce" = "yes" ; then
2064 2f30a81d Diego Biurrun
  echo "CONFIG_MINGW=yes" >> config.mak
2065 ac44871c Gildas Bazin
  echo "#define CONFIG_WINCE 1" >> $TMPH
2066
  echo "CONFIG_WINCE=yes" >> config.mak
2067
  echo "#ifndef __MINGW32__" >> $TMPH
2068
  echo "#define __MINGW32__ 1" >> $TMPH
2069
  echo "#endif" >> $TMPH
2070
fi
2071
2072 f3ec2d46 Slavik Gnatenko
if test "$os2" = "yes" ; then
2073
  echo "#define CONFIG_OS2 1" >> $TMPH
2074
  echo "CONFIG_OS2=yes" >> config.mak
2075 e2a5fd20 Michael Niedermayer
  echo "HAVE_OS2THREADS=yes" >> config.mak
2076
  echo "#define HAVE_OS2THREADS 1" >> $TMPH
2077
  echo "#define HAVE_THREADS 1" >> $TMPH
2078 f3ec2d46 Slavik Gnatenko
fi
2079
2080 b2828252 Diego Biurrun
if test "$targetos" = "SunOS" ; then
2081 6e023978 Roman Shaposhnik
  echo "#define CONFIG_SUNOS 1" >> $TMPH
2082
fi
2083
2084 b2828252 Diego Biurrun
if test "$targetos" = "BeOS" ; then
2085 2450cff2 François Revol
  echo "HAVE_BEOSTHREADS=yes" >> config.mak
2086
  echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
2087
  echo "#define HAVE_THREADS 1" >> $TMPH
2088
fi
2089
2090 b2828252 Diego Biurrun
if test "$targetos" = "Darwin"; then
2091 90cee0c3 Michael Niedermayer
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
2092
  echo "CONFIG_DARWIN=yes" >> config.mak
2093
fi
2094
2095 57514323 Zdenek Kabelac
if test "$_malloc_h" = "yes" ; then
2096 045ed63f Zdenek Kabelac
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
2097 3d204385 Nick Kurshev
else
2098 045ed63f Zdenek Kabelac
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
2099 3d204385 Nick Kurshev
fi
2100
2101 57514323 Zdenek Kabelac
if test "$_memalign" = "yes" ; then
2102 045ed63f Zdenek Kabelac
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
2103
else
2104
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
2105
fi
2106
2107 da9b170c Michael Niedermayer
if test "$memalignhack" = "yes" ; then
2108
  echo "#define MEMALIGN_HACK 1" >> $TMPH
2109
fi
2110
2111 47d23bbf Måns Rullgård
if test "$byteswap_h" = "yes"; then
2112
  echo "#define HAVE_BYTESWAP_H 1" >> $TMPH
2113
fi
2114 da9b170c Michael Niedermayer
2115 26b35efb François Revol
if test "$netserver" = "yes" ; then
2116
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
2117
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
2118
fi
2119
2120 4baca069 Philip Gladstone
if test "$need_inet_aton" = "yes" ; then
2121
  echo "NEED_INET_ATON=yes" >> config.mak
2122
fi
2123
2124 57514323 Zdenek Kabelac
if test "$simpleidct" = "yes" ; then
2125 045ed63f Zdenek Kabelac
  echo "#define SIMPLE_IDCT 1" >> $TMPH
2126
fi
2127
2128 04f46ced Gildas Bazin
if test "$protocols" = "yes" ; then
2129
  echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
2130
  echo "CONFIG_PROTOCOLS=yes" >> config.mak
2131
fi
2132
2133 786b30af Diego Biurrun
if test "$ffmpeg" = "yes" ; then
2134
  echo "#define CONFIG_FFMPEG 1" >> $TMPH
2135
  echo "CONFIG_FFMPEG=yes" >> config.mak
2136
fi
2137
2138 8154d2e0 Fabrice Bellard
if test "$ffserver" = "yes" ; then
2139
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
2140
  echo "CONFIG_FFSERVER=yes" >> config.mak
2141
fi
2142
2143 a86b921c Fabrice Bellard
if test "$ffplay" = "yes" ; then
2144
  echo "CONFIG_FFPLAY=yes" >> config.mak
2145
fi
2146
2147 b2e3c528 Michael Niedermayer
if test "$gpl" = "yes" ; then
2148
  echo "#define CONFIG_GPL 1" >> $TMPH
2149
  echo "CONFIG_GPL=yes" >> config.mak
2150
fi
2151
2152 c13e1abd Falk Hüffner
echo "#define restrict $_restrict" >> $TMPH
2153
2154 bb801c97 Michael Niedermayer
if test "$optimize" = "small"; then
2155
  echo "#define always_inline"  >> $TMPH
2156 e5f28e8f Michael Niedermayer
  echo "#define CONFIG_SMALL 1" >> $TMPH
2157 bb801c97 Michael Niedermayer
fi
2158
2159 0f3cb305 Fabrice Bellard
# build tree in object directory if source path is different from current one
2160
if test "$source_path_used" = "yes" ; then
2161 2a4e872b Alexander Strasser
    DIRS="\
2162
         doc \
2163
         libavformat \
2164
         libavcodec \
2165
         libavcodec/alpha \
2166
         libavcodec/armv4l \
2167 c4e96cee Luca Barbato
         libavcodec/bfin \
2168 2a4e872b Alexander Strasser
         libavcodec/i386 \
2169
         libavcodec/sparc \
2170
         libavcodec/mlib \
2171
         libavcodec/ppc \
2172
         libavcodec/liba52 \
2173 6d9a2421 Diego Biurrun
         libpostproc \
2174 2a4e872b Alexander Strasser
         libavutil \
2175 790c9ca7 Luca Abeni
         libswscale \
2176 2a4e872b Alexander Strasser
         tests \
2177
         vhook \
2178
         "
2179
    FILES="\
2180
          Makefile \
2181 997baf01 Måns Rullgård
          common.mak \
2182 2a4e872b Alexander Strasser
          libavformat/Makefile \
2183
          libavcodec/Makefile \
2184 6d9a2421 Diego Biurrun
          libpostproc/Makefile \
2185 2a4e872b Alexander Strasser
          libavutil/Makefile \
2186 790c9ca7 Luca Abeni
          libswscale/Makefile \
2187 2a4e872b Alexander Strasser
          tests/Makefile \
2188
          vhook/Makefile \
2189
          doc/Makefile \
2190
          doc/texi2pod.pl \
2191
          "
2192 0f3cb305 Fabrice Bellard
    for dir in $DIRS ; do
2193
            mkdir -p $dir
2194
    done
2195
    for f in $FILES ; do
2196 281a74da Michael Niedermayer
        ln -sf "$source_path/$f" $f
2197 0f3cb305 Fabrice Bellard
    done
2198
fi
2199 997baf01 Måns Rullgård
echo "SRC_PATH=\"$source_path\"" >> config.mak
2200
echo "SRC_PATH_BARE=$source_path" >> config.mak
2201
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2202 0f3cb305 Fabrice Bellard
2203 60827a1a Diego Biurrun
if test "$amr" = "yes" ; then
2204 6636b7e8 Måns Rullgård
  echo "#define CONFIG_AMR 1" >> $TMPH
2205
  echo "CONFIG_AMR=yes" >> config.mak
2206 60827a1a Diego Biurrun
fi
2207
2208 d663a1fd Michael Niedermayer
if test "$amr_wb" = "yes" ; then
2209 6636b7e8 Måns Rullgård
  echo "#define CONFIG_AMR_WB 1" >> $TMPH
2210
  echo "CONFIG_AMR_WB=yes" >> config.mak
2211 d663a1fd Michael Niedermayer
  echo
2212
  echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
2213
  echo "V5.1.0 from "
2214
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
2215
  echo "and extracted the source to libavcodec/amrwb_float"
2216
fi
2217
2218 891f64b3 joca@rixmail.se
if test "$amr_nb" = "yes" ; then
2219 6636b7e8 Måns Rullgård
  echo "#define CONFIG_AMR_NB 1" >> $TMPH
2220
  echo "CONFIG_AMR_NB=yes" >> config.mak
2221 891f64b3 joca@rixmail.se
  echo
2222 6eb07e73 Diego Biurrun
  echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
2223
  echo "REL-5 V5.1.0 from "
2224 c51c4fa0 Diego Biurrun
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
2225 6eb07e73 Diego Biurrun
  echo "and extracted the source to libavcodec/amr_float"
2226
  echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
2227
fi
2228
2229 bc634f6f Zdenek Kabelac
if test "$amr_nb_fixed" = "yes" ; then
2230 6636b7e8 Måns Rullgård
  echo "#define CONFIG_AMR_NB_FIXED 1" >> $TMPH
2231
  echo "CONFIG_AMR_NB_FIXED=yes" >> config.mak
2232 b9ca6d47 Diego Biurrun
  echo
2233 bc634f6f Zdenek Kabelac
  echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
2234
  echo "REL-5 version 5.1.0 from "
2235 c51c4fa0 Diego Biurrun
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
2236 891f64b3 joca@rixmail.se
  echo "and extracted src to libavcodec/amr"
2237 bc634f6f Zdenek Kabelac
  echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
2238
  echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
2239 891f64b3 joca@rixmail.se
fi
2240
2241 2a515c08 Torsten Martinsen
if test "$amr_if2" = "yes" ; then
2242
  echo "AMR_CFLAGS=-DIF2=1" >> config.mak
2243
fi
2244
2245 8156056e John Dalgliesh
# Apparently it's not possible to portably echo a backslash.
2246 4454dc1b John Dalgliesh
if test "$asmalign_pot" = "yes" ; then
2247 8156056e John Dalgliesh
  printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
2248 4454dc1b John Dalgliesh
else
2249 8156056e John Dalgliesh
  printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
2250 4454dc1b John Dalgliesh
fi
2251
2252 bc634f6f Zdenek Kabelac
2253 fe84b3f0 Diego Biurrun
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
2254 55006fc0 Diego Biurrun
for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
2255 fe84b3f0 Diego Biurrun
    echo "#define CONFIG_`echo $codec | tr '[a-z]' '[A-Z]'` 1" >> $TMPH
2256
    echo "CONFIG_`echo $codec | tr '[a-z]' '[A-Z]'`=yes" >> config.mak
2257 009cf97d Michael Niedermayer
done
2258
2259 9cb2cf10 Diego Biurrun
# Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
2260
diff $TMPH config.h >/dev/null 2>&1
2261 214c5f26 Michel Bardiaux
if test "$?" != "0" ; then
2262 9cb2cf10 Diego Biurrun
        mv -f $TMPH config.h
2263
else
2264
        echo "config.h is unchanged"
2265
fi
2266 3d204385 Nick Kurshev
2267 f3ec2d46 Slavik Gnatenko
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
2268 def4272a Aurelien Jacobs
2269
2270 29799f8b Diego Biurrun
# build pkg-config files libav*.pc and libpostproc.pc
2271 31abdc45 j@v2v.cc
# libavutil.pc
2272
cat <<EOF >libavutil.pc
2273 2266e085 Diego Biurrun
prefix=$PREFIX
2274 a94e666c Diego Biurrun
exec_prefix=\${prefix}
2275 31abdc45 j@v2v.cc
libdir=\${exec_prefix}/lib
2276 a94e666c Diego Biurrun
includedir=\${prefix}/include
2277 31abdc45 j@v2v.cc
2278
Name: libavutil
2279
Description: FFmpeg utility library
2280
Version: $lavu_version
2281 115329f1 Diego Biurrun
Requires:
2282 31abdc45 j@v2v.cc
Conflicts:
2283
Libs: -L\${libdir} -lavutil
2284
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2285
EOF
2286
2287
cat <<EOF >libavutil-uninstalled.pc
2288
prefix=
2289
exec_prefix=
2290
libdir=\${pcfiledir}/libavutil
2291
includedir=\${pcfiledir}/libavutil
2292
2293
Name: libavutil
2294
Description: FFmpeg utility library
2295
Version: $lavu_version
2296 115329f1 Diego Biurrun
Requires:
2297 31abdc45 j@v2v.cc
Conflicts:
2298
Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2299
Cflags: -I\${includedir}
2300
EOF
2301 def4272a Aurelien Jacobs
2302
# libavcodec.pc
2303
cat <<EOF >libavcodec.pc
2304 2266e085 Diego Biurrun
prefix=$PREFIX
2305 a94e666c Diego Biurrun
exec_prefix=\${prefix}
2306 def4272a Aurelien Jacobs
libdir=\${exec_prefix}/lib
2307 a94e666c Diego Biurrun
includedir=\${prefix}/include
2308 def4272a Aurelien Jacobs
2309
Name: libavcodec
2310
Description: FFmpeg codec library
2311 31abdc45 j@v2v.cc
Version: $lavc_version
2312 c99dd233 j@v2v.cc
Requires: $pkg_requires libavutil = $lavu_version
2313 def4272a Aurelien Jacobs
Conflicts:
2314
Libs: -L\${libdir} -lavcodec $extralibs
2315
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2316
EOF
2317
2318
cat <<EOF >libavcodec-uninstalled.pc
2319
prefix=
2320
exec_prefix=
2321
libdir=\${pcfiledir}/libavcodec
2322
includedir=\${pcfiledir}/libavcodec
2323
2324
Name: libavcodec
2325
Description: FFmpeg codec library
2326 31abdc45 j@v2v.cc
Version: $lavc_version
2327 c99dd233 j@v2v.cc
Requires: $pkg_requires libavutil = $lavu_version
2328 def4272a Aurelien Jacobs
Conflicts:
2329
Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2330
Cflags: -I\${includedir}
2331
EOF
2332
2333
# libavformat.pc
2334
cat <<EOF >libavformat.pc
2335 2266e085 Diego Biurrun
prefix=$PREFIX
2336 a94e666c Diego Biurrun
exec_prefix=\${prefix}
2337 def4272a Aurelien Jacobs
libdir=\${exec_prefix}/lib
2338 a94e666c Diego Biurrun
includedir=\${prefix}/include
2339 def4272a Aurelien Jacobs
2340
Name: libavformat
2341
Description: FFmpeg container format library
2342 31abdc45 j@v2v.cc
Version: $lavf_version
2343 c99dd233 j@v2v.cc
Requires: $pkg_requires libavcodec = $lavc_version
2344 def4272a Aurelien Jacobs
Conflicts:
2345
Libs: -L\${libdir} -lavformat $extralibs
2346
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2347
EOF
2348
2349
cat <<EOF >libavformat-uninstalled.pc
2350
prefix=
2351
exec_prefix=
2352
libdir=\${pcfiledir}/libavformat
2353
includedir=\${pcfiledir}/libavformat
2354
2355
Name: libavformat
2356
Description: FFmpeg container format library
2357 31abdc45 j@v2v.cc
Version: $lavf_version
2358 c99dd233 j@v2v.cc
Requires: $pkg_requires libavcodec = $lavc_version
2359 def4272a Aurelien Jacobs
Conflicts:
2360
Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2361
Cflags: -I\${includedir}
2362
EOF
2363
2364
2365
# libpostproc.pc
2366
cat <<EOF >libpostproc.pc
2367 2266e085 Diego Biurrun
prefix=$PREFIX
2368 a94e666c Diego Biurrun
exec_prefix=\${prefix}
2369 def4272a Aurelien Jacobs
libdir=\${exec_prefix}/lib
2370 a94e666c Diego Biurrun
includedir=\${prefix}/include
2371 def4272a Aurelien Jacobs
2372
Name: libpostproc
2373
Description: FFmpeg post processing library
2374 31abdc45 j@v2v.cc
Version: $lavc_version
2375 115329f1 Diego Biurrun
Requires:
2376 def4272a Aurelien Jacobs
Conflicts:
2377
Libs: -L\${libdir} -lpostproc
2378
Cflags: -I\${includedir} -I\${includedir}/postproc
2379
EOF
2380
2381
cat <<EOF >libpostproc-uninstalled.pc
2382
prefix=
2383
exec_prefix=
2384 6d9a2421 Diego Biurrun
libdir=\${pcfiledir}/libpostproc
2385
includedir=\${pcfiledir}/libpostproc
2386 def4272a Aurelien Jacobs
2387
Name: libpostproc
2388
Description: FFmpeg post processing library
2389 31abdc45 j@v2v.cc
Version: $lavc_version
2390 115329f1 Diego Biurrun
Requires:
2391 def4272a Aurelien Jacobs
Conflicts:
2392
Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2393
Cflags: -I\${includedir}
2394
EOF
2395 790c9ca7 Luca Abeni
2396
# libswscale.pc
2397
cat <<EOF >libswscale.pc
2398
prefix=$PREFIX
2399
exec_prefix=\${prefix}
2400
libdir=\${exec_prefix}/lib
2401
includedir=\${prefix}/include
2402
2403
Name: libswscale
2404
Description: FFmpeg image rescaling library
2405
Version: $sws_version
2406
Requires: $pkg_requires libavutil = $lavu_version
2407
Conflicts:
2408
Libs: -L\${libdir} -lswscale
2409
Cflags: -I\${includedir} -I\${includedir}/swscale
2410
EOF
2411
2412
cat <<EOF >libswscale-uninstalled.pc
2413
prefix=
2414
exec_prefix=
2415
libdir=\${pcfiledir}/libswscale
2416
includedir=\${pcfiledir}/libswscale
2417
2418
Name: libswscale
2419
Description: FFmpeg image rescaling library
2420
Version: $sws_version
2421
Requires: $pkg_requires libavutil = $lavu_version
2422
Conflicts:
2423
Libs: \${libdir}/${LIBPREF}swscale${LIBSUF}
2424
Cflags: -I\${includedir}
2425
EOF