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