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