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