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"
29 i386|i486|i586|i686|i86pc|BePC)
38 "Power Macintosh"|ppc)
68 prefix="/boot/home/config"
69 # helps building libavcodec
70 CFLAGS="-O3 -DPIC -fomit-frame-pointer"
72 # disable linux things
75 # no need for libm, but the inet stuff
77 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
78 extralibs="-lbind -lsocket"
80 echo "Not sure building for net_server will succeed... good luck."
86 extralibs="-lpoll -lgnugetopt -lm"
93 CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
103 test -f /usr/include/inttypes.h || \
104 test -f /usr/local/include/inttypes.h || \
105 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
106 "/usr/include/inttypes.h !!!"
112 # XXX: we assume an absolute path is given when launching configure,
113 # except in './configure' case.
114 source_path=${0%configure}
115 source_path=${source_path%/}
116 source_path_used="yes"
117 if test -z "$source_path" -o "$source_path" = "." ; then
119 source_path_used="no"
124 int main( void ) { return (int) dlopen("foo", 0); }
127 if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
132 #include <X11/Xlib.h>
134 int main( void ) { return (int) imlib_load_font("foo"); }
138 if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
144 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
146 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
148 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
150 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
152 --make=*) make=`echo $opt | cut -d '=' -f 2`
154 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
156 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
158 --extra-libs=*) extralibs=${opt#--extra-libs=}
160 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
162 --disable-mmx) mmx="no"
164 --enable-gprof) gprof="yes"
166 --disable-v4l) v4l="no"
168 --disable-audio-oss) audio_oss="no"
170 --disable-network) network="no"
172 --disable-zlib) zlib="no"
174 --disable-a52) a52="no"
176 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
178 --enable-mp3lame) mp3lame="yes"
180 --enable-vorbis) vorbis="yes"
182 --disable-vhook) vhook="no"
184 --disable-simple_idct) simpleidct="no"
186 --enable-win32) win32="yes"
188 --enable-shared) lshared="yes"
190 --disable-mpegaudio-hp) mpegaudio_hp="no"
196 if test $mmx = "default"; then
197 if test $cpu = "x86"; then
204 # Checking for CFLAGS
205 if test -z "$CFLAGS"; then
209 if test "$win32" = "yes" ; then
210 cross_prefix="i386-mingw32msvc-"
216 cc="${cross_prefix}${cc}"
217 ar="${cross_prefix}${ar}"
218 strip="${cross_prefix}${strip}"
221 # big/little endian test
223 #include <inttypes.h>
224 int main(int argc, char ** argv){
225 volatile uint32_t i=0x01234567;
226 return (*((uint8_t*)(&i))) == 0x67;
230 if $cc -o $TMPO $TMPC 2>/dev/null ; then
231 $TMPO && bigendian="yes"
233 echo big/little test failed
237 # check availability of some header files
241 int main( void ) { return 0; }
246 if $cc -o $TMPO $TMPC 2> /dev/null ; then
249 # check for memalign - atmos
254 string = memalign(64, sizeof(char));
258 $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
264 int main( void ) { return *strptime("", "", 0); }
268 if $cc -o $TMPO $TMPC 2> /dev/null ; then
272 if test "$zlib" = "yes"; then
273 # check for zlib - mmu_man
277 if (zlibVersion() != ZLIB_VERSION)
278 puts("zlib version differs !!!");
283 $cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
284 # $TMPO 2> /dev/null > /dev/null || zlib="no"
285 # XXX: more tests needed - runtime test
287 if test "$zlib" = "yes"; then
288 extralibs="$extralibs -lz"
292 for restrict_keyword in restrict __restrict__ __restrict; do
293 echo "void foo(char * $restrict_keyword p);" > $TMPC
294 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
295 _restrict=$restrict_keyword
300 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
303 Usage: configure [options]
304 Options: [defaults in brackets after descriptions]
307 echo "Standard options:"
308 echo " --help print this message"
309 echo " --prefix=PREFIX install in PREFIX [$prefix]"
310 echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
311 echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
312 echo " --enable-win32 enable win32 cross compile"
313 echo " --disable-a52 disable GPL'ed A52 support [default=no]"
314 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
315 echo " --enable-shared build shared libraries [default=no]"
317 echo "Advanced options (experts only):"
318 echo " --source-path=PATH path of source code [$source_path]"
319 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
320 echo " --cc=CC use C compiler CC [$cc]"
321 echo " --make=MAKE use specified make [$make]"
322 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
323 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
324 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
325 echo " --cpu=CPU force cpu to CPU [$cpu]"
326 echo " --disable-mmx disable mmx usage"
327 echo " --disable-audio-oss disable OSS audio support [default=no]"
328 echo " --disable-v4l disable video4linux grabbing [default=no]"
329 echo " --disable-network disable network support [default=no]"
330 echo " --disable-zlib disable zlib [default=no]"
331 echo " --disable-simple_idct disable simple IDCT routines [default=no]"
332 # echo " --disable-vhook disable video hooking support"
333 echo " --enable-gprof enable profiling with gprof [$gprof]"
334 echo " --disable-mpegaudio-hp faster (but less accurate)"
335 echo " mpegaudio decoding [default=no]"
337 echo "NOTE: The object files are build at the place where configure is launched"
341 echo "Install prefix $prefix"
342 echo "Source path $source_path"
343 echo "C compiler $cc"
346 echo "Big Endian $bigendian"
347 echo "MMX enabled $mmx"
348 echo "gprof enabled $gprof"
349 echo "zlib enabled $zlib"
350 echo "mp3lame enabled $mp3lame"
351 echo "vorbis enabled $vorbis"
352 echo "a52 support $a52"
353 echo "a52 dlopened $a52bin"
354 # echo "Video hooking $vhook"
356 if test "$vhook" = "yes" ; then
357 : echo "Imlib2 support $imlib2"
360 echo "Creating config.mak and config.h"
362 echo "# Automatically generated by configure - do not modify" > config.mak
363 echo "/* Automatically generated by configure - do not modify */" > $TMPH
365 echo "prefix=$prefix" >> config.mak
366 echo "MAKE=$make" >> config.mak
367 echo "CC=$cc" >> config.mak
368 echo "AR=$ar" >> config.mak
369 echo "STRIP=$strip" >> config.mak
370 echo "OPTFLAGS=$CFLAGS" >> config.mak
371 echo "LDFLAGS=$LDFLAGS" >> config.mak
372 echo "SHFLAGS=$SHFLAGS" >> config.mak
373 if test "$cpu" = "x86" ; then
374 echo "TARGET_ARCH_X86=yes" >> config.mak
375 echo "#define ARCH_X86 1" >> $TMPH
376 elif test "$cpu" = "armv4l" ; then
377 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
378 echo "#define ARCH_ARMV4L 1" >> $TMPH
379 elif test "$cpu" = "alpha" ; then
380 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
381 echo "#define ARCH_ALPHA 1" >> $TMPH
382 elif test "$cpu" = "powerpc" ; then
383 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
384 echo "#define ARCH_POWERPC 1" >> $TMPH
386 if test "$bigendian" = "yes" ; then
387 echo "WORDS_BIGENDIAN=yes" >> config.mak
388 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
390 if test "$mmx" = "yes" ; then
391 echo "TARGET_MMX=yes" >> config.mak
392 echo "#define HAVE_MMX 1" >> $TMPH
394 if test "$gprof" = "yes" ; then
395 echo "TARGET_GPROF=yes" >> config.mak
396 echo "#define HAVE_GPROF 1" >> $TMPH
398 if test "$strptime" = "yes" ; then
399 echo "#define HAVE_STRPTIME 1" >> $TMPH
401 echo "BUILD_STRPTIME=yes" >> config.mak
403 if test "$imlib2" = "yes" ; then
404 echo "HAVE_IMLIB2=yes" >> config.mak
406 if test "$vhook" = "yes" ; then
407 echo "BUILD_VHOOK=yes" >> config.mak
408 echo "#define HAVE_VHOOK 1" >> $TMPH
409 extralibs="$extralibs -ldl"
411 if test "$lshared" = "yes" ; then
412 echo "BUILD_SHARED=yes" >> config.mak
413 echo "PIC=-fPIC" >> config.mak
415 echo "EXTRALIBS=$extralibs" >> config.mak
416 echo -n "VERSION=" >>config.mak
417 head $source_path/VERSION >>config.mak
419 # if you do not want to use encoders, disable that.
420 echo "#define CONFIG_ENCODERS 1" >> $TMPH
421 echo "CONFIG_ENCODERS=yes" >> config.mak
423 # if you do not want to use decoders, disable that.
424 echo "#define CONFIG_DECODERS 1" >> $TMPH
425 echo "CONFIG_DECODERS=yes" >> config.mak
428 if test "$a52" = "yes" ; then
429 echo "#define CONFIG_AC3 1" >> $TMPH
430 echo "CONFIG_AC3=yes" >> config.mak
432 if test "$a52bin" = "yes" ; then
433 echo "#define CONFIG_A52BIN 1" >> $TMPH
434 echo "CONFIG_A52BIN=yes" >> config.mak
438 # mpeg audio high precision mode
439 if test "$mpegaudio_hp" = "yes" ; then
440 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
443 if test "$v4l" = "yes" ; then
444 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
445 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
448 if test "$audio_oss" = "yes" ; then
449 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
450 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
453 if test "$network" = "yes" ; then
454 echo "#define CONFIG_NETWORK 1" >> $TMPH
455 echo "CONFIG_NETWORK=yes" >> config.mak
458 if test "$zlib" = "yes" ; then
459 echo "#define CONFIG_ZLIB 1" >> $TMPH
460 echo "CONFIG_ZLIB=yes" >> config.mak
463 if test "$mp3lame" = "yes" ; then
464 echo "#define CONFIG_MP3LAME 1" >> $TMPH
465 echo "CONFIG_MP3LAME=yes" >> config.mak
468 if test "$vorbis" = "yes" ; then
469 echo "#define CONFIG_VORBIS 1" >> $TMPH
470 echo "CONFIG_VORBIS=yes" >> config.mak
473 if test "$win32" = "yes" ; then
474 echo "#define CONFIG_WIN32 1" >> $TMPH
475 echo "CONFIG_WIN32=yes" >> config.mak
478 if test "$cygwin" = "yes" ; then
479 # setup correct exesuffix
480 echo "CONFIG_WIN32=yes" >> config.mak
483 if test "$darwin" = "yes"; then
484 echo "#define CONFIG_DARWIN 1" >> $TMPH
485 echo "CONFIG_DARWIN=yes" >> config.mak
488 if test "$_malloc_h" = "yes" ; then
489 echo "#define HAVE_MALLOC_H 1" >> $TMPH
491 echo "#undef HAVE_MALLOC_H" >> $TMPH
494 if test "$_memalign" = "yes" ; then
495 echo "#define HAVE_MEMALIGN 1" >> $TMPH
497 echo "#undef HAVE_MEMALIGN" >> $TMPH
500 if test "$simpleidct" = "yes" ; then
501 echo "#define SIMPLE_IDCT 1" >> $TMPH
504 echo "#define restrict $_restrict" >> $TMPH
506 # build tree in object directory if source path is different from current one
507 if test "$source_path_used" = "yes" ; then
508 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
509 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
510 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
511 for dir in $DIRS ; do
515 ln -sf $source_path/$f $f
518 echo "SRC_PATH=$source_path" >> config.mak
520 diff $TMPH config.h >/dev/null 2>&1
521 if test $? -ne 0 ; then
524 echo "config.h is unchanged"
527 rm -f $TMPO $TMPC $TMPS $TMPH