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"
106 extralibs="-lpoll -lgnugetopt -lm"
113 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
114 SHFLAGS="-dynamiclib"
123 test -f /usr/include/inttypes.h || \
124 test -f /usr/local/include/inttypes.h || \
125 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
126 "/usr/include/inttypes.h !!!"
132 # XXX: we assume an absolute path is given when launching configure,
133 # except in './configure' case.
134 source_path=${0%configure}
135 source_path=${source_path%/}
136 source_path_used="yes"
137 if test -z "$source_path" -o "$source_path" = "." ; then
139 source_path_used="no"
144 int main( void ) { return (int) dlopen("foo", 0); }
147 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
152 #include <X11/Xlib.h>
154 int main( void ) { return (int) imlib_load_font("foo"); }
158 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
164 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
166 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
168 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
170 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
172 --make=*) make=`echo $opt | cut -d '=' -f 2`
174 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
176 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
178 --extra-libs=*) extralibs=${opt#--extra-libs=}
180 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
182 --disable-mmx) mmx="no"
184 --disable-altivec) altivec="no"
186 --enable-gprof) gprof="yes"
188 --disable-v4l) v4l="no"
190 --disable-audio-oss) audio_oss="no"
192 --disable-audio-beos) audio_beos="no"
194 --disable-network) network="no"
196 --disable-zlib) zlib="no"
198 --disable-a52) a52="no"
200 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
202 --enable-mp3lame) mp3lame="yes"
204 --enable-vorbis) vorbis="yes"
206 --disable-vhook) vhook="no"
208 --disable-simple_idct) simpleidct="no"
210 --enable-win32) win32="yes"
212 --enable-shared) lshared="yes"
214 --disable-mpegaudio-hp) mpegaudio_hp="no"
220 if test $mmx = "default"; then
221 if test $cpu = "x86"; then
228 # Can only do AltiVec on PowerPC
229 if test $altivec = "default"; then
230 if test $cpu = "powerpc"; then
237 # See does our compiler support Motorola AltiVec C API
238 if test $altivec = "yes"; then
241 vector signed int v1, v2, v3;
246 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
249 # Can only do mmi on mips
250 if test $mmi = "default"; then
251 if test $cpu = "mips"; then
258 # See does our compiler support mmi
259 if test $mmi = "yes"; then
262 __asm__ ("lq \$2, 0(\$2)");
266 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
269 # Checking for CFLAGS
270 if test -z "$CFLAGS"; then
274 if test "$win32" = "yes" ; then
275 cross_prefix="i386-mingw32msvc-"
281 cc="${cross_prefix}${cc}"
282 ar="${cross_prefix}${ar}"
283 ranlib="${cross_prefix}${ranlib}"
284 strip="${cross_prefix}${strip}"
286 if test -z "$cross_prefix" ; then
289 # big/little endian test
291 #include <inttypes.h>
292 int main(int argc, char ** argv){
293 volatile uint32_t i=0x01234567;
294 return (*((uint8_t*)(&i))) == 0x67;
298 if $cc -o $TMPO $TMPC 2>/dev/null ; then
299 $TMPO && bigendian="yes"
301 echo big/little test failed
306 # if cross compiling, cannot launch a program, so make a static guess
307 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
314 # check availability of some header files
318 int main( void ) { return 0; }
323 if $cc -o $TMPO $TMPC 2> /dev/null ; then
326 # check for memalign - atmos
331 string = memalign(64, sizeof(char));
335 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
341 int main( void ) { return *strptime("", "", 0); }
345 if $cc -o $TMPO $TMPC 2> /dev/null ; then
349 if test "$zlib" = "yes"; then
350 # check for zlib - mmu_man
354 if (zlibVersion() != ZLIB_VERSION)
355 puts("zlib version differs !!!");
360 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
361 # $TMPO 2> /dev/null > /dev/null || zlib="no"
362 # XXX: more tests needed - runtime test
364 if test "$zlib" = "yes"; then
365 extralibs="$extralibs -lz"
368 # test for lrintf in math.h
370 #define _ISOC9X_SOURCE 1
372 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
376 if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then
378 $TMPO 2> /dev/null > /dev/null || have_lrintf="no"
382 for restrict_keyword in restrict __restrict__ __restrict; do
383 echo "void foo(char * $restrict_keyword p);" > $TMPC
384 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
385 _restrict=$restrict_keyword
390 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
393 Usage: configure [options]
394 Options: [defaults in brackets after descriptions]
397 echo "Standard options:"
398 echo " --help print this message"
399 echo " --prefix=PREFIX install in PREFIX [$prefix]"
400 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
401 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
402 echo " --enable-win32 enable win32 cross compile"
403 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
404 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
405 echo " --enable-shared build shared libraries [default=no]"
407 echo "Advanced options (experts only):"
408 echo " --source-path=PATH path of source code [$source_path]"
409 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
410 echo " --cc=CC use C compiler CC [$cc]"
411 echo " --make=MAKE use specified make [$make]"
412 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
413 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
414 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
415 echo " --cpu=CPU force cpu to CPU [$cpu]"
416 echo " --disable-mmx disable mmx usage"
417 echo " --disable-altivec disable AltiVec usage"
418 echo " --disable-audio-oss disable OSS audio support [default=no]"
419 echo " --disable-audio-beos disable BeOS audio support [default=no]"
420 echo " --disable-v4l disable video4linux grabbing [default=no]"
421 echo " --disable-network disable network support [default=no]"
422 echo " --disable-zlib disable zlib [default=no]"
423 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
424 # echo " --disable-vhook disable video hooking support"
425 echo " --enable-gprof enable profiling with gprof [$gprof]"
426 echo " --disable-mpegaudio-hp faster (but less accurate)"
427 echo " mpegaudio decoding [default=no]"
429 echo "NOTE: The object files are build at the place where configure is launched"
433 echo "Install prefix $prefix"
434 echo "Source path $source_path"
435 echo "C compiler $cc"
438 echo "Big Endian $bigendian"
439 if test $cpu = "x86"; then
440 echo "MMX enabled $mmx"
442 if test $cpu = "mips"; then
443 echo "MMI enabled $mmi"
445 if test $cpu = "powerpc"; then
446 echo "AltiVec enabled $altivec"
448 echo "gprof enabled $gprof"
449 echo "zlib enabled $zlib"
450 echo "mp3lame enabled $mp3lame"
451 echo "vorbis enabled $vorbis"
452 echo "a52 support $a52"
453 echo "a52 dlopened $a52bin"
454 # echo "Video hooking $vhook"
456 if test "$vhook" = "yes" ; then
457 : echo "Imlib2 support $imlib2"
460 echo "Creating config.mak and config.h"
462 echo "# Automatically generated by configure - do not modify" > config.mak
463 echo "/* Automatically generated by configure - do not modify */" > $TMPH
465 echo "prefix=$prefix" >> config.mak
466 echo "MAKE=$make" >> config.mak
467 echo "CC=$cc" >> config.mak
468 echo "AR=$ar" >> config.mak
469 echo "RANLIB=$ranlib" >> config.mak
470 echo "STRIP=$strip" >> config.mak
471 echo "OPTFLAGS=$CFLAGS" >> config.mak
472 echo "LDFLAGS=$LDFLAGS" >> config.mak
473 echo "SHFLAGS=$SHFLAGS" >> config.mak
474 if test "$cpu" = "x86" ; then
475 echo "TARGET_ARCH_X86=yes" >> config.mak
476 echo "#define ARCH_X86 1" >> $TMPH
477 elif test "$cpu" = "armv4l" ; then
478 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
479 echo "#define ARCH_ARMV4L 1" >> $TMPH
480 elif test "$cpu" = "alpha" ; then
481 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
482 echo "#define ARCH_ALPHA 1" >> $TMPH
483 elif test "$cpu" = "powerpc" ; then
484 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
485 echo "#define ARCH_POWERPC 1" >> $TMPH
486 elif test "$cpu" = "mips" ; then
487 echo "TARGET_ARCH_MIPS=yes" >> config.mak
488 echo "#define ARCH_MIPS 1" >> $TMPH
490 if test "$bigendian" = "yes" ; then
491 echo "WORDS_BIGENDIAN=yes" >> config.mak
492 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
494 if test "$mmx" = "yes" ; then
495 echo "TARGET_MMX=yes" >> config.mak
496 echo "#define HAVE_MMX 1" >> $TMPH
498 if test "$mmi" = "yes" ; then
499 echo "TARGET_MMI=yes" >> config.mak
500 echo "#define HAVE_MMI 1" >> $TMPH
502 if test "$altivec" = "yes" ; then
503 echo "TARGET_ALTIVEC=yes" >> config.mak
504 echo "#define HAVE_ALTIVEC 1" >> $TMPH
506 if test "$gprof" = "yes" ; then
507 echo "TARGET_GPROF=yes" >> config.mak
508 echo "#define HAVE_GPROF 1" >> $TMPH
510 if test "$strptime" = "yes" ; then
511 echo "#define HAVE_STRPTIME 1" >> $TMPH
513 echo "BUILD_STRPTIME=yes" >> config.mak
515 if test "$imlib2" = "yes" ; then
516 echo "HAVE_IMLIB2=yes" >> config.mak
518 if test "$have_lrintf" = "yes" ; then
519 echo "#define HAVE_LRINTF 1" >> $TMPH
521 if test "$vhook" = "yes" ; then
522 echo "BUILD_VHOOK=yes" >> config.mak
523 echo "#define HAVE_VHOOK 1" >> $TMPH
524 extralibs="$extralibs -ldl"
526 if test "$lshared" = "yes" ; then
527 echo "BUILD_SHARED=yes" >> config.mak
528 echo "PIC=-fPIC" >> config.mak
530 echo "EXTRALIBS=$extralibs" >> config.mak
531 echo -n "VERSION=" >>config.mak
532 head $source_path/VERSION >>config.mak
534 # if you do not want to use encoders, disable that.
535 echo "#define CONFIG_ENCODERS 1" >> $TMPH
536 echo "CONFIG_ENCODERS=yes" >> config.mak
538 # if you do not want to use decoders, disable that.
539 echo "#define CONFIG_DECODERS 1" >> $TMPH
540 echo "CONFIG_DECODERS=yes" >> config.mak
543 if test "$a52" = "yes" ; then
544 echo "#define CONFIG_AC3 1" >> $TMPH
545 echo "CONFIG_AC3=yes" >> config.mak
547 if test "$a52bin" = "yes" ; then
548 echo "#define CONFIG_A52BIN 1" >> $TMPH
549 echo "CONFIG_A52BIN=yes" >> config.mak
553 # mpeg audio high precision mode
554 if test "$mpegaudio_hp" = "yes" ; then
555 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
558 if test "$v4l" = "yes" ; then
559 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
560 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
563 if test "$audio_oss" = "yes" ; then
564 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
565 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
568 if test "$audio_beos" = "yes" ; then
569 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
570 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
573 if test "$network" = "yes" ; then
574 echo "#define CONFIG_NETWORK 1" >> $TMPH
575 echo "CONFIG_NETWORK=yes" >> config.mak
578 if test "$zlib" = "yes" ; then
579 echo "#define CONFIG_ZLIB 1" >> $TMPH
580 echo "CONFIG_ZLIB=yes" >> config.mak
583 if test "$mp3lame" = "yes" ; then
584 echo "#define CONFIG_MP3LAME 1" >> $TMPH
585 echo "CONFIG_MP3LAME=yes" >> config.mak
588 if test "$vorbis" = "yes" ; then
589 echo "#define CONFIG_VORBIS 1" >> $TMPH
590 echo "CONFIG_VORBIS=yes" >> config.mak
593 if test "$win32" = "yes" ; then
594 echo "#define CONFIG_WIN32 1" >> $TMPH
595 echo "CONFIG_WIN32=yes" >> config.mak
598 if test "$cygwin" = "yes" ; then
599 # setup correct exesuffix
600 echo "CONFIG_WIN32=yes" >> config.mak
603 if test "$darwin" = "yes"; then
604 echo "#define CONFIG_DARWIN 1" >> $TMPH
605 echo "CONFIG_DARWIN=yes" >> config.mak
608 if test "$_malloc_h" = "yes" ; then
609 echo "#define HAVE_MALLOC_H 1" >> $TMPH
611 echo "#undef HAVE_MALLOC_H" >> $TMPH
614 if test "$_memalign" = "yes" ; then
615 echo "#define HAVE_MEMALIGN 1" >> $TMPH
617 echo "#undef HAVE_MEMALIGN" >> $TMPH
620 if test "$netserver" = "yes" ; then
621 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
622 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
625 if test "$simpleidct" = "yes" ; then
626 echo "#define SIMPLE_IDCT 1" >> $TMPH
629 echo "#define restrict $_restrict" >> $TMPH
631 # build tree in object directory if source path is different from current one
632 if test "$source_path_used" = "yes" ; then
633 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
634 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
635 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
636 for dir in $DIRS ; do
640 ln -sf $source_path/$f $f
643 echo "SRC_PATH=$source_path" >> config.mak
645 diff $TMPH config.h >/dev/null 2>&1
646 if test $? -ne 0 ; then
649 echo "config.h is unchanged"
652 rm -f $TMPO $TMPC $TMPS $TMPH