Statistics
| Branch: | Revision:

ffmpeg / configure @ 98ca7790

History | View | Annotate | Download (21.4 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
# set temporary file name
6 57514323 Zdenek Kabelac
if test ! -z "$TMPDIR" ; then
7 0f3cb305 Fabrice Bellard
    TMPDIR1="${TMPDIR}"
8 57514323 Zdenek Kabelac
elif test ! -z "$TEMPDIR" ; then
9 0f3cb305 Fabrice Bellard
    TMPDIR1="${TEMPDIR}"
10 3d204385 Nick Kurshev
else
11 0f3cb305 Fabrice Bellard
    TMPDIR1="/tmp"
12 3d204385 Nick Kurshev
fi
13
14 0f3cb305 Fabrice Bellard
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
16 f3ec2d46 Slavik Gnatenko
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
17 0f3cb305 Fabrice Bellard
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
18
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
19
20 de6d9b64 Fabrice Bellard
# default parameters
21
prefix="/usr/local"
22 0f3cb305 Fabrice Bellard
cross_prefix=""
23 de6d9b64 Fabrice Bellard
cc="gcc"
24
ar="ar"
25 be7109c1 Michael Niedermayer
ranlib="ranlib"
26 4a908fbc Alex Beregszaszi
make="make"
27 0f3cb305 Fabrice Bellard
strip="strip"
28 de6d9b64 Fabrice Bellard
cpu=`uname -m`
29 0f3cb305 Fabrice Bellard
mmx="default"
30 ab6c65f6 Brian Foley
altivec="default"
31 d46aba26 Leon van Stuivenberg
mmi="default"
32 de6d9b64 Fabrice Bellard
case "$cpu" in
33 ef0bc4c9 François Revol
  i386|i486|i586|i686|i86pc|BePC)
34 de6d9b64 Fabrice Bellard
    cpu="x86"
35
  ;;
36 6ed7422a Fabrice Bellard
  armv4l)
37
    cpu="armv4l"
38
  ;;
39 91d1f1a4 Nick Kurshev
  alpha)
40
    cpu="alpha"
41
  ;;
42 a43bd1d7 Heliodoro Tammaro
  "Power Macintosh"|ppc)
43 90cee0c3 Michael Niedermayer
    cpu="powerpc"
44
  ;;
45 d46aba26 Leon van Stuivenberg
  mips)
46
    cpu="mips"
47
  ;;
48 de6d9b64 Fabrice Bellard
  *)
49 0f3cb305 Fabrice Bellard
    cpu="unknown"
50 de6d9b64 Fabrice Bellard
  ;;
