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