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