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 prefix="/boot/home/config"
76 # helps building libavcodec
77 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
79 # disable linux things
82 # no need for libm, but the inet stuff
84 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
85 extralibs="-lbind -lsocket"
93 extralibs="-lpoll -lgnugetopt -lm"
100 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
101 SHFLAGS="-dynamiclib"
110 test -f /usr/include/inttypes.h || \
111 test -f /usr/local/include/inttypes.h || \
112 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
113 "/usr/include/inttypes.h !!!"
119 # XXX: we assume an absolute path is given when launching configure,
120 # except in './configure' case.
121 source_path=${0%configure}
122 source_path=${source_path%/}
123 source_path_used="yes"
124 if test -z "$source_path" -o "$source_path" = "." ; then
126 source_path_used="no"
131 int main( void ) { return (int) dlopen("foo", 0); }
134 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
139 #include <X11/Xlib.h>
141 int main( void ) { return (int) imlib_load_font("foo"); }
145 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
151 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
153 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
155 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
157 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
159 --make=*) make=`echo $opt | cut -d '=' -f 2`
161 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
163 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
165 --extra-libs=*) extralibs=${opt#--extra-libs=}
167 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
169 --disable-mmx) mmx="no"
171 --disable-altivec) altivec="no"
173 --enable-gprof) gprof="yes"
175 --disable-v4l) v4l="no"
177 --disable-audio-oss) audio_oss="no"
179 --disable-network) network="no"
181 --disable-zlib) zlib="no"
183 --disable-a52) a52="no"
185 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
187 --enable-mp3lame) mp3lame="yes"
189 --enable-vorbis) vorbis="yes"
191 --disable-vhook) vhook="no"
193 --disable-simple_idct) simpleidct="no"
195 --enable-win32) win32="yes"
197 --enable-shared) lshared="yes"
199 --disable-mpegaudio-hp) mpegaudio_hp="no"
205 if test $mmx = "default"; then
206 if test $cpu = "x86"; then
213 # Can only do AltiVec on PowerPC
214 if test $altivec = "default"; then
215 if test $cpu = "powerpc"; then
222 # See does our compiler support Motorola AltiVec C API
223 if test $altivec = "yes"; then
226 vector signed int v1, v2, v3;
231 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
234 # Can only do mmi on mips
235 if test $mmi = "default"; then
236 if test $cpu = "mips"; then
243 # See does our compiler support mmi
244 if test $mmi = "yes"; then
247 __asm__ ("lq \$2, 0(\$2)");
251 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
254 # Checking for CFLAGS
255 if test -z "$CFLAGS"; then
259 if test "$win32" = "yes" ; then
260 cross_prefix="i386-mingw32msvc-"
266 cc="${cross_prefix}${cc}"
267 ar="${cross_prefix}${ar}"
268 ranlib="${cross_prefix}${ranlib}"
269 strip="${cross_prefix}${strip}"
271 if test -z "$cross_prefix" ; then
274 # big/little endian test
276 #include <inttypes.h>
277 int main(int argc, char ** argv){
278 volatile uint32_t i=0x01234567;
279 return (*((uint8_t*)(&i))) == 0x67;
283 if $cc -o $TMPO $TMPC 2>/dev/null ; then
284 $TMPO && bigendian="yes"
286 echo big/little test failed
291 # if cross compiling, cannot launch a program, so make a static guess
292 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
299 # check availability of some header files
303 int main( void ) { return 0; }
308 if $cc -o $TMPO $TMPC 2> /dev/null ; then
311 # check for memalign - atmos
316 string = memalign(64, sizeof(char));
320 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
326 int main( void ) { return *strptime("", "", 0); }
330 if $cc -o $TMPO $TMPC 2> /dev/null ; then
334 if test "$zlib" = "yes"; then
335 # check for zlib - mmu_man
339 if (zlibVersion() != ZLIB_VERSION)
340 puts("zlib version differs !!!");
345 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
346 # $TMPO 2> /dev/null > /dev/null || zlib="no"
347 # XXX: more tests needed - runtime test
349 if test "$zlib" = "yes"; then
350 extralibs="$extralibs -lz"
354 for restrict_keyword in restrict __restrict__ __restrict; do
355 echo "void foo(char * $restrict_keyword p);" > $TMPC
356 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
357 _restrict=$restrict_keyword
362 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
365 Usage: configure [options]
366 Options: [defaults in brackets after descriptions]
369 echo "Standard options:"
370 echo " --help print this message"
371 echo " --prefix=PREFIX install in PREFIX [$prefix]"
372 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
373 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
374 echo " --enable-win32 enable win32 cross compile"
375 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
376 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
377 echo " --enable-shared build shared libraries [default=no]"
379 echo "Advanced options (experts only):"
380 echo " --source-path=PATH path of source code [$source_path]"
381 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
382 echo " --cc=CC use C compiler CC [$cc]"
383 echo " --make=MAKE use specified make [$make]"
384 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
385 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
386 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
387 echo " --cpu=CPU force cpu to CPU [$cpu]"
388 echo " --disable-mmx disable mmx usage"
389 echo " --disable-altivec disable AltiVec usage"
390 echo " --disable-audio-oss disable OSS audio support [default=no]"
391 echo " --disable-v4l disable video4linux grabbing [default=no]"
392 echo " --disable-network disable network support [default=no]"
393 echo " --disable-zlib disable zlib [default=no]"
394 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
395 # echo " --disable-vhook disable video hooking support"
396 echo " --enable-gprof enable profiling with gprof [$gprof]"
397 echo " --disable-mpegaudio-hp faster (but less accurate)"
398 echo " mpegaudio decoding [default=no]"
400 echo "NOTE: The object files are build at the place where configure is launched"
404 echo "Install prefix $prefix"
405 echo "Source path $source_path"
406 echo "C compiler $cc"
409 echo "Big Endian $bigendian"
410 if test $cpu = "x86"; then
411 echo "MMX enabled $mmx"
413 if test $cpu = "mips"; then
414 echo "MMI enabled $mmi"
416 if test $cpu = "powerpc"; then
417 echo "AltiVec enabled $altivec"
419 echo "gprof enabled $gprof"
420 echo "zlib enabled $zlib"
421 echo "mp3lame enabled $mp3lame"
422 echo "vorbis enabled $vorbis"
423 echo "a52 support $a52"
424 echo "a52 dlopened $a52bin"
425 # echo "Video hooking $vhook"
427 if test "$vhook" = "yes" ; then
428 : echo "Imlib2 support $imlib2"
431 echo "Creating config.mak and config.h"
433 echo "# Automatically generated by configure - do not modify" > config.mak
434 echo "/* Automatically generated by configure - do not modify */" > $TMPH
436 echo "prefix=$prefix" >> config.mak
437 echo "MAKE=$make" >> config.mak
438 echo "CC=$cc" >> config.mak
439 echo "AR=$ar" >> config.mak
440 echo "RANLIB=$ranlib" >> config.mak
441 echo "STRIP=$strip" >> config.mak
442 echo "OPTFLAGS=$CFLAGS" >> config.mak
443 echo "LDFLAGS=$LDFLAGS" >> config.mak
444 echo "SHFLAGS=$SHFLAGS" >> config.mak
445 if test "$cpu" = "x86" ; then
446 echo "TARGET_ARCH_X86=yes" >> config.mak
447 echo "#define ARCH_X86 1" >> $TMPH
448 elif test "$cpu" = "armv4l" ; then
449 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
450 echo "#define ARCH_ARMV4L 1" >> $TMPH
451 elif test "$cpu" = "alpha" ; then
452 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
453 echo "#define ARCH_ALPHA 1" >> $TMPH
454 elif test "$cpu" = "powerpc" ; then
455 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
456 echo "#define ARCH_POWERPC 1" >> $TMPH
457 elif test "$cpu" = "mips" ; then
458 echo "TARGET_ARCH_MIPS=yes" >> config.mak
459 echo "#define ARCH_MIPS 1" >> $TMPH
461 if test "$bigendian" = "yes" ; then
462 echo "WORDS_BIGENDIAN=yes" >> config.mak
463 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
465 if test "$mmx" = "yes" ; then
466 echo "TARGET_MMX=yes" >> config.mak
467 echo "#define HAVE_MMX 1" >> $TMPH
469 if test "$mmi" = "yes" ; then
470 echo "TARGET_MMI=yes" >> config.mak
471 echo "#define HAVE_MMI 1" >> $TMPH
473 if test "$altivec" = "yes" ; then
474 echo "TARGET_ALTIVEC=yes" >> config.mak
475 echo "#define HAVE_ALTIVEC 1" >> $TMPH
477 if test "$gprof" = "yes" ; then
478 echo "TARGET_GPROF=yes" >> config.mak
479 echo "#define HAVE_GPROF 1" >> $TMPH
481 if test "$strptime" = "yes" ; then
482 echo "#define HAVE_STRPTIME 1" >> $TMPH
484 echo "BUILD_STRPTIME=yes" >> config.mak
486 if test "$imlib2" = "yes" ; then
487 echo "HAVE_IMLIB2=yes" >> config.mak
489 if test "$vhook" = "yes" ; then
490 echo "BUILD_VHOOK=yes" >> config.mak
491 echo "#define HAVE_VHOOK 1" >> $TMPH
492 extralibs="$extralibs -ldl"
494 if test "$lshared" = "yes" ; then
495 echo "BUILD_SHARED=yes" >> config.mak
496 echo "PIC=-fPIC" >> config.mak
498 echo "EXTRALIBS=$extralibs" >> config.mak
499 echo -n "VERSION=" >>config.mak
500 head $source_path/VERSION >>config.mak
502 # if you do not want to use encoders, disable that.
503 echo "#define CONFIG_ENCODERS 1" >> $TMPH
504 echo "CONFIG_ENCODERS=yes" >> config.mak
506 # if you do not want to use decoders, disable that.
507 echo "#define CONFIG_DECODERS 1" >> $TMPH
508 echo "CONFIG_DECODERS=yes" >> config.mak
511 if test "$a52" = "yes" ; then
512 echo "#define CONFIG_AC3 1" >> $TMPH
513 echo "CONFIG_AC3=yes" >> config.mak
515 if test "$a52bin" = "yes" ; then
516 echo "#define CONFIG_A52BIN 1" >> $TMPH
517 echo "CONFIG_A52BIN=yes" >> config.mak
521 # mpeg audio high precision mode
522 if test "$mpegaudio_hp" = "yes" ; then
523 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
526 if test "$v4l" = "yes" ; then
527 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
528 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
531 if test "$audio_oss" = "yes" ; then
532 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
533 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
536 if test "$network" = "yes" ; then
537 echo "#define CONFIG_NETWORK 1" >> $TMPH
538 echo "CONFIG_NETWORK=yes" >> config.mak
541 if test "$zlib" = "yes" ; then
542 echo "#define CONFIG_ZLIB 1" >> $TMPH
543 echo "CONFIG_ZLIB=yes" >> config.mak
546 if test "$mp3lame" = "yes" ; then
547 echo "#define CONFIG_MP3LAME 1" >> $TMPH
548 echo "CONFIG_MP3LAME=yes" >> config.mak
551 if test "$vorbis" = "yes" ; then
552 echo "#define CONFIG_VORBIS 1" >> $TMPH
553 echo "CONFIG_VORBIS=yes" >> config.mak
556 if test "$win32" = "yes" ; then
557 echo "#define CONFIG_WIN32 1" >> $TMPH
558 echo "CONFIG_WIN32=yes" >> config.mak
561 if test "$cygwin" = "yes" ; then
562 # setup correct exesuffix
563 echo "CONFIG_WIN32=yes" >> config.mak
566 if test "$darwin" = "yes"; then
567 echo "#define CONFIG_DARWIN 1" >> $TMPH
568 echo "CONFIG_DARWIN=yes" >> config.mak
571 if test "$_malloc_h" = "yes" ; then
572 echo "#define HAVE_MALLOC_H 1" >> $TMPH
574 echo "#undef HAVE_MALLOC_H" >> $TMPH
577 if test "$_memalign" = "yes" ; then
578 echo "#define HAVE_MEMALIGN 1" >> $TMPH
580 echo "#undef HAVE_MEMALIGN" >> $TMPH
583 if test "$netserver" = "yes" ; then
584 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
585 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
588 if test "$simpleidct" = "yes" ; then
589 echo "#define SIMPLE_IDCT 1" >> $TMPH
592 echo "#define restrict $_restrict" >> $TMPH
594 # build tree in object directory if source path is different from current one
595 if test "$source_path_used" = "yes" ; then
596 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
597 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
598 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
599 for dir in $DIRS ; do
603 ln -sf $source_path/$f $f
606 echo "SRC_PATH=$source_path" >> config.mak
608 diff $TMPH config.h >/dev/null 2>&1
609 if test $? -ne 0 ; then
612 echo "config.h is unchanged"
615 rm -f $TMPO $TMPC $TMPS $TMPH