]> git.sesse.net Git - ffmpeg/blob - configure
AMR links
[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 for opt do
351   case "$opt" in
352   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
353   ;;
354   --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
355   ;;
356   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
357   ;;
358   --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
359   ;;
360   --cc=*) cc=`echo $opt | cut -d '=' -f 2`
361   ;;
362   --make=*) make=`echo $opt | cut -d '=' -f 2`
363   ;;
364   --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
365   ;;
366   --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
367   ;;
368   --extra-libs=*) extralibs=${opt#--extra-libs=}
369   ;;
370   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
371   ;;
372   --tune=*) tune=`echo $opt | cut -d '=' -f 2`
373   ;;
374   --powerpc-perf-enable) powerpc_perf="yes"
375   ;;
376   --disable-mmx) mmx="no"
377   ;;
378   --disable-altivec) altivec="no"
379   ;;
380   --enable-gprof) gprof="yes"
381   ;;
382   --disable-v4l) v4l="no"
383   ;;
384   --disable-audio-oss) audio_oss="no"
385   ;;
386   --disable-audio-beos) audio_beos="no"
387   ;;
388   --disable-dv1394) dv1394="no"
389   ;;
390   --disable-network) network="no"; ffserver="no"
391   ;;
392   --disable-zlib) zlib="no"
393   ;;
394   --enable-a52) a52="yes"
395   ;;
396   --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
397   ;;
398   --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
399   ;;
400   --enable-pp) pp="yes"
401   ;;
402   --enable-shared-pp) shared_pp="yes"
403   ;;
404   --enable-mp3lame) mp3lame="yes"
405   ;;
406   --enable-vorbis) vorbis="yes"
407   ;;
408   --enable-faad) faad="yes"
409   ;;
410   --enable-faadbin) faadbin="yes"
411   ;;
412   --enable-faac) faac="yes"
413   ;;
414   --enable-xvid) xvid="yes"
415   ;;
416   --disable-vhook) vhook="no"
417   ;;
418   --disable-simple_idct) simpleidct="no"
419   ;;
420   --enable-mingw32) mingw32="yes"
421   ;;
422   --enable-shared) lshared="yes"
423   ;;
424   --disable-debug) debug="no"
425   ;;
426   --disable-opts) optimize="no"
427   ;;
428   --disable-mpegaudio-hp) mpegaudio_hp="no"
429   ;;
430   --disable-ffserver) ffserver="no"
431   ;;
432   --disable-ffplay) ffplay="no"
433   ;;
434   --disable-risky) risky="no"
435   ;;
436   --enable-small) optimize="small"
437   ;;
438   --enable-amr_nb) amr_nb="yes"
439   ;;
440   --enable-amr_nb-fixed) amr_nb_fixed="yes"
441   ;;
442   --enable-amr_wb) amr_wb="yes"
443   ;; 
444   --enable-sunmlib) sunmlib="yes"
445   ;;
446   --enable-pthreads) pthreads="yes"
447   ;;
448   --enable-gpl) gpl="yes"
449   ;;
450   --enable-memalign-hack) memalignhack="yes"
451   ;;
452   --disable-strip) dostrip="no"
453   ;;
454   esac
455 done
456
457 if test "$gpl" != "yes"; then
458     if test "$pp" != "no" -o "$shared_pp" != "no"; then
459         echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
460         fail="yes"
461     fi
462
463     if test "$a52" != "no" -o "$a52bin" != "no"; then
464         echo "liba52 is under GPL and --enable-gpl is not specified"
465         fail="yes"
466     fi
467
468     if test "$xvid" != "no"; then
469         echo "libxvidcore is under GPL and --enable-gpl is not specified"
470         fail="yes"
471     fi
472
473     if test "$dts" != "no"; then
474         echo "libdts is under GPL and --enable-gpl is not specified"
475         fail="yes"
476     fi
477     
478     if test "$faad" != "no" -o "$faadbin" != "no"; then
479         cat > $TMPC << EOF
480             #include <faad.h>
481             int main( void ) { return 0; }
482 EOF
483     
484         if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
485             cat > $TMPC << EOF
486                 #include <faad.h>
487                 #ifndef FAAD2_VERSION
488                 ok faad1
489                 #endif
490                 int main( void ) { return 0; }
491 EOF
492             if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
493                 echo "faad2 is under GPL and --enable-gpl is not specified"
494                 fail="yes"
495             fi
496         else
497             faad="no"
498             faadbin="no"
499             echo "faad test failed"
500         fi
501     fi
502    
503
504     if test "$fail" = "yes"; then
505         exit 1
506     fi
507 fi
508
509 # compute mmx state
510 if test $mmx = "default"; then
511     if test $cpu = "x86" -o $cpu = "x86_64"; then
512         mmx="yes"
513     else
514         mmx="no"
515     fi
516 fi
517
518 #Darwin CC versions
519 needmdynamicnopic="no"
520 if test $targetos = Darwin; then
521     if test -n "`$cc -v 2>&1 | grep xlc`"; then
522         CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
523     else
524         gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
525         case "$gcc_version" in
526             *2.95*) 
527                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
528                 ;;
529             *3.*)
530                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
531                 if test "$lshared" = no; then
532                    needmdynamicnopic="yes"
533                 fi
534                 ;;
535             *)
536                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
537                 if test "$lshared" = no; then
538                    needmdynamicnopic="yes"
539                 fi
540                 ;;
541         esac
542     fi
543 fi
544
545 # Can only do AltiVec on PowerPC
546 if test $altivec = "default"; then
547     if test $cpu = "powerpc"; then
548         altivec="yes"
549     else
550         altivec="no"
551     fi
552 fi
553
554 # Add processor-specific flags
555 TUNECPU="generic"
556 POWERPCMODE="32bits"
557 if test $tune != "generic"; then
558     case $tune in
559         601|ppc601|PowerPC601)
560             CFLAGS="$CFLAGS -mcpu=601"
561             if test $altivec = "yes"; then
562                 echo "WARNING: tuning for PPC601 but altivec enabled !";
563             fi
564             TUNECPU=ppc601
565         ;;
566         603*|ppc603*|PowerPC603*)
567             CFLAGS="$CFLAGS -mcpu=603"
568             if test $altivec = "yes"; then
569                 echo "WARNING: tuning for PPC603 but altivec enabled !";
570             fi
571             TUNECPU=ppc603
572         ;;
573         604*|ppc604*|PowerPC604*)
574             CFLAGS="$CFLAGS -mcpu=604"
575             if test $altivec = "yes"; then
576                 echo "WARNING: tuning for PPC604 but altivec enabled !";
577             fi
578             TUNECPU=ppc604
579         ;;
580         G3|g3|75*|ppc75*|PowerPC75*)
581             CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
582             if test $altivec = "yes"; then
583                 echo "WARNING: tuning for PPC75x but altivec enabled !";
584             fi
585             TUNECPU=ppc750
586         ;;
587         G4|g4|745*|ppc745*|PowerPC745*)
588             CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
589             if test $altivec = "no"; then
590                 echo "WARNING: tuning for PPC745x but altivec disabled !";
591             fi
592             TUNECPU=ppc7450
593         ;;
594         74*|ppc74*|PowerPC74*)
595             CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
596             if test $altivec = "no"; then
597                 echo "WARNING: tuning for PPC74xx but altivec disabled !";
598             fi
599             TUNECPU=ppc7400
600         ;;
601         G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
602             CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
603             if test $altivec = "no"; then
604                 echo "WARNING: tuning for PPC970 but altivec disabled !";
605             fi
606             TUNECPU=ppc970
607             POWERPCMODE="64bits"
608         ;;
609         *)
610         echo "WARNING: unknown CPU "$tune", ignored"
611         ;;
612     esac
613 fi
614
615 # AltiVec flags: The FSF version of GCC differs from the Apple version 
616 if test $cpu = "powerpc"; then
617     if test $altivec = "yes"; then
618         if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
619             CFLAGS="$CFLAGS -faltivec"
620         else
621             CFLAGS="$CFLAGS -maltivec -mabi=altivec"
622         fi
623     fi
624 fi
625
626 # See if we have <altivec.h>
627 cat > $TMPC << EOF
628 #include <altivec.h>
629 int main( void ) { return 0; }
630 EOF
631
632 _altivec_h="no"
633 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
634 _altivec_h="yes"
635 fi
636
637 # See does our compiler support Motorola AltiVec C API
638 if test $altivec = "yes"; then
639 if test $_altivec_h = "yes"; then
640 cat > $TMPC << EOF
641 #include <altivec.h>
642 int main(void) {
643     vector signed int v1, v2, v3;
644     v1 = vec_add(v2,v3);
645     return 0;
646 }
647 EOF
648 else
649 cat > $TMPC << EOF
650 int main(void) {
651     vector signed int v1, v2, v3;
652     v1 = vec_add(v2,v3);
653     return 0;
654 }
655 EOF
656 fi
657 $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
658 fi
659
660 # Can only do mmi on mips
661 if test $mmi = "default"; then
662     if test $cpu = "mips"; then
663         mmi="yes"
664     else
665         mmi="no"
666     fi
667 fi
668
669 # See does our compiler support mmi
670 if test $mmi = "yes"; then
671 cat > $TMPC << EOF
672 int main(void) {
673     __asm__ ("lq \$2, 0(\$2)");
674     return 0;
675 }
676 EOF
677 $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
678 fi
679
680 if test "$mingw32" = "yes" ; then
681     v4l="no"
682     audio_oss="no"
683     dv1394="no"
684     ffserver="no"
685     network="no"
686     LIBPREF=""
687     LIBSUF=".lib"
688     SLIBPREF=""
689     SLIBSUF=".dll"
690     EXESUF=".exe"
691     prefix="/c/Program Files/FFmpeg"
692     bindir="$prefix"
693 fi
694
695 cc="${cross_prefix}${cc}"
696 ar="${cross_prefix}${ar}"
697 ranlib="${cross_prefix}${ranlib}"
698 strip="${cross_prefix}${strip}"
699
700 if test -z "$cross_prefix" ; then
701
702 # ---
703 # big/little endian test
704 cat > $TMPC << EOF
705 #include <inttypes.h>
706 int main(int argc, char ** argv){
707         volatile uint32_t i=0x01234567;
708         return (*((uint8_t*)(&i))) == 0x67;
709 }
710 EOF
711
712 if $cc -o $TMPE $TMPC 2>/dev/null ; then
713 $TMPE && bigendian="yes"
714 else
715 echo big/little test failed
716 fi
717
718 else
719
720 # if cross compiling, cannot launch a program, so make a static guess
721 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
722     bigendian="yes"
723 fi
724
725 fi
726
727 # ---
728 # *inttypes.h* test
729 cat > $TMPC << EOF
730 #include <inttypes.h>
731 int main(int argc, char ** argv){
732     return 0;
733 }
734 EOF
735
736 $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
737
738 # ---
739 # *int_fast* test
740 cat > $TMPC << EOF
741 #include <inttypes.h>
742 int main(int argc, char ** argv){
743         volatile uint_fast64_t i=0x01234567;
744         return 0;
745 }
746 EOF
747
748 $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
749
750 # ---
751 # check availability of some header files
752
753 cat > $TMPC << EOF
754 #include <malloc.h>
755 int main( void ) { return 0; }
756 EOF
757
758 _memalign=no
759 _malloc_h=no
760 if $cc -o $TMPE $TMPC 2> /dev/null ; then
761 _malloc_h=yes
762 _memalign=yes
763 # check for memalign - atmos
764 cat > $TMPC << EOF
765 #include <malloc.h>
766 int main ( void ) {
767 char *string = NULL;
768 string = memalign(64, sizeof(char));
769 return 0;
770 }
771 EOF
772 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
773 fi
774
775 if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
776     echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
777     exit 1
778 fi
779
780 cat > $TMPC << EOF
781 #include <time.h>
782 int main( void ) { localtime_r(NULL, NULL); }
783 EOF
784
785 localtime_r=no
786 if $cc -o $TMPE $TMPC 2> /dev/null ; then
787   localtime_r=yes
788 fi
789
790 if test "$zlib" = "yes"; then
791 # check for zlib - mmu_man
792 cat > $TMPC << EOF
793 #include <zlib.h>
794 int main ( void ) {
795 if (zlibVersion() != ZLIB_VERSION)
796    puts("zlib version differs !!!");
797    return 1;
798 return 0;
799 }
800 EOF
801 $cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
802 # $TMPE 2> /dev/null > /dev/null || zlib="no"
803 # XXX: more tests needed - runtime test
804 fi
805 if test "$zlib" = "yes"; then
806 extralibs="$extralibs -lz"
807 fi
808
809 # test for lrintf in math.h
810 cat > $TMPC << EOF
811 #define _ISOC9X_SOURCE  1
812 #include <math.h>
813 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
814 EOF
815
816 have_lrintf="no"
817 if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
818   have_lrintf="yes"
819   # allanc@chickenandporn.com: cannot execute cross-compiled
820   # code on the host.  Only execute if not cross-compiling.
821   if test -z "$cross_prefix" ; then
822     $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
823   fi
824 fi
825
826 _restrict=
827 for restrict_keyword in restrict __restrict__ __restrict; do
828   echo "void foo(char * $restrict_keyword p);" > $TMPC
829   if $cc -c -o $TMPO $TMPC 2> /dev/null; then
830     _restrict=$restrict_keyword
831     break;
832   fi
833 done
834
835 # test gcc version to see if vector builtins can be used
836 # currently only used on i386 for MMX builtins
837 cat > $TMPC << EOF
838 #include <xmmintrin.h>
839 int main(void) { 
840 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
841 return 0;
842 #else
843 #error no vector builtins
844 #endif
845 }
846 EOF
847
848 builtin_vector=no
849 if $cc -o $TMPO $TMPC 2> /dev/null ; then
850   builtin_vector=yes
851 fi
852
853 # dlopen/dlfcn.h probing
854
855 cat > $TMPC << EOF
856 #include <dlfcn.h>
857 int main( void ) { return (int) dlopen("foo", 0); }
858 EOF
859
860 ldl=-ldl
861
862 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
863 dlfcn=yes
864 dlopen=yes
865 fi
866
867 if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
868 dlfcn=yes
869 dlopen=yes
870 ldl=""
871 fi
872
873 cat > $TMPC << EOF
874 int main( void ) { return (int) dlopen("foo", 0); }
875 EOF
876
877 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
878 dlopen=yes
879 fi
880
881 if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
882 dlopen=yes
883 ldl=""
884 fi
885
886 if test "$vhook" = "default" ; then
887   vhook="$dlopen"
888 fi
889
890 ##########################################
891 # imlib probe
892
893 cat > $TMPC << EOF
894 #include <X11/Xlib.h>
895 #include <Imlib2.h>
896 int main( void ) { return (int) imlib_load_font("foo"); }
897 EOF
898
899 imlib2=no
900 if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
901 imlib2=yes
902 fi
903
904 ##########################################
905 # freetype probe
906
907 cat > $TMPC << EOF
908 #include <ft2build.h>
909 int main( void ) { return (int) FT_Init_FreeType(0); }
910 EOF
911
912 freetype2=no
913 if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
914   if (freetype-config --version) >/dev/null 2>&1 ; then
915     if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
916       freetype2=yes
917     fi
918   fi
919 fi
920
921 ##########################################
922 # SDL probe
923
924 cat > $TMPC << EOF
925 #include <SDL.h>
926 #undef main /* We don't want SDL to override our main() */
927 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
928 EOF
929
930 sdl_too_old=no
931 sdl=no
932 if (sdl-config --version) >/dev/null 2>&1 ; then
933 if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
934 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
935 if test "$_sdlversion" -lt 121 ; then
936 sdl_too_old=yes
937 else
938 sdl=yes
939 fi
940 fi
941 fi
942
943 ##########################################
944 # texi2html probe
945
946 texi2html=no
947 if (texi2html -version) >/dev/null 2>&1; then
948 texi2html=yes
949 fi
950
951 case "`$cc -v 2>&1 | grep version`" in
952     *gcc*)
953         CFLAGS="-Wall $CFLAGS"
954         ;;
955     *)
956         ;;
957 esac
958
959 if test "$sdl" = "no" ; then
960    ffplay=no
961 fi
962
963 if test "$debug" = "yes"; then
964         CFLAGS="-g $CFLAGS"
965 fi
966
967 if test "$optimize" = "small"; then
968 #  CFLAGS=${CFLAGS//-O3/-Os}
969   CFLAGS="$CFLAGS -Os"
970 fi
971
972 if test "$optimize" = "yes"; then
973     if test -n "`$cc -v 2>&1 | grep xlc`"; then
974         CFLAGS="$CFLAGS -O5"
975         LDFLAGS="$LDFLAGS -O5"
976     else
977         CFLAGS="-O3 $CFLAGS"
978     fi
979 fi
980
981 if test x"$bindir" = x""; then
982 bindir="${prefix}/bin"
983 fi
984
985 if test x"$mandir" = x""; then
986 mandir="${prefix}/man"
987 fi
988
989 echo "Install prefix   $prefix"
990 echo "Source path      $source_path"
991 echo "C compiler       $cc"
992 echo "make             $make"
993 echo "CPU              $cpu ($tune)"
994 echo "Big Endian       $bigendian"
995 echo "inttypes.h       $inttypes"
996 echo "broken inttypes.h $emu_fast_int"
997 if test $cpu = "x86" -o $cpu = "x86_64"; then
998 echo "MMX enabled      $mmx"
999 echo "Vector Builtins  $builtin_vector"
1000 fi
1001 if test $cpu = "mips"; then
1002 echo "MMI enabled      $mmi"
1003 fi
1004 if test $cpu = "powerpc"; then
1005 echo "AltiVec enabled  $altivec"
1006 fi
1007 echo "gprof enabled    $gprof"
1008 echo "zlib enabled     $zlib"
1009 echo "mp3lame enabled  $mp3lame"
1010 echo "vorbis enabled   $vorbis"
1011 echo "faad enabled     $faad"
1012 echo "faadbin enabled  $faadbin"
1013 echo "faac enabled     $faac"
1014 echo "xvid enabled     $xvid"
1015 echo "a52 support      $a52"
1016 echo "a52 dlopened     $a52bin"
1017 echo "dts support      $dts"
1018 echo "pp support       $pp"
1019 echo "debug symbols    $debug"
1020 echo "strip symbols    $dostrip"
1021 echo "optimize         $optimize"
1022 echo "shared pp        $shared_pp"
1023 echo "Video hooking    $vhook"
1024 echo "SDL support      $sdl"
1025 if test $sdl_too_old = "yes"; then
1026 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1027 fi
1028 echo "risky / patent encumbered codecs $risky"
1029
1030 if test "$vhook" = "yes" ; then
1031 echo "Imlib2 support   $imlib2"
1032 echo "freetype support $freetype2"
1033 fi
1034 echo "Sun medialib support"  $sunmlib
1035 echo "pthreads support"      $pthreads
1036 echo "AMR-NB float support"  $amr_nb
1037 echo "AMR-NB fixed support"  $amr_nb_fixed
1038 echo "AMR-WB float support"  $amr_wb
1039 if test "$gpl" = "no" ; then
1040 echo "License: LGPL"
1041 else
1042 echo "License: GPL"
1043 fi
1044
1045 echo "Creating config.mak and config.h"
1046
1047 echo "# Automatically generated by configure - do not modify" > config.mak
1048 echo "/* Automatically generated by configure - do not modify */" > $TMPH
1049
1050 echo "prefix=$prefix" >> config.mak
1051 echo "bindir=$bindir" >> config.mak
1052 echo "mandir=$mandir" >> config.mak
1053 echo "MAKE=$make" >> config.mak
1054 echo "CC=$cc" >> config.mak
1055 echo "AR=$ar" >> config.mak
1056 echo "RANLIB=$ranlib" >> config.mak
1057 if test "$dostrip" = "yes" ; then
1058 echo "STRIP=$strip" >> config.mak
1059 echo "INSTALLSTRIP=-s" >> config.mak
1060 else
1061 echo "STRIP=echo ignoring strip" >> config.mak
1062 echo "INSTALLSTRIP=" >> config.mak
1063 fi
1064
1065 # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
1066 # shared modules on OS/X (vhook/Makefile).
1067 SHCFLAGS=$CFLAGS
1068 if test "$needmdynamicnopic" = yes; then
1069    CFLAGS="$CFLAGS -mdynamic-no-pic"
1070 fi
1071
1072 echo "OPTFLAGS=$CFLAGS" >> config.mak
1073 echo "SHCFLAGS=$SHCFLAGS">>config.mak
1074 echo "LDFLAGS=$LDFLAGS" >> config.mak
1075 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1076 echo "SHFLAGS=$SHFLAGS" >> config.mak
1077 echo "LIBPREF=$LIBPREF" >> config.mak
1078 echo "LIBSUF=$LIBSUF" >> config.mak
1079 echo "SLIBPREF=$SLIBPREF" >> config.mak
1080 echo "SLIBSUF=$SLIBSUF" >> config.mak
1081 echo "EXESUF=$EXESUF" >> config.mak
1082 echo "TARGET_OS=$TARGET_OS" >> config.mak
1083 if test "$cpu" = "x86" ; then
1084   echo "TARGET_ARCH_X86=yes" >> config.mak
1085   echo "#define ARCH_X86 1" >> $TMPH
1086 elif test "$cpu" = "x86_64" ; then
1087   echo "TARGET_ARCH_X86_64=yes" >> config.mak
1088   echo "#define ARCH_X86_64 1" >> $TMPH
1089 elif test "$cpu" = "armv4l" ; then
1090   echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1091   echo "#define ARCH_ARMV4L 1" >> $TMPH
1092 elif test "$cpu" = "alpha" ; then
1093   echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1094   echo "#define ARCH_ALPHA 1" >> $TMPH
1095 elif test "$cpu" = "sparc64" ; then
1096   echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1097   echo "#define ARCH_SPARC64 1" >> $TMPH
1098   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1099   echo "#define ARCH_SPARC 1" >> $TMPH
1100 elif test "$cpu" = "sparc" ; then
1101   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1102   echo "#define ARCH_SPARC 1" >> $TMPH
1103 elif test "$cpu" = "powerpc" ; then
1104   echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1105   echo "#define ARCH_POWERPC 1" >> $TMPH
1106   if test $POWERPCMODE = "32bits"; then
1107     echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1108   else
1109     echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1110   fi
1111   if test "$powerpc_perf" = "yes"; then
1112     echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1113   fi
1114 elif test "$cpu" = "mips" ; then
1115   echo "TARGET_ARCH_MIPS=yes" >> config.mak
1116   echo "#define ARCH_MIPS 1" >> $TMPH
1117 elif test "$cpu" = "sh4" ; then
1118   echo "TARGET_ARCH_SH4=yes" >> config.mak
1119   echo "#define ARCH_SH4 1" >> $TMPH
1120 fi
1121 echo "#define TUNECPU $TUNECPU" >> $TMPH
1122 if test "$bigendian" = "yes" ; then
1123   echo "WORDS_BIGENDIAN=yes" >> config.mak
1124   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1125 fi
1126 if test "$inttypes" != "yes" ; then
1127   echo "#define EMULATE_INTTYPES 1" >> $TMPH
1128 fi
1129 if test "$emu_fast_int" = "yes" ; then
1130   echo "#define EMULATE_FAST_INT 1" >> $TMPH
1131 fi
1132 if test "$mmx" = "yes" ; then
1133   echo "TARGET_MMX=yes" >> config.mak
1134   echo "#define HAVE_MMX 1" >> $TMPH
1135   echo "#define __CPU__ 586" >> $TMPH
1136 fi
1137 if test "$builtin_vector" = "yes" ; then
1138   echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1139   echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1140 fi
1141 if test "$mmi" = "yes" ; then
1142   echo "TARGET_MMI=yes" >> config.mak
1143   echo "#define HAVE_MMI 1" >> $TMPH
1144 fi
1145 if test "$altivec" = "yes" ; then
1146   echo "TARGET_ALTIVEC=yes" >> config.mak
1147   echo "#define HAVE_ALTIVEC 1" >> $TMPH
1148   echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1149   echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1150   if test "$_altivec_h" = "yes" ; then
1151     echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1152   else
1153     echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1154   fi
1155 fi
1156 if test "$gprof" = "yes" ; then
1157   echo "TARGET_GPROF=yes" >> config.mak
1158   echo "#define HAVE_GPROF 1" >> $TMPH
1159 fi
1160 if test "$localtime_r" = "yes" ; then
1161   echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1162 fi
1163 if test "$imlib2" = "yes" ; then
1164   echo "HAVE_IMLIB2=yes" >> config.mak
1165 fi
1166 if test "$freetype2" = "yes" ; then
1167   echo "HAVE_FREETYPE2=yes" >> config.mak
1168 fi
1169 if test "$sunmlib" = "yes" ; then
1170   echo "HAVE_MLIB=yes" >> config.mak
1171   echo "#define HAVE_MLIB 1" >> $TMPH
1172   extralibs="$extralibs -lmlib"
1173 fi
1174 if test "$pthreads" = "yes" ; then
1175   echo "HAVE_PTHREADS=yes" >> config.mak
1176   echo "#define HAVE_PTHREADS 1" >> $TMPH
1177   if test $targetos != FreeBSD; then
1178      extralibs="$extralibs -lpthread"
1179   fi
1180 fi
1181 if test "$sdl" = "yes" ; then
1182   echo "CONFIG_SDL=yes" >> config.mak
1183   echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1184   echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1185 fi
1186 if test "$texi2html" = "yes"; then
1187   echo "BUILD_DOC=yes" >> config.mak
1188 fi
1189 if test "$have_lrintf" = "yes" ; then
1190   echo "#define HAVE_LRINTF 1" >> $TMPH
1191 fi
1192 if test "$vhook" = "yes" ; then
1193   echo "BUILD_VHOOK=yes" >> config.mak
1194   echo "#define HAVE_VHOOK 1" >> $TMPH
1195   extralibs="$extralibs $ldl"
1196 fi
1197 if test "$lshared" = "yes" ; then
1198   echo "BUILD_SHARED=yes" >> config.mak
1199   echo "PIC=-fPIC" >> config.mak
1200 fi
1201 echo "EXTRALIBS=$extralibs" >> config.mak
1202 version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1203  cut -d '"' -f 2`
1204 echo "VERSION=$version" >>config.mak
1205 # if you do not want to use encoders, disable that.
1206 echo "#define CONFIG_ENCODERS 1" >> $TMPH
1207 echo "CONFIG_ENCODERS=yes" >> config.mak
1208
1209 # if you do not want to use decoders, disable that.
1210 echo "#define CONFIG_DECODERS 1" >> $TMPH
1211 echo "CONFIG_DECODERS=yes" >> config.mak
1212
1213 # AC3
1214 if test "$a52" = "yes" ; then
1215   echo "#define CONFIG_AC3 1" >> $TMPH
1216   echo "CONFIG_AC3=yes" >> config.mak
1217
1218   if test "$a52bin" = "yes" ; then
1219     echo "#define CONFIG_A52BIN 1" >> $TMPH
1220     echo "CONFIG_A52BIN=yes" >> config.mak
1221   fi
1222 fi
1223
1224 # DTS
1225 if test "$dts" = "yes" ; then
1226   echo "#define CONFIG_DTS 1" >> $TMPH
1227   echo "CONFIG_DTS=yes" >> config.mak
1228 fi
1229
1230 # PP
1231 if test "$pp" = "yes" ; then
1232   echo "#define CONFIG_PP 1" >> $TMPH
1233   echo "CONFIG_PP=yes" >> config.mak
1234
1235   if test "$shared_pp" = "yes" ; then
1236     echo "#define SHARED_PP 1" >> $TMPH
1237     echo "SHARED_PP=yes" >> config.mak
1238   fi
1239 fi
1240
1241 # mpeg audio high precision mode
1242 if test "$mpegaudio_hp" = "yes" ; then
1243   echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1244 fi
1245
1246 if test "$v4l" = "yes" ; then
1247   echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1248   echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1249 fi
1250
1251 if test "$dv1394" = "yes" ; then
1252   echo "#define CONFIG_DV1394 1" >> $TMPH
1253   echo "CONFIG_DV1394=yes" >> config.mak
1254 fi
1255
1256 if test "$dlopen" = "yes" ; then
1257   echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1258 fi
1259
1260 if test "$dlfcn" = "yes" ; then
1261   echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1262 fi
1263
1264 if test "$audio_oss" = "yes" ; then
1265   echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1266   echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1267 fi
1268
1269 if test "$audio_beos" = "yes" ; then
1270   echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1271   echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1272 fi
1273
1274 if test "$network" = "yes" ; then
1275   echo "#define CONFIG_NETWORK 1" >> $TMPH
1276   echo "CONFIG_NETWORK=yes" >> config.mak
1277 fi
1278
1279 if test "$zlib" = "yes" ; then
1280   echo "#define CONFIG_ZLIB 1" >> $TMPH
1281   echo "CONFIG_ZLIB=yes" >> config.mak
1282 fi
1283
1284 if test "$mp3lame" = "yes" ; then
1285   echo "#define CONFIG_MP3LAME 1" >> $TMPH
1286   echo "CONFIG_MP3LAME=yes" >> config.mak
1287 fi
1288
1289 if test "$vorbis" = "yes" ; then
1290   echo "#define CONFIG_VORBIS 1" >> $TMPH
1291   echo "CONFIG_VORBIS=yes" >> config.mak
1292 fi
1293
1294 if test "$faad" = "yes" ; then
1295   echo "#define CONFIG_FAAD 1" >> $TMPH
1296   echo "CONFIG_FAAD=yes" >> config.mak
1297 fi
1298
1299 if test "$faadbin" = "yes" ; then
1300   echo "#define CONFIG_FAADBIN 1" >> $TMPH
1301   echo "CONFIG_FAADBIN=yes" >> config.mak
1302 fi
1303
1304 if test "$faac" = "yes" ; then
1305   echo "#define CONFIG_FAAC 1" >> $TMPH
1306   echo "CONFIG_FAAC=yes" >> config.mak
1307 fi
1308
1309 if test "$xvid" = "yes" ; then
1310   echo "#define CONFIG_XVID 1" >> $TMPH
1311   echo "CONFIG_XVID=yes" >> config.mak
1312 fi
1313
1314 if test "$mingw32" = "yes" ; then
1315   echo "#define CONFIG_WIN32 1" >> $TMPH
1316   echo "CONFIG_WIN32=yes" >> config.mak
1317   echo "HAVE_W32THREADS=yes" >> config.mak
1318   echo "#define HAVE_W32THREADS 1" >> $TMPH
1319   echo "#ifndef __MINGW32__" >> $TMPH
1320   echo "#define __MINGW32__ 1" >> $TMPH
1321   echo "#endif" >> $TMPH
1322 fi
1323
1324 if test "$os2" = "yes" ; then
1325   echo "#define CONFIG_OS2 1" >> $TMPH
1326   echo "CONFIG_OS2=yes" >> config.mak
1327 fi
1328
1329 if test "$TARGET_OS" = "SunOS" ; then
1330   echo "#define CONFIG_SUNOS 1" >> $TMPH
1331 fi
1332
1333 if test "$darwin" = "yes"; then
1334   echo "#define CONFIG_DARWIN 1"  >> $TMPH
1335   echo "CONFIG_DARWIN=yes" >> config.mak
1336 fi
1337
1338 if test "$_malloc_h" = "yes" ; then
1339   echo "#define HAVE_MALLOC_H 1" >> $TMPH
1340 else
1341   echo "#undef  HAVE_MALLOC_H" >> $TMPH
1342 fi
1343
1344 if test "$_memalign" = "yes" ; then
1345   echo "#define HAVE_MEMALIGN 1" >> $TMPH
1346 else
1347   echo "#undef  HAVE_MEMALIGN" >> $TMPH
1348 fi
1349
1350 if test "$memalignhack" = "yes" ; then
1351   echo "#define MEMALIGN_HACK 1" >> $TMPH
1352 fi
1353
1354
1355 if test "$netserver" = "yes" ; then
1356   echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1357   echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1358 fi
1359
1360 if test "$need_inet_aton" = "yes" ; then
1361   echo "NEED_INET_ATON=yes" >> config.mak
1362 fi
1363
1364 if test "$simpleidct" = "yes" ; then
1365   echo "#define SIMPLE_IDCT 1" >> $TMPH
1366 fi
1367
1368 if test "$ffserver" = "yes" ; then
1369   echo "#define CONFIG_FFSERVER 1" >> $TMPH
1370   echo "CONFIG_FFSERVER=yes" >> config.mak
1371 fi
1372
1373 if test "$ffplay" = "yes" ; then
1374   echo "CONFIG_FFPLAY=yes" >> config.mak
1375 fi
1376
1377 if test "$risky" = "yes" ; then
1378   echo "#define CONFIG_RISKY 1" >> $TMPH
1379   echo "CONFIG_RISKY=yes" >> config.mak
1380 fi
1381
1382 if test "$gpl" = "yes" ; then
1383   echo "#define CONFIG_GPL 1" >> $TMPH
1384   echo "CONFIG_GPL=yes" >> config.mak
1385 fi
1386
1387 echo "#define restrict $_restrict" >> $TMPH
1388
1389 if test "$optimize" = "small"; then
1390   echo "#define always_inline"  >> $TMPH
1391 fi
1392
1393 # build tree in object directory if source path is different from current one
1394 if test "$source_path_used" = "yes" ; then
1395     DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1396           libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1397     FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1398     for dir in $DIRS ; do
1399             mkdir -p $dir
1400     done
1401     for f in $FILES ; do
1402         ln -sf $source_path/$f $f
1403     done
1404 fi
1405 echo "SRC_PATH=$source_path" >> config.mak
1406
1407 if test "$amr_wb" = "yes" ; then
1408   echo "#define AMR_WB 1" >> $TMPH
1409   echo "AMR_WB=yes" >> config.mak
1410   echo
1411   echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1412   echo "V5.1.0 from "
1413   echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1414   echo "and extracted the source to libavcodec/amrwb_float"
1415   echo
1416 fi
1417
1418 if test "$amr_nb" = "yes" ; then
1419   echo "#define AMR_NB 1" >> $TMPH
1420   echo "AMR_NB=yes" >> config.mak
1421   echo
1422 if test "$amr_nb_fixed" = "yes" ; then
1423   echo "AMR_NB_FIXED=yes" >> config.mak
1424   echo "#define AMR_NB_FIXED 1" >> $TMPH
1425   echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1426   echo "REL-5 version 5.1.0 from "
1427   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
1428   echo "and extracted src to libavcodec/amr"
1429   echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1430   echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1431   echo
1432 else
1433   echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1434   echo "REL-5 V5.1.0 from "
1435   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
1436   echo "and extracted the source to libavcodec/amr_float"
1437   echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1438   echo
1439 fi
1440
1441 fi
1442
1443 diff $TMPH config.h >/dev/null 2>&1
1444 if test $? -ne 0 ; then
1445         mv -f $TMPH config.h
1446 else
1447         echo "config.h is unchanged"
1448 fi
1449
1450 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH