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