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