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