51
esac
52
gprof="no"
53 5cbcf02c Fabrice Bellard
v4l="yes"
54
audio_oss="yes"
55 dfdfa47c François Revol
audio_beos="no"
56 8aa3ee32 Max Krasnyansky
dv1394="yes"
57 5cbcf02c Fabrice Bellard
network="yes"
58 0147f198 François Revol
zlib="yes"
59 a6741398 Juanjo
mp3lame="no"
60 81e0d0b4 Mark Hills
vorbis="no"
61 5cbcf02c Fabrice Bellard
a52="yes"
62 57514323 Zdenek Kabelac
a52bin="no"
63 bba9b16c Michael Niedermayer
pp="yes"
64
shared_pp="no"
65 daf8e955 Fabrice Bellard
win32="no"
66 732d9245 Bill Eldridge
mingw32="no"
67 3f027ca7 Felix Bünemann
cygwin="no"
68 f3ec2d46 Slavik Gnatenko
os2="no"
69 83286d2a Zdenek Kabelac
lshared="no"
70 ef0bc4c9 François Revol
extralibs="-lm"
71 c02dbee1 Michael Niedermayer
simpleidct="yes"
72 0f3cb305 Fabrice Bellard
bigendian="no"
73 a8721c09 Fabrice Bellard
vhook="default"
74 adbc0510 Philip Gladstone
dlfcn="no"
75
dlopen="no"
76 1eb2212e Fabrice Bellard
mpegaudio_hp="yes"
77 e1707f52 Michael Niedermayer
SHFLAGS=-shared
78 26b35efb François Revol
netserver="no"
79 4baca069 Philip Gladstone
need_inet_aton="no"
80 8154d2e0 Fabrice Bellard
ffserver="yes"
81 4baca069 Philip Gladstone
LDFLAGS=-Wl,--warn-common
82
FFSLDFLAGS=-Wl,-E
83 f3ec2d46 Slavik Gnatenko
LIBPREF="lib"
84
LIBSUF=".a"
85
SLIBPREF="lib"
86
SLIBSUF=".so"
87 1d0d55da Michael Niedermayer
risky="yes"
88 553a6284 Michael Niedermayer
small="no"
89 ef0bc4c9 François Revol
90
# OS specific
91
targetos=`uname -s`
92
case $targetos in
93
BeOS)
94
prefix="/boot/home/config"
95
# helps building libavcodec
96 e1707f52 Michael Niedermayer
CFLAGS="-O3 -DPIC -fomit-frame-pointer"
97 31ba0b4d François Revol
# 3 gcc releases known for BeOS, each with ugly bugs
98
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
99
case "$gcc_version" in
100
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
101
mmx="no"
102
;;
103
*20010315*) echo "BeBits gcc"
104
CFLAGS="$CFLAGS -fno-expensive-optimizations"
105
;;
106
esac
107 e1707f52 Michael Niedermayer
SHFLAGS=-nostart
108
# disable linux things
109
audio_oss="no"
110 5cbcf02c Fabrice Bellard
v4l="no"
111 8aa3ee32 Max Krasnyansky
dv1394="no"
112 dfdfa47c François Revol
# enable beos things
113
audio_beos="yes"
114 ef0bc4c9 François Revol
# no need for libm, but the inet stuff
115
# Check for BONE
116
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
117
extralibs="-lbind -lsocket"
118
else
119 26b35efb François Revol
netserver="yes"
120 4baca069 Philip Gladstone
need_inet_aton="yes"
121 26b35efb François Revol
extralibs="-lnet"
122 ef0bc4c9 François Revol
fi ;;
123 4baca069 Philip Gladstone
SunOS)
124
v4l="no"
125
audio_oss="no"
126 8aa3ee32 Max Krasnyansky
dv1394="no"
127 4baca069 Philip Gladstone
make="gmake"
128
LDFLAGS=""
129
FFSLDFLAGS=""
130
need_inet_aton="yes"
131
extralibs="$extralibs -lsocket -lnsl"
132
;;
133 9c938e77 Philip Gladstone
FreeBSD)
134
v4l="no"
135
audio_oss="yes"
136 8aa3ee32 Max Krasnyansky
dv1394="no"
137 9c938e77 Philip Gladstone
make="gmake"
138 4baca069 Philip Gladstone
LDFLAGS="$LDFLAGS -export-dynamic"
139 9c938e77 Philip Gladstone
;;
140 4a908fbc Alex Beregszaszi
BSD/OS)
141 5cbcf02c Fabrice Bellard
v4l="no"
142 6063bce7 Fabrice Bellard
audio_oss="yes"
143 8aa3ee32 Max Krasnyansky
dv1394="no"
144 4a908fbc Alex Beregszaszi
extralibs="-lpoll -lgnugetopt -lm"
145
make="gmake"
146
;;
147 90cee0c3 Michael Niedermayer
Darwin)
148 a43bd1d7 Heliodoro Tammaro
cc="cc"
149 90cee0c3 Michael Niedermayer
v4l="no"
150
audio_oss="no"
151 8aa3ee32 Max Krasnyansky
dv1394="no"
152 a43bd1d7 Heliodoro Tammaro
SHFLAGS="-dynamiclib"
153 90cee0c3 Michael Niedermayer
extralibs=""
154 a43bd1d7 Heliodoro Tammaro
darwin="yes"
155 47930f09 Philip Gladstone
strip="strip -x"
156 6207ba95 Philip Gladstone
LDFLAGS="-d"
157 4baca069 Philip Gladstone
FFSLDFLAGS=-Wl,-bind_at_load
158
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
159
case "$gcc_version" in
160
*2.95*) 
161
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
162
;;
163
*) 
164
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
165
;;
166
esac
167 90cee0c3 Michael Niedermayer
;;
168 732d9245 Bill Eldridge
MINGW32*)
169
v4l="no"
170
audio_oss="no"
171 8aa3ee32 Max Krasnyansky
dv1394="no"
172 732d9245 Bill Eldridge
ffserver="no"
173
network="no"
174
mingw32="yes"
175
;;
176 3f027ca7 Felix Bünemann
CYGWIN*)
177
v4l="no"
178
audio_oss="yes"
179 8aa3ee32 Max Krasnyansky
dv1394="no"
180 3f027ca7 Felix Bünemann
extralibs=""
181
cygwin="yes"
182
test -f /usr/include/inttypes.h || \
183
test -f /usr/local/include/inttypes.h || \
184
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
185
     "/usr/include/inttypes.h !!!"
186
;;
187 b55e4ef4 Philip Gladstone
Linux)
188 4baca069 Philip Gladstone
LDFLAGS="$LDFLAGS -rdynamic"
189 b55e4ef4 Philip Gladstone
;;
190 f3ec2d46 Slavik Gnatenko
OS/2)
191
TMPE=$TMPE".exe"
192 69db4e10 Slavik Gnatenko
ar="emxomfar -p64"
193
ranlib="echo ignoring ranlib"
194
strip="echo ignoring strip"
195
CFLAGS="-Zomf -O3"
196
LDFLAGS="-Zomf -Zstack 16384 -s"
197 f3ec2d46 Slavik Gnatenko
SHFLAGS=""
198
FFSLDFLAGS=""
199
LIBPREF=""
200
LIBSUF=".lib"
201
SLIBPREF=""
202
SLIBSUF=".dll"
203
extralibs=""
204
v4l="no"
205
audio_oss="no"
206 8aa3ee32 Max Krasnyansky
dv1394="no"
207 f3ec2d46 Slavik Gnatenko
network="no"
208
ffserver="no"
209
os2="yes"
210
;;
211 ef0bc4c9 François Revol
*) ;;
212
esac
213 de6d9b64 Fabrice Bellard
214 6852ac95 Romain Dolbeau
# From mplayer configure. We need TARGET_OS available
215
# to the Makefile, so it can distinguish between flavors
216
# of AltiVec on PowerPC
217
TARGET_OS=`( uname -s ) 2>&1`
218
  case "$TARGET_OS" in
219
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
220
    ;;
221
  IRIX*)
222
    TARGET_OS=IRIX
223
    ;;
224
  HP-UX*)
