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