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"
124 test -f
/usr
/include
/inttypes.h || \
125 test -f
/usr
/local/include
/inttypes.h || \
126 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
127 "/usr/include/inttypes.h !!!"
136 # XXX: we assume an absolute path is given when launching configure,
137 # except in './configure' case.
138 source_path
=${0%configure}
139 source_path
=${source_path%/}
140 source_path_used
="yes"
141 if test -z
"$source_path" -o
"$source_path" = "." ; then
143 source_path_used
="no"
148 int main( void ) { return (int) dlopen("foo", 0); }
151 if $cc -o
$TMPO $TMPC -ldl
2> /dev
/null
; then
156 #include <X11/Xlib.h>
158 int main( void ) { return (int) imlib_load_font("foo"); }
162 if $cc -o
$TMPO $TMPC -lImlib2
2> /dev
/null
; then
168 --prefix
=*) prefix
=`echo $opt | cut -d '=' -f 2`
170 --source-path
=*) source_path
=`echo $opt | cut -d '=' -f 2`
172 --cross-prefix
=*) cross_prefix
=`echo $opt | cut -d '=' -f 2`
174 --cc
=*) cc
=`echo $opt | cut -d '=' -f 2`
176 --make=*) make=`echo $opt | cut -d '=' -f 2`
178 --extra-cflags
=*) CFLAGS
="${opt#--extra-cflags=}"
180 --extra-ldflags
=*) LDFLAGS
=${opt#--extra-ldflags=}
182 --extra-libs
=*) extralibs
=${opt#--extra-libs=}
184 --cpu
=*) cpu
=`echo $opt | cut -d '=' -f 2`
186 --disable-mmx
) mmx
="no"
188 --disable-altivec
) altivec
="no"
190 --enable-gprof
) gprof
="yes"
192 --disable-v4l
) v4l
="no"
194 --disable-audio-oss
) audio_oss
="no"
196 --disable-audio-beos
) audio_beos
="no"
198 --disable-network
) network
="no"
200 --disable-zlib
) zlib
="no"
202 --disable-a52
) a52
="no"
204 --enable-a52bin
) a52bin
="yes" ; extralibs
="-ldl $extralibs"
206 --enable-mp3lame
) mp3lame
="yes"
208 --enable-vorbis
) vorbis
="yes"
210 --disable-vhook
) vhook
="no"
212 --disable-simple_idct
) simpleidct
="no"
214 --enable-win32
) win32
="yes"
216 --enable-shared
) lshared
="yes"
218 --disable-mpegaudio-hp
) mpegaudio_hp
="no"
224 if test $mmx = "default"; then
225 if test $cpu = "x86"; then
232 # Can only do AltiVec on PowerPC
233 if test $altivec = "default"; then
234 if test $cpu = "powerpc"; then
241 # See does our compiler support Motorola AltiVec C API
242 if test $altivec = "yes"; then
245 vector signed int v1, v2, v3;
250 $cc -o
$TMPO $TMPC -faltivec
2> /dev
/null || altivec
="no"
253 # Can only do mmi on mips
254 if test $mmi = "default"; then
255 if test $cpu = "mips"; then
262 # See does our compiler support mmi
263 if test $mmi = "yes"; then
266 __asm__ ("lq \$2, 0(\$2)");
270 $cc -o
$TMPO $TMPC 2> /dev
/null || mmi
="no"
273 # Checking for CFLAGS
274 if test -z
"$CFLAGS"; then
278 if test "$win32" = "yes" ; then
279 cross_prefix
="i386-mingw32msvc-"
285 cc
="${cross_prefix}${cc}"
286 ar="${cross_prefix}${ar}"
287 ranlib
="${cross_prefix}${ranlib}"
288 strip
="${cross_prefix}${strip}"
290 if test -z
"$cross_prefix" ; then
293 # big/little endian test
295 #include <inttypes.h>
296 int main(int argc, char ** argv){
297 volatile uint32_t i=0x01234567;
298 return (*((uint8_t*)(&i))) == 0x67;
302 if $cc -o
$TMPO $TMPC 2>/dev
/null
; then
303 $TMPO && bigendian
="yes"
305 echo big
/little
test failed
310 # if cross compiling, cannot launch a program, so make a static guess
311 if test "$cpu" = "powerpc" -o
"$cpu" = "mips" ; then
318 # check availability of some header files
322 int main( void ) { return 0; }
327 if $cc -o
$TMPO $TMPC 2> /dev
/null
; then
330 # check for memalign - atmos
335 string = memalign(64, sizeof(char));
339 $cc -o
$TMPO $TMPC 2> /dev
/null || _memalign
=no
345 int main( void ) { return *strptime("", "", 0); }
349 if $cc -o
$TMPO $TMPC 2> /dev
/null
; then
353 if test "$zlib" = "yes"; then
354 # check for zlib - mmu_man
358 if (zlibVersion() != ZLIB_VERSION)
359 puts("zlib version differs !!!");
364 $cc -o
$TMPO $TMPC -lz
2> /dev
/null || zlib
="no"
365 # $TMPO 2> /dev/null > /dev/null || zlib="no"
366 # XXX: more tests needed - runtime test
368 if test "$zlib" = "yes"; then
369 extralibs
="$extralibs -lz"
372 # test for lrintf in math.h
374 #define _ISOC9X_SOURCE 1
376 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
380 if $cc $extralibs -o
$TMPO $TMPC 2> /dev
/null
; then
382 $TMPO 2> /dev
/null
> /dev
/null || have_lrintf
="no"
386 for restrict_keyword
in restrict __restrict__ __restrict
; do
387 echo "void foo(char * $restrict_keyword p);" > $TMPC
388 if $cc -c
-o
$TMPO $TMPC 2> /dev
/null
; then
389 _restrict
=$restrict_keyword
394 if test x
"$1" = x
"-h" -o x
"$1" = x
"--help" ; then
397 Usage: configure [options]
398 Options: [defaults in brackets after descriptions]
401 echo "Standard options:"
402 echo " --help print this message"
403 echo " --prefix=PREFIX install in PREFIX [$prefix]"
404 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
405 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
406 echo " --enable-win32 enable win32 cross compile"
407 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
408 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
409 echo " --enable-shared build shared libraries [default=no]"
411 echo "Advanced options (experts only):"
412 echo " --source-path=PATH path of source code [$source_path]"
413 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
414 echo " --cc=CC use C compiler CC [$cc]"
415 echo " --make=MAKE use specified make [$make]"
416 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
417 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
418 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
419 echo " --cpu=CPU force cpu to CPU [$cpu]"
420 echo " --disable-mmx disable mmx usage"
421 echo " --disable-altivec disable AltiVec usage"
422 echo " --disable-audio-oss disable OSS audio support [default=no]"
423 echo " --disable-audio-beos disable BeOS audio support [default=no]"
424 echo " --disable-v4l disable video4linux grabbing [default=no]"
425 echo " --disable-network disable network support [default=no]"
426 echo " --disable-zlib disable zlib [default=no]"
427 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
428 echo " --disable-vhook disable video hooking support"
429 echo " --enable-gprof enable profiling with gprof [$gprof]"
430 echo " --disable-mpegaudio-hp faster (but less accurate)"
431 echo " mpegaudio decoding [default=no]"
433 echo "NOTE: The object files are build at the place where configure is launched"
437 echo "Install prefix $prefix"
438 echo "Source path $source_path"
439 echo "C compiler $cc"
442 echo "Big Endian $bigendian"
443 if test $cpu = "x86"; then
444 echo "MMX enabled $mmx"
446 if test $cpu = "mips"; then
447 echo "MMI enabled $mmi"
449 if test $cpu = "powerpc"; then
450 echo "AltiVec enabled $altivec"
452 echo "gprof enabled $gprof"
453 echo "zlib enabled $zlib"
454 echo "mp3lame enabled $mp3lame"
455 echo "vorbis enabled $vorbis"
456 echo "a52 support $a52"
457 echo "a52 dlopened $a52bin"
458 echo "Video hooking $vhook"
460 if test "$vhook" = "yes" ; then
461 echo "Imlib2 support $imlib2"
464 echo "Creating config.mak and config.h"
466 echo "# Automatically generated by configure - do not modify" > config.mak
467 echo "/* Automatically generated by configure - do not modify */" > $TMPH
469 echo "prefix=$prefix" >> config.mak
470 echo "MAKE=$make" >> config.mak
471 echo "CC=$cc" >> config.mak
472 echo "AR=$ar" >> config.mak
473 echo "RANLIB=$ranlib" >> config.mak
474 echo "STRIP=$strip" >> config.mak
475 echo "OPTFLAGS=$CFLAGS" >> config.mak
476 echo "LDFLAGS=$LDFLAGS" >> config.mak
477 echo "SHFLAGS=$SHFLAGS" >> config.mak
478 echo "LDFLAGS=$LDFLAGS" >> config.mak
479 if test "$cpu" = "x86" ; then
480 echo "TARGET_ARCH_X86=yes" >> config.mak
481 echo "#define ARCH_X86 1" >> $TMPH
482 elif test "$cpu" = "armv4l" ; then
483 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
484 echo "#define ARCH_ARMV4L 1" >> $TMPH
485 elif test "$cpu" = "alpha" ; then
486 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
487 echo "#define ARCH_ALPHA 1" >> $TMPH
488 elif test "$cpu" = "powerpc" ; then
489 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
490 echo "#define ARCH_POWERPC 1" >> $TMPH
491 elif test "$cpu" = "mips" ; then
492 echo "TARGET_ARCH_MIPS=yes" >> config.mak
493 echo "#define ARCH_MIPS 1" >> $TMPH
495 if test "$bigendian" = "yes" ; then
496 echo "WORDS_BIGENDIAN=yes" >> config.mak
497 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
499 if test "$mmx" = "yes" ; then
500 echo "TARGET_MMX=yes" >> config.mak
501 echo "#define HAVE_MMX 1" >> $TMPH
503 if test "$mmi" = "yes" ; then
504 echo "TARGET_MMI=yes" >> config.mak
505 echo "#define HAVE_MMI 1" >> $TMPH
507 if test "$altivec" = "yes" ; then
508 echo "TARGET_ALTIVEC=yes" >> config.mak
509 echo "#define HAVE_ALTIVEC 1" >> $TMPH
511 if test "$gprof" = "yes" ; then
512 echo "TARGET_GPROF=yes" >> config.mak
513 echo "#define HAVE_GPROF 1" >> $TMPH
515 if test "$strptime" = "yes" ; then
516 echo "#define HAVE_STRPTIME 1" >> $TMPH
518 echo "BUILD_STRPTIME=yes" >> config.mak
520 if test "$imlib2" = "yes" ; then
521 echo "HAVE_IMLIB2=yes" >> config.mak
523 if test "$have_lrintf" = "yes" ; then
524 echo "#define HAVE_LRINTF 1" >> $TMPH
526 if test "$vhook" = "yes" ; then
527 echo "BUILD_VHOOK=yes" >> config.mak
528 echo "#define HAVE_VHOOK 1" >> $TMPH
529 extralibs
="$extralibs -ldl"
531 if test "$lshared" = "yes" ; then
532 echo "BUILD_SHARED=yes" >> config.mak
533 echo "PIC=-fPIC" >> config.mak
535 echo "EXTRALIBS=$extralibs" >> config.mak
536 echo -n
"VERSION=" >>config.mak
537 head $source_path/VERSION
>>config.mak
539 # if you do not want to use encoders, disable that.
540 echo "#define CONFIG_ENCODERS 1" >> $TMPH
541 echo "CONFIG_ENCODERS=yes" >> config.mak
543 # if you do not want to use decoders, disable that.
544 echo "#define CONFIG_DECODERS 1" >> $TMPH
545 echo "CONFIG_DECODERS=yes" >> config.mak
548 if test "$a52" = "yes" ; then
549 echo "#define CONFIG_AC3 1" >> $TMPH
550 echo "CONFIG_AC3=yes" >> config.mak
552 if test "$a52bin" = "yes" ; then
553 echo "#define CONFIG_A52BIN 1" >> $TMPH
554 echo "CONFIG_A52BIN=yes" >> config.mak
558 # mpeg audio high precision mode
559 if test "$mpegaudio_hp" = "yes" ; then
560 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
563 if test "$v4l" = "yes" ; then
564 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
565 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
568 if test "$audio_oss" = "yes" ; then
569 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
570 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
573 if test "$audio_beos" = "yes" ; then
574 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
575 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
578 if test "$network" = "yes" ; then
579 echo "#define CONFIG_NETWORK 1" >> $TMPH
580 echo "CONFIG_NETWORK=yes" >> config.mak
583 if test "$zlib" = "yes" ; then
584 echo "#define CONFIG_ZLIB 1" >> $TMPH
585 echo "CONFIG_ZLIB=yes" >> config.mak
588 if test "$mp3lame" = "yes" ; then
589 echo "#define CONFIG_MP3LAME 1" >> $TMPH
590 echo "CONFIG_MP3LAME=yes" >> config.mak
593 if test "$vorbis" = "yes" ; then
594 echo "#define CONFIG_VORBIS 1" >> $TMPH
595 echo "CONFIG_VORBIS=yes" >> config.mak
598 if test "$win32" = "yes" ; then
599 echo "#define CONFIG_WIN32 1" >> $TMPH
600 echo "CONFIG_WIN32=yes" >> config.mak
603 if test "$cygwin" = "yes" ; then
604 # setup correct exesuffix
605 echo "CONFIG_WIN32=yes" >> config.mak
608 if test "$darwin" = "yes"; then
609 echo "#define CONFIG_DARWIN 1" >> $TMPH
610 echo "CONFIG_DARWIN=yes" >> config.mak
613 if test "$_malloc_h" = "yes" ; then
614 echo "#define HAVE_MALLOC_H 1" >> $TMPH
616 echo "#undef HAVE_MALLOC_H" >> $TMPH
619 if test "$_memalign" = "yes" ; then
620 echo "#define HAVE_MEMALIGN 1" >> $TMPH
622 echo "#undef HAVE_MEMALIGN" >> $TMPH
625 if test "$netserver" = "yes" ; then
626 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
627 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
630 if test "$simpleidct" = "yes" ; then
631 echo "#define SIMPLE_IDCT 1" >> $TMPH
634 echo "#define restrict $_restrict" >> $TMPH
636 # build tree in object directory if source path is different from current one
637 if test "$source_path_used" = "yes" ; then
638 DIRS
="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
639 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
640 FILES
="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
641 for dir
in $DIRS ; do
645 ln -sf
$source_path/$f $f
648 echo "SRC_PATH=$source_path" >> config.mak
650 diff $TMPH config.h
>/dev
/null
2>&1
651 if test $?
-ne
0 ; then
654 echo "config.h is unchanged"
657 rm -f
$TMPO $TMPC $TMPS $TMPH