#!/bin/sh
#
-# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
+# FFmpeg configure script
+#
+# Copyright (c) 2000, 2001, 2002 Fabrice Bellard
+# Copyright (c) 2005-2006 Diego Biurrun
+# Copyright (c) 2005-2006 Mans Rullgard
#
# make sure we are running under a compatible shell
+# try to make this part work with most shells
+
+try_exec(){
+ type "$1" >/dev/null 2>&1 && exec "$@"
+}
+
unset foo
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
if test "$?" != 0; then
- if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
- FFMPEG_CONFIGURE_EXEC=1
- export FFMPEG_CONFIGURE_EXEC
- exec bash "$0" "$@"
- exec ksh "$0" "$@"
- exec /usr/xpg4/bin/sh "$0" "$@"
+ export FF_CONF_EXEC
+ if test "0$FF_CONF_EXEC" -lt 1; then
+ FF_CONF_EXEC=1
+ try_exec bash "$0" "$@"
+ fi
+ if test "0$FF_CONF_EXEC" -lt 2; then
+ FF_CONF_EXEC=2
+ try_exec ksh "$0" "$@"
+ fi
+ if test "0$FF_CONF_EXEC" -lt 3; then
+ FF_CONF_EXEC=3
+ try_exec /usr/xpg4/bin/sh "$0" "$@"
fi
echo "No compatible shell script interpreter found."
+ echo "This configure script requires a POSIX compatible shell"
+ echo "such as bash or ksh."
+ if test "$BASH_VERSION" = '2.04.0(1)-release'; then
+ echo "This bash version ($BASH_VERSION) is broken on your platform."
+ echo "Upgrade to a later version if available."
+ fi
exit 1
fi
#include <$header>
int x;
EOF
+ err=$?
+ var=`echo $header | sed 's/[^[:alnum:]]/_/g'`
+ test "$err" = 0 && enable $var || disable $var
+ return $err
}
check_func(){
$func();
}
EOF
+ err=$?
+ test "$err" = 0 && enable $func || disable $func
+ return $err
}
check_lib(){
vhook
video4linux
video4linux2
+ wince
x264
xvid
zlib
beosthreads
byteswap_h
dcbzl
- dlfcn
+ dlfcn_h
dlopen
- fast_int
freetype2
gprof
imlib2
inet_aton
- inttypes
localtime_r
lrintf
malloc_h
memalign
mlib
+ os2
os2threads
pthreads
sdl
dts="no"
pp="no"
mingw32="no"
-mingwce="no"
+wince="no"
os2="no"
lstatic="yes"
lshared="no"
installstrip="-s"
extralibs="-lm"
bigendian="no"
-inttypes="yes"
-fast_int="yes"
vhook="default"
avisynth="no"
-dlfcn="no"
+dlfcn_h="no"
dlopen="no"
mpegaudio_hp="yes"
SHFLAGS='-shared -Wl,-soname,$@'
;;
CYGWIN*)
targetos=CYGWIN
-shlibdir='${PREFIX}/bin'
+shlibdir="$bindir"
video4linux="no"
video4linux2="no"
audio_oss="yes"
FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done
-ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
-DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
-PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
-MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
-DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
+ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
+DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
+PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
+MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
+DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
;;
--log=*) logging="$optval"
;;
- --prefix=*) PREFIX="$optval"; force_prefix=yes
+ --prefix=*) PREFIX="$optval"
;;
- --libdir=*) libdir="$optval"; force_libdir=yes
+ --libdir=*) libdir="$optval"
;;
--shlibdir=*) shlibdir="$optval"
;;
;;
--enable-mingw32) mingw32="yes"
;;
- --enable-mingwce) mingwce="yes"
+ --enable-mingwce) wince="yes"
;;
--enable-static) lstatic="yes"
;;
logfile=/dev/null
fi
-if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
+if test "$mingw32" = "yes" -o "$wince" = "yes"; then
if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
cat <<EOF
You can only build one library type at once on MinGW.
if enabled mingw32; then
w32threads="yes"
fi
- if test "$mingwce" = "yes"; then
+ if test "$wince" = "yes"; then
protocols="no"
fi
SLIBPREF=""
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
- if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
- if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
- shlibdir='${PREFIX}'
fi
# Combine FFLDFLAGS and the LDFLAGS environment variable.
fi
# Add processor-specific flags
-TUNECPU="generic"
POWERPCMODE="32bits"
if test $cpu != "generic"; then
case $cpu in
if test $altivec = "yes"; then
echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
fi
- TUNECPU=ppc601
;;
603*|ppc603*|PowerPC603*)
add_cflags "-mcpu=603"
if test $altivec = "yes"; then
echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
fi
- TUNECPU=ppc603
;;
604*|ppc604*|PowerPC604*)
add_cflags "-mcpu=604"
if test $altivec = "yes"; then
echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
fi
- TUNECPU=ppc604
;;
G3|g3|75*|ppc75*|PowerPC75*)
add_cflags "-mcpu=750 -mpowerpc-gfxopt"
if test $altivec = "yes"; then
echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
fi
- TUNECPU=ppc750
;;
G4|g4|745*|ppc745*|PowerPC745*)
add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
if test $altivec = "no"; then
echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
fi
- TUNECPU=ppc7450
;;
74*|ppc74*|PowerPC74*)
add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
if test $altivec = "no"; then
echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
fi
- TUNECPU=ppc7400
;;
G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
if test $altivec = "no"; then
echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
fi
- TUNECPU=ppc970
POWERPCMODE="64bits"
;;
# targets that do NOT support conditional mov (cmov)
fi
fi
-check_header altivec.h && altivec_h=yes || altivec_h=no
+check_header altivec.h
# check if our compiler supports Motorola AltiVec C API
if test $altivec = "yes"; then
fi
fi
-# ---
-# *inttypes.h* test
-check_header inttypes.h || inttypes=no
-
-# ---
-# *int_fast* test
-check_cc <<EOF || fast_int=no
-#include <inttypes.h>
-int main(int argc, char ** argv){
- volatile uint_fast64_t i=0x01234567;
- return 0;
-}
-EOF
-
# ---
# check availability of some header files
-memalign=no
-malloc_h=no
-if check_header malloc.h; then
- malloc_h=yes
- memalign=yes
- check_func memalign || memalign="no"
-fi
+check_header malloc.h
+check_func memalign
if test "$memalign" = "no" -a "$mmx" = "yes" -a \
"$memalign_hack" != "yes" -a "$targetos" != "Darwin" -a \
die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
fi
-check_header byteswap.h && byteswap_h=yes || byteswap_h=no
+check_header byteswap.h
-check_func inet_aton && inet_aton=yes || inet_aton=no
-check_func localtime_r && localtime_r=yes || localtime_r=no
+check_func inet_aton
+check_func localtime_r
enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
# check for some common methods of building with pthread support
# do this before the optional library checks as some of them require pthreads
if enabled pthreads; then
- { check_cflags -pthread && check_ldflags -pthread; } ||
- { check_cflags -pthreads && check_ldflags -pthreads; } ||
- check_lib pthread.h pthread_create -lpthread ||
- check_func pthread_create ||
- die "ERROR: can't find pthreads library"
+ if check_func pthread_create; then
+ :
+ elif check_func pthread_create -pthread; then
+ add_cflags -pthread
+ add_ldflags -pthread
+ elif check_func pthread_create -pthreads; then
+ add_cflags -pthreads
+ add_ldflags -pthreads
+ elif ! check_lib pthread.h pthread_create -lpthread; then
+ die "ERROR: can't find pthreads library"
+ fi
fi
# these are off by default, so fail if requested and not available
# dlopen/dlfcn.h probing
-check_header dlfcn.h && dlfcn=yes
+check_header dlfcn.h
-temp_extralibs -ldl
if check_func dlopen; then
- dlopen=yes
- ldl=-ldl
-fi
-restore_flags
-
-if check_func dlopen; then
- dlopen=yes
ldl=
+elif check_func dlopen -ldl; then
+ ldl=-ldl
fi
if test "$vhook" = "default"; then
check_ldflags -export-dynamic
fi
+if enabled audio_beos; then
+ add_extralibs "-lmedia -lbe"
+fi
+
##########################################
# imlib check
echo "build suffix $BUILDSUF"
fi
echo "big-endian $bigendian"
-echo "inttypes.h $inttypes"
-echo "int_fastxx_t $fast_int"
if test $arch = "x86_32" -o $arch = "x86_64"; then
echo "MMX enabled $mmx"
echo "CMOV enabled $cmov"
echo "License: GPL"
fi
-if test "$amr_wb" = "yes" ; then
- echo
- echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
- echo "V5.1.0 from "
- echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
- echo "and extracted the source to libavcodec/amrwb_float"
-fi
-
-if test "$amr_nb" = "yes" ; then
- echo
- echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
- echo "REL-5 V5.1.0 from "
- echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
- echo "and extracted the source to libavcodec/amr_float"
- echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
-fi
-
-if test "$amr_nb_fixed" = "yes" ; then
- echo
- echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
- echo "REL-5 version 5.1.0 from "
- echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
- echo "and extracted src to libavcodec/amr"
- echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
- echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
-fi
-
echo "Creating config.mak and config.h..."
-date >> config.log
-echo " $0 $FFMPEG_CONFIGURATION" >> config.log
echo "# Automatically generated by configure - do not modify!" > config.mak
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
echo "TARGET_OS=$targetos" >> config.mak
-if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then
- echo "TARGET_ARCH_X86=yes" >> config.mak
- echo "#define ARCH_X86 1" >> $TMPH
-fi
-if test "$arch" = "x86_32" ; then
- echo "TARGET_ARCH_X86_32=yes" >> config.mak
- echo "#define ARCH_X86_32 1" >> $TMPH
-elif test "$arch" = "x86_64" ; then
- echo "TARGET_ARCH_X86_64=yes" >> config.mak
- echo "#define ARCH_X86_64 1" >> $TMPH
-elif test "$arch" = "armv4l" ; then
- echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
- echo "#define ARCH_ARMV4L 1" >> $TMPH
-elif test "$arch" = "alpha" ; then
- echo "TARGET_ARCH_ALPHA=yes" >> config.mak
- echo "#define ARCH_ALPHA 1" >> $TMPH
-elif test "$arch" = "sparc64" ; then
- echo "TARGET_ARCH_SPARC64=yes" >> config.mak
- echo "#define ARCH_SPARC64 1" >> $TMPH
- echo "TARGET_ARCH_SPARC=yes" >> config.mak
- echo "#define ARCH_SPARC 1" >> $TMPH
-elif test "$arch" = "sparc" ; then
- echo "TARGET_ARCH_SPARC=yes" >> config.mak
- echo "#define ARCH_SPARC 1" >> $TMPH
-elif test "$arch" = "powerpc" ; then
- echo "TARGET_ARCH_POWERPC=yes" >> config.mak
- echo "#define ARCH_POWERPC 1" >> $TMPH
- if test $POWERPCMODE = "32bits"; then
- echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
- else
- echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
- fi
- if test "$powerpc_perf" = "yes"; then
- echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
- fi
-elif test "$arch" = "mips" ; then
- echo "TARGET_ARCH_MIPS=yes" >> config.mak
- echo "#define ARCH_MIPS 1" >> $TMPH
-elif test "$arch" = "sh4" ; then
- echo "TARGET_ARCH_SH4=yes" >> config.mak
- echo "#define ARCH_SH4 1" >> $TMPH
-elif test "$arch" = "parisc" ; then
- echo "TARGET_ARCH_PARISC=yes" >> config.mak
- echo "#define ARCH_PARISC 1" >> $TMPH
-elif test "$arch" = "s390" ; then
- echo "TARGET_ARCH_S390=yes" >> config.mak
- echo "#define ARCH_S390 1" >> $TMPH
-elif test "$arch" = "m68k" ; then
- echo "TARGET_ARCH_M68K=yes" >> config.mak
- echo "#define ARCH_M68K 1" >> $TMPH
-elif test "$arch" = "ia64" ; then
- echo "TARGET_ARCH_IA64=yes" >> config.mak
- echo "#define ARCH_IA64 1" >> $TMPH
-elif test "$arch" = "bfin" ; then
- echo "TARGET_ARCH_BFIN=yes" >> config.mak
- echo "#define ARCH_BFIN 1" >> $TMPH
-fi
-echo "#define TUNECPU $TUNECPU" >> $TMPH
+
+ucarch=`toupper $arch`
+echo "TARGET_ARCH_${ucarch}=yes" >> config.mak
+echo "#define ARCH_${ucarch} 1" >> $TMPH
+
+# special cases
+case "$arch" in
+ x86_32|x86_64)
+ echo "TARGET_ARCH_X86=yes" >> config.mak
+ echo "#define ARCH_X86 1" >> $TMPH
+ ;;
+ powerpc)
+ if test "$POWERPCMODE" = "64bits"; then
+ echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
+ fi
+ if test "$powerpc_perf" = "yes"; then
+ echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
+ fi
+ ;;
+ sparc64)
+ echo "TARGET_ARCH_SPARC=yes" >> config.mak
+ echo "#define ARCH_SPARC 1" >> $TMPH
+ ;;
+esac
+
if test "$bigendian" = "yes" ; then
echo "WORDS_BIGENDIAN=yes" >> config.mak
echo "#define WORDS_BIGENDIAN 1" >> $TMPH
print_config HAVE_ $TMPH config.mak $HAVE_LIST
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
-if test "$mingw32" = "yes" ; then
- echo "#ifndef __MINGW32__" >> $TMPH
- echo "#define __MINGW32__ 1" >> $TMPH
- echo "#endif" >> $TMPH
-fi
-
-if test "$mingwce" = "yes" ; then
- echo "#define CONFIG_WINCE 1" >> $TMPH
- echo "#ifndef __MINGW32__" >> $TMPH
- echo "#define __MINGW32__ 1" >> $TMPH
- echo "#endif" >> $TMPH
-fi
-
-if test "$os2" = "yes" ; then
- echo "#define CONFIG_OS2 1" >> $TMPH
-fi
-
if test "$targetos" = "Darwin"; then
echo "#define CONFIG_DARWIN 1" >> $TMPH
fi