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"
31 i386|i486|i586|i686|i86pc|BePC)
40 "Power Macintosh"|ppc)
70 prefix="/boot/home/config"
71 # helps building libavcodec
72 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
74 # disable linux things
77 # no need for libm, but the inet stuff
79 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
80 extralibs="-lbind -lsocket"
82 echo "Not sure building for net_server will succeed... good luck."
88 extralibs="-lpoll -lgnugetopt -lm"
95 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
105 test -f /usr/include/inttypes.h || \
106 test -f /usr/local/include/inttypes.h || \
107 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
108 "/usr/include/inttypes.h !!!"
114 # XXX: we assume an absolute path is given when launching configure,
115 # except in './configure' case.
116 source_path=${0%configure}
117 source_path=${source_path%/}
118 source_path_used="yes"
119 if test -z "$source_path" -o "$source_path" = "." ; then
121 source_path_used="no"
126 int main( void ) { return (int) dlopen("foo", 0); }
129 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
134 #include <X11/Xlib.h>
136 int main( void ) { return (int) imlib_load_font("foo"); }
140 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
146 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
148 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
150 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
152 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
154 --make=*) make=`echo $opt | cut -d '=' -f 2`
156 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
158 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
160 --extra-libs=*) extralibs=${opt#--extra-libs=}
162 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
164 --disable-mmx) mmx="no"
166 --disable-altivec) altivec="no"
168 --enable-gprof) gprof="yes"
170 --disable-v4l) v4l="no"
172 --disable-audio-oss) audio_oss="no"
174 --disable-network) network="no"
176 --disable-zlib) zlib="no"
178 --disable-a52) a52="no"
180 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
182 --enable-mp3lame) mp3lame="yes"
184 --enable-vorbis) vorbis="yes"
186 --disable-vhook) vhook="no"
188 --disable-simple_idct) simpleidct="no"
190 --enable-win32) win32="yes"
192 --enable-shared) lshared="yes"
194 --disable-mpegaudio-hp) mpegaudio_hp="no"
200 if test $mmx = "default"; then
201 if test $cpu = "x86"; then
208 # Can only do AltiVec on PowerPC
209 if test $altivec = "default"; then
210 if test $cpu = "powerpc"; then
217 # See does our compiler support Motorola AltiVec C API
218 if test $altivec = "yes"; then
221 vector signed int v1, v2, v3;
226 $cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
229 # Checking for CFLAGS
230 if test -z "$CFLAGS"; then
234 if test "$win32" = "yes" ; then
235 cross_prefix="i386-mingw32msvc-"
241 cc="${cross_prefix}${cc}"
242 ar="${cross_prefix}${ar}"
243 ranlib="${cross_prefix}${ranlib}"
244 strip="${cross_prefix}${strip}"
247 # big/little endian test
249 #include <inttypes.h>
250 int main(int argc, char ** argv){
251 volatile uint32_t i=0x01234567;
252 return (*((uint8_t*)(&i))) == 0x67;
256 if $cc -o $TMPO $TMPC 2>/dev/null ; then
257 $TMPO && bigendian="yes"
259 echo big/little test failed
263 # check availability of some header files
267 int main( void ) { return 0; }
272 if $cc -o $TMPO $TMPC 2> /dev/null ; then
275 # check for memalign - atmos
280 string = memalign(64, sizeof(char));
284 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
290 int main( void ) { return *strptime("", "", 0); }
294 if $cc -o $TMPO $TMPC 2> /dev/null ; then
298 if test "$zlib" = "yes"; then
299 # check for zlib - mmu_man
303 if (zlibVersion() != ZLIB_VERSION)
304 puts("zlib version differs !!!");
309 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
310 # $TMPO 2> /dev/null > /dev/null || zlib="no"
311 # XXX: more tests needed - runtime test
313 if test "$zlib" = "yes"; then
314 extralibs="$extralibs -lz"
318 for restrict_keyword in restrict __restrict__ __restrict; do
319 echo "void foo(char * $restrict_keyword p);" > $TMPC
320 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
321 _restrict=$restrict_keyword
326 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
329 Usage: configure [options]
330 Options: [defaults in brackets after descriptions]
333 echo "Standard options:"
334 echo " --help print this message"
335 echo " --prefix=PREFIX install in PREFIX [$prefix]"
336 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
337 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
338 echo " --enable-win32 enable win32 cross compile"
339 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
340 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
341 echo " --enable-shared build shared libraries [default=no]"
343 echo "Advanced options (experts only):"
344 echo " --source-path=PATH path of source code [$source_path]"
345 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
346 echo " --cc=CC use C compiler CC [$cc]"
347 echo " --make=MAKE use specified make [$make]"
348 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
349 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
350 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
351 echo " --cpu=CPU force cpu to CPU [$cpu]"
352 echo " --disable-mmx disable mmx usage"
353 echo " --disable-altivec disable AltiVec usage"
354 echo " --disable-audio-oss disable OSS audio support [default=no]"
355 echo " --disable-v4l disable video4linux grabbing [default=no]"
356 echo " --disable-network disable network support [default=no]"
357 echo " --disable-zlib disable zlib [default=no]"
358 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
359 # echo " --disable-vhook disable video hooking support"
360 echo " --enable-gprof enable profiling with gprof [$gprof]"
361 echo " --disable-mpegaudio-hp faster (but less accurate)"
362 echo " mpegaudio decoding [default=no]"
364 echo "NOTE: The object files are build at the place where configure is launched"
368 echo "Install prefix $prefix"
369 echo "Source path $source_path"
370 echo "C compiler $cc"
373 echo "Big Endian $bigendian"
374 echo "MMX enabled $mmx"
375 echo "AltiVec enabled $altivec"
376 echo "gprof enabled $gprof"
377 echo "zlib enabled $zlib"
378 echo "mp3lame enabled $mp3lame"
379 echo "vorbis enabled $vorbis"
380 echo "a52 support $a52"
381 echo "a52 dlopened $a52bin"
382 # echo "Video hooking $vhook"
384 if test "$vhook" = "yes" ; then
385 : echo "Imlib2 support $imlib2"
388 echo "Creating config.mak and config.h"
390 echo "# Automatically generated by configure - do not modify" > config.mak
391 echo "/* Automatically generated by configure - do not modify */" > $TMPH
393 echo "prefix=$prefix" >> config.mak
394 echo "MAKE=$make" >> config.mak
395 echo "CC=$cc" >> config.mak
396 echo "AR=$ar" >> config.mak
397 echo "RANLIB=$ranlib" >> config.mak
398 echo "STRIP=$strip" >> config.mak
399 echo "OPTFLAGS=$CFLAGS" >> config.mak
400 echo "LDFLAGS=$LDFLAGS" >> config.mak
401 echo "SHFLAGS=$SHFLAGS" >> config.mak
402 if test "$cpu" = "x86" ; then
403 echo "TARGET_ARCH_X86=yes" >> config.mak
404 echo "#define ARCH_X86 1" >> $TMPH
405 elif test "$cpu" = "armv4l" ; then
406 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
407 echo "#define ARCH_ARMV4L 1" >> $TMPH
408 elif test "$cpu" = "alpha" ; then
409 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
410 echo "#define ARCH_ALPHA 1" >> $TMPH
411 elif test "$cpu" = "powerpc" ; then
412 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
413 echo "#define ARCH_POWERPC 1" >> $TMPH
415 if test "$bigendian" = "yes" ; then
416 echo "WORDS_BIGENDIAN=yes" >> config.mak
417 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
419 if test "$mmx" = "yes" ; then
420 echo "TARGET_MMX=yes" >> config.mak
421 echo "#define HAVE_MMX 1" >> $TMPH
423 if test "$altivec" = "yes" ; then
424 echo "TARGET_ALTIVEC=yes" >> config.mak
425 echo "#define HAVE_ALTIVEC 1" >> $TMPH
427 if test "$gprof" = "yes" ; then
428 echo "TARGET_GPROF=yes" >> config.mak
429 echo "#define HAVE_GPROF 1" >> $TMPH
431 if test "$strptime" = "yes" ; then
432 echo "#define HAVE_STRPTIME 1" >> $TMPH
434 echo "BUILD_STRPTIME=yes" >> config.mak
436 if test "$imlib2" = "yes" ; then
437 echo "HAVE_IMLIB2=yes" >> config.mak
439 if test "$vhook" = "yes" ; then
440 echo "BUILD_VHOOK=yes" >> config.mak
441 echo "#define HAVE_VHOOK 1" >> $TMPH
442 extralibs="$extralibs -ldl"
444 if test "$lshared" = "yes" ; then
445 echo "BUILD_SHARED=yes" >> config.mak
446 echo "PIC=-fPIC" >> config.mak
448 echo "EXTRALIBS=$extralibs" >> config.mak
449 echo -n "VERSION=" >>config.mak
450 head $source_path/VERSION >>config.mak
452 # if you do not want to use encoders, disable that.
453 echo "#define CONFIG_ENCODERS 1" >> $TMPH
454 echo "CONFIG_ENCODERS=yes" >> config.mak
456 # if you do not want to use decoders, disable that.
457 echo "#define CONFIG_DECODERS 1" >> $TMPH
458 echo "CONFIG_DECODERS=yes" >> config.mak
461 if test "$a52" = "yes" ; then
462 echo "#define CONFIG_AC3 1" >> $TMPH
463 echo "CONFIG_AC3=yes" >> config.mak
465 if test "$a52bin" = "yes" ; then
466 echo "#define CONFIG_A52BIN 1" >> $TMPH
467 echo "CONFIG_A52BIN=yes" >> config.mak
471 # mpeg audio high precision mode
472 if test "$mpegaudio_hp" = "yes" ; then
473 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
476 if test "$v4l" = "yes" ; then
477 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
478 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
481 if test "$audio_oss" = "yes" ; then
482 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
483 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
486 if test "$network" = "yes" ; then
487 echo "#define CONFIG_NETWORK 1" >> $TMPH
488 echo "CONFIG_NETWORK=yes" >> config.mak
491 if test "$zlib" = "yes" ; then
492 echo "#define CONFIG_ZLIB 1" >> $TMPH
493 echo "CONFIG_ZLIB=yes" >> config.mak
496 if test "$mp3lame" = "yes" ; then
497 echo "#define CONFIG_MP3LAME 1" >> $TMPH
498 echo "CONFIG_MP3LAME=yes" >> config.mak
501 if test "$vorbis" = "yes" ; then
502 echo "#define CONFIG_VORBIS 1" >> $TMPH
503 echo "CONFIG_VORBIS=yes" >> config.mak
506 if test "$win32" = "yes" ; then
507 echo "#define CONFIG_WIN32 1" >> $TMPH
508 echo "CONFIG_WIN32=yes" >> config.mak
511 if test "$cygwin" = "yes" ; then
512 # setup correct exesuffix
513 echo "CONFIG_WIN32=yes" >> config.mak
516 if test "$darwin" = "yes"; then
517 echo "#define CONFIG_DARWIN 1" >> $TMPH
518 echo "CONFIG_DARWIN=yes" >> config.mak
521 if test "$_malloc_h" = "yes" ; then
522 echo "#define HAVE_MALLOC_H 1" >> $TMPH
524 echo "#undef HAVE_MALLOC_H" >> $TMPH
527 if test "$_memalign" = "yes" ; then
528 echo "#define HAVE_MEMALIGN 1" >> $TMPH
530 echo "#undef HAVE_MEMALIGN" >> $TMPH
533 if test "$simpleidct" = "yes" ; then
534 echo "#define SIMPLE_IDCT 1" >> $TMPH
537 echo "#define restrict $_restrict" >> $TMPH
539 # build tree in object directory if source path is different from current one
540 if test "$source_path_used" = "yes" ; then
541 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
542 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
543 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
544 for dir in $DIRS ; do
548 ln -sf $source_path/$f $f
551 echo "SRC_PATH=$source_path" >> config.mak
553 diff $TMPH config.h >/dev/null 2>&1
554 if test $? -ne 0 ; then
557 echo "config.h is unchanged"
560 rm -f $TMPO $TMPC $TMPS $TMPH