3 # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
18 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
33 i386|i486|i586|i686|i86pc|BePC)
42 "Power Macintosh"|ppc)
79 LDFLAGS=-Wl,--warn-common
90 prefix="/boot/home/config"
91 # helps building libavcodec
92 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
93 # 3 gcc releases known for BeOS, each with ugly bugs
94 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
95 case "$gcc_version" in
96 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
99 *20010315*) echo "BeBits gcc"
100 CFLAGS="$CFLAGS -fno-expensive-optimizations"
104 # disable linux things
110 # no need for libm, but the inet stuff
112 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
113 extralibs="-lbind -lsocket"
127 extralibs="$extralibs -lsocket -lnsl"
134 LDFLAGS="$LDFLAGS -export-dynamic"
140 extralibs="-lpoll -lgnugetopt -lm"
148 SHFLAGS="-dynamiclib"
153 FFSLDFLAGS=-Wl,-bind_at_load
154 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
155 case "$gcc_version" in
157 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
160 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
178 test -f /usr/include/inttypes.h || \
179 test -f /usr/local/include/inttypes.h || \
180 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
181 "/usr/include/inttypes.h !!!"
184 LDFLAGS="$LDFLAGS -rdynamic"
189 strip="echo ignore strip"
191 LDFLAGS="-Zomf -Zstack 16384"
209 # From mplayer configure. We need TARGET_OS available
210 # to the Makefile, so it can distinguish between flavors
211 # of AltiVec on PowerPC
212 TARGET_OS=`( uname -s ) 2>&1`
214 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
222 [cC][yY][gG][wW][iI][nN]*)
226 TARGET_OS="$TARGET_OS-UNKNOWN"
231 # XXX: we assume an absolute path is given when launching configure,
232 # except in './configure' case.
233 source_path=${0%configure}
234 source_path=${source_path%/}
235 source_path_used="yes"
236 if test -z "$source_path" -o "$source_path" = "." ; then
238 source_path_used="no"
243 int main( void ) { return (int) dlopen("foo", 0); }
248 if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
254 if $cc -o $TMPE $TMPC 2> /dev/null ; then
262 int main( void ) { return (int) dlopen("foo", 0); }
265 if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
270 if $cc -o $TMPE $TMPC 2> /dev/null ; then
278 #include <X11/Xlib.h>
280 int main( void ) { return (int) imlib_load_font("foo"); }
284 if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
290 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
292 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
294 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
296 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
298 --make=*) make=`echo $opt | cut -d '=' -f 2`
300 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
302 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
304 --extra-libs=*) extralibs=${opt#--extra-libs=}
306 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
308 --disable-mmx) mmx="no"
310 --disable-altivec) altivec="no"
312 --enable-gprof) gprof="yes"
314 --disable-v4l) v4l="no"
316 --disable-audio-oss) audio_oss="no"
318 --disable-audio-beos) audio_beos="no"
320 --disable-dv1394) dv1394="no"
322 --disable-network) network="no"
324 --disable-zlib) zlib="no"
326 --disable-a52) a52="no"
328 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
330 --enable-mp3lame) mp3lame="yes"
332 --enable-vorbis) vorbis="yes"
334 --disable-vhook) vhook="no"
336 --disable-simple_idct) simpleidct="no"
338 --enable-win32) win32="yes"
340 --enable-mingw32) mingw32="yes"
342 --enable-shared) lshared="yes"
344 --disable-mpegaudio-hp) mpegaudio_hp="no"
346 --disable-ffserver) ffserver="no"
352 if test $mmx = "default"; then
353 if test $cpu = "x86"; then
360 # Can only do AltiVec on PowerPC
361 if test $altivec = "default"; then
362 if test $cpu = "powerpc"; then
369 # See does our compiler support Motorola AltiVec C API
370 if test $altivec = "yes"; then
373 vector signed int v1, v2, v3;
378 $cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
381 # Can only do mmi on mips
382 if test $mmi = "default"; then
383 if test $cpu = "mips"; then
390 # See does our compiler support mmi
391 if test $mmi = "yes"; then
394 __asm__ ("lq \$2, 0(\$2)");
398 $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
401 # Checking for CFLAGS
402 if test -z "$CFLAGS"; then
406 if test "$win32" = "yes" ; then
407 cross_prefix="i386-mingw32msvc-"
414 if test "$mingw32" = "yes" ; then
422 cc="${cross_prefix}${cc}"
423 ar="${cross_prefix}${ar}"
424 ranlib="${cross_prefix}${ranlib}"
425 strip="${cross_prefix}${strip}"
427 if test -z "$cross_prefix" ; then
430 # big/little endian test
432 #include <inttypes.h>
433 int main(int argc, char ** argv){
434 volatile uint32_t i=0x01234567;
435 return (*((uint8_t*)(&i))) == 0x67;
439 if $cc -o $TMPE $TMPC 2>/dev/null ; then
440 $TMPE && bigendian="yes"
442 echo big/little test failed
447 # if cross compiling, cannot launch a program, so make a static guess
448 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
455 # check availability of some header files
459 int main( void ) { return 0; }
464 if $cc -o $TMPE $TMPC 2> /dev/null ; then
467 # check for memalign - atmos
472 string = memalign(64, sizeof(char));
476 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
482 int main( void ) { return *strptime("", "", 0); }
486 if $cc -o $TMPE $TMPC 2> /dev/null ; then
490 if test "$zlib" = "yes"; then
491 # check for zlib - mmu_man
495 if (zlibVersion() != ZLIB_VERSION)
496 puts("zlib version differs !!!");
501 $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
502 # $TMPE 2> /dev/null > /dev/null || zlib="no"
503 # XXX: more tests needed - runtime test
505 if test "$zlib" = "yes"; then
506 extralibs="$extralibs -lz"
509 # test for lrintf in math.h
511 #define _ISOC9X_SOURCE 1
513 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
517 if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
519 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
523 for restrict_keyword in restrict __restrict__ __restrict; do
524 echo "void foo(char * $restrict_keyword p);" > $TMPC
525 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
526 _restrict=$restrict_keyword
531 # test gcc version to see if vector builtins can be used
532 # currently only used on i386 for MMX builtins
535 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
538 #error no vector builtins
544 if $cc -o $TMPO $TMPC 2> /dev/null ; then
548 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
551 Usage: configure [options]
552 Options: [defaults in brackets after descriptions]
555 echo "Standard options:"
556 echo " --help print this message"
557 echo " --prefix=PREFIX install in PREFIX [$prefix]"
558 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
559 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
560 echo " --enable-win32 enable win32 cross compile"
561 echo " --enable-mingw32 enable mingw32 native windows compile"
562 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
563 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
564 echo " --enable-shared build shared libraries [default=no]"
566 echo "Advanced options (experts only):"
567 echo " --source-path=PATH path of source code [$source_path]"
568 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
569 echo " --cc=CC use C compiler CC [$cc]"
570 echo " --make=MAKE use specified make [$make]"
571 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
572 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
573 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
574 echo " --cpu=CPU force cpu to CPU [$cpu]"
575 echo " --disable-mmx disable mmx usage"
576 echo " --disable-altivec disable AltiVec usage"
577 echo " --disable-audio-oss disable OSS audio support [default=no]"
578 echo " --disable-audio-beos disable BeOS audio support [default=no]"
579 echo " --disable-v4l disable video4linux grabbing [default=no]"
580 echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
581 echo " --disable-network disable network support [default=no]"
582 echo " --disable-zlib disable zlib [default=no]"
583 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
584 echo " --disable-vhook disable video hooking support"
585 echo " --enable-gprof enable profiling with gprof [$gprof]"
586 echo " --disable-mpegaudio-hp faster (but less accurate)"
587 echo " mpegaudio decoding [default=no]"
588 echo " --disable-ffserver disable ffserver build"
590 echo "NOTE: The object files are build at the place where configure is launched"
594 echo "Install prefix $prefix"
595 echo "Source path $source_path"
596 echo "C compiler $cc"
599 echo "Big Endian $bigendian"
600 if test $cpu = "x86"; then
601 echo "MMX enabled $mmx"
602 echo "Vector Builtins $builtin_vector"
604 if test $cpu = "mips"; then
605 echo "MMI enabled $mmi"
607 if test $cpu = "powerpc"; then
608 echo "AltiVec enabled $altivec"
610 echo "gprof enabled $gprof"
611 echo "zlib enabled $zlib"
612 echo "mp3lame enabled $mp3lame"
613 echo "vorbis enabled $vorbis"
614 echo "a52 support $a52"
615 echo "a52 dlopened $a52bin"
616 echo "Video hooking $vhook"
618 if test "$vhook" = "yes" ; then
619 echo "Imlib2 support $imlib2"
622 echo "Creating config.mak and config.h"
624 echo "# Automatically generated by configure - do not modify" > config.mak
625 echo "/* Automatically generated by configure - do not modify */" > $TMPH
627 echo "prefix=$prefix" >> config.mak
628 echo "MAKE=$make" >> config.mak
629 echo "CC=$cc" >> config.mak
630 echo "AR=$ar" >> config.mak
631 echo "RANLIB=$ranlib" >> config.mak
632 echo "STRIP=$strip" >> config.mak
633 echo "OPTFLAGS=$CFLAGS" >> config.mak
634 echo "LDFLAGS=$LDFLAGS" >> config.mak
635 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
636 echo "SHFLAGS=$SHFLAGS" >> config.mak
637 echo "LIBPREF=$LIBPREF" >> config.mak
638 echo "LIBSUF=$LIBSUF" >> config.mak
639 echo "SLIBPREF=$SLIBPREF" >> config.mak
640 echo "SLIBSUF=$SLIBSUF" >> config.mak
641 echo "TARGET_OS=$TARGET_OS" >> config.mak
642 if test "$cpu" = "x86" ; then
643 echo "TARGET_ARCH_X86=yes" >> config.mak
644 echo "#define ARCH_X86 1" >> $TMPH
645 elif test "$cpu" = "armv4l" ; then
646 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
647 echo "#define ARCH_ARMV4L 1" >> $TMPH
648 elif test "$cpu" = "alpha" ; then
649 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
650 echo "#define ARCH_ALPHA 1" >> $TMPH
651 elif test "$cpu" = "sparc64" ; then
652 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
653 echo "#define ARCH_SPARC64 1" >> $TMPH
654 elif test "$cpu" = "powerpc" ; then
655 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
656 echo "#define ARCH_POWERPC 1" >> $TMPH
657 echo "// Enable the next line to get PowerPC performance report" >> $TMPH
658 echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
659 echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
660 echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
661 elif test "$cpu" = "mips" ; then
662 echo "TARGET_ARCH_MIPS=yes" >> config.mak
663 echo "#define ARCH_MIPS 1" >> $TMPH
665 if test "$bigendian" = "yes" ; then
666 echo "WORDS_BIGENDIAN=yes" >> config.mak
667 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
669 if test "$mmx" = "yes" ; then
670 echo "TARGET_MMX=yes" >> config.mak
671 echo "#define HAVE_MMX 1" >> $TMPH
673 if test "$builtin_vector" = "yes" ; then
674 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
675 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
677 if test "$mmi" = "yes" ; then
678 echo "TARGET_MMI=yes" >> config.mak
679 echo "#define HAVE_MMI 1" >> $TMPH
681 if test "$altivec" = "yes" ; then
682 echo "TARGET_ALTIVEC=yes" >> config.mak
683 echo "#define HAVE_ALTIVEC 1" >> $TMPH
684 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
685 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
687 if test "$gprof" = "yes" ; then
688 echo "TARGET_GPROF=yes" >> config.mak
689 echo "#define HAVE_GPROF 1" >> $TMPH
691 if test "$strptime" = "yes" ; then
692 echo "#define HAVE_STRPTIME 1" >> $TMPH
694 echo "BUILD_STRPTIME=yes" >> config.mak
696 if test "$imlib2" = "yes" ; then
697 echo "HAVE_IMLIB2=yes" >> config.mak
699 if test "$have_lrintf" = "yes" ; then
700 echo "#define HAVE_LRINTF 1" >> $TMPH
702 if test "$vhook" = "yes" ; then
703 echo "BUILD_VHOOK=yes" >> config.mak
704 echo "#define HAVE_VHOOK 1" >> $TMPH
705 extralibs="$extralibs $ldl"
707 if test "$lshared" = "yes" ; then
708 echo "BUILD_SHARED=yes" >> config.mak
709 echo "PIC=-fPIC" >> config.mak
711 echo "EXTRALIBS=$extralibs" >> config.mak
712 echo -n "VERSION=" >>config.mak
713 head $source_path/VERSION >>config.mak
715 # if you do not want to use encoders, disable that.
716 echo "#define CONFIG_ENCODERS 1" >> $TMPH
717 echo "CONFIG_ENCODERS=yes" >> config.mak
719 # if you do not want to use decoders, disable that.
720 echo "#define CONFIG_DECODERS 1" >> $TMPH
721 echo "CONFIG_DECODERS=yes" >> config.mak
724 if test "$a52" = "yes" ; then
725 echo "#define CONFIG_AC3 1" >> $TMPH
726 echo "CONFIG_AC3=yes" >> config.mak
728 if test "$a52bin" = "yes" ; then
729 echo "#define CONFIG_A52BIN 1" >> $TMPH
730 echo "CONFIG_A52BIN=yes" >> config.mak
734 # mpeg audio high precision mode
735 if test "$mpegaudio_hp" = "yes" ; then
736 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
739 if test "$v4l" = "yes" ; then
740 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
741 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
744 if test "$dv1394" = "yes" ; then
745 echo "#define CONFIG_DV1394 1" >> $TMPH
746 echo "CONFIG_DV1394=yes" >> config.mak
749 if test "$dlopen" = "yes" ; then
750 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
753 if test "$dlfcn" = "yes" ; then
754 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
757 if test "$audio_oss" = "yes" ; then
758 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
759 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
762 if test "$audio_beos" = "yes" ; then
763 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
764 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
767 if test "$network" = "yes" ; then
768 echo "#define CONFIG_NETWORK 1" >> $TMPH
769 echo "CONFIG_NETWORK=yes" >> config.mak
772 if test "$zlib" = "yes" ; then
773 echo "#define CONFIG_ZLIB 1" >> $TMPH
774 echo "CONFIG_ZLIB=yes" >> config.mak
777 if test "$mp3lame" = "yes" ; then
778 echo "#define CONFIG_MP3LAME 1" >> $TMPH
779 echo "CONFIG_MP3LAME=yes" >> config.mak
782 if test "$vorbis" = "yes" ; then
783 echo "#define CONFIG_VORBIS 1" >> $TMPH
784 echo "CONFIG_VORBIS=yes" >> config.mak
787 if test "$win32" = "yes" ; then
788 echo "#define CONFIG_WIN32 1" >> $TMPH
789 echo "CONFIG_WIN32=yes" >> config.mak
792 if test "$mingw32" = "yes" ; then
793 echo "#define CONFIG_WIN32 1" >> $TMPH
794 echo "CONFIG_WIN32=yes" >> config.mak
795 echo "#define __MINGW32__ 1" >> $TMPH
796 echo "__MINGW32__=1" >> config.mak
799 if test "$cygwin" = "yes" ; then
800 # setup correct exesuffix
801 echo "CONFIG_WIN32=yes" >> config.mak
804 if test "$os2" = "yes" ; then
805 echo "#define CONFIG_OS2 1" >> $TMPH
806 echo "CONFIG_OS2=yes" >> config.mak
809 if test "$darwin" = "yes"; then
810 echo "#define CONFIG_DARWIN 1" >> $TMPH
811 echo "CONFIG_DARWIN=yes" >> config.mak
814 if test "$_malloc_h" = "yes" ; then
815 echo "#define HAVE_MALLOC_H 1" >> $TMPH
817 echo "#undef HAVE_MALLOC_H" >> $TMPH
820 if test "$_memalign" = "yes" ; then
821 echo "#define HAVE_MEMALIGN 1" >> $TMPH
823 echo "#undef HAVE_MEMALIGN" >> $TMPH
826 if test "$netserver" = "yes" ; then
827 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
828 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
831 if test "$need_inet_aton" = "yes" ; then
832 echo "NEED_INET_ATON=yes" >> config.mak
835 if test "$simpleidct" = "yes" ; then
836 echo "#define SIMPLE_IDCT 1" >> $TMPH
839 if test "$ffserver" = "yes" ; then
840 echo "#define CONFIG_FFSERVER 1" >> $TMPH
841 echo "CONFIG_FFSERVER=yes" >> config.mak
844 echo "#define restrict $_restrict" >> $TMPH
846 # build tree in object directory if source path is different from current one
847 if test "$source_path_used" = "yes" ; then
848 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
849 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
850 FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
851 for dir in $DIRS ; do
855 ln -sf $source_path/$f $f
858 echo "SRC_PATH=$source_path" >> config.mak
860 diff $TMPH config.h >/dev/null 2>&1
861 if test $? -ne 0 ; then
864 echo "config.h is unchanged"
867 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH