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