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