OSDN Git Service

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