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