225
    TARGET_OS=HP-UX
226
    ;;
227
  [cC][yY][gG][wW][iI][nN]*)
228
    TARGET_OS=CYGWIN
229
    ;;
230
  *)
231
    TARGET_OS="$TARGET_OS-UNKNOWN"
232
    ;;
233
  esac
234
235 0f3cb305 Fabrice Bellard
# find source path
236
# XXX: we assume an absolute path is given when launching configure, 
237
# except in './configure' case.
238 586bc755 Roman Shaposhnik
source_path="`echo $0 | sed -e 's#/configure##'`"
239 0f3cb305 Fabrice Bellard
source_path_used="yes"
240
if test -z "$source_path" -o "$source_path" = "." ; then
241
    source_path=`pwd`
242
    source_path_used="no"
243 de6d9b64 Fabrice Bellard
fi
244
245
for opt do
246
  case "$opt" in
247
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
248
  ;;
249 0f3cb305 Fabrice Bellard
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
250
  ;;
251
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
252
  ;;
253 de6d9b64 Fabrice Bellard
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
254
  ;;
255 4a908fbc Alex Beregszaszi
  --make=*) make=`echo $opt | cut -d '=' -f 2`
256
  ;;
257 0f3cb305 Fabrice Bellard
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
258
  ;;
259
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
260
  ;;
261
  --extra-libs=*) extralibs=${opt#--extra-libs=}
262
  ;;
263 de6d9b64 Fabrice Bellard
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
264
  ;;
265
  --disable-mmx) mmx="no"
266
  ;;
267 ab6c65f6 Brian Foley
  --disable-altivec) altivec="no"
268
  ;;
269 de6d9b64 Fabrice Bellard
  --enable-gprof) gprof="yes"
270
  ;;
271 5cbcf02c Fabrice Bellard
  --disable-v4l) v4l="no"
272
  ;;
273
  --disable-audio-oss) audio_oss="no"
274
  ;;
275 dfdfa47c François Revol
  --disable-audio-beos) audio_beos="no"
276
  ;;
277 8aa3ee32 Max Krasnyansky
  --disable-dv1394) dv1394="no"
278
  ;;
279 5cbcf02c Fabrice Bellard
  --disable-network) network="no"
280
  ;;
281 0147f198 François Revol
  --disable-zlib) zlib="no"
282
  ;;
283 5cbcf02c Fabrice Bellard
  --disable-a52) a52="no"
284 6ed7422a Fabrice Bellard
  ;;
285 9c938e77 Philip Gladstone
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
286 57514323 Zdenek Kabelac
  ;;
287 bba9b16c Michael Niedermayer
  --disable-pp) pp="no"
288
  ;;
289
  --enable-shared-pp) shared_pp="yes"
290
  ;;
291 a6741398 Juanjo
  --enable-mp3lame) mp3lame="yes"
292
  ;;
293 81e0d0b4 Mark Hills
  --enable-vorbis) vorbis="yes"
294
  ;;
295 68892110 Philip Gladstone
  --disable-vhook) vhook="no"
296
  ;;
297 c02dbee1 Michael Niedermayer
  --disable-simple_idct) simpleidct="no"
298 045ed63f Zdenek Kabelac
  ;;
299 daf8e955 Fabrice Bellard
  --enable-win32) win32="yes"
300
  ;;
301 732d9245 Bill Eldridge
  --enable-mingw32) mingw32="yes"
302
  ;;
303 83286d2a Zdenek Kabelac
  --enable-shared) lshared="yes"
304 0319c531 Nick Kurshev
  ;;
305 1eb2212e Fabrice Bellard
  --disable-mpegaudio-hp) mpegaudio_hp="no"
306
  ;;
307 8154d2e0 Fabrice Bellard
  --disable-ffserver) ffserver="no"
308
  ;;
309 1d0d55da Michael Niedermayer
  --disable-risky) risky="no"
310
  ;;
311 553a6284 Michael Niedermayer
  --enable-small) small="yes"
312
  ;;
313 de6d9b64 Fabrice Bellard
  esac
314
done
315
316 0f3cb305 Fabrice Bellard
# compute mmx state
317
if test $mmx = "default"; then
318
    if test $cpu = "x86"; then
319
        mmx="yes"
320
    else
321
        mmx="no"
322
    fi
323
fi
324
325 ab6c65f6 Brian Foley
# Can only do AltiVec on PowerPC
326
if test $altivec = "default"; then
327
    if test $cpu = "powerpc"; then
328
        altivec="yes"
329
    else
330
        altivec="no"
331
    fi
332
fi
333
334
# See does our compiler support Motorola AltiVec C API
335
if test $altivec = "yes"; then
336
cat > $TMPC << EOF
337
int main(void) {
338
    vector signed int v1, v2, v3;
339
    v1 = vec_add(v2,v3);
340
    return 0;
341
}
342
EOF
343 f3ec2d46 Slavik Gnatenko
$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
344 ab6c65f6 Brian Foley
fi
345
346 d46aba26 Leon van Stuivenberg
# Can only do mmi on mips
347
if test $mmi = "default"; then
348
    if test $cpu = "mips"; then
349
        mmi="yes"
350
    else
351
        mmi="no"
352
    fi
