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)
74 LDFLAGS=-Wl,--warn-common
81 prefix="/boot/home/config"
82 # helps building libavcodec
83 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
84 # 3 gcc releases known for BeOS, each with ugly bugs
85 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
86 case "$gcc_version" in
87 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
90 *20010315*) echo "BeBits gcc"
91 CFLAGS="$CFLAGS -fno-expensive-optimizations"
95 # disable linux things
100 # no need for libm, but the inet stuff
102 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
103 extralibs="-lbind -lsocket"
116 extralibs="$extralibs -lsocket -lnsl"
122 LDFLAGS="$LDFLAGS -export-dynamic"
127 extralibs="-lpoll -lgnugetopt -lm"
134 SHFLAGS="-dynamiclib"
139 FFSLDFLAGS=-Wl,-bind_at_load
140 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
141 case "$gcc_version" in
143 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
146 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
155 test -f /usr/include/inttypes.h || \
156 test -f /usr/local/include/inttypes.h || \
157 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
158 "/usr/include/inttypes.h !!!"
161 LDFLAGS="$LDFLAGS -rdynamic"
167 # XXX: we assume an absolute path is given when launching configure,
168 # except in './configure' case.
169 source_path=${0%configure}
170 source_path=${source_path%/}
171 source_path_used="yes"
172 if test -z "$source_path" -o "$source_path" = "." ; then
174 source_path_used="no"
179 int main( void ) { return (int) dlopen("foo", 0); }
184 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
190 if $cc -o $TMPO $TMPC 2> /dev/null ; then
198 int main( void ) { return (int) dlopen("foo", 0); }
201 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
206 if $cc -o $TMPO $TMPC 2> /dev/null ; then
214 #include <X11/Xlib.h>
216 int main( void ) { return (int) imlib_load_font("foo"); }
220 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
226 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
228 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
230 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
232 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
234 --make=*) make=`echo $opt | cut -d '=' -f 2`
236 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
238 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
240 --extra-libs=*) extralibs=${opt#--extra-libs=}
242 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
244 --disable-mmx) mmx="no"
246 --disable-altivec) altivec="no"
248 --enable-gprof) gprof="yes"
250 --disable-v4l) v4l="no"
252 --disable-audio-oss) audio_oss="no"
254 --disable-audio-beos) audio_beos="no"
256 --disable-network) network="no"
258 --disable-zlib) zlib="no"
260 --disable-a52) a52="no"
262 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
264 --enable-mp3lame) mp3lame="yes"
266 --enable-vorbis) vorbis="yes"
268 --disable-vhook) vhook="no"
270 --disable-simple_idct) simpleidct="no"
272 --enable-win32) win32="yes"
274 --enable-shared) lshared="yes"
276 --disable-mpegaudio-hp) mpegaudio_hp="no"
282 if test $mmx = "default"; then
283 if test $cpu = "x86"; then
290 # Can only do AltiVec on PowerPC
291 if test $altivec = "default"; then
292 if test $cpu = "powerpc"; then
299 # See does our compiler support Motorola AltiVec C API
300 if test $altivec = "yes"; then
303 vector signed int v1, v2, v3;
308 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
311 # Can only do mmi on mips
312 if test $mmi = "default"; then
313 if test $cpu = "mips"; then
320 # See does our compiler support mmi
321 if test $mmi = "yes"; then
324 __asm__ ("lq \$2, 0(\$2)");
328 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
331 # Checking for CFLAGS
332 if test -z "$CFLAGS"; then
336 if test "$win32" = "yes" ; then
337 cross_prefix="i386-mingw32msvc-"
343 cc="${cross_prefix}${cc}"
344 ar="${cross_prefix}${ar}"
345 ranlib="${cross_prefix}${ranlib}"
346 strip="${cross_prefix}${strip}"
348 if test -z "$cross_prefix" ; then
351 # big/little endian test
353 #include <inttypes.h>
354 int main(int argc, char ** argv){
355 volatile uint32_t i=0x01234567;
356 return (*((uint8_t*)(&i))) == 0x67;
360 if $cc -o $TMPO $TMPC 2>/dev/null ; then
361 $TMPO && bigendian="yes"
363 echo big/little test failed
368 # if cross compiling, cannot launch a program, so make a static guess
369 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
376 # check availability of some header files
380 int main( void ) { return 0; }
385 if $cc -o $TMPO $TMPC 2> /dev/null ; then
388 # check for memalign - atmos
393 string = memalign(64, sizeof(char));
397 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
403 int main( void ) { return *strptime("", "", 0); }
407 if $cc -o $TMPO $TMPC 2> /dev/null ; then
411 if test "$zlib" = "yes"; then
412 # check for zlib - mmu_man
416 if (zlibVersion() != ZLIB_VERSION)
417 puts("zlib version differs !!!");
422 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
423 # $TMPO 2> /dev/null > /dev/null || zlib="no"
424 # XXX: more tests needed - runtime test
426 if test "$zlib" = "yes"; then
427 extralibs="$extralibs -lz"
430 # test for lrintf in math.h
432 #define _ISOC9X_SOURCE 1
434 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
438 if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then
440 $TMPO 2> /dev/null > /dev/null || have_lrintf="no"
444 for restrict_keyword in restrict __restrict__ __restrict; do
445 echo "void foo(char * $restrict_keyword p);" > $TMPC
446 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
447 _restrict=$restrict_keyword
452 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
455 Usage: configure [options]
456 Options: [defaults in brackets after descriptions]
459 echo "Standard options:"
460 echo " --help print this message"
461 echo " --prefix=PREFIX install in PREFIX [$prefix]"
462 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
463 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
464 echo " --enable-win32 enable win32 cross compile"
465 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
466 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
467 echo " --enable-shared build shared libraries [default=no]"
469 echo "Advanced options (experts only):"
470 echo " --source-path=PATH path of source code [$source_path]"
471 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
472 echo " --cc=CC use C compiler CC [$cc]"
473 echo " --make=MAKE use specified make [$make]"
474 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
475 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
476 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
477 echo " --cpu=CPU force cpu to CPU [$cpu]"
478 echo " --disable-mmx disable mmx usage"
479 echo " --disable-altivec disable AltiVec usage"
480 echo " --disable-audio-oss disable OSS audio support [default=no]"
481 echo " --disable-audio-beos disable BeOS audio support [default=no]"
482 echo " --disable-v4l disable video4linux grabbing [default=no]"
483 echo " --disable-network disable network support [default=no]"
484 echo " --disable-zlib disable zlib [default=no]"
485 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
486 echo " --disable-vhook disable video hooking support"
487 echo " --enable-gprof enable profiling with gprof [$gprof]"
488 echo " --disable-mpegaudio-hp faster (but less accurate)"
489 echo " mpegaudio decoding [default=no]"
491 echo "NOTE: The object files are build at the place where configure is launched"
495 echo "Install prefix $prefix"
496 echo "Source path $source_path"
497 echo "C compiler $cc"
500 echo "Big Endian $bigendian"
501 if test $cpu = "x86"; then
502 echo "MMX enabled $mmx"
504 if test $cpu = "mips"; then
505 echo "MMI enabled $mmi"
507 if test $cpu = "powerpc"; then
508 echo "AltiVec enabled $altivec"
510 echo "gprof enabled $gprof"
511 echo "zlib enabled $zlib"
512 echo "mp3lame enabled $mp3lame"
513 echo "vorbis enabled $vorbis"
514 echo "a52 support $a52"
515 echo "a52 dlopened $a52bin"
516 echo "Video hooking $vhook"
518 if test "$vhook" = "yes" ; then
519 echo "Imlib2 support $imlib2"
522 echo "Creating config.mak and config.h"
524 echo "# Automatically generated by configure - do not modify" > config.mak
525 echo "/* Automatically generated by configure - do not modify */" > $TMPH
527 echo "prefix=$prefix" >> config.mak
528 echo "MAKE=$make" >> config.mak
529 echo "CC=$cc" >> config.mak
530 echo "AR=$ar" >> config.mak
531 echo "RANLIB=$ranlib" >> config.mak
532 echo "STRIP=$strip" >> config.mak
533 echo "OPTFLAGS=$CFLAGS" >> config.mak
534 echo "LDFLAGS=$LDFLAGS" >> config.mak
535 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
536 echo "SHFLAGS=$SHFLAGS" >> config.mak
537 if test "$cpu" = "x86" ; then
538 echo "TARGET_ARCH_X86=yes" >> config.mak
539 echo "#define ARCH_X86 1" >> $TMPH
540 elif test "$cpu" = "armv4l" ; then
541 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
542 echo "#define ARCH_ARMV4L 1" >> $TMPH
543 elif test "$cpu" = "alpha" ; then
544 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
545 echo "#define ARCH_ALPHA 1" >> $TMPH
546 elif test "$cpu" = "sparc64" ; then
547 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
548 echo "#define ARCH_SPARC64 1" >> $TMPH
549 elif test "$cpu" = "powerpc" ; then
550 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
551 echo "#define ARCH_POWERPC 1" >> $TMPH
552 elif test "$cpu" = "mips" ; then
553 echo "TARGET_ARCH_MIPS=yes" >> config.mak
554 echo "#define ARCH_MIPS 1" >> $TMPH
556 if test "$bigendian" = "yes" ; then
557 echo "WORDS_BIGENDIAN=yes" >> config.mak
558 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
560 if test "$mmx" = "yes" ; then
561 echo "TARGET_MMX=yes" >> config.mak
562 echo "#define HAVE_MMX 1" >> $TMPH
564 if test "$mmi" = "yes" ; then
565 echo "TARGET_MMI=yes" >> config.mak
566 echo "#define HAVE_MMI 1" >> $TMPH
568 if test "$altivec" = "yes" ; then
569 echo "TARGET_ALTIVEC=yes" >> config.mak
570 echo "#define HAVE_ALTIVEC 1" >> $TMPH
572 if test "$gprof" = "yes" ; then
573 echo "TARGET_GPROF=yes" >> config.mak
574 echo "#define HAVE_GPROF 1" >> $TMPH
576 if test "$strptime" = "yes" ; then
577 echo "#define HAVE_STRPTIME 1" >> $TMPH
579 echo "BUILD_STRPTIME=yes" >> config.mak
581 if test "$imlib2" = "yes" ; then
582 echo "HAVE_IMLIB2=yes" >> config.mak
584 if test "$have_lrintf" = "yes" ; then
585 echo "#define HAVE_LRINTF 1" >> $TMPH
587 if test "$vhook" = "yes" ; then
588 echo "BUILD_VHOOK=yes" >> config.mak
589 echo "#define HAVE_VHOOK 1" >> $TMPH
590 extralibs="$extralibs $ldl"
592 if test "$lshared" = "yes" ; then
593 echo "BUILD_SHARED=yes" >> config.mak
594 echo "PIC=-fPIC" >> config.mak
596 echo "EXTRALIBS=$extralibs" >> config.mak
597 echo -n "VERSION=" >>config.mak
598 head $source_path/VERSION >>config.mak
600 # if you do not want to use encoders, disable that.
601 echo "#define CONFIG_ENCODERS 1" >> $TMPH
602 echo "CONFIG_ENCODERS=yes" >> config.mak
604 # if you do not want to use decoders, disable that.
605 echo "#define CONFIG_DECODERS 1" >> $TMPH
606 echo "CONFIG_DECODERS=yes" >> config.mak
609 if test "$a52" = "yes" ; then
610 echo "#define CONFIG_AC3 1" >> $TMPH
611 echo "CONFIG_AC3=yes" >> config.mak
613 if test "$a52bin" = "yes" ; then
614 echo "#define CONFIG_A52BIN 1" >> $TMPH
615 echo "CONFIG_A52BIN=yes" >> config.mak
619 # mpeg audio high precision mode
620 if test "$mpegaudio_hp" = "yes" ; then
621 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
624 if test "$v4l" = "yes" ; then
625 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
626 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
629 if test "$dlopen" = "yes" ; then
630 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
633 if test "$dlfcn" = "yes" ; then
634 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
637 if test "$audio_oss" = "yes" ; then
638 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
639 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
642 if test "$audio_beos" = "yes" ; then
643 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
644 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
647 if test "$network" = "yes" ; then
648 echo "#define CONFIG_NETWORK 1" >> $TMPH
649 echo "CONFIG_NETWORK=yes" >> config.mak
652 if test "$zlib" = "yes" ; then
653 echo "#define CONFIG_ZLIB 1" >> $TMPH
654 echo "CONFIG_ZLIB=yes" >> config.mak
657 if test "$mp3lame" = "yes" ; then
658 echo "#define CONFIG_MP3LAME 1" >> $TMPH
659 echo "CONFIG_MP3LAME=yes" >> config.mak
662 if test "$vorbis" = "yes" ; then
663 echo "#define CONFIG_VORBIS 1" >> $TMPH
664 echo "CONFIG_VORBIS=yes" >> config.mak
667 if test "$win32" = "yes" ; then
668 echo "#define CONFIG_WIN32 1" >> $TMPH
669 echo "CONFIG_WIN32=yes" >> config.mak
672 if test "$cygwin" = "yes" ; then
673 # setup correct exesuffix
674 echo "CONFIG_WIN32=yes" >> config.mak
677 if test "$darwin" = "yes"; then
678 echo "#define CONFIG_DARWIN 1" >> $TMPH
679 echo "CONFIG_DARWIN=yes" >> config.mak
682 if test "$_malloc_h" = "yes" ; then
683 echo "#define HAVE_MALLOC_H 1" >> $TMPH
685 echo "#undef HAVE_MALLOC_H" >> $TMPH
688 if test "$_memalign" = "yes" ; then
689 echo "#define HAVE_MEMALIGN 1" >> $TMPH
691 echo "#undef HAVE_MEMALIGN" >> $TMPH
694 if test "$netserver" = "yes" ; then
695 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
696 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
699 if test "$need_inet_aton" = "yes" ; then
700 echo "NEED_INET_ATON=yes" >> config.mak
703 if test "$simpleidct" = "yes" ; then
704 echo "#define SIMPLE_IDCT 1" >> $TMPH
707 echo "#define restrict $_restrict" >> $TMPH
709 # build tree in object directory if source path is different from current one
710 if test "$source_path_used" = "yes" ; then
711 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
712 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
713 FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
714 for dir in $DIRS ; do
718 ln -sf $source_path/$f $f
721 echo "SRC_PATH=$source_path" >> config.mak
723 diff $TMPH config.h >/dev/null 2>&1
724 if test $? -ne 0 ; then
727 echo "config.h is unchanged"
730 rm -f $TMPO $TMPC $TMPS $TMPH