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