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