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