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