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