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