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