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