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