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