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