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