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