353
fi
354
355
# See does our compiler support mmi
356
if test $mmi = "yes"; then
357
cat > $TMPC << EOF
358
int main(void) {
359
    __asm__ ("lq \$2, 0(\$2)");
360
    return 0;
361
}
362
EOF
363 f3ec2d46 Slavik Gnatenko
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
364 d46aba26 Leon van Stuivenberg
fi
365
366 daf8e955 Fabrice Bellard
# Checking for CFLAGS
367
if test -z "$CFLAGS"; then
368 29482cb4 Michael Niedermayer
    CFLAGS="-O3"
369 daf8e955 Fabrice Bellard
fi
370
371 57514323 Zdenek Kabelac
if test "$win32" = "yes" ; then
372 daf8e955 Fabrice Bellard
    cross_prefix="i386-mingw32msvc-"
373 5cbcf02c Fabrice Bellard
    v4l="no"
374
    audio_oss="no"
375 8aa3ee32 Max Krasnyansky
    dv1394="no"
376 5cbcf02c Fabrice Bellard
    network="no"
377 daf8e955 Fabrice Bellard
fi
378
379 732d9245 Bill Eldridge
if test "$mingw32" = "yes" ; then
380
    cross_prefix=""
381
    v4l="no"
382
    audio_oss="no"
383 8aa3ee32 Max Krasnyansky
    dv1394="no"
384 732d9245 Bill Eldridge
    network="no"
385
fi
386
387 0f3cb305 Fabrice Bellard
cc="${cross_prefix}${cc}"
388
ar="${cross_prefix}${ar}"
389 be7109c1 Michael Niedermayer
ranlib="${cross_prefix}${ranlib}"
390 0f3cb305 Fabrice Bellard
strip="${cross_prefix}${strip}"
391
392 487a54d7 Fabrice Bellard
if test -z "$cross_prefix" ; then
393
394 3d204385 Nick Kurshev
# ---
395 a3999908 Michael Niedermayer
# big/little endian test
396
cat > $TMPC << EOF
397
#include <inttypes.h>
398
int main(int argc, char ** argv){
399
	volatile uint32_t i=0x01234567;
400
	return (*((uint8_t*)(&i))) == 0x67;
401
}
402
EOF
403
404 f3ec2d46 Slavik Gnatenko
if $cc -o $TMPE $TMPC 2>/dev/null ; then
405
$TMPE && bigendian="yes"
406 a3999908 Michael Niedermayer
else
407
echo big/little test failed
408
fi
409
410 487a54d7 Fabrice Bellard
else
411
412
# if cross compiling, cannot launch a program, so make a static guess
413
if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
414
    bigendian="yes"
415
fi
416
417
fi
418
419 a3999908 Michael Niedermayer
# ---
420 3d204385 Nick Kurshev
# check availability of some header files
421
422
cat > $TMPC << EOF
423
#include <malloc.h>
424
int main( void ) { return 0; }
425
EOF
426
427
_memalign=no
428
_malloc_h=no
429 f3ec2d46 Slavik Gnatenko
if $cc -o $TMPE $TMPC 2> /dev/null ; then
430 3d204385 Nick Kurshev
_malloc_h=yes
431
_memalign=yes
432
# check for memalign - atmos
433
cat > $TMPC << EOF
434
#include <malloc.h>
435
int main ( void ) {
436
char *string = NULL;
437
string = memalign(64, sizeof(char));
438
return 0;
439
}
440
EOF
441 f3ec2d46 Slavik Gnatenko
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
442 3d204385 Nick Kurshev
fi
443
444 68892110 Philip Gladstone
cat > $TMPC << EOF
445
#define _GNU_SOURCE
446
#include <time.h>
447
int main( void ) { return *strptime("", "", 0); }
448
EOF
449
450
strptime=no
451 f3ec2d46 Slavik Gnatenko
if $cc -o $TMPE $TMPC 2> /dev/null ; then
452 68892110 Philip Gladstone
  strptime=yes
453
fi
454
455 0147f198 François Revol
if test "$zlib" = "yes"; then
456
# check for zlib - mmu_man
457
cat > $TMPC << EOF
458
#include <zlib.h>
459
int main ( void ) {
460
if (zlibVersion() != ZLIB_VERSION)
461
   puts("zlib version differs !!!");
462
   return 1;
463
return 0;
464
}
465
EOF
466 f3ec2d46 Slavik Gnatenko
$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
467
# $TMPE 2> /dev/null > /dev/null || zlib="no"
468 0147f198 François Revol
# XXX: more tests needed - runtime test
469
fi
470
if test "$zlib" = "yes"; then
471
extralibs="$extralibs -lz"
472
fi
473
474 95e2ce4a Michael Niedermayer
# test for lrintf in math.h
475
cat > $TMPC << EOF
476
#define _ISOC9X_SOURCE  1
477
#include <math.h>
478
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
479
EOF
480
481
have_lrintf="no"
482 f3ec2d46 Slavik Gnatenko
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
483 95e2ce4a Michael Niedermayer
  have_lrintf="yes"
484 f3ec2d46 Slavik Gnatenko
  $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
485 95e2ce4a Michael Niedermayer
fi
486
487 c13e1abd Falk Hüffner
_restrict=
488
for restrict_keyword in restrict __restrict__ __restrict; do
489
  echo "void foo(char * $restrict_keyword p);" > $TMPC
490
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
491
    _restrict=$restrict_keyword
492
    break;
493
  fi
