undefined local_port fix by (Giancarlo Formicuccia <ilsensine at inwind dot it>)
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305
FB
4#
5# set temporary file name
57514323 6if test ! -z "$TMPDIR" ; then
0f3cb305 7 TMPDIR1="${TMPDIR}"
57514323 8elif test ! -z "$TEMPDIR" ; then
0f3cb305 9 TMPDIR1="${TEMPDIR}"
3d204385 10else
0f3cb305 11 TMPDIR1="/tmp"
3d204385
NK
12fi
13
0f3cb305
FB
14TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 16TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
17TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
18TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
19
de6d9b64
FB
20# default parameters
21prefix="/usr/local"
0f3cb305 22cross_prefix=""
de6d9b64
FB
23cc="gcc"
24ar="ar"
be7109c1 25ranlib="ranlib"
4a908fbc 26make="make"
0f3cb305 27strip="strip"
de6d9b64 28cpu=`uname -m`
a4adb608 29tune="generic"
0f3cb305 30mmx="default"
ab6c65f6 31altivec="default"
d46aba26 32mmi="default"
de6d9b64 33case "$cpu" in
ef0bc4c9 34 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 35 cpu="x86"
de6d9b64 36 ;;
93caefc7
AB
37 # armv4l is a subset of armv5tel
38 armv4l|armv5tel)
6ed7422a 39 cpu="armv4l"
6ed7422a 40 ;;
91d1f1a4
NK
41 alpha)
42 cpu="alpha"
91d1f1a4 43 ;;
a43bd1d7 44 "Power Macintosh"|ppc)
90cee0c3
MN
45 cpu="powerpc"
46 ;;
d46aba26
LS
47 mips)
48 cpu="mips"
49 ;;
a7beab73
RS
50 sun4u)
51 cpu="sparc64"
52 ;;
de6d9b64 53 *)
0f3cb305 54 cpu="unknown"
de6d9b64
FB
55 ;;
56esac
57gprof="no"
5cbcf02c
FB
58v4l="yes"
59audio_oss="yes"
dfdfa47c 60audio_beos="no"
8aa3ee32 61dv1394="yes"
5cbcf02c 62network="yes"
0147f198 63zlib="yes"
a6741398 64mp3lame="no"
81e0d0b4 65vorbis="no"
0fc50e58
ZK
66faad="no"
67faadbin="no"
5cbcf02c 68a52="yes"
57514323 69a52bin="no"
bba9b16c
MN
70pp="yes"
71shared_pp="no"
daf8e955 72win32="no"
732d9245 73mingw32="no"
3f027ca7 74cygwin="no"
f3ec2d46 75os2="no"
83286d2a 76lshared="no"
ef0bc4c9 77extralibs="-lm"
c02dbee1 78simpleidct="yes"
0f3cb305 79bigendian="no"
a8721c09 80vhook="default"
adbc0510
PG
81dlfcn="no"
82dlopen="no"
1eb2212e 83mpegaudio_hp="yes"
e1707f52 84SHFLAGS=-shared
26b35efb 85netserver="no"
4baca069 86need_inet_aton="no"
8154d2e0 87ffserver="yes"
a86b921c 88ffplay="yes"
4baca069
PG
89LDFLAGS=-Wl,--warn-common
90FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
91LIBPREF="lib"
92LIBSUF=".a"
93SLIBPREF="lib"
94SLIBSUF=".so"
1d0d55da 95risky="yes"
553a6284 96small="no"
891f64b3 97amr_nb="no"
bc634f6f 98amr_nb_fixed="no"
ef0bc4c9
FR
99
100# OS specific
101targetos=`uname -s`
102case $targetos in
103BeOS)
104prefix="/boot/home/config"
105# helps building libavcodec
e1707f52 106CFLAGS="-O3 -DPIC -fomit-frame-pointer"
31ba0b4d
FR
107# 3 gcc releases known for BeOS, each with ugly bugs
108gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
109case "$gcc_version" in
1102.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
111mmx="no"
112;;
113*20010315*) echo "BeBits gcc"
114CFLAGS="$CFLAGS -fno-expensive-optimizations"
115;;
116esac
e1707f52
MN
117SHFLAGS=-nostart
118# disable linux things
119audio_oss="no"
5cbcf02c 120v4l="no"
8aa3ee32 121dv1394="no"
dfdfa47c
FR
122# enable beos things
123audio_beos="yes"
ef0bc4c9
FR
124# no need for libm, but the inet stuff
125# Check for BONE
126if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
127extralibs="-lbind -lsocket"
128else
26b35efb 129netserver="yes"
4baca069 130need_inet_aton="yes"
26b35efb 131extralibs="-lnet"
ef0bc4c9 132fi ;;
4baca069
PG
133SunOS)
134v4l="no"
135audio_oss="no"
8aa3ee32 136dv1394="no"
4baca069
PG
137make="gmake"
138LDFLAGS=""
139FFSLDFLAGS=""
140need_inet_aton="yes"
141extralibs="$extralibs -lsocket -lnsl"
142;;
9c938e77
PG
143FreeBSD)
144v4l="no"
145audio_oss="yes"
8aa3ee32 146dv1394="no"
9c938e77 147make="gmake"
4baca069 148LDFLAGS="$LDFLAGS -export-dynamic"
9c938e77 149;;
4a908fbc 150BSD/OS)
5cbcf02c 151v4l="no"
6063bce7 152audio_oss="yes"
8aa3ee32 153dv1394="no"
4a908fbc
AB
154extralibs="-lpoll -lgnugetopt -lm"
155make="gmake"
156;;
90cee0c3 157Darwin)
a43bd1d7 158cc="cc"
90cee0c3
MN
159v4l="no"
160audio_oss="no"
8aa3ee32 161dv1394="no"
d3b15036 162ffserver="no"
a43bd1d7 163SHFLAGS="-dynamiclib"
90cee0c3 164extralibs=""
a43bd1d7 165darwin="yes"
47930f09 166strip="strip -x"
6207ba95 167LDFLAGS="-d"
4baca069
PG
168FFSLDFLAGS=-Wl,-bind_at_load
169gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
170case "$gcc_version" in
171*2.95*)
172CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
173;;
174*)
175CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
176;;
177esac
90cee0c3 178;;
732d9245
BE
179MINGW32*)
180v4l="no"
181audio_oss="no"
8aa3ee32 182dv1394="no"
732d9245
BE
183ffserver="no"
184network="no"
185mingw32="yes"
186;;
3f027ca7
FB
187CYGWIN*)
188v4l="no"
189audio_oss="yes"
8aa3ee32 190dv1394="no"
3f027ca7
FB
191extralibs=""
192cygwin="yes"
193test -f /usr/include/inttypes.h || \
194test -f /usr/local/include/inttypes.h || \
195echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
196 "/usr/include/inttypes.h !!!"
197;;
b55e4ef4 198Linux)
4baca069 199LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 200;;
f3ec2d46
SG
201OS/2)
202TMPE=$TMPE".exe"
69db4e10
SG
203ar="emxomfar -p64"
204ranlib="echo ignoring ranlib"
205strip="echo ignoring strip"
206CFLAGS="-Zomf -O3"
207LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
208SHFLAGS=""
209FFSLDFLAGS=""
210LIBPREF=""
211LIBSUF=".lib"
212SLIBPREF=""
213SLIBSUF=".dll"
214extralibs=""
215v4l="no"
216audio_oss="no"
8aa3ee32 217dv1394="no"
f3ec2d46
SG
218network="no"
219ffserver="no"
220os2="yes"
221;;
ef0bc4c9
FR
222*) ;;
223esac
de6d9b64 224
6852ac95
RD
225# From mplayer configure. We need TARGET_OS available
226# to the Makefile, so it can distinguish between flavors
227# of AltiVec on PowerPC
228TARGET_OS=`( uname -s ) 2>&1`
229 case "$TARGET_OS" in
230 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
231 ;;
232 IRIX*)
233 TARGET_OS=IRIX
234 ;;
235 HP-UX*)
236 TARGET_OS=HP-UX
237 ;;
238 [cC][yY][gG][wW][iI][nN]*)
239 TARGET_OS=CYGWIN
240 ;;
241 *)
242 TARGET_OS="$TARGET_OS-UNKNOWN"
243 ;;
244 esac
245
0f3cb305
FB
246# find source path
247# XXX: we assume an absolute path is given when launching configure,
248# except in './configure' case.
586bc755 249source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
250source_path_used="yes"
251if test -z "$source_path" -o "$source_path" = "." ; then
252 source_path=`pwd`
253 source_path_used="no"
de6d9b64
FB
254fi
255
256for opt do
257 case "$opt" in
258 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
259 ;;
0f3cb305
FB
260 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
261 ;;
262 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
263 ;;
de6d9b64
FB
264 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
265 ;;
4a908fbc
AB
266 --make=*) make=`echo $opt | cut -d '=' -f 2`
267 ;;
0f3cb305
FB
268 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
269 ;;
270 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
271 ;;
272 --extra-libs=*) extralibs=${opt#--extra-libs=}
273 ;;
de6d9b64
FB
274 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
275 ;;
a4adb608
MN
276 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
277 ;;
de6d9b64
FB
278 --disable-mmx) mmx="no"
279 ;;
ab6c65f6
BF
280 --disable-altivec) altivec="no"
281 ;;
de6d9b64
FB
282 --enable-gprof) gprof="yes"
283 ;;
5cbcf02c
FB
284 --disable-v4l) v4l="no"
285 ;;
286 --disable-audio-oss) audio_oss="no"
287 ;;
dfdfa47c
FR
288 --disable-audio-beos) audio_beos="no"
289 ;;
8aa3ee32
MK
290 --disable-dv1394) dv1394="no"
291 ;;
5cbcf02c
FB
292 --disable-network) network="no"
293 ;;
0147f198
FR
294 --disable-zlib) zlib="no"
295 ;;
5cbcf02c 296 --disable-a52) a52="no"
6ed7422a 297 ;;
9c938e77 298 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 299 ;;
bba9b16c
MN
300 --disable-pp) pp="no"
301 ;;
302 --enable-shared-pp) shared_pp="yes"
303 ;;
a6741398
J
304 --enable-mp3lame) mp3lame="yes"
305 ;;
81e0d0b4
MH
306 --enable-vorbis) vorbis="yes"
307 ;;
445ad18d
ZK
308 --enable-faad) faad="yes"
309 ;;
310 --enable-faadbin) faadbin="yes"
311 ;;
68892110
PG
312 --disable-vhook) vhook="no"
313 ;;
c02dbee1 314 --disable-simple_idct) simpleidct="no"
045ed63f 315 ;;
daf8e955
FB
316 --enable-win32) win32="yes"
317 ;;
732d9245
BE
318 --enable-mingw32) mingw32="yes"
319 ;;
83286d2a 320 --enable-shared) lshared="yes"
0319c531 321 ;;
1eb2212e
FB
322 --disable-mpegaudio-hp) mpegaudio_hp="no"
323 ;;
8154d2e0
FB
324 --disable-ffserver) ffserver="no"
325 ;;
a86b921c
FB
326 --disable-ffplay) ffplay="no"
327 ;;
1d0d55da
MN
328 --disable-risky) risky="no"
329 ;;
553a6284
MN
330 --enable-small) small="yes"
331 ;;
891f64b3 332 --enable-amr_nb) amr_nb="yes"
333 ;;
bc634f6f
ZK
334 --enable-amr_nb-fixed) amr_nb_fixed="yes"
335 ;;
de6d9b64
FB
336 esac
337done
338
0f3cb305
FB
339# compute mmx state
340if test $mmx = "default"; then
341 if test $cpu = "x86"; then
342 mmx="yes"
343 else
344 mmx="no"
345 fi
346fi
347
ab6c65f6
BF
348# Can only do AltiVec on PowerPC
349if test $altivec = "default"; then
350 if test $cpu = "powerpc"; then
351 altivec="yes"
352 else
353 altivec="no"
354 fi
355fi
356
a4adb608
MN
357# Add processor-specific flags
358TUNECPU="generic"
359if test $tune != "generic"; then
360 case $tune in
361 601|ppc601|PowerPC601)
362 CFLAGS="$CFLAGS -mcpu=601"
363 if test $altivec = "yes"; then
364 echo "WARNING: tuning for PPC601 but altivec enabled !";
365 fi
366 TUNECPU=ppc601
367 ;;
368 603*|ppc603*|PowerPC603*)
369 CFLAGS="$CFLAGS -mcpu=603"
370 if test $altivec = "yes"; then
371 echo "WARNING: tuning for PPC603 but altivec enabled !";
372 fi
373 TUNECPU=ppc603
374 ;;
375 604*|ppc604*|PowerPC604*)
376 CFLAGS="$CFLAGS -mcpu=604"
377 if test $altivec = "yes"; then
378 echo "WARNING: tuning for PPC604 but altivec enabled !";
379 fi
380 TUNECPU=ppc604
381 ;;
382 G3|75*|ppc75*|PowerPC75*)
383 CFLAGS="$CFLAGS -mcpu=750"
384 if test $altivec = "yes"; then
385 echo "WARNING: tuning for PPC75x but altivec enabled !";
386 fi
387 TUNECPU=ppc750
388 ;;
389 G4|74*|ppc74*|PowerPC74*)
390 CFLAGS="$CFLAGS -mcpu=7400"
391 if test $altivec = "no"; then
392 echo "WARNING: tuning for PPC74xx but altivec disabled !";
393 fi
394 TUNECPU=ppc7400
395 ;;
396 G5|970|ppc970|PowerPC970|power4*|Power4*)
397 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL "
398 if test $altivec = "no"; then
399 echo "WARNING: tuning for PPC970 but altivec disabled !";
400 fi
401 TUNECPU=ppc970
402 ;;
403 *)
404 echo "WARNING: unknown CPU "$tune", ignored"
405 ;;
406 esac
407fi
408
a9a07762
MN
409# See if we have <altivec.h>
410cat > $TMPC << EOF
411#include <altivec.h>
412int main( void ) { return 0; }
413EOF
414
415_altivec_h="no"
416if $cc -o $TMPE $TMPC 2> /dev/null ; then
417_altivec_h="yes"
418fi
419
ab6c65f6
BF
420# See does our compiler support Motorola AltiVec C API
421if test $altivec = "yes"; then
a9a07762 422if test $_altivec_h = "yes"; then
ab6c65f6 423cat > $TMPC << EOF
a9a07762 424#include <altivec.h>
ab6c65f6
BF
425int main(void) {
426 vector signed int v1, v2, v3;
427 v1 = vec_add(v2,v3);
428 return 0;
429}
430EOF
a9a07762
MN
431else
432cat > $TMPC << EOF
433int main(void) {
434 vector signed int v1, v2, v3;
435 v1 = vec_add(v2,v3);
436 return 0;
437}
438EOF
439fi
440if test "$darwin" = "yes"; then
f3ec2d46 441$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
a9a07762
MN
442else
443$cc -o $TMPE $TMPC -maltivec -mabi=altivec 2> /dev/null || altivec="no"
444fi
ab6c65f6
BF
445fi
446
d46aba26
LS
447# Can only do mmi on mips
448if test $mmi = "default"; then
449 if test $cpu = "mips"; then
450 mmi="yes"
451 else
452 mmi="no"
453 fi
454fi
455
456# See does our compiler support mmi
457if test $mmi = "yes"; then
458cat > $TMPC << EOF
459int main(void) {
460 __asm__ ("lq \$2, 0(\$2)");
461 return 0;
462}
463EOF
f3ec2d46 464$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
465fi
466
daf8e955
FB
467# Checking for CFLAGS
468if test -z "$CFLAGS"; then
29482cb4 469 CFLAGS="-O3"
daf8e955
FB
470fi
471
57514323 472if test "$win32" = "yes" ; then
daf8e955 473 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
474 v4l="no"
475 audio_oss="no"
8aa3ee32 476 dv1394="no"
5cbcf02c 477 network="no"
daf8e955
FB
478fi
479
732d9245
BE
480if test "$mingw32" = "yes" ; then
481 cross_prefix=""
482 v4l="no"
483 audio_oss="no"
8aa3ee32 484 dv1394="no"
732d9245
BE
485 network="no"
486fi
487
0f3cb305
FB
488cc="${cross_prefix}${cc}"
489ar="${cross_prefix}${ar}"
be7109c1 490ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
491strip="${cross_prefix}${strip}"
492
487a54d7
FB
493if test -z "$cross_prefix" ; then
494
3d204385 495# ---
a3999908
MN
496# big/little endian test
497cat > $TMPC << EOF
498#include <inttypes.h>
499int main(int argc, char ** argv){
500 volatile uint32_t i=0x01234567;
501 return (*((uint8_t*)(&i))) == 0x67;
502}
503EOF
504
f3ec2d46
SG
505if $cc -o $TMPE $TMPC 2>/dev/null ; then
506$TMPE && bigendian="yes"
a3999908
MN
507else
508echo big/little test failed
509fi
510
487a54d7
FB
511else
512
513# if cross compiling, cannot launch a program, so make a static guess
514if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
515 bigendian="yes"
516fi
517
518fi
519
a3999908 520# ---
3d204385
NK
521# check availability of some header files
522
523cat > $TMPC << EOF
524#include <malloc.h>
525int main( void ) { return 0; }
526EOF
527
528_memalign=no
529_malloc_h=no
f3ec2d46 530if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
531_malloc_h=yes
532_memalign=yes
533# check for memalign - atmos
534cat > $TMPC << EOF
535#include <malloc.h>
536int main ( void ) {
537char *string = NULL;
538string = memalign(64, sizeof(char));
539return 0;
540}
541EOF
f3ec2d46 542$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
543fi
544
68892110
PG
545cat > $TMPC << EOF
546#define _GNU_SOURCE
547#include <time.h>
548int main( void ) { return *strptime("", "", 0); }
549EOF
550
551strptime=no
f3ec2d46 552if $cc -o $TMPE $TMPC 2> /dev/null ; then
68892110
PG
553 strptime=yes
554fi
555
0147f198
FR
556if test "$zlib" = "yes"; then
557# check for zlib - mmu_man
558cat > $TMPC << EOF
559#include <zlib.h>
560int main ( void ) {
561if (zlibVersion() != ZLIB_VERSION)
562 puts("zlib version differs !!!");
563 return 1;
564return 0;
565}
566EOF
f3ec2d46
SG
567$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
568# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
569# XXX: more tests needed - runtime test
570fi
571if test "$zlib" = "yes"; then
572extralibs="$extralibs -lz"
573fi
574
95e2ce4a
MN
575# test for lrintf in math.h
576cat > $TMPC << EOF
577#define _ISOC9X_SOURCE 1
578#include <math.h>
579int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
580EOF
581
582have_lrintf="no"
f3ec2d46 583if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 584 have_lrintf="yes"
f3ec2d46 585 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
95e2ce4a
MN
586fi
587
c13e1abd
FH
588_restrict=
589for restrict_keyword in restrict __restrict__ __restrict; do
590 echo "void foo(char * $restrict_keyword p);" > $TMPC
591 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
592 _restrict=$restrict_keyword
593 break;
594 fi
595done
596
52b41d7f
FB
597# test gcc version to see if vector builtins can be used
598# currently only used on i386 for MMX builtins
599cat > $TMPC << EOF
600int main(void) {
601#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
602return 0;
603#else
604#error no vector builtins
605#endif
606}
607EOF
608
609builtin_vector=no
610if $cc -o $TMPO $TMPC 2> /dev/null ; then
611 builtin_vector=yes
a8721c09
FB
612fi
613
614# dlopen/dlfcn.h probing
615
616cat > $TMPC << EOF
617#include <dlfcn.h>
618int main( void ) { return (int) dlopen("foo", 0); }
619EOF
620
621ldl=-ldl
622
623if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
624dlfcn=yes
625dlopen=yes
626fi
627
628if $cc -o $TMPE $TMPC 2> /dev/null ; then
629dlfcn=yes
630dlopen=yes
631ldl=""
632fi
633
634cat > $TMPC << EOF
635int main( void ) { return (int) dlopen("foo", 0); }
636EOF
637
638if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
639dlopen=yes
640fi
641
642if $cc -o $TMPE $TMPC 2> /dev/null ; then
643dlopen=yes
644ldl=""
645fi
646
647if test "$vhook" = "default" ; then
648 vhook="$dlopen"
649fi
650
a86b921c
FB
651##########################################
652# imlib probe
653
a8721c09
FB
654cat > $TMPC << EOF
655#include <X11/Xlib.h>
656#include <Imlib2.h>
657int main( void ) { return (int) imlib_load_font("foo"); }
658EOF
659
660imlib2=no
661if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
662imlib2=yes
52b41d7f
FB
663fi
664
a86b921c
FB
665##########################################
666# freetype probe
667
04511d53
PG
668cat > $TMPC << EOF
669#include <ft2build.h>
670int main( void ) { return (int) FT_Init_FreeType(0); }
671EOF
672
673freetype2=no
69db4e10 674if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
6e023978 675 if test "`which freetype-config`" != ""; then
04511d53 676 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
dee076fc 677 freetype2=yes
04511d53 678 fi
dee076fc 679 fi
04511d53
PG
680fi
681
a86b921c
FB
682##########################################
683# SDL probe
684
685cat > $TMPC << EOF
686#include <SDL.h>
31319a8c 687#undef main /* We don't want SDL to override our main() */
a86b921c
FB
688int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
689EOF
690
691sdl_too_old=no
692sdl=no
693if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then
694_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
695if test "$_sdlversion" -lt 121 ; then
696sdl_too_old=yes
697else
698sdl=yes
699fi
700fi
701
94a3401e
FB
702if test "$sdl" = "no" ; then
703 ffplay=no
704fi
705
c9f97d82 706if test "$small" = "yes"; then
98ca7790 707# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
708 CFLAGS="$CFLAGS -Os"
709fi
710
6063bce7 711if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
712cat << EOF
713
714Usage: configure [options]
715Options: [defaults in brackets after descriptions]
716
717EOF
718echo "Standard options:"
719echo " --help print this message"
720echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305 721echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
81e0d0b4 722echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
0fc50e58
ZK
723echo " --enable-faad enable faad support via libfaad [default=no]"
724echo " --enable-faadbin build faad support with runtime linking [default=no]"
0f3cb305 725echo " --enable-win32 enable win32 cross compile"
732d9245 726echo " --enable-mingw32 enable mingw32 native windows compile"
5cbcf02c 727echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305 728echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
bba9b16c
MN
729echo " --disable-pp disable GPL'ed post processing support [default=no]"
730echo " --enable-shared-pp use libpostproc.so [default=no]"
0f3cb305 731echo " --enable-shared build shared libraries [default=no]"
bc634f6f
ZK
732echo " --enable-amr_nb enable amr_nb float audio codec"
733echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
0f3cb305
FB
734echo ""
735echo "Advanced options (experts only):"
736echo " --source-path=PATH path of source code [$source_path]"
737echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
738echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 739echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
740echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
741echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
742echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
743echo " --cpu=CPU force cpu to CPU [$cpu]"
a4adb608 744echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
0f3cb305 745echo " --disable-mmx disable mmx usage"
ab6c65f6 746echo " --disable-altivec disable AltiVec usage"
5cbcf02c 747echo " --disable-audio-oss disable OSS audio support [default=no]"
dfdfa47c 748echo " --disable-audio-beos disable BeOS audio support [default=no]"
6063bce7 749echo " --disable-v4l disable video4linux grabbing [default=no]"
8aa3ee32 750echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
5cbcf02c 751echo " --disable-network disable network support [default=no]"
0147f198 752echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 753echo " --disable-simple_idct disable simple IDCT routines [default=no]"
47930f09 754echo " --disable-vhook disable video hooking support"
0f3cb305 755echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
756echo " --disable-mpegaudio-hp faster (but less accurate)"
757echo " mpegaudio decoding [default=no]"
8154d2e0 758echo " --disable-ffserver disable ffserver build"
a86b921c 759echo " --disable-ffplay disable ffplay build"
1d0d55da 760echo " --disable-risky disables patent encumbered codecs"
553a6284 761echo " --enable-small optimize for size instead of speed"
0f3cb305
FB
762echo ""
763echo "NOTE: The object files are build at the place where configure is launched"
764exit 1
765fi
766
de6d9b64 767echo "Install prefix $prefix"
0f3cb305 768echo "Source path $source_path"
de6d9b64 769echo "C compiler $cc"
4a908fbc 770echo "make $make"
a4adb608 771echo "CPU $cpu ($tune)"
0f3cb305 772echo "Big Endian $bigendian"
e41e8342 773if test $cpu = "x86"; then
de6d9b64 774echo "MMX enabled $mmx"
52b41d7f 775echo "Vector Builtins $builtin_vector"
e41e8342
FB
776fi
777if test $cpu = "mips"; then
d46aba26 778echo "MMI enabled $mmi"
e41e8342
FB
779fi
780if test $cpu = "powerpc"; then
ab6c65f6 781echo "AltiVec enabled $altivec"
e41e8342 782fi
de6d9b64 783echo "gprof enabled $gprof"
0147f198 784echo "zlib enabled $zlib"
a6741398 785echo "mp3lame enabled $mp3lame"
81e0d0b4 786echo "vorbis enabled $vorbis"
445ad18d
ZK
787echo "faad enabled $faad"
788echo "faadbin enabled $faadbin"
5cbcf02c 789echo "a52 support $a52"
57514323 790echo "a52 dlopened $a52bin"
bba9b16c
MN
791echo "pp support $pp"
792echo "shared pp $shared_pp"
47930f09 793echo "Video hooking $vhook"
a86b921c
FB
794echo "SDL support $sdl"
795if test $sdl_too_old = "yes"; then
796echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
797fi
1d0d55da 798echo "risky / patent encumbered codecs $risky"
553a6284 799echo "optimize for size $small"
68892110
PG
800
801if test "$vhook" = "yes" ; then
47930f09 802echo "Imlib2 support $imlib2"
04511d53 803echo "freetype support $freetype2"
68892110 804fi
bc634f6f
ZK
805echo "AMR-NB float support" $amr_nb
806echo "AMR-NB fixed support" $amr_nb_fixed
de6d9b64 807
980fc7b8 808echo "Creating config.mak and config.h"
de6d9b64 809
980fc7b8 810echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 811echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 812
980fc7b8 813echo "prefix=$prefix" >> config.mak
4a908fbc 814echo "MAKE=$make" >> config.mak
980fc7b8
FB
815echo "CC=$cc" >> config.mak
816echo "AR=$ar" >> config.mak
be7109c1 817echo "RANLIB=$ranlib" >> config.mak
0f3cb305 818echo "STRIP=$strip" >> config.mak
a9b3f630 819echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 820echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 821echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 822echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
823echo "LIBPREF=$LIBPREF" >> config.mak
824echo "LIBSUF=$LIBSUF" >> config.mak
825echo "SLIBPREF=$SLIBPREF" >> config.mak
826echo "SLIBSUF=$SLIBSUF" >> config.mak
6852ac95 827echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 828if test "$cpu" = "x86" ; then
980fc7b8 829 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 830 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 831elif test "$cpu" = "armv4l" ; then
6ed7422a 832 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 833 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 834elif test "$cpu" = "alpha" ; then
91d1f1a4 835 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 836 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
837elif test "$cpu" = "sparc64" ; then
838 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
839 echo "#define ARCH_SPARC64 1" >> $TMPH
0f3cb305
FB
840elif test "$cpu" = "powerpc" ; then
841 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
842 echo "#define ARCH_POWERPC 1" >> $TMPH
35e5fb06
RD
843 echo "// Enable the next line to get PowerPC performance report" >> $TMPH
844 echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
845 echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
846 echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
d46aba26
LS
847elif test "$cpu" = "mips" ; then
848 echo "TARGET_ARCH_MIPS=yes" >> config.mak
849 echo "#define ARCH_MIPS 1" >> $TMPH
0f3cb305 850fi
a4adb608 851echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
852if test "$bigendian" = "yes" ; then
853 echo "WORDS_BIGENDIAN=yes" >> config.mak
854 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 855fi
57514323 856if test "$mmx" = "yes" ; then
980fc7b8 857 echo "TARGET_MMX=yes" >> config.mak
045ed63f 858 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 859 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 860fi
52b41d7f
FB
861if test "$builtin_vector" = "yes" ; then
862 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
863 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
864fi
d46aba26
LS
865if test "$mmi" = "yes" ; then
866 echo "TARGET_MMI=yes" >> config.mak
867 echo "#define HAVE_MMI 1" >> $TMPH
868fi
ab6c65f6
BF
869if test "$altivec" = "yes" ; then
870 echo "TARGET_ALTIVEC=yes" >> config.mak
871 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
872 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
873 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
874 if test "$_altivec_h" = "yes" ; then
875 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
876 else
e67e14d5 877 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 878 fi
ab6c65f6 879fi
57514323 880if test "$gprof" = "yes" ; then
980fc7b8 881 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 882 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 883fi
68892110
PG
884if test "$strptime" = "yes" ; then
885 echo "#define HAVE_STRPTIME 1" >> $TMPH
886else
887 echo "BUILD_STRPTIME=yes" >> config.mak
888fi
889if test "$imlib2" = "yes" ; then
890 echo "HAVE_IMLIB2=yes" >> config.mak
891fi
04511d53
PG
892if test "$freetype2" = "yes" ; then
893 echo "HAVE_FREETYPE2=yes" >> config.mak
894fi
a86b921c
FB
895if test "$sdl" = "yes" ; then
896 echo "CONFIG_SDL=yes" >> config.mak
897 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
898 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
899fi
95e2ce4a
MN
900if test "$have_lrintf" = "yes" ; then
901 echo "#define HAVE_LRINTF 1" >> $TMPH
902fi
68892110
PG
903if test "$vhook" = "yes" ; then
904 echo "BUILD_VHOOK=yes" >> config.mak
905 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 906 extralibs="$extralibs $ldl"
68892110 907fi
57514323 908if test "$lshared" = "yes" ; then
0319c531 909 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 910 echo "PIC=-fPIC" >> config.mak
0319c531 911fi
ef0bc4c9 912echo "EXTRALIBS=$extralibs" >> config.mak
586bc755 913echo "VERSION=`head $source_path/VERSION`" >>config.mak
0319c531 914echo "" >>config.mak
d771bcae 915# if you do not want to use encoders, disable that.
045ed63f 916echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
917echo "CONFIG_ENCODERS=yes" >> config.mak
918
919# if you do not want to use decoders, disable that.
045ed63f 920echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
921echo "CONFIG_DECODERS=yes" >> config.mak
922
5cbcf02c
FB
923# AC3
924if test "$a52" = "yes" ; then
925 echo "#define CONFIG_AC3 1" >> $TMPH
926 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 927
5cbcf02c
FB
928 if test "$a52bin" = "yes" ; then
929 echo "#define CONFIG_A52BIN 1" >> $TMPH
930 echo "CONFIG_A52BIN=yes" >> config.mak
931 fi
932fi
933
bba9b16c
MN
934# PP
935if test "$pp" = "yes" ; then
936 echo "#define CONFIG_PP 1" >> $TMPH
937 echo "CONFIG_PP=yes" >> config.mak
938
939 if test "$shared_pp" = "yes" ; then
940 echo "#define SHARED_PP 1" >> $TMPH
941 echo "SHARED_PP=yes" >> config.mak
942 fi
943fi
944
1eb2212e
FB
945# mpeg audio high precision mode
946if test "$mpegaudio_hp" = "yes" ; then
947 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
948fi
949
5cbcf02c
FB
950if test "$v4l" = "yes" ; then
951 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
952 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
953fi
954
8aa3ee32
MK
955if test "$dv1394" = "yes" ; then
956 echo "#define CONFIG_DV1394 1" >> $TMPH
957 echo "CONFIG_DV1394=yes" >> config.mak
958fi
959
adbc0510
PG
960if test "$dlopen" = "yes" ; then
961 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
962fi
963
964if test "$dlfcn" = "yes" ; then
965 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
966fi
967
5cbcf02c
FB
968if test "$audio_oss" = "yes" ; then
969 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
970 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
971fi
972
dfdfa47c
FR
973if test "$audio_beos" = "yes" ; then
974 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
975 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
976fi
977
5cbcf02c
FB
978if test "$network" = "yes" ; then
979 echo "#define CONFIG_NETWORK 1" >> $TMPH
980 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 981fi
daf8e955 982
0147f198
FR
983if test "$zlib" = "yes" ; then
984 echo "#define CONFIG_ZLIB 1" >> $TMPH
985 echo "CONFIG_ZLIB=yes" >> config.mak
986fi
987
57514323 988if test "$mp3lame" = "yes" ; then
045ed63f 989 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
990 echo "CONFIG_MP3LAME=yes" >> config.mak
991fi
992
81e0d0b4
MH
993if test "$vorbis" = "yes" ; then
994 echo "#define CONFIG_VORBIS 1" >> $TMPH
995 echo "CONFIG_VORBIS=yes" >> config.mak
996fi
997
0fc50e58
ZK
998if test "$faad" = "yes" ; then
999 echo "#define CONFIG_FAAD 1" >> $TMPH
1000 echo "CONFIG_FAAD=yes" >> config.mak
1001fi
1002
1003if test "$faadbin" = "yes" ; then
1004 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1005 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1006fi
1007
57514323 1008if test "$win32" = "yes" ; then
045ed63f 1009 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
1010 echo "CONFIG_WIN32=yes" >> config.mak
1011fi
3d204385 1012
732d9245
BE
1013if test "$mingw32" = "yes" ; then
1014 echo "#define CONFIG_WIN32 1" >> $TMPH
1015 echo "CONFIG_WIN32=yes" >> config.mak
1016 echo "#define __MINGW32__ 1" >> $TMPH
1017 echo "__MINGW32__=1" >> config.mak
1018fi
1019
3f027ca7
FB
1020if test "$cygwin" = "yes" ; then
1021 # setup correct exesuffix
1022 echo "CONFIG_WIN32=yes" >> config.mak
1023fi
1024
f3ec2d46
SG
1025if test "$os2" = "yes" ; then
1026 echo "#define CONFIG_OS2 1" >> $TMPH
1027 echo "CONFIG_OS2=yes" >> config.mak
1028fi
1029
6e023978
RS
1030if test "$TARGET_OS" = "SunOS" ; then
1031 echo "#define CONFIG_SUNOS 1" >> $TMPH
1032fi
1033
90cee0c3
MN
1034if test "$darwin" = "yes"; then
1035 echo "#define CONFIG_DARWIN 1" >> $TMPH
1036 echo "CONFIG_DARWIN=yes" >> config.mak
1037fi
1038
57514323 1039if test "$_malloc_h" = "yes" ; then
045ed63f 1040 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1041else
045ed63f 1042 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1043fi
1044
57514323 1045if test "$_memalign" = "yes" ; then
045ed63f
ZK
1046 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1047else
1048 echo "#undef HAVE_MEMALIGN" >> $TMPH
1049fi
1050
26b35efb
FR
1051if test "$netserver" = "yes" ; then
1052 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1053 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1054fi
1055
4baca069
PG
1056if test "$need_inet_aton" = "yes" ; then
1057 echo "NEED_INET_ATON=yes" >> config.mak
1058fi
1059
57514323 1060if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1061 echo "#define SIMPLE_IDCT 1" >> $TMPH
1062fi
1063
8154d2e0
FB
1064if test "$ffserver" = "yes" ; then
1065 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1066 echo "CONFIG_FFSERVER=yes" >> config.mak
1067fi
1068
a86b921c
FB
1069if test "$ffplay" = "yes" ; then
1070 echo "CONFIG_FFPLAY=yes" >> config.mak
1071fi
1072
1d0d55da
MN
1073if test "$risky" = "yes" ; then
1074 echo "#define CONFIG_RISKY 1" >> $TMPH
1075 echo "CONFIG_RISKY=yes" >> config.mak
1076fi
1077
c13e1abd
FH
1078echo "#define restrict $_restrict" >> $TMPH
1079
0f3cb305
FB
1080# build tree in object directory if source path is different from current one
1081if test "$source_path_used" = "yes" ; then
a382b927 1082 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
5f6b58de
MR
1083 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1084 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
1085 for dir in $DIRS ; do
1086 mkdir -p $dir
1087 done
1088 for f in $FILES ; do
1089 ln -sf $source_path/$f $f
1090 done
1091fi
1092echo "SRC_PATH=$source_path" >> config.mak
1093
891f64b3 1094if test "$amr_nb" = "yes" ; then
1095 echo "#define AMR_NB 1" >> $TMPH
1096 echo "AMR_NB=yes" >> config.mak
1097 echo
bc634f6f
ZK
1098if test "$amr_nb_fixed" = "yes" ; then
1099 echo "AMR_NB_FIXED=yes" >> config.mak
1100 echo "#define AMR_NB_FIXED 1" >> $TMPH
1101 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1102 echo "REL-5 version 5.1.0 from "
891f64b3 1103 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1104 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1105 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1106 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1107 echo
1108else
1109 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1110 echo "REL-5 V5.1.0 from "
1111 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1112 echo "and extracted the source to libavcodec/amr_float"
891f64b3 1113 echo
1114fi
1115
bc634f6f
ZK
1116fi
1117
a7c02e25 1118diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
1119if test $? -ne 0 ; then
1120 mv -f $TMPH config.h
3d204385 1121else
045ed63f 1122 echo "config.h is unchanged"
3d204385
NK
1123fi
1124
f3ec2d46 1125rm -f $TMPO $TMPC $TMPE $TMPS $TMPH