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