]> git.sesse.net Git - ffmpeg/blob - configure
* static allocation for audio packets. This will make it a little bit
[ffmpeg] / configure
1 #!/bin/sh
2 #
3 # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4 #
5
6 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
7 cat << EOF
8
9 Usage: configure [options]
10 Options: [defaults in brackets after descriptions]
11
12 EOF
13 echo "Standard options:"
14 echo "  --help                   print this message"
15 echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
16 echo "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
17 echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
18 echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
19 echo "  --enable-faad            enable faad support via libfaad [default=no]"
20 echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
21 echo "  --enable-faac            enable faac support via libfaac [default=no]"
22 echo "  --enable-xvid            enable xvid support via xvidcore [default=no]"
23 echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
24 echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
25 echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
26 echo "  --enable-dts             enable GPL'ed DTS support [default=no]"
27 echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
28 echo "  --enable-shared-pp       use libpostproc.so [default=no]"
29 echo "  --enable-shared          build shared libraries [default=no]"
30 echo "  --enable-amr_nb          enable amr_nb float audio codec"
31 echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
32 echo "  --enable-amr_wb          enable amr_wb float audio codec"
33 echo "  --enable-sunmlib         use Sun medialib [default=no]"
34 echo "  --enable-pthreads        use pthreads [default=no]"
35 echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
36 echo ""
37 echo "Advanced options (experts only):"
38 echo "  --source-path=PATH       path of source code [$source_path]"
39 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
40 echo "  --cc=CC                  use C compiler CC [$cc]"
41 echo "  --make=MAKE              use specified make [$make]"
42 echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
43 echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
44 echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
45 echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
46 echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
47 echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
48 echo "  --disable-mmx            disable mmx usage"
49 echo "  --disable-altivec        disable AltiVec usage"
50 echo "  --disable-audio-oss      disable OSS audio support [default=no]"
51 echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
52 echo "  --disable-v4l            disable video4linux grabbing [default=no]"
53 echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
54 echo "  --disable-network        disable network support [default=no]"
55 echo "  --disable-zlib           disable zlib [default=no]"
56 echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
57 echo "  --disable-vhook          disable video hooking support"
58 echo "  --enable-gprof           enable profiling with gprof [$gprof]"
59 echo "  --disable-debug          disable debugging symbols"
60 echo "  --disable-opts           disable compiler optimizations"
61 echo "  --disable-mpegaudio-hp   faster (but less accurate)"
62 echo "                           mpegaudio decoding [default=no]"
63 echo "  --disable-ffserver       disable ffserver build"
64 echo "  --disable-ffplay         disable ffplay build"
65 echo "  --disable-risky          disables patent encumbered codecs"
66 echo "  --enable-small           optimize for size instead of speed"
67 echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
68 echo "  --disable-strip          disable stripping of executables and shared libraries"
69 echo ""
70 echo "NOTE: The object files are build at the place where configure is launched"
71 exit 1
72 fi
73
74 # set temporary file name
75 if test ! -z "$TMPDIR" ; then
76     TMPDIR1="${TMPDIR}"
77 elif test ! -z "$TEMPDIR" ; then
78     TMPDIR1="${TEMPDIR}"
79 else
80     TMPDIR1="/tmp"
81 fi
82
83 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
84 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
85 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
86 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
87 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
88
89 # default parameters
90 prefix="/usr/local"
91 mandir=""
92 bindir=""
93 cross_prefix=""
94 cc="gcc"
95 ar="ar"
96 ranlib="ranlib"
97 make="make"
98 strip="strip"
99 cpu=`uname -m`
100 tune="generic"
101 powerpc_perf="no"
102 mmx="default"
103 altivec="default"
104 mmi="default"
105 case "$cpu" in
106   i386|i486|i586|i686|i86pc|BePC)
107     cpu="x86"
108   ;;
109   x86_64)
110     if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
111          -z "`echo $CFLAGS | grep -- -m32`"  ]; then
112       cpu="x86_64"
113     else
114       cpu="x86"
115     fi
116   ;;
117   # armv4l is a subset of armv5tel
118   armv4l|armv5tel)
119     cpu="armv4l"
120   ;;
121   alpha)
122     cpu="alpha"
123   ;;
124   "Power Macintosh"|ppc)
125     cpu="powerpc"
126   ;;
127   mips)
128     cpu="mips"
129   ;;
130   sun4u|sparc64)
131     cpu="sparc64"
132   ;;
133   sparc)
134     cpu="sparc"
135   ;;
136   sh4)
137     cpu="sh4"
138   ;;
139   *)
140     cpu="unknown"
141   ;;
142 esac
143 gprof="no"
144 v4l="yes"
145 audio_oss="yes"
146 audio_beos="no"
147 dv1394="yes"
148 network="yes"
149 zlib="yes"
150 mp3lame="no"
151 vorbis="no"
152 faad="no"
153 faadbin="no"
154 faac="no"
155 xvid="no"
156 a52="no"
157 a52bin="no"
158 dts="no"
159 pp="no"
160 shared_pp="no"
161 mingw32="no"
162 cygwin="no"
163 os2="no"
164 lshared="no"
165 optimize="yes"
166 debug="yes"
167 dostrip="yes"
168 extralibs="-lm"
169 simpleidct="yes"
170 bigendian="no"
171 inttypes="yes"
172 emu_fast_int="no"
173 vhook="default"
174 dlfcn="no"
175 dlopen="no"
176 mpegaudio_hp="yes"
177 SHFLAGS=-shared
178 netserver="no"
179 need_inet_aton="no"
180 ffserver="yes"
181 ffplay="yes"
182 LDFLAGS=-Wl,--warn-common
183 FFSLDFLAGS=-Wl,-E
184 LIBPREF="lib"
185 LIBSUF=".a"
186 SLIBPREF="lib"
187 SLIBSUF=".so"
188 EXESUF=""
189 risky="yes"
190 amr_nb="no"
191 amr_wb="no"
192 amr_nb_fixed="no"
193 sunmlib="no"
194 pthreads="no"
195 gpl="no"
196 memalignhack="no"
197
198 # OS specific
199 targetos=`uname -s`
200 case $targetos in
201 BeOS)
202 prefix="/boot/home/config"
203 # helps building libavcodec
204 CFLAGS="-DPIC -fomit-frame-pointer"
205 # 3 gcc releases known for BeOS, each with ugly bugs
206 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
207 case "$gcc_version" in
208 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
209 mmx="no"
210 ;;
211 *20010315*) echo "BeBits gcc"
212 CFLAGS="$CFLAGS -fno-expensive-optimizations"
213 ;;
214 esac
215 SHFLAGS=-nostart
216 # disable linux things
217 audio_oss="no"
218 v4l="no"
219 dv1394="no"
220 # enable beos things
221 audio_beos="yes"
222 # no need for libm, but the inet stuff
223 # Check for BONE
224 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
225 extralibs="-lbind -lsocket"
226 else
227 netserver="yes"
228 need_inet_aton="yes"
229 extralibs="-lnet"
230 fi ;;
231 SunOS)
232 v4l="no"
233 audio_oss="no"
234 dv1394="no"
235 make="gmake"
236 LDFLAGS=""
237 FFSLDFLAGS=""
238 need_inet_aton="yes"
239 extralibs="$extralibs -lsocket -lnsl"
240 ;;
241 FreeBSD)
242 v4l="no"
243 audio_oss="yes"
244 dv1394="no"
245 make="gmake"
246 CFLAGS="-pthread"
247 LDFLAGS="$LDFLAGS -export-dynamic -pthread"
248 ;;
249 BSD/OS)
250 v4l="no"
251 audio_oss="yes"
252 dv1394="no"
253 extralibs="-lpoll -lgnugetopt -lm"
254 make="gmake"
255 ;;
256 Darwin)
257 cc="cc"
258 v4l="no"
259 audio_oss="no"
260 dv1394="no"
261 ffserver="no"
262 SHFLAGS="-dynamiclib"
263 extralibs=""
264 darwin="yes"
265 strip="strip -x"
266 LDFLAGS="-Wl,-d"
267 FFSLDFLAGS=-Wl,-bind_at_load
268 ;;
269 MINGW32*)
270 # Note: the rest of the mingw32 config is done afterwards as mingw32
271 # can be forced on command line for linux cross compilation
272 mingw32="yes"
273 ;;
274 CYGWIN*)
275 v4l="no"
276 audio_oss="yes"
277 dv1394="no"
278 extralibs=""
279 cygwin="yes"
280 test -f /usr/include/inttypes.h || \
281 test -f /usr/local/include/inttypes.h || \
282 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
283      "/usr/local/include/inttypes.h !!!"
284 ;;
285 Linux)
286 LDFLAGS="$LDFLAGS -rdynamic"
287 ;;
288 IRIX*)
289 ranlib="echo ignoring ranlib"
290 v4l="no"
291 audio_oss="no"
292 make="gmake"
293 ;;
294 OS/2)
295 TMPE=$TMPE".exe"
296 ar="emxomfar -p64"
297 ranlib="echo ignoring ranlib"
298 strip="echo ignoring strip"
299 CFLAGS="-Zomf"
300 LDFLAGS="-Zomf -Zstack 16384 -s"
301 SHFLAGS=""
302 FFSLDFLAGS=""
303 LIBPREF=""
304 LIBSUF=".lib"
305 SLIBPREF=""
306 SLIBSUF=".dll"
307 EXESUF=".exe"
308 extralibs=""
309 v4l="no"
310 audio_oss="no"
311 dv1394="no"
312 network="no"
313 ffserver="no"
314 os2="yes"
315 ;;
316 *) ;;
317 esac
318
319 # From mplayer configure. We need TARGET_OS available
320 # to the Makefile, so it can distinguish between flavors
321 # of AltiVec on PowerPC
322 TARGET_OS=`( uname -s ) 2>&1`
323   case "$TARGET_OS" in
324   Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
325     ;;
326   IRIX*)
327     TARGET_OS=IRIX
328     ;;
329   HP-UX*)
330     TARGET_OS=HP-UX
331     ;;
332   [cC][yY][gG][wW][iI][nN]*)
333     TARGET_OS=CYGWIN
334     ;;
335   *)
336     TARGET_OS="$TARGET_OS-UNKNOWN"
337     ;;
338   esac
339
340 # find source path
341 # XXX: we assume an absolute path is given when launching configure, 
342 # except in './configure' case.
343 source_path="`echo $0 | sed -e 's#/configure##'`"
344 source_path_used="yes"
345 if test -z "$source_path" -o "$source_path" = "." ; then
346     source_path=`pwd`
347     source_path_used="no"
348 fi
349
350 FFMPEG_CONFIGURATION=" "
351 for opt do
352   FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
353 done
354
355 for opt do
356   case "$opt" in
357   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
358   ;;
359   --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
360   ;;
361   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
362   ;;
363   --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
364   ;;
365   --cc=*) cc=`echo $opt | cut -d '=' -f 2`
366   ;;
367   --make=*) make=`echo $opt | cut -d '=' -f 2`
368   ;;
369   --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
370   ;;
371   --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
372   ;;
373   --extra-libs=*) extralibs=${opt#--extra-libs=}
374   ;;
375   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
376   ;;
377   --tune=*) tune=`echo $opt | cut -d '=' -f 2`
378   ;;
379   --powerpc-perf-enable) powerpc_perf="yes"
380   ;;
381   --disable-mmx) mmx="no"
382   ;;
383   --disable-altivec) altivec="no"
384   ;;
385   --enable-gprof) gprof="yes"
386   ;;
387   --disable-v4l) v4l="no"
388   ;;
389   --disable-audio-oss) audio_oss="no"
390   ;;
391   --disable-audio-beos) audio_beos="no"
392   ;;
393   --disable-dv1394) dv1394="no"
394   ;;
395   --disable-network) network="no"; ffserver="no"
396   ;;
397   --disable-zlib) zlib="no"
398   ;;
399   --enable-a52) a52="yes"
400   ;;
401   --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
402   ;;
403   --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
404   ;;
405   --enable-pp) pp="yes"
406   ;;
407   --enable-shared-pp) shared_pp="yes"
408   ;;
409   --enable-mp3lame) mp3lame="yes"
410   ;;
411   --enable-vorbis) vorbis="yes"
412   ;;
413   --enable-faad) faad="yes"
414   ;;
415   --enable-faadbin) faadbin="yes"
416   ;;
417   --enable-faac) faac="yes"
418   ;;
419   --enable-xvid) xvid="yes"
420   ;;
421   --disable-vhook) vhook="no"
422   ;;
423   --disable-simple_idct) simpleidct="no"
424   ;;
425   --enable-mingw32) mingw32="yes"
426   ;;
427   --enable-shared) lshared="yes"
428   ;;
429   --disable-debug) debug="no"
430   ;;
431   --disable-opts) optimize="no"
432   ;;
433   --disable-mpegaudio-hp) mpegaudio_hp="no"
434   ;;
435   --disable-ffserver) ffserver="no"
436   ;;
437   --disable-ffplay) ffplay="no"
438   ;;
439   --disable-risky) risky="no"
440   ;;
441   --enable-small) optimize="small"
442   ;;
443   --enable-amr_nb) amr_nb="yes"
444   ;;
445   --enable-amr_nb-fixed) amr_nb_fixed="yes"
446   ;;
447   --enable-amr_wb) amr_wb="yes"
448   ;; 
449   --enable-sunmlib) sunmlib="yes"
450   ;;
451   --enable-pthreads) pthreads="yes"
452   ;;
453   --enable-gpl) gpl="yes"
454   ;;
455   --enable-memalign-hack) memalignhack="yes"
456   ;;
457   --disable-strip) dostrip="no"
458   ;;
459   esac
460 done
461
462 if test "$gpl" != "yes"; then
463     if test "$pp" != "no" -o "$shared_pp" != "no"; then
464         echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
465         fail="yes"
466     fi
467
468     if test "$a52" != "no" -o "$a52bin" != "no"; then
469         echo "liba52 is under GPL and --enable-gpl is not specified"
470         fail="yes"
471     fi
472
473     if test "$xvid" != "no"; then
474         echo "libxvidcore is under GPL and --enable-gpl is not specified"
475         fail="yes"
476     fi
477
478     if test "$dts" != "no"; then
479         echo "libdts is under GPL and --enable-gpl is not specified"
480         fail="yes"
481     fi
482     
483     if test "$faad" != "no" -o "$faadbin" != "no"; then
484         cat > $TMPC << EOF
485             #include <faad.h>
486             int main( void ) { return 0; }
487 EOF
488     
489         if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
490             cat > $TMPC << EOF
491                 #include <faad.h>
492                 #ifndef FAAD2_VERSION
493                 ok faad1
494                 #endif
495                 int main( void ) { return 0; }
496 EOF
497             if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
498                 echo "faad2 is under GPL and --enable-gpl is not specified"
499                 fail="yes"
500             fi
501         else
502             faad="no"
503             faadbin="no"
504             echo "faad test failed"
505         fi
506     fi
507    
508
509     if test "$fail" = "yes"; then
510         exit 1
511     fi
512 fi
513
514 # compute mmx state
515 if test $mmx = "default"; then
516     if test $cpu = "x86" -o $cpu = "x86_64"; then
517         mmx="yes"
518     else
519         mmx="no"
520     fi
521 fi
522
523 #Darwin CC versions
524 needmdynamicnopic="no"
525 if test $targetos = Darwin; then
526     if test -n "`$cc -v 2>&1 | grep xlc`"; then
527         CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
528     else
529         gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
530         case "$gcc_version" in
531             *2.95*) 
532                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
533                 ;;
534             *3.*)
535                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
536                 if test "$lshared" = no; then
537                    needmdynamicnopic="yes"
538                 fi
539                 ;;
540             *)
541                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
542                 if test "$lshared" = no; then
543                    needmdynamicnopic="yes"
544                 fi
545                 ;;
546         esac
547     fi
548 fi
549
550 # Can only do AltiVec on PowerPC
551 if test $altivec = "default"; then
552     if test $cpu = "powerpc"; then
553         altivec="yes"
554     else
555         altivec="no"
556     fi
557 fi
558
559 # Add processor-specific flags
560 TUNECPU="generic"
561 POWERPCMODE="32bits"
562 if test $tune != "generic"; then
563     case $tune in
564         601|ppc601|PowerPC601)
565             CFLAGS="$CFLAGS -mcpu=601"
566             if test $altivec = "yes"; then
567                 echo "WARNING: tuning for PPC601 but altivec enabled !";
568             fi
569             TUNECPU=ppc601
570         ;;
571         603*|ppc603*|PowerPC603*)
572             CFLAGS="$CFLAGS -mcpu=603"
573             if test $altivec = "yes"; then
574                 echo "WARNING: tuning for PPC603 but altivec enabled !";
575             fi
576             TUNECPU=ppc603
577         ;;
578         604*|ppc604*|PowerPC604*)
579             CFLAGS="$CFLAGS -mcpu=604"
580             if test $altivec = "yes"; then
581                 echo "WARNING: tuning for PPC604 but altivec enabled !";
582             fi
583             TUNECPU=ppc604
584         ;;
585         G3|g3|75*|ppc75*|PowerPC75*)
586             CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
587             if test $altivec = "yes"; then
588                 echo "WARNING: tuning for PPC75x but altivec enabled !";
589             fi
590             TUNECPU=ppc750
591         ;;
592         G4|g4|745*|ppc745*|PowerPC745*)
593             CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
594             if test $altivec = "no"; then
595                 echo "WARNING: tuning for PPC745x but altivec disabled !";
596             fi
597             TUNECPU=ppc7450
598         ;;
599         74*|ppc74*|PowerPC74*)
600             CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
601             if test $altivec = "no"; then
602                 echo "WARNING: tuning for PPC74xx but altivec disabled !";
603             fi
604             TUNECPU=ppc7400
605         ;;
606         G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
607             CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
608             if test $altivec = "no"; then
609                 echo "WARNING: tuning for PPC970 but altivec disabled !";
610             fi
611             TUNECPU=ppc970
612             POWERPCMODE="64bits"
613         ;;
614         *)
615         echo "WARNING: unknown CPU "$tune", ignored"
616         ;;
617     esac
618 fi
619
620 # AltiVec flags: The FSF version of GCC differs from the Apple version 
621 if test $cpu = "powerpc"; then
622     if test $altivec = "yes"; then
623         if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
624             CFLAGS="$CFLAGS -faltivec"
625         else
626             CFLAGS="$CFLAGS -maltivec -mabi=altivec"
627         fi
628     fi
629 fi
630
631 # See if we have <altivec.h>
632 cat > $TMPC << EOF
633 #include <altivec.h>
634 int main( void ) { return 0; }
635 EOF
636
637 _altivec_h="no"
638 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
639 _altivec_h="yes"
640 fi
641
642 # See does our compiler support Motorola AltiVec C API
643 if test $altivec = "yes"; then
644 if test $_altivec_h = "yes"; then
645 cat > $TMPC << EOF
646 #include <altivec.h>
647 int main(void) {
648     vector signed int v1, v2, v3;
649     v1 = vec_add(v2,v3);
650     return 0;
651 }
652 EOF
653 else
654 cat > $TMPC << EOF
655 int main(void) {
656     vector signed int v1, v2, v3;
657     v1 = vec_add(v2,v3);
658     return 0;
659 }
660 EOF
661 fi
662 $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
663 fi
664
665 # Can only do mmi on mips
666 if test $mmi = "default"; then
667     if test $cpu = "mips"; then
668         mmi="yes"
669     else
670         mmi="no"
671     fi
672 fi
673
674 # See does our compiler support mmi
675 if test $mmi = "yes"; then
676 cat > $TMPC << EOF
677 int main(void) {
678     __asm__ ("lq \$2, 0(\$2)");
679     return 0;
680 }
681 EOF
682 $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
683 fi
684
685 if test "$mingw32" = "yes" ; then
686     v4l="no"
687     audio_oss="no"
688     dv1394="no"
689     ffserver="no"
690     network="no"
691     LIBPREF=""
692     LIBSUF=".lib"
693     SLIBPREF=""
694     SLIBSUF=".dll"
695     EXESUF=".exe"
696     prefix="/c/Program Files/FFmpeg"
697     bindir="$prefix"
698 fi
699
700 cc="${cross_prefix}${cc}"
701 ar="${cross_prefix}${ar}"
702 ranlib="${cross_prefix}${ranlib}"
703 strip="${cross_prefix}${strip}"
704
705 if test -z "$cross_prefix" ; then
706
707 # ---
708 # big/little endian test
709 cat > $TMPC << EOF
710 #include <inttypes.h>
711 int main(int argc, char ** argv){
712         volatile uint32_t i=0x01234567;
713         return (*((uint8_t*)(&i))) == 0x67;
714 }
715 EOF
716
717 if $cc -o $TMPE $TMPC 2>/dev/null ; then
718 $TMPE && bigendian="yes"
719 else
720 echo big/little test failed
721 fi
722
723 else
724
725 # if cross compiling, cannot launch a program, so make a static guess
726 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
727     bigendian="yes"
728 fi
729
730 fi
731
732 # ---
733 # *inttypes.h* test
734 cat > $TMPC << EOF
735 #include <inttypes.h>
736 int main(int argc, char ** argv){
737     return 0;
738 }
739 EOF
740
741 $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
742
743 # ---
744 # *int_fast* test
745 cat > $TMPC << EOF
746 #include <inttypes.h>
747 int main(int argc, char ** argv){
748         volatile uint_fast64_t i=0x01234567;
749         return 0;
750 }
751 EOF
752
753 $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
754
755 # ---
756 # check availability of some header files
757
758 cat > $TMPC << EOF
759 #include <malloc.h>
760 int main( void ) { return 0; }
761 EOF
762
763 _memalign=no
764 _malloc_h=no
765 if $cc -o $TMPE $TMPC 2> /dev/null ; then
766 _malloc_h=yes
767 _memalign=yes
768 # check for memalign - atmos
769 cat > $TMPC << EOF
770 #include <malloc.h>
771 int main ( void ) {
772 char *string = NULL;
773 string = memalign(64, sizeof(char));
774 return 0;
775 }
776 EOF
777 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
778 fi
779
780 if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
781     echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
782     exit 1
783 fi
784
785 cat > $TMPC << EOF
786 #include <time.h>
787 int main( void ) { localtime_r(NULL, NULL); }
788 EOF
789
790 localtime_r=no
791 if $cc -o $TMPE $TMPC 2> /dev/null ; then
792   localtime_r=yes
793 fi
794
795 if test "$zlib" = "yes"; then
796 # check for zlib - mmu_man
797 cat > $TMPC << EOF
798 #include <zlib.h>
799 int main ( void ) {
800 if (zlibVersion() != ZLIB_VERSION)
801    puts("zlib version differs !!!");
802    return 1;
803 return 0;
804 }
805 EOF
806 $cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
807 # $TMPE 2> /dev/null > /dev/null || zlib="no"
808 # XXX: more tests needed - runtime test
809 fi
810 if test "$zlib" = "yes"; then
811 extralibs="$extralibs -lz"
812 fi
813
814 # test for lrintf in math.h
815 cat > $TMPC << EOF
816 #define _ISOC9X_SOURCE  1
817 #include <math.h>
818 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
819 EOF
820
821 have_lrintf="no"
822 if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
823   have_lrintf="yes"
824   # allanc@chickenandporn.com: cannot execute cross-compiled
825   # code on the host.  Only execute if not cross-compiling.
826   if test -z "$cross_prefix" ; then
827     $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
828   fi
829 fi
830
831 _restrict=
832 for restrict_keyword in restrict __restrict__ __restrict; do
833   echo "void foo(char * $restrict_keyword p);" > $TMPC
834   if $cc -c -o $TMPO $TMPC 2> /dev/null; then
835     _restrict=$restrict_keyword
836     break;
837   fi
838 done
839
840 # test gcc version to see if vector builtins can be used
841 # currently only used on i386 for MMX builtins
842 cat > $TMPC << EOF
843 #include <xmmintrin.h>
844 int main(void) { 
845 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
846 return 0;
847 #else
848 #error no vector builtins
849 #endif
850 }
851 EOF
852
853 builtin_vector=no
854 if $cc -o $TMPO $TMPC 2> /dev/null ; then
855   builtin_vector=yes
856 fi
857
858 # dlopen/dlfcn.h probing
859
860 cat > $TMPC << EOF
861 #include <dlfcn.h>
862 int main( void ) { return (int) dlopen("foo", 0); }
863 EOF
864
865 ldl=-ldl
866
867 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
868 dlfcn=yes
869 dlopen=yes
870 fi
871
872 if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
873 dlfcn=yes
874 dlopen=yes
875 ldl=""
876 fi
877
878 cat > $TMPC << EOF
879 int main( void ) { return (int) dlopen("foo", 0); }
880 EOF
881
882 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
883 dlopen=yes
884 fi
885
886 if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
887 dlopen=yes
888 ldl=""
889 fi
890
891 if test "$vhook" = "default" ; then
892   vhook="$dlopen"
893 fi
894
895 ##########################################
896 # imlib probe
897
898 cat > $TMPC << EOF
899 #include <X11/Xlib.h>
900 #include <Imlib2.h>
901 int main( void ) { return (int) imlib_load_font("foo"); }
902 EOF
903
904 imlib2=no
905 if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
906 imlib2=yes
907 fi
908
909 ##########################################
910 # freetype probe
911
912 cat > $TMPC << EOF
913 #include <ft2build.h>
914 int main( void ) { return (int) FT_Init_FreeType(0); }
915 EOF
916
917 freetype2=no
918 if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
919   if (freetype-config --version) >/dev/null 2>&1 ; then
920     if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
921       freetype2=yes
922     fi
923   fi
924 fi
925
926 ##########################################
927 # SDL probe
928
929 cat > $TMPC << EOF
930 #include <SDL.h>
931 #undef main /* We don't want SDL to override our main() */
932 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
933 EOF
934
935 sdl_too_old=no
936 sdl=no
937 if (sdl-config --version) >/dev/null 2>&1 ; then
938 if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
939 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
940 if test "$_sdlversion" -lt 121 ; then
941 sdl_too_old=yes
942 else
943 sdl=yes
944 fi
945 fi
946 fi
947
948 ##########################################
949 # texi2html probe
950
951 texi2html=no
952 if (texi2html -version) >/dev/null 2>&1; then
953 texi2html=yes
954 fi
955
956 case "`$cc -v 2>&1 | grep version`" in
957     *gcc*)
958         CFLAGS="-Wall $CFLAGS"
959         ;;
960     *)
961         ;;
962 esac
963
964 if test "$sdl" = "no" ; then
965    ffplay=no
966 fi
967
968 if test "$debug" = "yes"; then
969         CFLAGS="-g $CFLAGS"
970 fi
971
972 if test "$optimize" = "small"; then
973 #  CFLAGS=${CFLAGS//-O3/-Os}
974   CFLAGS="$CFLAGS -Os"
975 fi
976
977 if test "$optimize" = "yes"; then
978     if test -n "`$cc -v 2>&1 | grep xlc`"; then
979         CFLAGS="$CFLAGS -O5"
980         LDFLAGS="$LDFLAGS -O5"
981     else
982         CFLAGS="-O3 $CFLAGS"
983     fi
984 fi
985
986 if test x"$bindir" = x""; then
987 bindir="${prefix}/bin"
988 fi
989
990 if test x"$mandir" = x""; then
991 mandir="${prefix}/man"
992 fi
993
994 echo "Install prefix   $prefix"
995 echo "Source path      $source_path"
996 echo "C compiler       $cc"
997 echo "make             $make"
998 echo "CPU              $cpu ($tune)"
999 echo "Big Endian       $bigendian"
1000 echo "inttypes.h       $inttypes"
1001 echo "broken inttypes.h $emu_fast_int"
1002 if test $cpu = "x86" -o $cpu = "x86_64"; then
1003 echo "MMX enabled      $mmx"
1004 echo "Vector Builtins  $builtin_vector"
1005 fi
1006 if test $cpu = "mips"; then
1007 echo "MMI enabled      $mmi"
1008 fi
1009 if test $cpu = "powerpc"; then
1010 echo "AltiVec enabled  $altivec"
1011 fi
1012 echo "gprof enabled    $gprof"
1013 echo "zlib enabled     $zlib"
1014 echo "mp3lame enabled  $mp3lame"
1015 echo "vorbis enabled   $vorbis"
1016 echo "faad enabled     $faad"
1017 echo "faadbin enabled  $faadbin"
1018 echo "faac enabled     $faac"
1019 echo "xvid enabled     $xvid"
1020 echo "a52 support      $a52"
1021 echo "a52 dlopened     $a52bin"
1022 echo "dts support      $dts"
1023 echo "pp support       $pp"
1024 echo "debug symbols    $debug"
1025 echo "strip symbols    $dostrip"
1026 echo "optimize         $optimize"
1027 echo "shared pp        $shared_pp"
1028 echo "Video hooking    $vhook"
1029 echo "SDL support      $sdl"
1030 if test $sdl_too_old = "yes"; then
1031 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1032 fi
1033 echo "risky / patent encumbered codecs $risky"
1034
1035 if test "$vhook" = "yes" ; then
1036 echo "Imlib2 support   $imlib2"
1037 echo "freetype support $freetype2"
1038 fi
1039 echo "Sun medialib support"  $sunmlib
1040 echo "pthreads support"      $pthreads
1041 echo "AMR-NB float support"  $amr_nb
1042 echo "AMR-NB fixed support"  $amr_nb_fixed
1043 echo "AMR-WB float support"  $amr_wb
1044 if test "$gpl" = "no" ; then
1045 echo "License: LGPL"
1046 else
1047 echo "License: GPL"
1048 fi
1049
1050 echo "Creating config.mak and config.h"
1051
1052 date >> config.log
1053 echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1054 echo "# Automatically generated by configure - do not modify" > config.mak
1055 echo "/* Automatically generated by configure - do not modify */" > $TMPH
1056 echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1057
1058 echo "prefix=$prefix" >> config.mak
1059 echo "bindir=$bindir" >> config.mak
1060 echo "mandir=$mandir" >> config.mak
1061 echo "MAKE=$make" >> config.mak
1062 echo "CC=$cc" >> config.mak
1063 echo "AR=$ar" >> config.mak
1064 echo "RANLIB=$ranlib" >> config.mak
1065 if test "$dostrip" = "yes" ; then
1066 echo "STRIP=$strip" >> config.mak
1067 echo "INSTALLSTRIP=-s" >> config.mak
1068 else
1069 echo "STRIP=echo ignoring strip" >> config.mak
1070 echo "INSTALLSTRIP=" >> config.mak
1071 fi
1072
1073 # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
1074 # shared modules on OS/X (vhook/Makefile).
1075 SHCFLAGS=$CFLAGS
1076 if test "$needmdynamicnopic" = yes; then
1077    CFLAGS="$CFLAGS -mdynamic-no-pic"
1078 fi
1079
1080 echo "OPTFLAGS=$CFLAGS" >> config.mak
1081 echo "SHCFLAGS=$SHCFLAGS">>config.mak
1082 echo "LDFLAGS=$LDFLAGS" >> config.mak
1083 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1084 echo "SHFLAGS=$SHFLAGS" >> config.mak
1085 echo "LIBPREF=$LIBPREF" >> config.mak
1086 echo "LIBSUF=$LIBSUF" >> config.mak
1087 echo "SLIBPREF=$SLIBPREF" >> config.mak
1088 echo "SLIBSUF=$SLIBSUF" >> config.mak
1089 echo "EXESUF=$EXESUF" >> config.mak
1090 echo "TARGET_OS=$TARGET_OS" >> config.mak
1091 if test "$cpu" = "x86" ; then
1092   echo "TARGET_ARCH_X86=yes" >> config.mak
1093   echo "#define ARCH_X86 1" >> $TMPH
1094 elif test "$cpu" = "x86_64" ; then
1095   echo "TARGET_ARCH_X86_64=yes" >> config.mak
1096   echo "#define ARCH_X86_64 1" >> $TMPH
1097 elif test "$cpu" = "armv4l" ; then
1098   echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1099   echo "#define ARCH_ARMV4L 1" >> $TMPH
1100 elif test "$cpu" = "alpha" ; then
1101   echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1102   echo "#define ARCH_ALPHA 1" >> $TMPH
1103 elif test "$cpu" = "sparc64" ; then
1104   echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1105   echo "#define ARCH_SPARC64 1" >> $TMPH
1106   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1107   echo "#define ARCH_SPARC 1" >> $TMPH
1108 elif test "$cpu" = "sparc" ; then
1109   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1110   echo "#define ARCH_SPARC 1" >> $TMPH
1111 elif test "$cpu" = "powerpc" ; then
1112   echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1113   echo "#define ARCH_POWERPC 1" >> $TMPH
1114   if test $POWERPCMODE = "32bits"; then
1115     echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1116   else
1117     echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1118   fi
1119   if test "$powerpc_perf" = "yes"; then
1120     echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1121   fi
1122 elif test "$cpu" = "mips" ; then
1123   echo "TARGET_ARCH_MIPS=yes" >> config.mak
1124   echo "#define ARCH_MIPS 1" >> $TMPH
1125 elif test "$cpu" = "sh4" ; then
1126   echo "TARGET_ARCH_SH4=yes" >> config.mak
1127   echo "#define ARCH_SH4 1" >> $TMPH
1128 fi
1129 echo "#define TUNECPU $TUNECPU" >> $TMPH
1130 if test "$bigendian" = "yes" ; then
1131   echo "WORDS_BIGENDIAN=yes" >> config.mak
1132   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1133 fi
1134 if test "$inttypes" != "yes" ; then
1135   echo "#define EMULATE_INTTYPES 1" >> $TMPH
1136 fi
1137 if test "$emu_fast_int" = "yes" ; then
1138   echo "#define EMULATE_FAST_INT 1" >> $TMPH
1139 fi
1140 if test "$mmx" = "yes" ; then
1141   echo "TARGET_MMX=yes" >> config.mak
1142   echo "#define HAVE_MMX 1" >> $TMPH
1143   echo "#define __CPU__ 586" >> $TMPH
1144 fi
1145 if test "$builtin_vector" = "yes" ; then
1146   echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1147   echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1148 fi
1149 if test "$mmi" = "yes" ; then
1150   echo "TARGET_MMI=yes" >> config.mak
1151   echo "#define HAVE_MMI 1" >> $TMPH
1152 fi
1153 if test "$altivec" = "yes" ; then
1154   echo "TARGET_ALTIVEC=yes" >> config.mak
1155   echo "#define HAVE_ALTIVEC 1" >> $TMPH
1156   echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1157   echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1158   if test "$_altivec_h" = "yes" ; then
1159     echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1160   else
1161     echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1162   fi
1163 fi
1164 if test "$gprof" = "yes" ; then
1165   echo "TARGET_GPROF=yes" >> config.mak
1166   echo "#define HAVE_GPROF 1" >> $TMPH
1167 fi
1168 if test "$localtime_r" = "yes" ; then
1169   echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1170 fi
1171 if test "$imlib2" = "yes" ; then
1172   echo "HAVE_IMLIB2=yes" >> config.mak
1173 fi
1174 if test "$freetype2" = "yes" ; then
1175   echo "HAVE_FREETYPE2=yes" >> config.mak
1176 fi
1177 if test "$sunmlib" = "yes" ; then
1178   echo "HAVE_MLIB=yes" >> config.mak
1179   echo "#define HAVE_MLIB 1" >> $TMPH
1180   extralibs="$extralibs -lmlib"
1181 fi
1182 if test "$pthreads" = "yes" ; then
1183   echo "HAVE_PTHREADS=yes" >> config.mak
1184   echo "#define HAVE_PTHREADS 1" >> $TMPH
1185   if test $targetos != FreeBSD; then
1186      extralibs="$extralibs -lpthread"
1187   fi
1188 fi
1189 if test "$sdl" = "yes" ; then
1190   echo "CONFIG_SDL=yes" >> config.mak
1191   echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1192   echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1193 fi
1194 if test "$texi2html" = "yes"; then
1195   echo "BUILD_DOC=yes" >> config.mak
1196 fi
1197 if test "$have_lrintf" = "yes" ; then
1198   echo "#define HAVE_LRINTF 1" >> $TMPH
1199 fi
1200 if test "$vhook" = "yes" ; then
1201   echo "BUILD_VHOOK=yes" >> config.mak
1202   echo "#define HAVE_VHOOK 1" >> $TMPH
1203   extralibs="$extralibs $ldl"
1204 fi
1205 if test "$lshared" = "yes" ; then
1206   echo "BUILD_SHARED=yes" >> config.mak
1207   echo "PIC=-fPIC" >> config.mak
1208 fi
1209 echo "EXTRALIBS=$extralibs" >> config.mak
1210 version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1211  cut -d '"' -f 2`
1212 echo "VERSION=$version" >>config.mak
1213 # if you do not want to use encoders, disable that.
1214 echo "#define CONFIG_ENCODERS 1" >> $TMPH
1215 echo "CONFIG_ENCODERS=yes" >> config.mak
1216
1217 # if you do not want to use decoders, disable that.
1218 echo "#define CONFIG_DECODERS 1" >> $TMPH
1219 echo "CONFIG_DECODERS=yes" >> config.mak
1220
1221 # AC3
1222 if test "$a52" = "yes" ; then
1223   echo "#define CONFIG_AC3 1" >> $TMPH
1224   echo "CONFIG_AC3=yes" >> config.mak
1225
1226   if test "$a52bin" = "yes" ; then
1227     echo "#define CONFIG_A52BIN 1" >> $TMPH
1228     echo "CONFIG_A52BIN=yes" >> config.mak
1229   fi
1230 fi
1231
1232 # DTS
1233 if test "$dts" = "yes" ; then
1234   echo "#define CONFIG_DTS 1" >> $TMPH
1235   echo "CONFIG_DTS=yes" >> config.mak
1236 fi
1237
1238 # PP
1239 if test "$pp" = "yes" ; then
1240   echo "#define CONFIG_PP 1" >> $TMPH
1241   echo "CONFIG_PP=yes" >> config.mak
1242
1243   if test "$shared_pp" = "yes" ; then
1244     echo "#define SHARED_PP 1" >> $TMPH
1245     echo "SHARED_PP=yes" >> config.mak
1246   fi
1247 fi
1248
1249 # mpeg audio high precision mode
1250 if test "$mpegaudio_hp" = "yes" ; then
1251   echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1252 fi
1253
1254 if test "$v4l" = "yes" ; then
1255   echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1256   echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1257 fi
1258
1259 if test "$dv1394" = "yes" ; then
1260   echo "#define CONFIG_DV1394 1" >> $TMPH
1261   echo "CONFIG_DV1394=yes" >> config.mak
1262 fi
1263
1264 if test "$dlopen" = "yes" ; then
1265   echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1266 fi
1267
1268 if test "$dlfcn" = "yes" ; then
1269   echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1270 fi
1271
1272 if test "$audio_oss" = "yes" ; then
1273   echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1274   echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1275 fi
1276
1277 if test "$audio_beos" = "yes" ; then
1278   echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1279   echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1280 fi
1281
1282 if test "$network" = "yes" ; then
1283   echo "#define CONFIG_NETWORK 1" >> $TMPH
1284   echo "CONFIG_NETWORK=yes" >> config.mak
1285 fi
1286
1287 if test "$zlib" = "yes" ; then
1288   echo "#define CONFIG_ZLIB 1" >> $TMPH
1289   echo "CONFIG_ZLIB=yes" >> config.mak
1290 fi
1291
1292 if test "$mp3lame" = "yes" ; then
1293   echo "#define CONFIG_MP3LAME 1" >> $TMPH
1294   echo "CONFIG_MP3LAME=yes" >> config.mak
1295 fi
1296
1297 if test "$vorbis" = "yes" ; then
1298   echo "#define CONFIG_VORBIS 1" >> $TMPH
1299   echo "CONFIG_VORBIS=yes" >> config.mak
1300 fi
1301
1302 if test "$faad" = "yes" ; then
1303   echo "#define CONFIG_FAAD 1" >> $TMPH
1304   echo "CONFIG_FAAD=yes" >> config.mak
1305 fi
1306
1307 if test "$faadbin" = "yes" ; then
1308   echo "#define CONFIG_FAADBIN 1" >> $TMPH
1309   echo "CONFIG_FAADBIN=yes" >> config.mak
1310 fi
1311
1312 if test "$faac" = "yes" ; then
1313   echo "#define CONFIG_FAAC 1" >> $TMPH
1314   echo "CONFIG_FAAC=yes" >> config.mak
1315 fi
1316
1317 if test "$xvid" = "yes" ; then
1318   echo "#define CONFIG_XVID 1" >> $TMPH
1319   echo "CONFIG_XVID=yes" >> config.mak
1320 fi
1321
1322 if test "$mingw32" = "yes" ; then
1323   echo "#define CONFIG_WIN32 1" >> $TMPH
1324   echo "CONFIG_WIN32=yes" >> config.mak
1325   echo "HAVE_W32THREADS=yes" >> config.mak
1326   echo "#define HAVE_W32THREADS 1" >> $TMPH
1327   echo "#ifndef __MINGW32__" >> $TMPH
1328   echo "#define __MINGW32__ 1" >> $TMPH
1329   echo "#endif" >> $TMPH
1330 fi
1331
1332 if test "$os2" = "yes" ; then
1333   echo "#define CONFIG_OS2 1" >> $TMPH
1334   echo "CONFIG_OS2=yes" >> config.mak
1335 fi
1336
1337 if test "$TARGET_OS" = "SunOS" ; then
1338   echo "#define CONFIG_SUNOS 1" >> $TMPH
1339 fi
1340
1341 if test "$darwin" = "yes"; then
1342   echo "#define CONFIG_DARWIN 1"  >> $TMPH
1343   echo "CONFIG_DARWIN=yes" >> config.mak
1344 fi
1345
1346 if test "$_malloc_h" = "yes" ; then
1347   echo "#define HAVE_MALLOC_H 1" >> $TMPH
1348 else
1349   echo "#undef  HAVE_MALLOC_H" >> $TMPH
1350 fi
1351
1352 if test "$_memalign" = "yes" ; then
1353   echo "#define HAVE_MEMALIGN 1" >> $TMPH
1354 else
1355   echo "#undef  HAVE_MEMALIGN" >> $TMPH
1356 fi
1357
1358 if test "$memalignhack" = "yes" ; then
1359   echo "#define MEMALIGN_HACK 1" >> $TMPH
1360 fi
1361
1362
1363 if test "$netserver" = "yes" ; then
1364   echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1365   echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1366 fi
1367
1368 if test "$need_inet_aton" = "yes" ; then
1369   echo "NEED_INET_ATON=yes" >> config.mak
1370 fi
1371
1372 if test "$simpleidct" = "yes" ; then
1373   echo "#define SIMPLE_IDCT 1" >> $TMPH
1374 fi
1375
1376 if test "$ffserver" = "yes" ; then
1377   echo "#define CONFIG_FFSERVER 1" >> $TMPH
1378   echo "CONFIG_FFSERVER=yes" >> config.mak
1379 fi
1380
1381 if test "$ffplay" = "yes" ; then
1382   echo "CONFIG_FFPLAY=yes" >> config.mak
1383 fi
1384
1385 if test "$risky" = "yes" ; then
1386   echo "#define CONFIG_RISKY 1" >> $TMPH
1387   echo "CONFIG_RISKY=yes" >> config.mak
1388 fi
1389
1390 if test "$gpl" = "yes" ; then
1391   echo "#define CONFIG_GPL 1" >> $TMPH
1392   echo "CONFIG_GPL=yes" >> config.mak
1393 fi
1394
1395 echo "#define restrict $_restrict" >> $TMPH
1396
1397 if test "$optimize" = "small"; then
1398   echo "#define always_inline"  >> $TMPH
1399 fi
1400
1401 # build tree in object directory if source path is different from current one
1402 if test "$source_path_used" = "yes" ; then
1403     DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1404           libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1405     FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1406     for dir in $DIRS ; do
1407             mkdir -p $dir
1408     done
1409     for f in $FILES ; do
1410         ln -sf $source_path/$f $f
1411     done
1412 fi
1413 echo "SRC_PATH=$source_path" >> config.mak
1414
1415 if test "$amr_wb" = "yes" ; then
1416   echo "#define AMR_WB 1" >> $TMPH
1417   echo "AMR_WB=yes" >> config.mak
1418   echo
1419   echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1420   echo "V5.1.0 from "
1421   echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1422   echo "and extracted the source to libavcodec/amrwb_float"
1423   echo
1424 fi
1425
1426 if test "$amr_nb" = "yes" ; then
1427   echo "#define AMR_NB 1" >> $TMPH
1428   echo "AMR_NB=yes" >> config.mak
1429   echo
1430 if test "$amr_nb_fixed" = "yes" ; then
1431   echo "AMR_NB_FIXED=yes" >> config.mak
1432   echo "#define AMR_NB_FIXED 1" >> $TMPH
1433   echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1434   echo "REL-5 version 5.1.0 from "
1435   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
1436   echo "and extracted src to libavcodec/amr"
1437   echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1438   echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1439   echo
1440 else
1441   echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1442   echo "REL-5 V5.1.0 from "
1443   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
1444   echo "and extracted the source to libavcodec/amr_float"
1445   echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1446   echo
1447 fi
1448
1449 fi
1450
1451 diff $TMPH config.h >/dev/null 2>&1
1452 if test $? -ne 0 ; then
1453         mv -f $TMPH config.h
1454 else
1455         echo "config.h is unchanged"
1456 fi
1457
1458 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH