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