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 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
17 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
32 i386|i486|i586|i686|i86pc|BePC)
41 "Power Macintosh"|ppc)
75 LDFLAGS=-Wl,--warn-common
82 prefix="/boot/home/config"
83 # helps building libavcodec
84 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
85 # 3 gcc releases known for BeOS, each with ugly bugs
86 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
87 case "$gcc_version" in
88 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
91 *20010315*) echo "BeBits gcc"
92 CFLAGS="$CFLAGS -fno-expensive-optimizations"
96 # disable linux things
101 # no need for libm, but the inet stuff
103 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
104 extralibs="-lbind -lsocket"
117 extralibs="$extralibs -lsocket -lnsl"
123 LDFLAGS="$LDFLAGS -export-dynamic"
128 extralibs="-lpoll -lgnugetopt -lm"
135 SHFLAGS="-dynamiclib"
140 FFSLDFLAGS=-Wl,-bind_at_load
141 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
142 case "$gcc_version" in
144 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
147 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
156 test -f /usr/include/inttypes.h || \
157 test -f /usr/local/include/inttypes.h || \
158 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
159 "/usr/include/inttypes.h !!!"
162 LDFLAGS="$LDFLAGS -rdynamic"
168 # XXX: we assume an absolute path is given when launching configure,
169 # except in './configure' case.
170 source_path=${0%configure}
171 source_path=${source_path%/}
172 source_path_used="yes"
173 if test -z "$source_path" -o "$source_path" = "." ; then
175 source_path_used="no"
180 int main( void ) { return (int) dlopen("foo", 0); }
185 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
191 if $cc -o $TMPO $TMPC 2> /dev/null ; then
199 int main( void ) { return (int) dlopen("foo", 0); }
202 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
207 if $cc -o $TMPO $TMPC 2> /dev/null ; then
215 #include <X11/Xlib.h>
217 int main( void ) { return (int) imlib_load_font("foo"); }
221 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
227 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
229 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
231 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
233 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
235 --make=*) make=`echo $opt | cut -d '=' -f 2`
237 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
239 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
241 --extra-libs=*) extralibs=${opt#--extra-libs=}
243 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
245 --disable-mmx) mmx="no"
247 --disable-altivec) altivec="no"
249 --enable-gprof) gprof="yes"
251 --disable-v4l) v4l="no"
253 --disable-audio-oss) audio_oss="no"
255 --disable-audio-beos) audio_beos="no"
257 --disable-network) network="no"
259 --disable-zlib) zlib="no"
261 --disable-a52) a52="no"
263 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
265 --enable-mp3lame) mp3lame="yes"
267 --enable-vorbis) vorbis="yes"
269 --disable-vhook) vhook="no"
271 --disable-simple_idct) simpleidct="no"
273 --enable-win32) win32="yes"
275 --enable-shared) lshared="yes"
277 --disable-mpegaudio-hp) mpegaudio_hp="no"
279 --disable-ffserver) ffserver="no"
285 if test $mmx = "default"; then
286 if test $cpu = "x86"; then
293 # Can only do AltiVec on PowerPC
294 if test $altivec = "default"; then
295 if test $cpu = "powerpc"; then
302 # See does our compiler support Motorola AltiVec C API
303 if test $altivec = "yes"; then
306 vector signed int v1, v2, v3;
311 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
314 # Can only do mmi on mips
315 if test $mmi = "default"; then
316 if test $cpu = "mips"; then
323 # See does our compiler support mmi
324 if test $mmi = "yes"; then
327 __asm__ ("lq \$2, 0(\$2)");
331 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
334 # Checking for CFLAGS
335 if test -z "$CFLAGS"; then
339 if test "$win32" = "yes" ; then
340 cross_prefix="i386-mingw32msvc-"
346 cc="${cross_prefix}${cc}"
347 ar="${cross_prefix}${ar}"
348 ranlib="${cross_prefix}${ranlib}"
349 strip="${cross_prefix}${strip}"
351 if test -z "$cross_prefix" ; then
354 # big/little endian test
356 #include <inttypes.h>
357 int main(int argc, char ** argv){
358 volatile uint32_t i=0x01234567;
359 return (*((uint8_t*)(&i))) == 0x67;
363 if $cc -o $TMPO $TMPC 2>/dev/null ; then
364 $TMPO && bigendian="yes"
366 echo big/little test failed
371 # if cross compiling, cannot launch a program, so make a static guess
372 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
379 # check availability of some header files
383 int main( void ) { return 0; }
388 if $cc -o $TMPO $TMPC 2> /dev/null ; then
391 # check for memalign - atmos
396 string = memalign(64, sizeof(char));
400 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
406 int main( void ) { return *strptime("", "", 0); }
410 if $cc -o $TMPO $TMPC 2> /dev/null ; then
414 if test "$zlib" = "yes"; then
415 # check for zlib - mmu_man
419 if (zlibVersion() != ZLIB_VERSION)
420 puts("zlib version differs !!!");
425 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
426 # $TMPO 2> /dev/null > /dev/null || zlib="no"
427 # XXX: more tests needed - runtime test
429 if test "$zlib" = "yes"; then
430 extralibs="$extralibs -lz"
433 # test for lrintf in math.h
435 #define _ISOC9X_SOURCE 1
437 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
441 if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then
443 $TMPO 2> /dev/null > /dev/null || have_lrintf="no"
447 for restrict_keyword in restrict __restrict__ __restrict; do
448 echo "void foo(char * $restrict_keyword p);" > $TMPC
449 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
450 _restrict=$restrict_keyword
455 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
458 Usage: configure [options]
459 Options: [defaults in brackets after descriptions]
462 echo "Standard options:"
463 echo " --help print this message"
464 echo " --prefix=PREFIX install in PREFIX [$prefix]"
465 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
466 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
467 echo " --enable-win32 enable win32 cross compile"
468 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
469 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
470 echo " --enable-shared build shared libraries [default=no]"
472 echo "Advanced options (experts only):"
473 echo " --source-path=PATH path of source code [$source_path]"
474 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
475 echo " --cc=CC use C compiler CC [$cc]"
476 echo " --make=MAKE use specified make [$make]"
477 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
478 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
479 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
480 echo " --cpu=CPU force cpu to CPU [$cpu]"
481 echo " --disable-mmx disable mmx usage"
482 echo " --disable-altivec disable AltiVec usage"
483 echo " --disable-audio-oss disable OSS audio support [default=no]"
484 echo " --disable-audio-beos disable BeOS audio support [default=no]"
485 echo " --disable-v4l disable video4linux grabbing [default=no]"
486 echo " --disable-network disable network support [default=no]"
487 echo " --disable-zlib disable zlib [default=no]"
488 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
489 echo " --disable-vhook disable video hooking support"
490 echo " --enable-gprof enable profiling with gprof [$gprof]"
491 echo " --disable-mpegaudio-hp faster (but less accurate)"
492 echo " mpegaudio decoding [default=no]"
493 echo " --disable-ffserver disable ffserver build"
495 echo "NOTE: The object files are build at the place where configure is launched"
499 echo "Install prefix $prefix"
500 echo "Source path $source_path"
501 echo "C compiler $cc"
504 echo "Big Endian $bigendian"
505 if test $cpu = "x86"; then
506 echo "MMX enabled $mmx"
508 if test $cpu = "mips"; then
509 echo "MMI enabled $mmi"
511 if test $cpu = "powerpc"; then
512 echo "AltiVec enabled $altivec"
514 echo "gprof enabled $gprof"
515 echo "zlib enabled $zlib"
516 echo "mp3lame enabled $mp3lame"
517 echo "vorbis enabled $vorbis"
518 echo "a52 support $a52"
519 echo "a52 dlopened $a52bin"
520 echo "Video hooking $vhook"
522 if test "$vhook" = "yes" ; then
523 echo "Imlib2 support $imlib2"
526 echo "Creating config.mak and config.h"
528 echo "# Automatically generated by configure - do not modify" > config.mak
529 echo "/* Automatically generated by configure - do not modify */" > $TMPH
531 echo "prefix=$prefix" >> config.mak
532 echo "MAKE=$make" >> config.mak
533 echo "CC=$cc" >> config.mak
534 echo "AR=$ar" >> config.mak
535 echo "RANLIB=$ranlib" >> config.mak
536 echo "STRIP=$strip" >> config.mak
537 echo "OPTFLAGS=$CFLAGS" >> config.mak
538 echo "LDFLAGS=$LDFLAGS" >> config.mak
539 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
540 echo "SHFLAGS=$SHFLAGS" >> config.mak
541 if test "$cpu" = "x86" ; then
542 echo "TARGET_ARCH_X86=yes" >> config.mak
543 echo "#define ARCH_X86 1" >> $TMPH
544 elif test "$cpu" = "armv4l" ; then
545 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
546 echo "#define ARCH_ARMV4L 1" >> $TMPH
547 elif test "$cpu" = "alpha" ; then
548 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
549 echo "#define ARCH_ALPHA 1" >> $TMPH
550 elif test "$cpu" = "sparc64" ; then
551 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
552 echo "#define ARCH_SPARC64 1" >> $TMPH
553 elif test "$cpu" = "powerpc" ; then
554 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
555 echo "#define ARCH_POWERPC 1" >> $TMPH
556 elif test "$cpu" = "mips" ; then
557 echo "TARGET_ARCH_MIPS=yes" >> config.mak
558 echo "#define ARCH_MIPS 1" >> $TMPH
560 if test "$bigendian" = "yes" ; then
561 echo "WORDS_BIGENDIAN=yes" >> config.mak
562 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
564 if test "$mmx" = "yes" ; then
565 echo "TARGET_MMX=yes" >> config.mak
566 echo "#define HAVE_MMX 1" >> $TMPH
568 if test "$mmi" = "yes" ; then
569 echo "TARGET_MMI=yes" >> config.mak
570 echo "#define HAVE_MMI 1" >> $TMPH
572 if test "$altivec" = "yes" ; then
573 echo "TARGET_ALTIVEC=yes" >> config.mak
574 echo "#define HAVE_ALTIVEC 1" >> $TMPH
576 if test "$gprof" = "yes" ; then
577 echo "TARGET_GPROF=yes" >> config.mak
578 echo "#define HAVE_GPROF 1" >> $TMPH
580 if test "$strptime" = "yes" ; then
581 echo "#define HAVE_STRPTIME 1" >> $TMPH
583 echo "BUILD_STRPTIME=yes" >> config.mak
585 if test "$imlib2" = "yes" ; then
586 echo "HAVE_IMLIB2=yes" >> config.mak
588 if test "$have_lrintf" = "yes" ; then
589 echo "#define HAVE_LRINTF 1" >> $TMPH
591 if test "$vhook" = "yes" ; then
592 echo "BUILD_VHOOK=yes" >> config.mak
593 echo "#define HAVE_VHOOK 1" >> $TMPH
594 extralibs="$extralibs $ldl"
596 if test "$lshared" = "yes" ; then
597 echo "BUILD_SHARED=yes" >> config.mak
598 echo "PIC=-fPIC" >> config.mak
600 echo "EXTRALIBS=$extralibs" >> config.mak
601 echo -n "VERSION=" >>config.mak
602 head $source_path/VERSION >>config.mak
604 # if you do not want to use encoders, disable that.
605 echo "#define CONFIG_ENCODERS 1" >> $TMPH
606 echo "CONFIG_ENCODERS=yes" >> config.mak
608 # if you do not want to use decoders, disable that.
609 echo "#define CONFIG_DECODERS 1" >> $TMPH
610 echo "CONFIG_DECODERS=yes" >> config.mak
613 if test "$a52" = "yes" ; then
614 echo "#define CONFIG_AC3 1" >> $TMPH
615 echo "CONFIG_AC3=yes" >> config.mak
617 if test "$a52bin" = "yes" ; then
618 echo "#define CONFIG_A52BIN 1" >> $TMPH
619 echo "CONFIG_A52BIN=yes" >> config.mak
623 # mpeg audio high precision mode
624 if test "$mpegaudio_hp" = "yes" ; then
625 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
628 if test "$v4l" = "yes" ; then
629 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
630 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
633 if test "$dlopen" = "yes" ; then
634 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
637 if test "$dlfcn" = "yes" ; then
638 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
641 if test "$audio_oss" = "yes" ; then
642 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
643 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
646 if test "$audio_beos" = "yes" ; then
647 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
648 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
651 if test "$network" = "yes" ; then
652 echo "#define CONFIG_NETWORK 1" >> $TMPH
653 echo "CONFIG_NETWORK=yes" >> config.mak
656 if test "$zlib" = "yes" ; then
657 echo "#define CONFIG_ZLIB 1" >> $TMPH
658 echo "CONFIG_ZLIB=yes" >> config.mak
661 if test "$mp3lame" = "yes" ; then
662 echo "#define CONFIG_MP3LAME 1" >> $TMPH
663 echo "CONFIG_MP3LAME=yes" >> config.mak
666 if test "$vorbis" = "yes" ; then
667 echo "#define CONFIG_VORBIS 1" >> $TMPH
668 echo "CONFIG_VORBIS=yes" >> config.mak
671 if test "$win32" = "yes" ; then
672 echo "#define CONFIG_WIN32 1" >> $TMPH
673 echo "CONFIG_WIN32=yes" >> config.mak
676 if test "$cygwin" = "yes" ; then
677 # setup correct exesuffix
678 echo "CONFIG_WIN32=yes" >> config.mak
681 if test "$darwin" = "yes"; then
682 echo "#define CONFIG_DARWIN 1" >> $TMPH
683 echo "CONFIG_DARWIN=yes" >> config.mak
686 if test "$_malloc_h" = "yes" ; then
687 echo "#define HAVE_MALLOC_H 1" >> $TMPH
689 echo "#undef HAVE_MALLOC_H" >> $TMPH
692 if test "$_memalign" = "yes" ; then
693 echo "#define HAVE_MEMALIGN 1" >> $TMPH
695 echo "#undef HAVE_MEMALIGN" >> $TMPH
698 if test "$netserver" = "yes" ; then
699 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
700 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
703 if test "$need_inet_aton" = "yes" ; then
704 echo "NEED_INET_ATON=yes" >> config.mak
707 if test "$simpleidct" = "yes" ; then
708 echo "#define SIMPLE_IDCT 1" >> $TMPH
711 if test "$ffserver" = "yes" ; then
712 echo "#define CONFIG_FFSERVER 1" >> $TMPH
713 echo "CONFIG_FFSERVER=yes" >> config.mak
716 echo "#define restrict $_restrict" >> $TMPH
718 # build tree in object directory if source path is different from current one
719 if test "$source_path_used" = "yes" ; then
720 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
721 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
722 FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
723 for dir in $DIRS ; do
727 ln -sf $source_path/$f $f
730 echo "SRC_PATH=$source_path" >> config.mak
732 diff $TMPH config.h >/dev/null 2>&1
733 if test $? -ne 0 ; then
736 echo "config.h is unchanged"
739 rm -f $TMPO $TMPC $TMPS $TMPH