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