494
done
495
496 52b41d7f Fabrice Bellard
# test gcc version to see if vector builtins can be used
497
# currently only used on i386 for MMX builtins
498
cat > $TMPC << EOF
499
int main(void) { 
500
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
501
return 0;
502
#else
503
#error no vector builtins
504
#endif
505
}
506
EOF
507
508
builtin_vector=no
509
if $cc -o $TMPO $TMPC 2> /dev/null ; then
510
  builtin_vector=yes
511 a8721c09 Fabrice Bellard
fi
512
513
# dlopen/dlfcn.h probing
514
515
cat > $TMPC << EOF
516
#include <dlfcn.h>
517
int main( void ) { return (int) dlopen("foo", 0); }
518
EOF
519
520
ldl=-ldl
521
522
if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
523
dlfcn=yes
524
dlopen=yes
525
fi
526
527
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
528
dlfcn=yes
529
dlopen=yes
530
ldl=""
531
fi
532
533
cat > $TMPC << EOF
534
int main( void ) { return (int) dlopen("foo", 0); }
535
EOF
536
537
if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
538
dlopen=yes
539
fi
540
541
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
542
dlopen=yes
543
ldl=""
544
fi
545
546
if test "$vhook" = "default" ; then
547
  vhook="$dlopen"
548
fi
549
550
cat > $TMPC << EOF
551
#include <X11/Xlib.h>
552
#include <Imlib2.h>
553
int main( void ) { return (int) imlib_load_font("foo"); }
554
EOF
555
556
imlib2=no
557
if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null  ; then
558
imlib2=yes
559 52b41d7f Fabrice Bellard
fi
560
561 04511d53 Philip Gladstone
cat > $TMPC << EOF
562
#include <ft2build.h>
563
int main( void ) { return (int) FT_Init_FreeType(0); }
564
EOF
565
566
freetype2=no
567 69db4e10 Slavik Gnatenko
if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
568 dee076fc François Revol
  which freetype-config > /dev/null
569
  if test $? -eq 0; then
570 04511d53 Philip Gladstone
    if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  2> /dev/null ; then
571 dee076fc François Revol
      freetype2=yes
572 04511d53 Philip Gladstone
    fi
573 dee076fc François Revol
  fi
574 04511d53 Philip Gladstone
fi
575
576 553a6284 Michael Niedermayer
if test "$small" == "yes"; then
577 98ca7790 Michael Niedermayer
#  CFLAGS=${CFLAGS//-O3/-Os}
578 553a6284 Michael Niedermayer
  CFLAGS="$CFLAGS -Os"
