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