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