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)
76 prefix="/boot/home/config"
77 # helps building libavcodec
78 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
79 # 3 gcc releases known for BeOS, each with ugly bugs
80 gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
81 case "$gcc_version" in
82 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
85 *20010315*) echo "BeBits gcc"
86 CFLAGS="$CFLAGS -fno-expensive-optimizations"
90 # disable linux things
95 # no need for libm, but the inet stuff
97 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
98 extralibs="-lbind -lsocket"
107 LDFLAGS="-export-dynamic"
112 extralibs="-lpoll -lgnugetopt -lm"
119 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
120 SHFLAGS="-dynamiclib"
130 test -f /usr/include/inttypes.h || \
131 test -f /usr/local/include/inttypes.h || \
132 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
133 "/usr/include/inttypes.h !!!"
142 # XXX: we assume an absolute path is given when launching configure,
143 # except in './configure' case.
144 source_path=${0%configure}
145 source_path=${source_path%/}
146 source_path_used="yes"
147 if test -z "$source_path" -o "$source_path" = "." ; then
149 source_path_used="no"
154 int main( void ) { return (int) dlopen("foo", 0); }
159 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
163 if $cc -o $TMPO $TMPC 2> /dev/null ; then
169 #include <X11/Xlib.h>
171 int main( void ) { return (int) imlib_load_font("foo"); }
175 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
181 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
183 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
185 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
187 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
189 --make=*) make=`echo $opt | cut -d '=' -f 2`
191 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
193 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
195 --extra-libs=*) extralibs=${opt#--extra-libs=}
197 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
199 --disable-mmx) mmx="no"
201 --disable-altivec) altivec="no"
203 --enable-gprof) gprof="yes"
205 --disable-v4l) v4l="no"
207 --disable-audio-oss) audio_oss="no"
209 --disable-audio-beos) audio_beos="no"
211 --disable-network) network="no"
213 --disable-zlib) zlib="no"
215 --disable-a52) a52="no"
217 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
219 --enable-mp3lame) mp3lame="yes"
221 --enable-vorbis) vorbis="yes"
223 --disable-vhook) vhook="no"
225 --disable-simple_idct) simpleidct="no"
227 --enable-win32) win32="yes"
229 --enable-shared) lshared="yes"
231 --disable-mpegaudio-hp) mpegaudio_hp="no"
237 if test $mmx = "default"; then
238 if test $cpu = "x86"; then
245 # Can only do AltiVec on PowerPC
246 if test $altivec = "default"; then
247 if test $cpu = "powerpc"; then
254 # See does our compiler support Motorola AltiVec C API
255 if test $altivec = "yes"; then
258 vector signed int v1, v2, v3;
263 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
266 # Can only do mmi on mips
267 if test $mmi = "default"; then
268 if test $cpu = "mips"; then
275 # See does our compiler support mmi
276 if test $mmi = "yes"; then
279 __asm__ ("lq \$2, 0(\$2)");
283 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
286 # Checking for CFLAGS
287 if test -z "$CFLAGS"; then
291 if test "$win32" = "yes" ; then
292 cross_prefix="i386-mingw32msvc-"
298 cc="${cross_prefix}${cc}"
299 ar="${cross_prefix}${ar}"
300 ranlib="${cross_prefix}${ranlib}"
301 strip="${cross_prefix}${strip}"
303 if test -z "$cross_prefix" ; then
306 # big/little endian test
308 #include <inttypes.h>
309 int main(int argc, char ** argv){
310 volatile uint32_t i=0x01234567;
311 return (*((uint8_t*)(&i))) == 0x67;
315 if $cc -o $TMPO $TMPC 2>/dev/null ; then
316 $TMPO && bigendian="yes"
318 echo big/little test failed
323 # if cross compiling, cannot launch a program, so make a static guess
324 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
331 # check availability of some header files
335 int main( void ) { return 0; }
340 if $cc -o $TMPO $TMPC 2> /dev/null ; then
343 # check for memalign - atmos
348 string = memalign(64, sizeof(char));
352 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
358 int main( void ) { return *strptime("", "", 0); }
362 if $cc -o $TMPO $TMPC 2> /dev/null ; then
366 if test "$zlib" = "yes"; then
367 # check for zlib - mmu_man
371 if (zlibVersion() != ZLIB_VERSION)
372 puts("zlib version differs !!!");
377 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
378 # $TMPO 2> /dev/null > /dev/null || zlib="no"
379 # XXX: more tests needed - runtime test
381 if test "$zlib" = "yes"; then
382 extralibs="$extralibs -lz"
385 # test for lrintf in math.h
387 #define _ISOC9X_SOURCE 1
389 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
393 if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then
395 $TMPO 2> /dev/null > /dev/null || have_lrintf="no"
399 for restrict_keyword in restrict __restrict__ __restrict; do
400 echo "void foo(char * $restrict_keyword p);" > $TMPC
401 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
402 _restrict=$restrict_keyword
407 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
410 Usage: configure [options]
411 Options: [defaults in brackets after descriptions]
414 echo "Standard options:"
415 echo " --help print this message"
416 echo " --prefix=PREFIX install in PREFIX [$prefix]"
417 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
418 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
419 echo " --enable-win32 enable win32 cross compile"
420 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
421 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
422 echo " --enable-shared build shared libraries [default=no]"
424 echo "Advanced options (experts only):"
425 echo " --source-path=PATH path of source code [$source_path]"
426 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
427 echo " --cc=CC use C compiler CC [$cc]"
428 echo " --make=MAKE use specified make [$make]"
429 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
430 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
431 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
432 echo " --cpu=CPU force cpu to CPU [$cpu]"
433 echo " --disable-mmx disable mmx usage"
434 echo " --disable-altivec disable AltiVec usage"
435 echo " --disable-audio-oss disable OSS audio support [default=no]"
436 echo " --disable-audio-beos disable BeOS audio support [default=no]"
437 echo " --disable-v4l disable video4linux grabbing [default=no]"
438 echo " --disable-network disable network support [default=no]"
439 echo " --disable-zlib disable zlib [default=no]"
440 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
441 echo " --disable-vhook disable video hooking support"
442 echo " --enable-gprof enable profiling with gprof [$gprof]"
443 echo " --disable-mpegaudio-hp faster (but less accurate)"
444 echo " mpegaudio decoding [default=no]"
446 echo "NOTE: The object files are build at the place where configure is launched"
450 echo "Install prefix $prefix"
451 echo "Source path $source_path"
452 echo "C compiler $cc"
455 echo "Big Endian $bigendian"
456 if test $cpu = "x86"; then
457 echo "MMX enabled $mmx"
459 if test $cpu = "mips"; then
460 echo "MMI enabled $mmi"
462 if test $cpu = "powerpc"; then
463 echo "AltiVec enabled $altivec"
465 echo "gprof enabled $gprof"
466 echo "zlib enabled $zlib"
467 echo "mp3lame enabled $mp3lame"
468 echo "vorbis enabled $vorbis"
469 echo "a52 support $a52"
470 echo "a52 dlopened $a52bin"
471 echo "Video hooking $vhook"
473 if test "$vhook" = "yes" ; then
474 echo "Imlib2 support $imlib2"
477 echo "Creating config.mak and config.h"
479 echo "# Automatically generated by configure - do not modify" > config.mak
480 echo "/* Automatically generated by configure - do not modify */" > $TMPH
482 echo "prefix=$prefix" >> config.mak
483 echo "MAKE=$make" >> config.mak
484 echo "CC=$cc" >> config.mak
485 echo "AR=$ar" >> config.mak
486 echo "RANLIB=$ranlib" >> config.mak
487 echo "STRIP=$strip" >> config.mak
488 echo "OPTFLAGS=$CFLAGS" >> config.mak
489 echo "LDFLAGS=$LDFLAGS" >> config.mak
490 echo "SHFLAGS=$SHFLAGS" >> config.mak
491 if test "$cpu" = "x86" ; then
492 echo "TARGET_ARCH_X86=yes" >> config.mak
493 echo "#define ARCH_X86 1" >> $TMPH
494 elif test "$cpu" = "armv4l" ; then
495 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
496 echo "#define ARCH_ARMV4L 1" >> $TMPH
497 elif test "$cpu" = "alpha" ; then
498 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
499 echo "#define ARCH_ALPHA 1" >> $TMPH
500 elif test "$cpu" = "sparc64" ; then
501 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
502 echo "#define ARCH_SPARC64 1" >> $TMPH
503 elif test "$cpu" = "powerpc" ; then
504 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
505 echo "#define ARCH_POWERPC 1" >> $TMPH
506 elif test "$cpu" = "mips" ; then
507 echo "TARGET_ARCH_MIPS=yes" >> config.mak
508 echo "#define ARCH_MIPS 1" >> $TMPH
510 if test "$bigendian" = "yes" ; then
511 echo "WORDS_BIGENDIAN=yes" >> config.mak
512 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
514 if test "$mmx" = "yes" ; then
515 echo "TARGET_MMX=yes" >> config.mak
516 echo "#define HAVE_MMX 1" >> $TMPH
518 if test "$mmi" = "yes" ; then
519 echo "TARGET_MMI=yes" >> config.mak
520 echo "#define HAVE_MMI 1" >> $TMPH
522 if test "$altivec" = "yes" ; then
523 echo "TARGET_ALTIVEC=yes" >> config.mak
524 echo "#define HAVE_ALTIVEC 1" >> $TMPH
526 if test "$gprof" = "yes" ; then
527 echo "TARGET_GPROF=yes" >> config.mak
528 echo "#define HAVE_GPROF 1" >> $TMPH
530 if test "$strptime" = "yes" ; then
531 echo "#define HAVE_STRPTIME 1" >> $TMPH
533 echo "BUILD_STRPTIME=yes" >> config.mak
535 if test "$imlib2" = "yes" ; then
536 echo "HAVE_IMLIB2=yes" >> config.mak
538 if test "$have_lrintf" = "yes" ; then
539 echo "#define HAVE_LRINTF 1" >> $TMPH
541 if test "$vhook" = "yes" ; then
542 echo "BUILD_VHOOK=yes" >> config.mak
543 echo "#define HAVE_VHOOK 1" >> $TMPH
544 extralibs="$extralibs $ldl"
546 if test "$lshared" = "yes" ; then
547 echo "BUILD_SHARED=yes" >> config.mak
548 echo "PIC=-fPIC" >> config.mak
550 echo "EXTRALIBS=$extralibs" >> config.mak
551 echo -n "VERSION=" >>config.mak
552 head $source_path/VERSION >>config.mak
554 # if you do not want to use encoders, disable that.
555 echo "#define CONFIG_ENCODERS 1" >> $TMPH
556 echo "CONFIG_ENCODERS=yes" >> config.mak
558 # if you do not want to use decoders, disable that.
559 echo "#define CONFIG_DECODERS 1" >> $TMPH
560 echo "CONFIG_DECODERS=yes" >> config.mak
563 if test "$a52" = "yes" ; then
564 echo "#define CONFIG_AC3 1" >> $TMPH
565 echo "CONFIG_AC3=yes" >> config.mak
567 if test "$a52bin" = "yes" ; then
568 echo "#define CONFIG_A52BIN 1" >> $TMPH
569 echo "CONFIG_A52BIN=yes" >> config.mak
573 # mpeg audio high precision mode
574 if test "$mpegaudio_hp" = "yes" ; then
575 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
578 if test "$v4l" = "yes" ; then
579 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
580 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
583 if test "$audio_oss" = "yes" ; then
584 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
585 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
588 if test "$audio_beos" = "yes" ; then
589 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
590 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
593 if test "$network" = "yes" ; then
594 echo "#define CONFIG_NETWORK 1" >> $TMPH
595 echo "CONFIG_NETWORK=yes" >> config.mak
598 if test "$zlib" = "yes" ; then
599 echo "#define CONFIG_ZLIB 1" >> $TMPH
600 echo "CONFIG_ZLIB=yes" >> config.mak
603 if test "$mp3lame" = "yes" ; then
604 echo "#define CONFIG_MP3LAME 1" >> $TMPH
605 echo "CONFIG_MP3LAME=yes" >> config.mak
608 if test "$vorbis" = "yes" ; then
609 echo "#define CONFIG_VORBIS 1" >> $TMPH
610 echo "CONFIG_VORBIS=yes" >> config.mak
613 if test "$win32" = "yes" ; then
614 echo "#define CONFIG_WIN32 1" >> $TMPH
615 echo "CONFIG_WIN32=yes" >> config.mak
618 if test "$cygwin" = "yes" ; then
619 # setup correct exesuffix
620 echo "CONFIG_WIN32=yes" >> config.mak
623 if test "$darwin" = "yes"; then
624 echo "#define CONFIG_DARWIN 1" >> $TMPH
625 echo "CONFIG_DARWIN=yes" >> config.mak
628 if test "$_malloc_h" = "yes" ; then
629 echo "#define HAVE_MALLOC_H 1" >> $TMPH
631 echo "#undef HAVE_MALLOC_H" >> $TMPH
634 if test "$_memalign" = "yes" ; then
635 echo "#define HAVE_MEMALIGN 1" >> $TMPH
637 echo "#undef HAVE_MEMALIGN" >> $TMPH
640 if test "$netserver" = "yes" ; then
641 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
642 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
645 if test "$simpleidct" = "yes" ; then
646 echo "#define SIMPLE_IDCT 1" >> $TMPH
649 echo "#define restrict $_restrict" >> $TMPH
651 # build tree in object directory if source path is different from current one
652 if test "$source_path_used" = "yes" ; then
653 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
654 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
655 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
656 for dir in $DIRS ; do
660 ln -sf $source_path/$f $f
663 echo "SRC_PATH=$source_path" >> config.mak
665 diff $TMPH config.h >/dev/null 2>&1
666 if test $? -ne 0 ; then
669 echo "config.h is unchanged"
672 rm -f $TMPO $TMPC $TMPS $TMPH