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