10l
[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.
586bc755 237source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
238source_path_used="yes"
239if test -z "$source_path" -o "$source_path" = "." ; then
240 source_path=`pwd`
241 source_path_used="no"
de6d9b64
FB
242fi
243
244for opt do
245 case "$opt" in
246 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
247 ;;
0f3cb305
FB
248 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
249 ;;
250 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
251 ;;
de6d9b64
FB
252 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
253 ;;
4a908fbc
AB
254 --make=*) make=`echo $opt | cut -d '=' -f 2`
255 ;;
0f3cb305
FB
256 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
257 ;;
258 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
259 ;;
260 --extra-libs=*) extralibs=${opt#--extra-libs=}
261 ;;
de6d9b64
FB
262 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
263 ;;
264 --disable-mmx) mmx="no"
265 ;;
ab6c65f6
BF
266 --disable-altivec) altivec="no"
267 ;;
de6d9b64
FB
268 --enable-gprof) gprof="yes"
269 ;;
5cbcf02c
FB
270 --disable-v4l) v4l="no"
271 ;;
272 --disable-audio-oss) audio_oss="no"
273 ;;
dfdfa47c
FR
274 --disable-audio-beos) audio_beos="no"
275 ;;
8aa3ee32
MK
276 --disable-dv1394) dv1394="no"
277 ;;
5cbcf02c
FB
278 --disable-network) network="no"
279 ;;
0147f198
FR
280 --disable-zlib) zlib="no"
281 ;;
5cbcf02c 282 --disable-a52) a52="no"
6ed7422a 283 ;;
9c938e77 284 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 285 ;;
bba9b16c
MN
286 --disable-pp) pp="no"
287 ;;
288 --enable-shared-pp) shared_pp="yes"
289 ;;
a6741398
J
290 --enable-mp3lame) mp3lame="yes"
291 ;;
81e0d0b4
MH
292 --enable-vorbis) vorbis="yes"
293 ;;
68892110
PG
294 --disable-vhook) vhook="no"
295 ;;
c02dbee1 296 --disable-simple_idct) simpleidct="no"
045ed63f 297 ;;
daf8e955
FB
298 --enable-win32) win32="yes"
299 ;;
732d9245
BE
300 --enable-mingw32) mingw32="yes"
301 ;;
83286d2a 302 --enable-shared) lshared="yes"
0319c531 303 ;;
1eb2212e
FB
304 --disable-mpegaudio-hp) mpegaudio_hp="no"
305 ;;
8154d2e0
FB
306 --disable-ffserver) ffserver="no"
307 ;;
1d0d55da
MN
308 --disable-risky) risky="no"
309 ;;
de6d9b64
FB
310 esac
311done
312
0f3cb305
FB
313# compute mmx state
314if test $mmx = "default"; then
315 if test $cpu = "x86"; then
316 mmx="yes"
317 else
318 mmx="no"
319 fi
320fi
321
ab6c65f6
BF
322# Can only do AltiVec on PowerPC
323if test $altivec = "default"; then
324 if test $cpu = "powerpc"; then
325 altivec="yes"
326 else
327 altivec="no"
328 fi
329fi
330
331# See does our compiler support Motorola AltiVec C API
332if test $altivec = "yes"; then
333cat > $TMPC << EOF
334int main(void) {
335 vector signed int v1, v2, v3;
336 v1 = vec_add(v2,v3);
337 return 0;
338}
339EOF
f3ec2d46 340$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
ab6c65f6
BF
341fi
342
d46aba26
LS
343# Can only do mmi on mips
344if test $mmi = "default"; then
345 if test $cpu = "mips"; then
346 mmi="yes"
347 else
348 mmi="no"
349 fi
350fi
351
352# See does our compiler support mmi
353if test $mmi = "yes"; then
354cat > $TMPC << EOF
355int main(void) {
356 __asm__ ("lq \$2, 0(\$2)");
357 return 0;
358}
359EOF
f3ec2d46 360$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
361fi
362
daf8e955
FB
363# Checking for CFLAGS
364if test -z "$CFLAGS"; then
29482cb4 365 CFLAGS="-O3"
daf8e955
FB
366fi
367
57514323 368if test "$win32" = "yes" ; then
daf8e955 369 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
370 v4l="no"
371 audio_oss="no"
8aa3ee32 372 dv1394="no"
5cbcf02c 373 network="no"
daf8e955
FB
374fi
375
732d9245
BE
376if test "$mingw32" = "yes" ; then
377 cross_prefix=""
378 v4l="no"
379 audio_oss="no"
8aa3ee32 380 dv1394="no"
732d9245
BE
381 network="no"
382fi
383
0f3cb305
FB
384cc="${cross_prefix}${cc}"
385ar="${cross_prefix}${ar}"
be7109c1 386ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
387strip="${cross_prefix}${strip}"
388
487a54d7
FB
389if test -z "$cross_prefix" ; then
390
3d204385 391# ---
a3999908
MN
392# big/little endian test
393cat > $TMPC << EOF
394#include <inttypes.h>
395int main(int argc, char ** argv){
396 volatile uint32_t i=0x01234567;
397 return (*((uint8_t*)(&i))) == 0x67;
398}
399EOF
400
f3ec2d46
SG
401if $cc -o $TMPE $TMPC 2>/dev/null ; then
402$TMPE && bigendian="yes"
a3999908
MN
403else
404echo big/little test failed
405fi
406
487a54d7
FB
407else
408
409# if cross compiling, cannot launch a program, so make a static guess
410if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
411 bigendian="yes"
412fi
413
414fi
415
a3999908 416# ---
3d204385
NK
417# check availability of some header files
418
419cat > $TMPC << EOF
420#include <malloc.h>
421int main( void ) { return 0; }
422EOF
423
424_memalign=no
425_malloc_h=no
f3ec2d46 426if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
427_malloc_h=yes
428_memalign=yes
429# check for memalign - atmos
430cat > $TMPC << EOF
431#include <malloc.h>
432int main ( void ) {
433char *string = NULL;
434string = memalign(64, sizeof(char));
435return 0;
436}
437EOF
f3ec2d46 438$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
439fi
440
68892110
PG
441cat > $TMPC << EOF
442#define _GNU_SOURCE
443#include <time.h>
444int main( void ) { return *strptime("", "", 0); }
445EOF
446
447strptime=no
f3ec2d46 448if $cc -o $TMPE $TMPC 2> /dev/null ; then
68892110
PG
449 strptime=yes
450fi
451
0147f198
FR
452if test "$zlib" = "yes"; then
453# check for zlib - mmu_man
454cat > $TMPC << EOF
455#include <zlib.h>
456int main ( void ) {
457if (zlibVersion() != ZLIB_VERSION)
458 puts("zlib version differs !!!");
459 return 1;
460return 0;
461}
462EOF
f3ec2d46
SG
463$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
464# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
465# XXX: more tests needed - runtime test
466fi
467if test "$zlib" = "yes"; then
468extralibs="$extralibs -lz"
469fi
470
95e2ce4a
MN
471# test for lrintf in math.h
472cat > $TMPC << EOF
473#define _ISOC9X_SOURCE 1
474#include <math.h>
475int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
476EOF
477
478have_lrintf="no"
f3ec2d46 479if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 480 have_lrintf="yes"
f3ec2d46 481 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
95e2ce4a
MN
482fi
483
c13e1abd
FH
484_restrict=
485for restrict_keyword in restrict __restrict__ __restrict; do
486 echo "void foo(char * $restrict_keyword p);" > $TMPC
487 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
488 _restrict=$restrict_keyword
489 break;
490 fi
491done
492
52b41d7f
FB
493# test gcc version to see if vector builtins can be used
494# currently only used on i386 for MMX builtins
495cat > $TMPC << EOF
496int main(void) {
497#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
498return 0;
499#else
500#error no vector builtins
501#endif
502}
503EOF
504
505builtin_vector=no
506if $cc -o $TMPO $TMPC 2> /dev/null ; then
507 builtin_vector=yes
a8721c09
FB
508fi
509
510# dlopen/dlfcn.h probing
511
512cat > $TMPC << EOF
513#include <dlfcn.h>
514int main( void ) { return (int) dlopen("foo", 0); }
515EOF
516
517ldl=-ldl
518
519if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
520dlfcn=yes
521dlopen=yes
522fi
523
524if $cc -o $TMPE $TMPC 2> /dev/null ; then
525dlfcn=yes
526dlopen=yes
527ldl=""
528fi
529
530cat > $TMPC << EOF
531int main( void ) { return (int) dlopen("foo", 0); }
532EOF
533
534if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
535dlopen=yes
536fi
537
538if $cc -o $TMPE $TMPC 2> /dev/null ; then
539dlopen=yes
540ldl=""
541fi
542
543if test "$vhook" = "default" ; then
544 vhook="$dlopen"
545fi
546
547cat > $TMPC << EOF
548#include <X11/Xlib.h>
549#include <Imlib2.h>
550int main( void ) { return (int) imlib_load_font("foo"); }
551EOF
552
553imlib2=no
554if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
555imlib2=yes
52b41d7f
FB
556fi
557
04511d53
PG
558cat > $TMPC << EOF
559#include <ft2build.h>
560int main( void ) { return (int) FT_Init_FreeType(0); }
561EOF
562
563freetype2=no
69db4e10 564if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
dee076fc
FR
565 which freetype-config > /dev/null
566 if test $? -eq 0; then
04511d53 567 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
dee076fc 568 freetype2=yes
04511d53 569 fi
dee076fc 570 fi
04511d53
PG
571fi
572
6063bce7 573if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
574cat << EOF
575
576Usage: configure [options]
577Options: [defaults in brackets after descriptions]
578
579EOF
580echo "Standard options:"
581echo " --help print this message"
582echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305 583echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
81e0d0b4 584echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
0f3cb305 585echo " --enable-win32 enable win32 cross compile"
732d9245 586echo " --enable-mingw32 enable mingw32 native windows compile"
5cbcf02c 587echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305 588echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
bba9b16c
MN
589echo " --disable-pp disable GPL'ed post processing support [default=no]"
590echo " --enable-shared-pp use libpostproc.so [default=no]"
0f3cb305
FB
591echo " --enable-shared build shared libraries [default=no]"
592echo ""
593echo "Advanced options (experts only):"
594echo " --source-path=PATH path of source code [$source_path]"
595echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
596echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 597echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
598echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
599echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
600echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
601echo " --cpu=CPU force cpu to CPU [$cpu]"
602echo " --disable-mmx disable mmx usage"
ab6c65f6 603echo " --disable-altivec disable AltiVec usage"
5cbcf02c 604echo " --disable-audio-oss disable OSS audio support [default=no]"
dfdfa47c 605echo " --disable-audio-beos disable BeOS audio support [default=no]"
6063bce7 606echo " --disable-v4l disable video4linux grabbing [default=no]"
8aa3ee32 607echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
5cbcf02c 608echo " --disable-network disable network support [default=no]"
0147f198 609echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 610echo " --disable-simple_idct disable simple IDCT routines [default=no]"
47930f09 611echo " --disable-vhook disable video hooking support"
0f3cb305 612echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
613echo " --disable-mpegaudio-hp faster (but less accurate)"
614echo " mpegaudio decoding [default=no]"
8154d2e0 615echo " --disable-ffserver disable ffserver build"
1d0d55da 616echo " --disable-risky disables patent encumbered codecs"
0f3cb305
FB
617echo ""
618echo "NOTE: The object files are build at the place where configure is launched"
619exit 1
620fi
621
de6d9b64 622echo "Install prefix $prefix"
0f3cb305 623echo "Source path $source_path"
de6d9b64 624echo "C compiler $cc"
4a908fbc 625echo "make $make"
de6d9b64 626echo "CPU $cpu"
0f3cb305 627echo "Big Endian $bigendian"
e41e8342 628if test $cpu = "x86"; then
de6d9b64 629echo "MMX enabled $mmx"
52b41d7f 630echo "Vector Builtins $builtin_vector"
e41e8342
FB
631fi
632if test $cpu = "mips"; then
d46aba26 633echo "MMI enabled $mmi"
e41e8342
FB
634fi
635if test $cpu = "powerpc"; then
ab6c65f6 636echo "AltiVec enabled $altivec"
e41e8342 637fi
de6d9b64 638echo "gprof enabled $gprof"
0147f198 639echo "zlib enabled $zlib"
a6741398 640echo "mp3lame enabled $mp3lame"
81e0d0b4 641echo "vorbis enabled $vorbis"
5cbcf02c 642echo "a52 support $a52"
57514323 643echo "a52 dlopened $a52bin"
bba9b16c
MN
644echo "pp support $pp"
645echo "shared pp $shared_pp"
47930f09 646echo "Video hooking $vhook"
1d0d55da 647echo "risky / patent encumbered codecs $risky"
68892110
PG
648
649if test "$vhook" = "yes" ; then
47930f09 650echo "Imlib2 support $imlib2"
04511d53 651echo "freetype support $freetype2"
68892110 652fi
de6d9b64 653
980fc7b8 654echo "Creating config.mak and config.h"
de6d9b64 655
980fc7b8 656echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 657echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 658
980fc7b8 659echo "prefix=$prefix" >> config.mak
4a908fbc 660echo "MAKE=$make" >> config.mak
980fc7b8
FB
661echo "CC=$cc" >> config.mak
662echo "AR=$ar" >> config.mak
be7109c1 663echo "RANLIB=$ranlib" >> config.mak
0f3cb305 664echo "STRIP=$strip" >> config.mak
a9b3f630 665echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 666echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 667echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 668echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
669echo "LIBPREF=$LIBPREF" >> config.mak
670echo "LIBSUF=$LIBSUF" >> config.mak
671echo "SLIBPREF=$SLIBPREF" >> config.mak
672echo "SLIBSUF=$SLIBSUF" >> config.mak
6852ac95 673echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 674if test "$cpu" = "x86" ; then
980fc7b8 675 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 676 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 677elif test "$cpu" = "armv4l" ; then
6ed7422a 678 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 679 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 680elif test "$cpu" = "alpha" ; then
91d1f1a4 681 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 682 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
683elif test "$cpu" = "sparc64" ; then
684 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
685 echo "#define ARCH_SPARC64 1" >> $TMPH
0f3cb305
FB
686elif test "$cpu" = "powerpc" ; then
687 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
688 echo "#define ARCH_POWERPC 1" >> $TMPH
35e5fb06
RD
689 echo "// Enable the next line to get PowerPC performance report" >> $TMPH
690 echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
691 echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
692 echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
d46aba26
LS
693elif test "$cpu" = "mips" ; then
694 echo "TARGET_ARCH_MIPS=yes" >> config.mak
695 echo "#define ARCH_MIPS 1" >> $TMPH
0f3cb305
FB
696fi
697if test "$bigendian" = "yes" ; then
698 echo "WORDS_BIGENDIAN=yes" >> config.mak
699 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 700fi
57514323 701if test "$mmx" = "yes" ; then
980fc7b8 702 echo "TARGET_MMX=yes" >> config.mak
045ed63f 703 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 704fi
52b41d7f
FB
705if test "$builtin_vector" = "yes" ; then
706 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
707 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
708fi
d46aba26
LS
709if test "$mmi" = "yes" ; then
710 echo "TARGET_MMI=yes" >> config.mak
711 echo "#define HAVE_MMI 1" >> $TMPH
712fi
ab6c65f6
BF
713if test "$altivec" = "yes" ; then
714 echo "TARGET_ALTIVEC=yes" >> config.mak
715 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
716 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
717 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
ab6c65f6 718fi
57514323 719if test "$gprof" = "yes" ; then
980fc7b8 720 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 721 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 722fi
68892110
PG
723if test "$strptime" = "yes" ; then
724 echo "#define HAVE_STRPTIME 1" >> $TMPH
725else
726 echo "BUILD_STRPTIME=yes" >> config.mak
727fi
728if test "$imlib2" = "yes" ; then
729 echo "HAVE_IMLIB2=yes" >> config.mak
730fi
04511d53
PG
731if test "$freetype2" = "yes" ; then
732 echo "HAVE_FREETYPE2=yes" >> config.mak
733fi
95e2ce4a
MN
734if test "$have_lrintf" = "yes" ; then
735 echo "#define HAVE_LRINTF 1" >> $TMPH
736fi
68892110
PG
737if test "$vhook" = "yes" ; then
738 echo "BUILD_VHOOK=yes" >> config.mak
739 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 740 extralibs="$extralibs $ldl"
68892110 741fi
57514323 742if test "$lshared" = "yes" ; then
0319c531 743 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 744 echo "PIC=-fPIC" >> config.mak
0319c531 745fi
ef0bc4c9 746echo "EXTRALIBS=$extralibs" >> config.mak
586bc755 747echo "VERSION=`head $source_path/VERSION`" >>config.mak
0319c531 748echo "" >>config.mak
d771bcae 749# if you do not want to use encoders, disable that.
045ed63f 750echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
751echo "CONFIG_ENCODERS=yes" >> config.mak
752
753# if you do not want to use decoders, disable that.
045ed63f 754echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
755echo "CONFIG_DECODERS=yes" >> config.mak
756
5cbcf02c
FB
757# AC3
758if test "$a52" = "yes" ; then
759 echo "#define CONFIG_AC3 1" >> $TMPH
760 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 761
5cbcf02c
FB
762 if test "$a52bin" = "yes" ; then
763 echo "#define CONFIG_A52BIN 1" >> $TMPH
764 echo "CONFIG_A52BIN=yes" >> config.mak
765 fi
766fi
767
bba9b16c
MN
768# PP
769if test "$pp" = "yes" ; then
770 echo "#define CONFIG_PP 1" >> $TMPH
771 echo "CONFIG_PP=yes" >> config.mak
772
773 if test "$shared_pp" = "yes" ; then
774 echo "#define SHARED_PP 1" >> $TMPH
775 echo "SHARED_PP=yes" >> config.mak
776 fi
777fi
778
1eb2212e
FB
779# mpeg audio high precision mode
780if test "$mpegaudio_hp" = "yes" ; then
781 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
782fi
783
5cbcf02c
FB
784if test "$v4l" = "yes" ; then
785 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
786 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
787fi
788
8aa3ee32
MK
789if test "$dv1394" = "yes" ; then
790 echo "#define CONFIG_DV1394 1" >> $TMPH
791 echo "CONFIG_DV1394=yes" >> config.mak
792fi
793
adbc0510
PG
794if test "$dlopen" = "yes" ; then
795 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
796fi
797
798if test "$dlfcn" = "yes" ; then
799 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
800fi
801
5cbcf02c
FB
802if test "$audio_oss" = "yes" ; then
803 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
804 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
805fi
806
dfdfa47c
FR
807if test "$audio_beos" = "yes" ; then
808 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
809 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
810fi
811
5cbcf02c
FB
812if test "$network" = "yes" ; then
813 echo "#define CONFIG_NETWORK 1" >> $TMPH
814 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 815fi
daf8e955 816
0147f198
FR
817if test "$zlib" = "yes" ; then
818 echo "#define CONFIG_ZLIB 1" >> $TMPH
819 echo "CONFIG_ZLIB=yes" >> config.mak
820fi
821
57514323 822if test "$mp3lame" = "yes" ; then
045ed63f 823 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
824 echo "CONFIG_MP3LAME=yes" >> config.mak
825fi
826
81e0d0b4
MH
827if test "$vorbis" = "yes" ; then
828 echo "#define CONFIG_VORBIS 1" >> $TMPH
829 echo "CONFIG_VORBIS=yes" >> config.mak
830fi
831
57514323 832if test "$win32" = "yes" ; then
045ed63f 833 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
834 echo "CONFIG_WIN32=yes" >> config.mak
835fi
3d204385 836
732d9245
BE
837if test "$mingw32" = "yes" ; then
838 echo "#define CONFIG_WIN32 1" >> $TMPH
839 echo "CONFIG_WIN32=yes" >> config.mak
840 echo "#define __MINGW32__ 1" >> $TMPH
841 echo "__MINGW32__=1" >> config.mak
842fi
843
3f027ca7
FB
844if test "$cygwin" = "yes" ; then
845 # setup correct exesuffix
846 echo "CONFIG_WIN32=yes" >> config.mak
847fi
848
f3ec2d46
SG
849if test "$os2" = "yes" ; then
850 echo "#define CONFIG_OS2 1" >> $TMPH
851 echo "CONFIG_OS2=yes" >> config.mak
852fi
853
90cee0c3
MN
854if test "$darwin" = "yes"; then
855 echo "#define CONFIG_DARWIN 1" >> $TMPH
856 echo "CONFIG_DARWIN=yes" >> config.mak
857fi
858
57514323 859if test "$_malloc_h" = "yes" ; then
045ed63f 860 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 861else
045ed63f 862 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
863fi
864
57514323 865if test "$_memalign" = "yes" ; then
045ed63f
ZK
866 echo "#define HAVE_MEMALIGN 1" >> $TMPH
867else
868 echo "#undef HAVE_MEMALIGN" >> $TMPH
869fi
870
26b35efb
FR
871if test "$netserver" = "yes" ; then
872 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
873 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
874fi
875
4baca069
PG
876if test "$need_inet_aton" = "yes" ; then
877 echo "NEED_INET_ATON=yes" >> config.mak
878fi
879
57514323 880if test "$simpleidct" = "yes" ; then
045ed63f
ZK
881 echo "#define SIMPLE_IDCT 1" >> $TMPH
882fi
883
8154d2e0
FB
884if test "$ffserver" = "yes" ; then
885 echo "#define CONFIG_FFSERVER 1" >> $TMPH
886 echo "CONFIG_FFSERVER=yes" >> config.mak
887fi
888
1d0d55da
MN
889if test "$risky" = "yes" ; then
890 echo "#define CONFIG_RISKY 1" >> $TMPH
891 echo "CONFIG_RISKY=yes" >> config.mak
892fi
893
c13e1abd
FH
894echo "#define restrict $_restrict" >> $TMPH
895
0f3cb305
FB
896# build tree in object directory if source path is different from current one
897if test "$source_path_used" = "yes" ; then
a382b927
FB
898 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
899 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
900 FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
901 for dir in $DIRS ; do
902 mkdir -p $dir
903 done
904 for f in $FILES ; do
905 ln -sf $source_path/$f $f
906 done
907fi
908echo "SRC_PATH=$source_path" >> config.mak
909
a7c02e25 910diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
911if test $? -ne 0 ; then
912 mv -f $TMPH config.h
3d204385 913else
045ed63f 914 echo "config.h is unchanged"
3d204385
NK
915fi
916
f3ec2d46 917rm -f $TMPO $TMPC $TMPE $TMPS $TMPH