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