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