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