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 prefix="/boot/home/config"
75 # helps building libavcodec
76 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
78 # disable linux things
81 # no need for libm, but the inet stuff
83 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
84 extralibs="-lbind -lsocket"
86 echo "Not sure building for net_server will succeed... good luck."
92 extralibs="-lpoll -lgnugetopt -lm"
99 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
100 SHFLAGS="-dynamiclib"
109 test -f /usr/include/inttypes.h || \
110 test -f /usr/local/include/inttypes.h || \
111 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
112 "/usr/include/inttypes.h !!!"
118 # XXX: we assume an absolute path is given when launching configure,
119 # except in './configure' case.
120 source_path=${0%configure}
121 source_path=${source_path%/}
122 source_path_used="yes"
123 if test -z "$source_path" -o "$source_path" = "." ; then
125 source_path_used="no"
130 int main( void ) { return (int) dlopen("foo", 0); }
133 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
138 #include <X11/Xlib.h>
140 int main( void ) { return (int) imlib_load_font("foo"); }
144 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
150 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
152 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
154 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
156 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
158 --make=*) make=`echo $opt | cut -d '=' -f 2`
160 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
162 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
164 --extra-libs=*) extralibs=${opt#--extra-libs=}
166 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
168 --disable-mmx) mmx="no"
170 --disable-altivec) altivec="no"
172 --enable-gprof) gprof="yes"
174 --disable-v4l) v4l="no"
176 --disable-audio-oss) audio_oss="no"
178 --disable-network) network="no"
180 --disable-zlib) zlib="no"
182 --disable-a52) a52="no"
184 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
186 --enable-mp3lame) mp3lame="yes"
188 --enable-vorbis) vorbis="yes"
190 --disable-vhook) vhook="no"
192 --disable-simple_idct) simpleidct="no"
194 --enable-win32) win32="yes"
196 --enable-shared) lshared="yes"
198 --disable-mpegaudio-hp) mpegaudio_hp="no"
204 if test $mmx = "default"; then
205 if test $cpu = "x86"; then
212 # Can only do AltiVec on PowerPC
213 if test $altivec = "default"; then
214 if test $cpu = "powerpc"; then
221 # See does our compiler support Motorola AltiVec C API
222 if test $altivec = "yes"; then
225 vector signed int v1, v2, v3;
230 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
233 # Can only do mmi on mips
234 if test $mmi = "default"; then
235 if test $cpu = "mips"; then
242 # See does our compiler support mmi
243 if test $mmi = "yes"; then
246 __asm__ ("lq \$2, 0(\$2)");
250 $cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
253 # Checking for CFLAGS
254 if test -z "$CFLAGS"; then
258 if test "$win32" = "yes" ; then
259 cross_prefix="i386-mingw32msvc-"
265 cc="${cross_prefix}${cc}"
266 ar="${cross_prefix}${ar}"
267 ranlib="${cross_prefix}${ranlib}"
268 strip="${cross_prefix}${strip}"
270 if test -z "$cross_prefix" ; then
273 # big/little endian test
275 #include <inttypes.h>
276 int main(int argc, char ** argv){
277 volatile uint32_t i=0x01234567;
278 return (*((uint8_t*)(&i))) == 0x67;
282 if $cc -o $TMPO $TMPC 2>/dev/null ; then
283 $TMPO && bigendian="yes"
285 echo big/little test failed
290 # if cross compiling, cannot launch a program, so make a static guess
291 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
298 # check availability of some header files
302 int main( void ) { return 0; }
307 if $cc -o $TMPO $TMPC 2> /dev/null ; then
310 # check for memalign - atmos
315 string = memalign(64, sizeof(char));
319 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
325 int main( void ) { return *strptime("", "", 0); }
329 if $cc -o $TMPO $TMPC 2> /dev/null ; then
333 if test "$zlib" = "yes"; then
334 # check for zlib - mmu_man
338 if (zlibVersion() != ZLIB_VERSION)
339 puts("zlib version differs !!!");
344 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
345 # $TMPO 2> /dev/null > /dev/null || zlib="no"
346 # XXX: more tests needed - runtime test
348 if test "$zlib" = "yes"; then
349 extralibs="$extralibs -lz"
353 for restrict_keyword in restrict __restrict__ __restrict; do
354 echo "void foo(char * $restrict_keyword p);" > $TMPC
355 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
356 _restrict=$restrict_keyword
361 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
364 Usage: configure [options]
365 Options: [defaults in brackets after descriptions]
368 echo "Standard options:"
369 echo " --help print this message"
370 echo " --prefix=PREFIX install in PREFIX [$prefix]"
371 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
372 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
373 echo " --enable-win32 enable win32 cross compile"
374 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
375 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
376 echo " --enable-shared build shared libraries [default=no]"
378 echo "Advanced options (experts only):"
379 echo " --source-path=PATH path of source code [$source_path]"
380 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
381 echo " --cc=CC use C compiler CC [$cc]"
382 echo " --make=MAKE use specified make [$make]"
383 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
384 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
385 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
386 echo " --cpu=CPU force cpu to CPU [$cpu]"
387 echo " --disable-mmx disable mmx usage"
388 echo " --disable-altivec disable AltiVec usage"
389 echo " --disable-audio-oss disable OSS audio support [default=no]"
390 echo " --disable-v4l disable video4linux grabbing [default=no]"
391 echo " --disable-network disable network support [default=no]"
392 echo " --disable-zlib disable zlib [default=no]"
393 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
394 # echo " --disable-vhook disable video hooking support"
395 echo " --enable-gprof enable profiling with gprof [$gprof]"
396 echo " --disable-mpegaudio-hp faster (but less accurate)"
397 echo " mpegaudio decoding [default=no]"
399 echo "NOTE: The object files are build at the place where configure is launched"
403 echo "Install prefix $prefix"
404 echo "Source path $source_path"
405 echo "C compiler $cc"
408 echo "Big Endian $bigendian"
409 if test $cpu = "x86"; then
410 echo "MMX enabled $mmx"
412 if test $cpu = "mips"; then
413 echo "MMI enabled $mmi"
415 if test $cpu = "powerpc"; then
416 echo "AltiVec enabled $altivec"
418 echo "gprof enabled $gprof"
419 echo "zlib enabled $zlib"
420 echo "mp3lame enabled $mp3lame"
421 echo "vorbis enabled $vorbis"
422 echo "a52 support $a52"
423 echo "a52 dlopened $a52bin"
424 # echo "Video hooking $vhook"
426 if test "$vhook" = "yes" ; then
427 : echo "Imlib2 support $imlib2"
430 echo "Creating config.mak and config.h"
432 echo "# Automatically generated by configure - do not modify" > config.mak
433 echo "/* Automatically generated by configure - do not modify */" > $TMPH
435 echo "prefix=$prefix" >> config.mak
436 echo "MAKE=$make" >> config.mak
437 echo "CC=$cc" >> config.mak
438 echo "AR=$ar" >> config.mak
439 echo "RANLIB=$ranlib" >> config.mak
440 echo "STRIP=$strip" >> config.mak
441 echo "OPTFLAGS=$CFLAGS" >> config.mak
442 echo "LDFLAGS=$LDFLAGS" >> config.mak
443 echo "SHFLAGS=$SHFLAGS" >> config.mak
444 if test "$cpu" = "x86" ; then
445 echo "TARGET_ARCH_X86=yes" >> config.mak
446 echo "#define ARCH_X86 1" >> $TMPH
447 elif test "$cpu" = "armv4l" ; then
448 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
449 echo "#define ARCH_ARMV4L 1" >> $TMPH
450 elif test "$cpu" = "alpha" ; then
451 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
452 echo "#define ARCH_ALPHA 1" >> $TMPH
453 elif test "$cpu" = "powerpc" ; then
454 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
455 echo "#define ARCH_POWERPC 1" >> $TMPH
456 elif test "$cpu" = "mips" ; then
457 echo "TARGET_ARCH_MIPS=yes" >> config.mak
458 echo "#define ARCH_MIPS 1" >> $TMPH
460 if test "$bigendian" = "yes" ; then
461 echo "WORDS_BIGENDIAN=yes" >> config.mak
462 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
464 if test "$mmx" = "yes" ; then
465 echo "TARGET_MMX=yes" >> config.mak
466 echo "#define HAVE_MMX 1" >> $TMPH
468 if test "$mmi" = "yes" ; then
469 echo "TARGET_MMI=yes" >> config.mak
470 echo "#define HAVE_MMI 1" >> $TMPH
472 if test "$altivec" = "yes" ; then
473 echo "TARGET_ALTIVEC=yes" >> config.mak
474 echo "#define HAVE_ALTIVEC 1" >> $TMPH
476 if test "$gprof" = "yes" ; then
477 echo "TARGET_GPROF=yes" >> config.mak
478 echo "#define HAVE_GPROF 1" >> $TMPH
480 if test "$strptime" = "yes" ; then
481 echo "#define HAVE_STRPTIME 1" >> $TMPH
483 echo "BUILD_STRPTIME=yes" >> config.mak
485 if test "$imlib2" = "yes" ; then
486 echo "HAVE_IMLIB2=yes" >> config.mak
488 if test "$vhook" = "yes" ; then
489 echo "BUILD_VHOOK=yes" >> config.mak
490 echo "#define HAVE_VHOOK 1" >> $TMPH
491 extralibs="$extralibs -ldl"
493 if test "$lshared" = "yes" ; then
494 echo "BUILD_SHARED=yes" >> config.mak
495 echo "PIC=-fPIC" >> config.mak
497 echo "EXTRALIBS=$extralibs" >> config.mak
498 echo -n "VERSION=" >>config.mak
499 head $source_path/VERSION >>config.mak
501 # if you do not want to use encoders, disable that.
502 echo "#define CONFIG_ENCODERS 1" >> $TMPH
503 echo "CONFIG_ENCODERS=yes" >> config.mak
505 # if you do not want to use decoders, disable that.
506 echo "#define CONFIG_DECODERS 1" >> $TMPH
507 echo "CONFIG_DECODERS=yes" >> config.mak
510 if test "$a52" = "yes" ; then
511 echo "#define CONFIG_AC3 1" >> $TMPH
512 echo "CONFIG_AC3=yes" >> config.mak
514 if test "$a52bin" = "yes" ; then
515 echo "#define CONFIG_A52BIN 1" >> $TMPH
516 echo "CONFIG_A52BIN=yes" >> config.mak
520 # mpeg audio high precision mode
521 if test "$mpegaudio_hp" = "yes" ; then
522 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
525 if test "$v4l" = "yes" ; then
526 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
527 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
530 if test "$audio_oss" = "yes" ; then
531 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
532 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
535 if test "$network" = "yes" ; then
536 echo "#define CONFIG_NETWORK 1" >> $TMPH
537 echo "CONFIG_NETWORK=yes" >> config.mak
540 if test "$zlib" = "yes" ; then
541 echo "#define CONFIG_ZLIB 1" >> $TMPH
542 echo "CONFIG_ZLIB=yes" >> config.mak
545 if test "$mp3lame" = "yes" ; then
546 echo "#define CONFIG_MP3LAME 1" >> $TMPH
547 echo "CONFIG_MP3LAME=yes" >> config.mak
550 if test "$vorbis" = "yes" ; then
551 echo "#define CONFIG_VORBIS 1" >> $TMPH
552 echo "CONFIG_VORBIS=yes" >> config.mak
555 if test "$win32" = "yes" ; then
556 echo "#define CONFIG_WIN32 1" >> $TMPH
557 echo "CONFIG_WIN32=yes" >> config.mak
560 if test "$cygwin" = "yes" ; then
561 # setup correct exesuffix
562 echo "CONFIG_WIN32=yes" >> config.mak
565 if test "$darwin" = "yes"; then
566 echo "#define CONFIG_DARWIN 1" >> $TMPH
567 echo "CONFIG_DARWIN=yes" >> config.mak
570 if test "$_malloc_h" = "yes" ; then
571 echo "#define HAVE_MALLOC_H 1" >> $TMPH
573 echo "#undef HAVE_MALLOC_H" >> $TMPH
576 if test "$_memalign" = "yes" ; then
577 echo "#define HAVE_MEMALIGN 1" >> $TMPH
579 echo "#undef HAVE_MEMALIGN" >> $TMPH
582 if test "$simpleidct" = "yes" ; then
583 echo "#define SIMPLE_IDCT 1" >> $TMPH
586 echo "#define restrict $_restrict" >> $TMPH
588 # build tree in object directory if source path is different from current one
589 if test "$source_path_used" = "yes" ; then
590 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
591 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
592 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
593 for dir in $DIRS ; do
597 ln -sf $source_path/$f $f
600 echo "SRC_PATH=$source_path" >> config.mak
602 diff $TMPH config.h >/dev/null 2>&1
603 if test $? -ne 0 ; then
606 echo "config.h is unchanged"
609 rm -f $TMPO $TMPC $TMPS $TMPH