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