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