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