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