removed deprecated win32 option (use --enable-mingw32 and --cross-prefix)
[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 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 mingw32="no"
77 cygwin="no"
78 os2="no"
79 lshared="no"
80 extralibs="-lm"
81 simpleidct="yes"
82 bigendian="no"
83 vhook="default"
84 dlfcn="no"
85 dlopen="no"
86 mpegaudio_hp="yes"
87 SHFLAGS=-shared
88 netserver="no"
89 need_inet_aton="no"
90 ffserver="yes"
91 ffplay="yes"
92 LDFLAGS=-Wl,--warn-common
93 FFSLDFLAGS=-Wl,-E
94 LIBPREF="lib"
95 LIBSUF=".a"
96 SLIBPREF="lib"
97 SLIBSUF=".so"
98 risky="yes"
99 small="no"
100 amr_nb="no"
101 amr_nb_fixed="no"
102 sunmlib="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-mingw32) mingw32="yes"
326 ;;
327 --enable-shared) lshared="yes"
328 ;;
329 --disable-mpegaudio-hp) mpegaudio_hp="no"
330 ;;
331 --disable-ffserver) ffserver="no"
332 ;;
333 --disable-ffplay) ffplay="no"
334 ;;
335 --disable-risky) risky="no"
336 ;;
337 --enable-small) small="yes"
338 ;;
339 --enable-amr_nb) amr_nb="yes"
340 ;;
341 --enable-amr_nb-fixed) amr_nb_fixed="yes"
342 ;;
343 --enable-sunmlib) sunmlib="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 "$mingw32" = "yes" ; then
496 v4l="no"
497 audio_oss="no"
498 dv1394="no"
499 network="no"
500 fi
501
502 cc="${cross_prefix}${cc}"
503 ar="${cross_prefix}${ar}"
504 ranlib="${cross_prefix}${ranlib}"
505 strip="${cross_prefix}${strip}"
506
507 if test -z "$cross_prefix" ; then
508
509 # ---
510 # big/little endian test
511 cat > $TMPC << EOF
512 #include <inttypes.h>
513 int main(int argc, char ** argv){
514 volatile uint32_t i=0x01234567;
515 return (*((uint8_t*)(&i))) == 0x67;
516 }
517 EOF
518
519 if $cc -o $TMPE $TMPC 2>/dev/null ; then
520 $TMPE && bigendian="yes"
521 else
522 echo big/little test failed
523 fi
524
525 else
526
527 # if cross compiling, cannot launch a program, so make a static guess
528 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
529 bigendian="yes"
530 fi
531
532 fi
533
534 # ---
535 # check availability of some header files
536
537 cat > $TMPC << EOF
538 #include <malloc.h>
539 int main( void ) { return 0; }
540 EOF
541
542 _memalign=no
543 _malloc_h=no
544 if $cc -o $TMPE $TMPC 2> /dev/null ; then
545 _malloc_h=yes
546 _memalign=yes
547 # check for memalign - atmos
548 cat > $TMPC << EOF
549 #include <malloc.h>
550 int main ( void ) {
551 char *string = NULL;
552 string = memalign(64, sizeof(char));
553 return 0;
554 }
555 EOF
556 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
557 fi
558
559 cat > $TMPC << EOF
560 #define _GNU_SOURCE
561 #include <time.h>
562 int main( void ) { return *strptime("", "", 0); }
563 EOF
564
565 strptime=no
566 if $cc -o $TMPE $TMPC 2> /dev/null ; then
567 strptime=yes
568 fi
569
570 if test "$zlib" = "yes"; then
571 # check for zlib - mmu_man
572 cat > $TMPC << EOF
573 #include <zlib.h>
574 int main ( void ) {
575 if (zlibVersion() != ZLIB_VERSION)
576 puts("zlib version differs !!!");
577 return 1;
578 return 0;
579 }
580 EOF
581 $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
582 # $TMPE 2> /dev/null > /dev/null || zlib="no"
583 # XXX: more tests needed - runtime test
584 fi
585 if test "$zlib" = "yes"; then
586 extralibs="$extralibs -lz"
587 fi
588
589 # test for lrintf in math.h
590 cat > $TMPC << EOF
591 #define _ISOC9X_SOURCE 1
592 #include <math.h>
593 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
594 EOF
595
596 have_lrintf="no"
597 if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
598 have_lrintf="yes"
599 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
600 fi
601
602 _restrict=
603 for restrict_keyword in restrict __restrict__ __restrict; do
604 echo "void foo(char * $restrict_keyword p);" > $TMPC
605 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
606 _restrict=$restrict_keyword
607 break;
608 fi
609 done
610
611 # test gcc version to see if vector builtins can be used
612 # currently only used on i386 for MMX builtins
613 cat > $TMPC << EOF
614 int main(void) {
615 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
616 return 0;
617 #else
618 #error no vector builtins
619 #endif
620 }
621 EOF
622
623 builtin_vector=no
624 if $cc -o $TMPO $TMPC 2> /dev/null ; then
625 builtin_vector=yes
626 fi
627
628 # dlopen/dlfcn.h probing
629
630 cat > $TMPC << EOF
631 #include <dlfcn.h>
632 int main( void ) { return (int) dlopen("foo", 0); }
633 EOF
634
635 ldl=-ldl
636
637 if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
638 dlfcn=yes
639 dlopen=yes
640 fi
641
642 if $cc -o $TMPE $TMPC 2> /dev/null ; then
643 dlfcn=yes
644 dlopen=yes
645 ldl=""
646 fi
647
648 cat > $TMPC << EOF
649 int main( void ) { return (int) dlopen("foo", 0); }
650 EOF
651
652 if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
653 dlopen=yes
654 fi
655
656 if $cc -o $TMPE $TMPC 2> /dev/null ; then
657 dlopen=yes
658 ldl=""
659 fi
660
661 if test "$vhook" = "default" ; then
662 vhook="$dlopen"
663 fi
664
665 ##########################################
666 # imlib probe
667
668 cat > $TMPC << EOF
669 #include <X11/Xlib.h>
670 #include <Imlib2.h>
671 int main( void ) { return (int) imlib_load_font("foo"); }
672 EOF
673
674 imlib2=no
675 if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
676 imlib2=yes
677 fi
678
679 ##########################################
680 # freetype probe
681
682 cat > $TMPC << EOF
683 #include <ft2build.h>
684 int main( void ) { return (int) FT_Init_FreeType(0); }
685 EOF
686
687 freetype2=no
688 if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
689 if test "`which freetype-config`" != ""; then
690 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
691 freetype2=yes
692 fi
693 fi
694 fi
695
696 ##########################################
697 # SDL probe
698
699 cat > $TMPC << EOF
700 #include <SDL.h>
701 #undef main /* We don't want SDL to override our main() */
702 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
703 EOF
704
705 sdl_too_old=no
706 sdl=no
707 if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then
708 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
709 if test "$_sdlversion" -lt 121 ; then
710 sdl_too_old=yes
711 else
712 sdl=yes
713 fi
714 fi
715
716 if test "$sdl" = "no" ; then
717 ffplay=no
718 fi
719
720 if test "$small" = "yes"; then
721 # CFLAGS=${CFLAGS//-O3/-Os}
722 CFLAGS="$CFLAGS -Os"
723 fi
724
725 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
726 cat << EOF
727
728 Usage: configure [options]
729 Options: [defaults in brackets after descriptions]
730
731 EOF
732 echo "Standard options:"
733 echo " --help print this message"
734 echo " --prefix=PREFIX install in PREFIX [$prefix]"
735 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
736 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
737 echo " --enable-faad enable faad support via libfaad [default=no]"
738 echo " --enable-faadbin build faad support with runtime linking [default=no]"
739 echo " --enable-mingw32 enable mingw32 native/cross windows compile"
740 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
741 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
742 echo " --disable-pp disable GPL'ed post processing support [default=no]"
743 echo " --enable-shared-pp use libpostproc.so [default=no]"
744 echo " --enable-shared build shared libraries [default=no]"
745 echo " --enable-amr_nb enable amr_nb float audio codec"
746 echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
747 echo " --enable-sunmlib use Sun medialib [default=no]"
748 echo ""
749 echo "Advanced options (experts only):"
750 echo " --source-path=PATH path of source code [$source_path]"
751 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
752 echo " --cc=CC use C compiler CC [$cc]"
753 echo " --make=MAKE use specified make [$make]"
754 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
755 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
756 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
757 echo " --cpu=CPU force cpu to CPU [$cpu]"
758 echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
759 echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
760 echo " --disable-mmx disable mmx usage"
761 echo " --disable-altivec disable AltiVec usage"
762 echo " --disable-audio-oss disable OSS audio support [default=no]"
763 echo " --disable-audio-beos disable BeOS audio support [default=no]"
764 echo " --disable-v4l disable video4linux grabbing [default=no]"
765 echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
766 echo " --disable-network disable network support [default=no]"
767 echo " --disable-zlib disable zlib [default=no]"
768 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
769 echo " --disable-vhook disable video hooking support"
770 echo " --enable-gprof enable profiling with gprof [$gprof]"
771 echo " --disable-mpegaudio-hp faster (but less accurate)"
772 echo " mpegaudio decoding [default=no]"
773 echo " --disable-ffserver disable ffserver build"
774 echo " --disable-ffplay disable ffplay build"
775 echo " --disable-risky disables patent encumbered codecs"
776 echo " --enable-small optimize for size instead of speed"
777 echo ""
778 echo "NOTE: The object files are build at the place where configure is launched"
779 exit 1
780 fi
781
782 echo "Install prefix $prefix"
783 echo "Source path $source_path"
784 echo "C compiler $cc"
785 echo "make $make"
786 echo "CPU $cpu ($tune)"
787 echo "Big Endian $bigendian"
788 if test $cpu = "x86"; then
789 echo "MMX enabled $mmx"
790 echo "Vector Builtins $builtin_vector"
791 fi
792 if test $cpu = "mips"; then
793 echo "MMI enabled $mmi"
794 fi
795 if test $cpu = "powerpc"; then
796 echo "AltiVec enabled $altivec"
797 fi
798 echo "gprof enabled $gprof"
799 echo "zlib enabled $zlib"
800 echo "mp3lame enabled $mp3lame"
801 echo "vorbis enabled $vorbis"
802 echo "faad enabled $faad"
803 echo "faadbin enabled $faadbin"
804 echo "a52 support $a52"
805 echo "a52 dlopened $a52bin"
806 echo "pp support $pp"
807 echo "shared pp $shared_pp"
808 echo "Video hooking $vhook"
809 echo "SDL support $sdl"
810 if test $sdl_too_old = "yes"; then
811 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
812 fi
813 echo "risky / patent encumbered codecs $risky"
814 echo "optimize for size $small"
815
816 if test "$vhook" = "yes" ; then
817 echo "Imlib2 support $imlib2"
818 echo "freetype support $freetype2"
819 fi
820 echo "Sun medialib support" $sunmlib
821 echo "AMR-NB float support" $amr_nb
822 echo "AMR-NB fixed support" $amr_nb_fixed
823
824 echo "Creating config.mak and config.h"
825
826 echo "# Automatically generated by configure - do not modify" > config.mak
827 echo "/* Automatically generated by configure - do not modify */" > $TMPH
828
829 echo "prefix=$prefix" >> config.mak
830 echo "MAKE=$make" >> config.mak
831 echo "CC=$cc" >> config.mak
832 echo "AR=$ar" >> config.mak
833 echo "RANLIB=$ranlib" >> config.mak
834 echo "STRIP=$strip" >> config.mak
835 echo "OPTFLAGS=$CFLAGS" >> config.mak
836 echo "LDFLAGS=$LDFLAGS" >> config.mak
837 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
838 echo "SHFLAGS=$SHFLAGS" >> config.mak
839 echo "LIBPREF=$LIBPREF" >> config.mak
840 echo "LIBSUF=$LIBSUF" >> config.mak
841 echo "SLIBPREF=$SLIBPREF" >> config.mak
842 echo "SLIBSUF=$SLIBSUF" >> config.mak
843 echo "TARGET_OS=$TARGET_OS" >> config.mak
844 if test "$cpu" = "x86" ; then
845 echo "TARGET_ARCH_X86=yes" >> config.mak
846 echo "#define ARCH_X86 1" >> $TMPH
847 elif test "$cpu" = "armv4l" ; then
848 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
849 echo "#define ARCH_ARMV4L 1" >> $TMPH
850 elif test "$cpu" = "alpha" ; then
851 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
852 echo "#define ARCH_ALPHA 1" >> $TMPH
853 elif test "$cpu" = "sparc64" ; then
854 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
855 echo "#define ARCH_SPARC64 1" >> $TMPH
856 elif test "$cpu" = "powerpc" ; then
857 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
858 echo "#define ARCH_POWERPC 1" >> $TMPH
859 if test "$powerpc_perf" = "yes"; then
860 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
861 fi
862 elif test "$cpu" = "mips" ; then
863 echo "TARGET_ARCH_MIPS=yes" >> config.mak
864 echo "#define ARCH_MIPS 1" >> $TMPH
865 elif test "$cpu" = "sh4" ; then
866 echo "TARGET_ARCH_SH4=yes" >> config.mak
867 echo "#define ARCH_SH4 1" >> $TMPH
868 fi
869 echo "#define TUNECPU $TUNECPU" >> $TMPH
870 if test "$bigendian" = "yes" ; then
871 echo "WORDS_BIGENDIAN=yes" >> config.mak
872 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
873 fi
874 if test "$mmx" = "yes" ; then
875 echo "TARGET_MMX=yes" >> config.mak
876 echo "#define HAVE_MMX 1" >> $TMPH
877 echo "#define __CPU__ 586" >> $TMPH
878 fi
879 if test "$builtin_vector" = "yes" ; then
880 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
881 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
882 fi
883 if test "$mmi" = "yes" ; then
884 echo "TARGET_MMI=yes" >> config.mak
885 echo "#define HAVE_MMI 1" >> $TMPH
886 fi
887 if test "$altivec" = "yes" ; then
888 echo "TARGET_ALTIVEC=yes" >> config.mak
889 echo "#define HAVE_ALTIVEC 1" >> $TMPH
890 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
891 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
892 if test "$_altivec_h" = "yes" ; then
893 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
894 else
895 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
896 fi
897 fi
898 if test "$gprof" = "yes" ; then
899 echo "TARGET_GPROF=yes" >> config.mak
900 echo "#define HAVE_GPROF 1" >> $TMPH
901 fi
902 if test "$strptime" = "yes" ; then
903 echo "#define HAVE_STRPTIME 1" >> $TMPH
904 else
905 echo "BUILD_STRPTIME=yes" >> config.mak
906 fi
907 if test "$imlib2" = "yes" ; then
908 echo "HAVE_IMLIB2=yes" >> config.mak
909 fi
910 if test "$freetype2" = "yes" ; then
911 echo "HAVE_FREETYPE2=yes" >> config.mak
912 fi
913 if test "$sunmlib" = "yes" ; then
914 echo "HAVE_MLIB=yes" >> config.mak
915 echo "#define HAVE_MLIB 1" >> $TMPH
916 extralibs="$extralibs -lmlib"
917 fi
918 if test "$sdl" = "yes" ; then
919 echo "CONFIG_SDL=yes" >> config.mak
920 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
921 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
922 fi
923 if test "$have_lrintf" = "yes" ; then
924 echo "#define HAVE_LRINTF 1" >> $TMPH
925 fi
926 if test "$vhook" = "yes" ; then
927 echo "BUILD_VHOOK=yes" >> config.mak
928 echo "#define HAVE_VHOOK 1" >> $TMPH
929 extralibs="$extralibs $ldl"
930 fi
931 if test "$lshared" = "yes" ; then
932 echo "BUILD_SHARED=yes" >> config.mak
933 echo "PIC=-fPIC" >> config.mak
934 fi
935 echo "EXTRALIBS=$extralibs" >> config.mak
936 echo "VERSION=`head $source_path/VERSION`" >>config.mak
937 echo "" >>config.mak
938 # if you do not want to use encoders, disable that.
939 echo "#define CONFIG_ENCODERS 1" >> $TMPH
940 echo "CONFIG_ENCODERS=yes" >> config.mak
941
942 # if you do not want to use decoders, disable that.
943 echo "#define CONFIG_DECODERS 1" >> $TMPH
944 echo "CONFIG_DECODERS=yes" >> config.mak
945
946 # AC3
947 if test "$a52" = "yes" ; then
948 echo "#define CONFIG_AC3 1" >> $TMPH
949 echo "CONFIG_AC3=yes" >> config.mak
950
951 if test "$a52bin" = "yes" ; then
952 echo "#define CONFIG_A52BIN 1" >> $TMPH
953 echo "CONFIG_A52BIN=yes" >> config.mak
954 fi
955 fi
956
957 # PP
958 if test "$pp" = "yes" ; then
959 echo "#define CONFIG_PP 1" >> $TMPH
960 echo "CONFIG_PP=yes" >> config.mak
961
962 if test "$shared_pp" = "yes" ; then
963 echo "#define SHARED_PP 1" >> $TMPH
964 echo "SHARED_PP=yes" >> config.mak
965 fi
966 fi
967
968 # mpeg audio high precision mode
969 if test "$mpegaudio_hp" = "yes" ; then
970 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
971 fi
972
973 if test "$v4l" = "yes" ; then
974 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
975 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
976 fi
977
978 if test "$dv1394" = "yes" ; then
979 echo "#define CONFIG_DV1394 1" >> $TMPH
980 echo "CONFIG_DV1394=yes" >> config.mak
981 fi
982
983 if test "$dlopen" = "yes" ; then
984 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
985 fi
986
987 if test "$dlfcn" = "yes" ; then
988 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
989 fi
990
991 if test "$audio_oss" = "yes" ; then
992 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
993 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
994 fi
995
996 if test "$audio_beos" = "yes" ; then
997 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
998 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
999 fi
1000
1001 if test "$network" = "yes" ; then
1002 echo "#define CONFIG_NETWORK 1" >> $TMPH
1003 echo "CONFIG_NETWORK=yes" >> config.mak
1004 fi
1005
1006 if test "$zlib" = "yes" ; then
1007 echo "#define CONFIG_ZLIB 1" >> $TMPH
1008 echo "CONFIG_ZLIB=yes" >> config.mak
1009 fi
1010
1011 if test "$mp3lame" = "yes" ; then
1012 echo "#define CONFIG_MP3LAME 1" >> $TMPH
1013 echo "CONFIG_MP3LAME=yes" >> config.mak
1014 fi
1015
1016 if test "$vorbis" = "yes" ; then
1017 echo "#define CONFIG_VORBIS 1" >> $TMPH
1018 echo "CONFIG_VORBIS=yes" >> config.mak
1019 fi
1020
1021 if test "$faad" = "yes" ; then
1022 echo "#define CONFIG_FAAD 1" >> $TMPH
1023 echo "CONFIG_FAAD=yes" >> config.mak
1024 fi
1025
1026 if test "$faadbin" = "yes" ; then
1027 echo "#define CONFIG_FAADBIN 1" >> $TMPH
1028 echo "CONFIG_FAADBIN=yes" >> config.mak
1029 fi
1030
1031 if test "$mingw32" = "yes" ; then
1032 echo "#define CONFIG_WIN32 1" >> $TMPH
1033 echo "CONFIG_WIN32=yes" >> config.mak
1034 echo "#ifndef __MINGW32__" >> $TMPH
1035 echo "#define __MINGW32__ 1" >> $TMPH
1036 echo "#endif" >> $TMPH
1037 echo "__MINGW32__=1" >> config.mak
1038 fi
1039
1040 if test "$cygwin" = "yes" ; then
1041 # setup correct exesuffix
1042 echo "CONFIG_WIN32=yes" >> config.mak
1043 fi
1044
1045 if test "$os2" = "yes" ; then
1046 echo "#define CONFIG_OS2 1" >> $TMPH
1047 echo "CONFIG_OS2=yes" >> config.mak
1048 fi
1049
1050 if test "$TARGET_OS" = "SunOS" ; then
1051 echo "#define CONFIG_SUNOS 1" >> $TMPH
1052 fi
1053
1054 if test "$darwin" = "yes"; then
1055 echo "#define CONFIG_DARWIN 1" >> $TMPH
1056 echo "CONFIG_DARWIN=yes" >> config.mak
1057 fi
1058
1059 if test "$_malloc_h" = "yes" ; then
1060 echo "#define HAVE_MALLOC_H 1" >> $TMPH
1061 else
1062 echo "#undef HAVE_MALLOC_H" >> $TMPH
1063 fi
1064
1065 if test "$_memalign" = "yes" ; then
1066 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1067 else
1068 echo "#undef HAVE_MEMALIGN" >> $TMPH
1069 fi
1070
1071 if test "$netserver" = "yes" ; then
1072 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1073 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1074 fi
1075
1076 if test "$need_inet_aton" = "yes" ; then
1077 echo "NEED_INET_ATON=yes" >> config.mak
1078 fi
1079
1080 if test "$simpleidct" = "yes" ; then
1081 echo "#define SIMPLE_IDCT 1" >> $TMPH
1082 fi
1083
1084 if test "$ffserver" = "yes" ; then
1085 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1086 echo "CONFIG_FFSERVER=yes" >> config.mak
1087 fi
1088
1089 if test "$ffplay" = "yes" ; then
1090 echo "CONFIG_FFPLAY=yes" >> config.mak
1091 fi
1092
1093 if test "$risky" = "yes" ; then
1094 echo "#define CONFIG_RISKY 1" >> $TMPH
1095 echo "CONFIG_RISKY=yes" >> config.mak
1096 fi
1097
1098 echo "#define restrict $_restrict" >> $TMPH
1099
1100 # build tree in object directory if source path is different from current one
1101 if test "$source_path_used" = "yes" ; then
1102 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1103 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1104 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1105 for dir in $DIRS ; do
1106 mkdir -p $dir
1107 done
1108 for f in $FILES ; do
1109 ln -sf $source_path/$f $f
1110 done
1111 fi
1112 echo "SRC_PATH=$source_path" >> config.mak
1113
1114 if test "$amr_nb" = "yes" ; then
1115 echo "#define AMR_NB 1" >> $TMPH
1116 echo "AMR_NB=yes" >> config.mak
1117 echo
1118 if test "$amr_nb_fixed" = "yes" ; then
1119 echo "AMR_NB_FIXED=yes" >> config.mak
1120 echo "#define AMR_NB_FIXED 1" >> $TMPH
1121 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1122 echo "REL-5 version 5.1.0 from "
1123 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1124 echo "and extracted src to libavcodec/amr"
1125 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1126 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1127 echo
1128 else
1129 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1130 echo "REL-5 V5.1.0 from "
1131 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1132 echo "and extracted the source to libavcodec/amr_float"
1133 echo
1134 fi
1135
1136 fi
1137
1138 diff $TMPH config.h >/dev/null 2>&1
1139 if test $? -ne 0 ; then
1140 mv -f $TMPH config.h
1141 else
1142 echo "config.h is unchanged"
1143 fi
1144
1145 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH