PIC / ebx fix
[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
6063bce7 472if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
473cat << EOF
474
475Usage: configure [options]
476Options: [defaults in brackets after descriptions]
477
478EOF
479echo "Standard options:"
480echo " --help print this message"
481echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305 482echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
81e0d0b4 483echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
0f3cb305 484echo " --enable-win32 enable win32 cross compile"
732d9245 485echo " --enable-mingw32 enable mingw32 native windows compile"
5cbcf02c 486echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305
FB
487echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
488echo " --enable-shared build shared libraries [default=no]"
489echo ""
490echo "Advanced options (experts only):"
491echo " --source-path=PATH path of source code [$source_path]"
492echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
493echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 494echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
495echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
496echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
497echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
498echo " --cpu=CPU force cpu to CPU [$cpu]"
499echo " --disable-mmx disable mmx usage"
ab6c65f6 500echo " --disable-altivec disable AltiVec usage"
5cbcf02c 501echo " --disable-audio-oss disable OSS audio support [default=no]"
dfdfa47c 502echo " --disable-audio-beos disable BeOS audio support [default=no]"
6063bce7 503echo " --disable-v4l disable video4linux grabbing [default=no]"
5cbcf02c 504echo " --disable-network disable network support [default=no]"
0147f198 505echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 506echo " --disable-simple_idct disable simple IDCT routines [default=no]"
47930f09 507echo " --disable-vhook disable video hooking support"
0f3cb305 508echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
509echo " --disable-mpegaudio-hp faster (but less accurate)"
510echo " mpegaudio decoding [default=no]"
8154d2e0 511echo " --disable-ffserver disable ffserver build"
0f3cb305
FB
512echo ""
513echo "NOTE: The object files are build at the place where configure is launched"
514exit 1
515fi
516
de6d9b64 517echo "Install prefix $prefix"
0f3cb305 518echo "Source path $source_path"
de6d9b64 519echo "C compiler $cc"
4a908fbc 520echo "make $make"
de6d9b64 521echo "CPU $cpu"
0f3cb305 522echo "Big Endian $bigendian"
e41e8342 523if test $cpu = "x86"; then
de6d9b64 524echo "MMX enabled $mmx"
e41e8342
FB
525fi
526if test $cpu = "mips"; then
d46aba26 527echo "MMI enabled $mmi"
e41e8342
FB
528fi
529if test $cpu = "powerpc"; then
ab6c65f6 530echo "AltiVec enabled $altivec"
e41e8342 531fi
de6d9b64 532echo "gprof enabled $gprof"
0147f198 533echo "zlib enabled $zlib"
a6741398 534echo "mp3lame enabled $mp3lame"
81e0d0b4 535echo "vorbis enabled $vorbis"
5cbcf02c 536echo "a52 support $a52"
57514323 537echo "a52 dlopened $a52bin"
47930f09 538echo "Video hooking $vhook"
68892110
PG
539
540if test "$vhook" = "yes" ; then
47930f09 541echo "Imlib2 support $imlib2"
68892110 542fi
de6d9b64 543
980fc7b8 544echo "Creating config.mak and config.h"
de6d9b64 545
980fc7b8 546echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 547echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 548
980fc7b8 549echo "prefix=$prefix" >> config.mak
4a908fbc 550echo "MAKE=$make" >> config.mak
980fc7b8
FB
551echo "CC=$cc" >> config.mak
552echo "AR=$ar" >> config.mak
be7109c1 553echo "RANLIB=$ranlib" >> config.mak
0f3cb305 554echo "STRIP=$strip" >> config.mak
a9b3f630 555echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 556echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 557echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 558echo "SHFLAGS=$SHFLAGS" >> config.mak
57514323 559if test "$cpu" = "x86" ; then
980fc7b8 560 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 561 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 562elif test "$cpu" = "armv4l" ; then
6ed7422a 563 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 564 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 565elif test "$cpu" = "alpha" ; then
91d1f1a4 566 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 567 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
568elif test "$cpu" = "sparc64" ; then
569 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
570 echo "#define ARCH_SPARC64 1" >> $TMPH
0f3cb305
FB
571elif test "$cpu" = "powerpc" ; then
572 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
573 echo "#define ARCH_POWERPC 1" >> $TMPH
d46aba26
LS
574elif test "$cpu" = "mips" ; then
575 echo "TARGET_ARCH_MIPS=yes" >> config.mak
576 echo "#define ARCH_MIPS 1" >> $TMPH
0f3cb305
FB
577fi
578if test "$bigendian" = "yes" ; then
579 echo "WORDS_BIGENDIAN=yes" >> config.mak
580 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 581fi
57514323 582if test "$mmx" = "yes" ; then
980fc7b8 583 echo "TARGET_MMX=yes" >> config.mak
045ed63f 584 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 585fi
d46aba26
LS
586if test "$mmi" = "yes" ; then
587 echo "TARGET_MMI=yes" >> config.mak
588 echo "#define HAVE_MMI 1" >> $TMPH
589fi
ab6c65f6
BF
590if test "$altivec" = "yes" ; then
591 echo "TARGET_ALTIVEC=yes" >> config.mak
592 echo "#define HAVE_ALTIVEC 1" >> $TMPH
593fi
57514323 594if test "$gprof" = "yes" ; then
980fc7b8 595 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 596 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 597fi
68892110
PG
598if test "$strptime" = "yes" ; then
599 echo "#define HAVE_STRPTIME 1" >> $TMPH
600else
601 echo "BUILD_STRPTIME=yes" >> config.mak
602fi
603if test "$imlib2" = "yes" ; then
604 echo "HAVE_IMLIB2=yes" >> config.mak
605fi
95e2ce4a
MN
606if test "$have_lrintf" = "yes" ; then
607 echo "#define HAVE_LRINTF 1" >> $TMPH
608fi
68892110
PG
609if test "$vhook" = "yes" ; then
610 echo "BUILD_VHOOK=yes" >> config.mak
611 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 612 extralibs="$extralibs $ldl"
68892110 613fi
57514323 614if test "$lshared" = "yes" ; then
0319c531 615 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 616 echo "PIC=-fPIC" >> config.mak
0319c531 617fi
ef0bc4c9 618echo "EXTRALIBS=$extralibs" >> config.mak
0319c531 619echo -n "VERSION=" >>config.mak
0f3cb305 620head $source_path/VERSION >>config.mak
0319c531 621echo "" >>config.mak
d771bcae 622# if you do not want to use encoders, disable that.
045ed63f 623echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
624echo "CONFIG_ENCODERS=yes" >> config.mak
625
626# if you do not want to use decoders, disable that.
045ed63f 627echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
628echo "CONFIG_DECODERS=yes" >> config.mak
629
5cbcf02c
FB
630# AC3
631if test "$a52" = "yes" ; then
632 echo "#define CONFIG_AC3 1" >> $TMPH
633 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 634
5cbcf02c
FB
635 if test "$a52bin" = "yes" ; then
636 echo "#define CONFIG_A52BIN 1" >> $TMPH
637 echo "CONFIG_A52BIN=yes" >> config.mak
638 fi
639fi
640
1eb2212e
FB
641# mpeg audio high precision mode
642if test "$mpegaudio_hp" = "yes" ; then
643 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
644fi
645
5cbcf02c
FB
646if test "$v4l" = "yes" ; then
647 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
648 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
649fi
650
adbc0510
PG
651if test "$dlopen" = "yes" ; then
652 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
653fi
654
655if test "$dlfcn" = "yes" ; then
656 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
657fi
658
5cbcf02c
FB
659if test "$audio_oss" = "yes" ; then
660 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
661 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
662fi
663
dfdfa47c
FR
664if test "$audio_beos" = "yes" ; then
665 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
666 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
667fi
668
5cbcf02c
FB
669if test "$network" = "yes" ; then
670 echo "#define CONFIG_NETWORK 1" >> $TMPH
671 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 672fi
daf8e955 673
0147f198
FR
674if test "$zlib" = "yes" ; then
675 echo "#define CONFIG_ZLIB 1" >> $TMPH
676 echo "CONFIG_ZLIB=yes" >> config.mak
677fi
678
57514323 679if test "$mp3lame" = "yes" ; then
045ed63f 680 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
681 echo "CONFIG_MP3LAME=yes" >> config.mak
682fi
683
81e0d0b4
MH
684if test "$vorbis" = "yes" ; then
685 echo "#define CONFIG_VORBIS 1" >> $TMPH
686 echo "CONFIG_VORBIS=yes" >> config.mak
687fi
688
57514323 689if test "$win32" = "yes" ; then
045ed63f 690 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
691 echo "CONFIG_WIN32=yes" >> config.mak
692fi
3d204385 693
732d9245
BE
694if test "$mingw32" = "yes" ; then
695 echo "#define CONFIG_WIN32 1" >> $TMPH
696 echo "CONFIG_WIN32=yes" >> config.mak
697 echo "#define __MINGW32__ 1" >> $TMPH
698 echo "__MINGW32__=1" >> config.mak
699fi
700
3f027ca7
FB
701if test "$cygwin" = "yes" ; then
702 # setup correct exesuffix
703 echo "CONFIG_WIN32=yes" >> config.mak
704fi
705
90cee0c3
MN
706if test "$darwin" = "yes"; then
707 echo "#define CONFIG_DARWIN 1" >> $TMPH
708 echo "CONFIG_DARWIN=yes" >> config.mak
709fi
710
57514323 711if test "$_malloc_h" = "yes" ; then
045ed63f 712 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 713else
045ed63f 714 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
715fi
716
57514323 717if test "$_memalign" = "yes" ; then
045ed63f
ZK
718 echo "#define HAVE_MEMALIGN 1" >> $TMPH
719else
720 echo "#undef HAVE_MEMALIGN" >> $TMPH
721fi
722
26b35efb
FR
723if test "$netserver" = "yes" ; then
724 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
725 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
726fi
727
4baca069
PG
728if test "$need_inet_aton" = "yes" ; then
729 echo "NEED_INET_ATON=yes" >> config.mak
730fi
731
57514323 732if test "$simpleidct" = "yes" ; then
045ed63f
ZK
733 echo "#define SIMPLE_IDCT 1" >> $TMPH
734fi
735
8154d2e0
FB
736if test "$ffserver" = "yes" ; then
737 echo "#define CONFIG_FFSERVER 1" >> $TMPH
738 echo "CONFIG_FFSERVER=yes" >> config.mak
739fi
740
c13e1abd
FH
741echo "#define restrict $_restrict" >> $TMPH
742
0f3cb305
FB
743# build tree in object directory if source path is different from current one
744if test "$source_path_used" = "yes" ; then
a382b927
FB
745 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
746 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
747 FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
748 for dir in $DIRS ; do
749 mkdir -p $dir
750 done
751 for f in $FILES ; do
752 ln -sf $source_path/$f $f
753 done
754fi
755echo "SRC_PATH=$source_path" >> config.mak
756
a7c02e25 757diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
758if test $? -ne 0 ; then
759 mv -f $TMPH config.h
3d204385 760else
045ed63f 761 echo "config.h is unchanged"
3d204385
NK
762fi
763
045ed63f 764rm -f $TMPO $TMPC $TMPS $TMPH