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