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