579
fi
580
581 6063bce7 Fabrice Bellard
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
582 0f3cb305 Fabrice Bellard
cat << EOF
583
584
Usage: configure [options]
585
Options: [defaults in brackets after descriptions]
586
587
EOF
588
echo "Standard options:"
589
echo "  --help                   print this message"
590
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
591
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
592 81e0d0b4 Mark Hills
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
593 0f3cb305 Fabrice Bellard
echo "  --enable-win32           enable win32 cross compile"
594 732d9245 Bill Eldridge
echo "  --enable-mingw32         enable mingw32 native windows compile"
595 5cbcf02c Fabrice Bellard
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
596 0f3cb305 Fabrice Bellard
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
597 bba9b16c Michael Niedermayer
echo "  --disable-pp             disable GPL'ed post processing support [default=no]"
598
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
599 0f3cb305 Fabrice Bellard
echo "  --enable-shared          build shared libraries [default=no]"
600
echo ""
601
echo "Advanced options (experts only):"
602
echo "  --source-path=PATH       path of source code [$source_path]"
603
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
604
echo "  --cc=CC                  use C compiler CC [$cc]"
605 4a908fbc Alex Beregszaszi
echo "  --make=MAKE              use specified make [$make]"
606 0f3cb305 Fabrice Bellard
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
607
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
608
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
609
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
610
echo "  --disable-mmx            disable mmx usage"
611 ab6c65f6 Brian Foley
echo "  --disable-altivec        disable AltiVec usage"
612 5cbcf02c Fabrice Bellard
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
613 dfdfa47c François Revol
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
614 6063bce7 Fabrice Bellard
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
615 8aa3ee32 Max Krasnyansky
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
616 5cbcf02c Fabrice Bellard
echo "  --disable-network        disable network support [default=no]"
617 0147f198 François Revol
echo "  --disable-zlib           disable zlib [default=no]"
618 5cbcf02c Fabrice Bellard
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
619 47930f09 Philip Gladstone
echo "  --disable-vhook          disable video hooking support"
620 0f3cb305 Fabrice Bellard
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
621 1eb2212e Fabrice Bellard
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
622
echo "                           mpegaudio decoding [default=no]"
623 8154d2e0 Fabrice Bellard
echo "  --disable-ffserver       disable ffserver build"
624 1d0d55da Michael Niedermayer
echo "  --disable-risky          disables patent encumbered codecs"
625 553a6284 Michael Niedermayer
echo "  --enable-small           optimize for size instead of speed"
626 0f3cb305 Fabrice Bellard
echo ""
627
echo "NOTE: The object files are build at the place where configure is launched"
628
exit 1
629
fi
630
631 de6d9b64 Fabrice Bellard
echo "Install prefix   $prefix"
632 0f3cb305 Fabrice Bellard
echo "Source path      $source_path"
633 de6d9b64 Fabrice Bellard
echo "C compiler       $cc"
634 4a908fbc Alex Beregszaszi
echo "make             $make"
635 de6d9b64 Fabrice Bellard
echo "CPU              $cpu"
636 0f3cb305 Fabrice Bellard
echo "Big Endian       $bigendian"
637 e41e8342 Fabrice Bellard
if test $cpu = "x86"; then
638 de6d9b64 Fabrice Bellard
echo "MMX enabled      $mmx"
639 52b41d7f Fabrice Bellard
echo "Vector Builtins  $builtin_vector"
640 e41e8342 Fabrice Bellard
fi
641
if test $cpu = "mips"; then
642 d46aba26 Leon van Stuivenberg
echo "MMI enabled      $mmi"
643 e41e8342 Fabrice Bellard
fi
644
if test $cpu = "powerpc"; then
645 ab6c65f6 Brian Foley
echo "AltiVec enabled  $altivec"
646 e41e8342 Fabrice Bellard
fi
647 de6d9b64 Fabrice Bellard
echo "gprof enabled    $gprof"
648 0147f198 François Revol
echo "zlib enabled     $zlib"
649 a6741398 Juanjo
echo "mp3lame enabled  $mp3lame"
650 81e0d0b4 Mark Hills
echo "vorbis enabled   $vorbis"
651 5cbcf02c Fabrice Bellard
echo "a52 support      $a52"
652 57514323 Zdenek Kabelac
echo "a52 dlopened     $a52bin"
653 bba9b16c Michael Niedermayer
echo "pp support       $pp"
654
echo "shared pp        $shared_pp"
655 47930f09 Philip Gladstone
echo "Video hooking    $vhook"
656 1d0d55da Michael Niedermayer
echo "risky / patent encumbered codecs $risky"
657 553a6284 Michael Niedermayer
echo "optimize for size $small"
658 68892110 Philip Gladstone
659
if test "$vhook" = "yes" ; then
660 47930f09 Philip Gladstone
echo "Imlib2 support   $imlib2"
661 04511d53 Philip Gladstone
echo "freetype support $freetype2"
662 68892110 Philip Gladstone
fi
663 de6d9b64 Fabrice Bellard
664 980fc7b8 Fabrice Bellard
echo "Creating config.mak and config.h"
665 de6d9b64 Fabrice Bellard
666 980fc7b8 Fabrice Bellard
echo "# Automatically generated by configure - do not modify" > config.mak
667 045ed63f Zdenek Kabelac
echo "/* Automatically generated by configure - do not modify */" > $TMPH
668 de6d9b64 Fabrice Bellard
669 980fc7b8 Fabrice Bellard
echo "prefix=$prefix" >> config.mak
670 4a908fbc Alex Beregszaszi
echo "MAKE=$make" >> config.mak
671 980fc7b8 Fabrice Bellard
echo "CC=$cc" >> config.mak
672
echo "AR=$ar" >> config.mak
673 be7109c1 Michael Niedermayer
echo "RANLIB=$ranlib" >> config.mak
674 0f3cb305 Fabrice Bellard
echo "STRIP=$strip" >> config.mak
675 a9b3f630 Nick Kurshev
echo "OPTFLAGS=$CFLAGS" >> config.mak
676 0f3cb305 Fabrice Bellard
echo "LDFLAGS=$LDFLAGS" >> config.mak
677 4baca069 Philip Gladstone
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
678 e1707f52 Michael Niedermayer
echo "SHFLAGS=$SHFLAGS" >> config.mak
679 f3ec2d46 Slavik Gnatenko
echo "LIBPREF=$LIBPREF" >> config.mak
680
echo "LIBSUF=$LIBSUF" >> config.mak
681
echo "SLIBPREF=$SLIBPREF" >> config.mak
682
echo "SLIBSUF=$SLIBSUF" >> config.mak
683 6852ac95 Romain Dolbeau
echo "TARGET_OS=$TARGET_OS" >> config.mak
684 57514323 Zdenek Kabelac
if test "$cpu" = "x86" ; then
685 980fc7b8 Fabrice Bellard
  echo "TARGET_ARCH_X86=yes" >> config.mak
686 045ed63f Zdenek Kabelac
  echo "#define ARCH_X86 1" >> $TMPH
687 0f3cb305 Fabrice Bellard
elif test "$cpu" = "armv4l" ; then
688 6ed7422a Fabrice Bellard
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
689 045ed63f Zdenek Kabelac
  echo "#define ARCH_ARMV4L 1" >> $TMPH
690 0f3cb305 Fabrice Bellard
elif test "$cpu" = "alpha" ; then
691 91d1f1a4 Nick Kurshev
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
692 045ed63f Zdenek Kabelac
  echo "#define ARCH_ALPHA 1" >> $TMPH
693 35fedfc3 Philip Gladstone
elif test "$cpu" = "sparc64" ; then
694
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
695
  echo "#define ARCH_SPARC64 1" >> $TMPH
696 0f3cb305 Fabrice Bellard
elif test "$cpu" = "powerpc" ; then
697
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
698
  echo "#define ARCH_POWERPC 1" >> $TMPH
699 35e5fb06 Romain Dolbeau
  echo "// Enable the next line to get PowerPC performance report" >> $TMPH
700
  echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
701
  echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
702
  echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
703 d46aba26 Leon van Stuivenberg
elif test "$cpu" = "mips" ; then
704
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
705
  echo "#define ARCH_MIPS 1" >> $TMPH
706 0f3cb305 Fabrice Bellard
fi
707
if test "$bigendian" = "yes" ; then
708
  echo "WORDS_BIGENDIAN=yes" >> config.mak
709
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
710 91d1f1a4 Nick Kurshev
fi
711 57514323 Zdenek Kabelac
if test "$mmx" = "yes" ; then
712 980fc7b8 Fabrice Bellard
  echo "TARGET_MMX=yes" >> config.mak
713 045ed63f Zdenek Kabelac
  echo "#define HAVE_MMX 1" >> $TMPH
714 de6d9b64 Fabrice Bellard
fi
715 52b41d7f Fabrice Bellard
if test "$builtin_vector" = "yes" ; then
716
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
717
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
718
fi
719 d46aba26 Leon van Stuivenberg
if test "$mmi" = "yes" ; then
720
  echo "TARGET_MMI=yes" >> config.mak
721
  echo "#define HAVE_MMI 1" >> $TMPH
722
fi
723 ab6c65f6 Brian Foley
if test "$altivec" = "yes" ; then
724
  echo "TARGET_ALTIVEC=yes" >> config.mak
725
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
726 db40a39a Michael Niedermayer
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
727
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
728 ab6c65f6 Brian Foley
fi
729 57514323 Zdenek Kabelac
if test "$gprof" = "yes" ; then
730 980fc7b8 Fabrice Bellard
  echo "TARGET_GPROF=yes" >> config.mak
731 045ed63f Zdenek Kabelac
  echo "#define HAVE_GPROF 1" >> $TMPH
732 de6d9b64 Fabrice Bellard
fi
733 68892110 Philip Gladstone
if test "$strptime" = "yes" ; then
734
  echo "#define HAVE_STRPTIME 1" >> $TMPH
735
else
736
  echo "BUILD_STRPTIME=yes" >> config.mak
737
fi
738
if test "$imlib2" = "yes" ; then
739
  echo "HAVE_IMLIB2=yes" >> config.mak
740
fi
741 04511d53 Philip Gladstone
if test "$freetype2" = "yes" ; then
742
  echo "HAVE_FREETYPE2=yes" >> config.mak
743
fi
744 95e2ce4a Michael Niedermayer
if test "$have_lrintf" = "yes" ; then
745
  echo "#define HAVE_LRINTF 1" >> $TMPH
746
fi
747 68892110 Philip Gladstone
if test "$vhook" = "yes" ; then
748
  echo "BUILD_VHOOK=yes" >> config.mak
749
  echo "#define HAVE_VHOOK 1" >> $TMPH
750 9c938e77 Philip Gladstone
  extralibs="$extralibs $ldl"
751 68892110 Philip Gladstone
fi
752 57514323 Zdenek Kabelac
if test "$lshared" = "yes" ; then
753 0319c531 Nick Kurshev
  echo "BUILD_SHARED=yes" >> config.mak
754 5cbcf02c Fabrice Bellard
  echo "PIC=-fPIC" >> config.mak
755 0319c531 Nick Kurshev
fi
756 ef0bc4c9 François Revol
echo "EXTRALIBS=$extralibs" >> config.mak
757 586bc755 Roman Shaposhnik
echo "VERSION=`head $source_path/VERSION`" >>config.mak
758 0319c531 Nick Kurshev
echo "" >>config.mak
759 d771bcae Fabrice Bellard
# if you do not want to use encoders, disable that.
760 045ed63f Zdenek Kabelac
echo "#define CONFIG_ENCODERS 1" >> $TMPH
761 d771bcae Fabrice Bellard
echo "CONFIG_ENCODERS=yes" >> config.mak
762
763
# if you do not want to use decoders, disable that.
764 045ed63f Zdenek Kabelac
echo "#define CONFIG_DECODERS 1" >> $TMPH
765 d771bcae Fabrice Bellard
echo "CONFIG_DECODERS=yes" >> config.mak
766
767 5cbcf02c Fabrice Bellard
# AC3
768
if test "$a52" = "yes" ; then
769
  echo "#define CONFIG_AC3 1" >> $TMPH
770
  echo "CONFIG_AC3=yes" >> config.mak
771 d771bcae Fabrice Bellard
772 5cbcf02c Fabrice Bellard
  if test "$a52bin" = "yes" ; then
773
    echo "#define CONFIG_A52BIN 1" >> $TMPH
774
    echo "CONFIG_A52BIN=yes" >> config.mak
775
  fi
776
fi
777
778 bba9b16c Michael Niedermayer
# PP
779
if test "$pp" = "yes" ; then
780
  echo "#define CONFIG_PP 1" >> $TMPH
781
  echo "CONFIG_PP=yes" >> config.mak
782
783
  if test "$shared_pp" = "yes" ; then
784
    echo "#define SHARED_PP 1" >> $TMPH
785
    echo "SHARED_PP=yes" >> config.mak
786
  fi
787
fi
788
789 1eb2212e Fabrice Bellard
# mpeg audio high precision mode
790
if test "$mpegaudio_hp" = "yes" ; then
791
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
792
fi
793
794 5cbcf02c Fabrice Bellard
if test "$v4l" = "yes" ; then
795
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
796
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
797
fi
798
799 8aa3ee32 Max Krasnyansky
if test "$dv1394" = "yes" ; then
800
  echo "#define CONFIG_DV1394 1" >> $TMPH
801
  echo "CONFIG_DV1394=yes" >> config.mak
802
fi
803
804 adbc0510 Philip Gladstone
if test "$dlopen" = "yes" ; then
805
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
806
fi
807
808
if test "$dlfcn" = "yes" ; then
809
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
810
fi
811
812 5cbcf02c Fabrice Bellard
if test "$audio_oss" = "yes" ; then
813
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
814
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
815 57514323 Zdenek Kabelac
fi
816
817 dfdfa47c François Revol
if test "$audio_beos" = "yes" ; then
818
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
819
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
820
fi
821
822 5cbcf02c Fabrice Bellard
if test "$network" = "yes" ; then
823
  echo "#define CONFIG_NETWORK 1" >> $TMPH
824
  echo "CONFIG_NETWORK=yes" >> config.mak
825 6ed7422a Fabrice Bellard
fi
826 daf8e955 Fabrice Bellard
827 0147f198 François Revol
if test "$zlib" = "yes" ; then
828
  echo "#define CONFIG_ZLIB 1" >> $TMPH
829
  echo "CONFIG_ZLIB=yes" >> config.mak
830
fi
831
832 57514323 Zdenek Kabelac
if test "$mp3lame" = "yes" ; then
833 045ed63f Zdenek Kabelac
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
834 a6741398 Juanjo
  echo "CONFIG_MP3LAME=yes" >> config.mak
835
fi
836
837 81e0d0b4 Mark Hills
if test "$vorbis" = "yes" ; then
838
  echo "#define CONFIG_VORBIS 1" >> $TMPH
839
  echo "CONFIG_VORBIS=yes" >> config.mak
840
fi
841
842 57514323 Zdenek Kabelac
if test "$win32" = "yes" ; then
843 045ed63f Zdenek Kabelac
  echo "#define CONFIG_WIN32 1" >> $TMPH
844 daf8e955 Fabrice Bellard
  echo "CONFIG_WIN32=yes" >> config.mak
845
fi
846 3d204385 Nick Kurshev
847 732d9245 Bill Eldridge
if test "$mingw32" = "yes" ; then
848
  echo "#define CONFIG_WIN32 1" >> $TMPH
849
  echo "CONFIG_WIN32=yes" >> config.mak
850
  echo "#define __MINGW32__ 1" >> $TMPH
851
  echo "__MINGW32__=1" >> config.mak
852
fi
853
854 3f027ca7 Felix Bünemann
if test "$cygwin" = "yes" ; then
855
  # setup correct exesuffix
856
  echo "CONFIG_WIN32=yes" >> config.mak
857
fi
858
859 f3ec2d46 Slavik Gnatenko
if test "$os2" = "yes" ; then
860
  echo "#define CONFIG_OS2 1" >> $TMPH
861
  echo "CONFIG_OS2=yes" >> config.mak
862
fi
863
864 90cee0c3 Michael Niedermayer
if test "$darwin" = "yes"; then
865
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
866
  echo "CONFIG_DARWIN=yes" >> config.mak
867
fi
868
869 57514323 Zdenek Kabelac
if test "$_malloc_h" = "yes" ; then
870 045ed63f Zdenek Kabelac
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
871 3d204385 Nick Kurshev
else
872 045ed63f Zdenek Kabelac
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
873 3d204385 Nick Kurshev
fi
874
875 57514323 Zdenek Kabelac
if test "$_memalign" = "yes" ; then
876 045ed63f Zdenek Kabelac
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
877
else
878
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
879
fi
880
881 26b35efb François Revol
if test "$netserver" = "yes" ; then
882
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
883
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
884
fi
885
886 4baca069 Philip Gladstone
if test "$need_inet_aton" = "yes" ; then
887
  echo "NEED_INET_ATON=yes" >> config.mak
888
fi
889
890 57514323 Zdenek Kabelac
if test "$simpleidct" = "yes" ; then
891 045ed63f Zdenek Kabelac
  echo "#define SIMPLE_IDCT 1" >> $TMPH
892
fi
893
894 8154d2e0 Fabrice Bellard
if test "$ffserver" = "yes" ; then
895
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
896
  echo "CONFIG_FFSERVER=yes" >> config.mak
897
fi
898
899 1d0d55da Michael Niedermayer
if test "$risky" = "yes" ; then
900
  echo "#define CONFIG_RISKY 1" >> $TMPH
901
  echo "CONFIG_RISKY=yes" >> config.mak
902
fi
903
904 c13e1abd Falk Hüffner
echo "#define restrict $_restrict" >> $TMPH
905
906 0f3cb305 Fabrice Bellard
# build tree in object directory if source path is different from current one
907
if test "$source_path_used" = "yes" ; then
908 a382b927 Fabrice Bellard
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
909
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
910
    FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
911 0f3cb305 Fabrice Bellard
    for dir in $DIRS ; do
912
            mkdir -p $dir
913
    done
914
    for f in $FILES ; do
915
        ln -sf $source_path/$f $f
916
    done
917
fi
918
echo "SRC_PATH=$source_path" >> config.mak
919
920 a7c02e25 Zdenek Kabelac
diff $TMPH config.h >/dev/null 2>&1
921 045ed63f Zdenek Kabelac
if test $? -ne 0 ; then
922
	mv -f $TMPH config.h
923 3d204385 Nick Kurshev
else
924 045ed63f Zdenek Kabelac
	echo "config.h is unchanged"
925 3d204385 Nick Kurshev
fi
926
927 f3ec2d46 Slavik Gnatenko
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH