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