echo
echo "Standard options:"
echo " --help print this message"
- echo " --log log tests and output to config.err"
+ echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
echo "Advanced options (experts only):"
echo " --source-path=PATH path to source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
+ echo " --cross-compile assume a cross-compiler is used"
echo " --cc=CC use C compiler CC [$cc]"
echo " --make=MAKE use specified make [$make]"
echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
log END $1
}
-die(){
+echolog(){
log "$@"
echo "$@"
+}
+
+die(){
+ echolog "$@"
+ cat <<EOF
+If you think configure made a mistake, make sure you are using the latest
+version from SVN. If the latest version fails, report the problem to the
+ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
+EOF
+ if enabled log; then
+ cat <<EOF
+Include the log file "$logfile" produced by configure as this will help
+solving the problem.
+EOF
+ else
+cat <<EOF
+Rerun configure with logging enabled (do not use --log=no), and include the
+log this produces with your report.
+EOF
+ fi
rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
exit 1
}
}
check_exec(){
- check_ld "$@" && { test -n "$cross_prefix" || $TMPE; }
+ check_ld "$@" && { test "$cross_compile" = yes || $TMPE 2>&1 >>$logfile; }
}
require(){
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
# default parameters
-log="no"
-logfile="/dev/null"
+log="yes"
+logfile="config.err"
prefix="/usr/local"
libdir=""
incdir=""
mandir=""
bindir=""
cross_prefix=""
+cross_compile="no"
cc="gcc"
ar="ar"
ranlib="ranlib"
"Power Macintosh"|ppc|powerpc)
cpu="powerpc"
;;
- mips|mipsel)
+ mips|mipsel|IP*)
cpu="mips"
;;
sun4u|sparc64)
audio_oss="yes"
dv1394="no"
make="gmake"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic"
extralibs="$extralibs -lossaudio"
;;
OpenBSD)
dv1394="no"
make="gmake"
LIBOBJFLAGS="\$(PIC)"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
LDCONFIG="ldconfig -m \$(libdir)"
extralibs="$extralibs -lossaudio"
;;
dv1394="no"
make="gmake"
CFLAGS="$CFLAGS -pthread"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
;;
GNU/kFreeBSD)
v4l="no"
audio_oss="yes"
dv1394="no"
CFLAGS="$CFLAGS -pthread"
-LDFLAGS="$LDFLAGS -rdynamic"
;;
BSD/OS)
v4l="no"
EXESUF=".exe"
;;
Linux)
-FFLDFLAGS="$FFLDFLAGS -rdynamic"
;;
IRIX*)
ranlib="echo ignoring ranlib"
for opt do
case "$opt" in
- --log) log=yes
+ --log)
+ ;;
+ --log=*) log="${opt#*=}"
;;
--prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
;;
;;
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
;;
+ --cross-compile) cross_compile=yes
+ ;;
--cc=*) cc=`echo $opt | cut -d '=' -f 2-`
;;
--make=*) make=`echo $opt | cut -d '=' -f 2`
esac
done
-if enabled log; then
- logfile=config.err
+if test "$log" != no; then
+ test "$log" = yes || logfile="$log"
echo "# $0 $@" >$logfile
set >>$logfile
+else
+ logfile=/dev/null
fi
# Combine FFLDFLAGS and the LDFLAGS environment variable
LDFLAGS="$FFLDFLAGS $LDFLAGS"
+test -n "$cross_prefix" && cross_compile=yes
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
ranlib="${cross_prefix}${ranlib}"
esac
fi
+# compiler sanity check
+check_exec <<EOF
+int main(){
+ return 0;
+}
+EOF
+if test "$?" != 0; then
+ echo "$cc is unable to create an executable file."
+ if test -z "$cross_prefix" -a "$cross_compile" = no; then
+ echo "If $cc is a cross-compiler, use the --cross-compile option."
+ fi
+ die "C compiler test failed."
+fi
+
# check for SIMD availability
# AltiVec flags: The FSF version of GCC differs from the Apple version
SLIBPREF=""
SLIBSUF=".dll"
EXESUF=".exe"
- if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
+ if test "$force_prefix" != yes; then prefix="$PROGRAMFILES/FFmpeg"; fi
if test "$force_libdir" != yes; then bindir="$prefix"; fi
fi
# ---
# big/little-endian test
-if test -z "$cross_prefix" ; then
+if test "$cross_compile" = "no"; then
check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
#include <inttypes.h>
int main(int argc, char ** argv){
enabled dts && require libdts dts.h dts_init -ldts
enabled libgsm && require libgsm gsm.h gsm_create -lgsm
enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
-enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc
+enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
enabled theora && require libtheora theora/theora.h theora_info_init -ltheora
-enabled faac && require libfaac faac.h faacEncOpen -lfaac
-enabled faad && require libfaad faad.h faacDecOpen -lfaad
enabled xvid && require XviD xvid.h xvid_global -lxvidcore
enabled x264 && require x264 x264.h x264_encoder_open -lx264
enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
+# Ugh, faac uses stdcall calling convention on win32 so we can't use
+# the generic test functions
+if enabled faac; then
+ save_flags
+ temp_extralibs -lfaac
+ check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
+#include <stdint.h>
+#include <faac.h>
+int main(){
+ char *id, *cpr;
+ faacEncGetVersion(&id, &cpr);
+ return 0;
+}
+EOF
+ restore_flags
+fi
+
+# Ugh, recent faad2 versions have renamed all functions and #define the
+# old names in faad.h. Generic tests won't work.
+if enabled faad; then
+ save_flags
+ temp_extralibs -lfaad
+ check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
+#include <faad.h>
+int main(){
+ faacDecOpen();
+ return 0;
+}
+EOF
+ restore_flags
+fi
+
# test for lrintf in math.h
check_exec <<EOF && have_lrintf=yes || have_lrintf=no
#define _ISOC9X_SOURCE 1
add_extralibs $ldl
fi
+if enabled vhook; then
+ check_ldflags -rdynamic
+ check_ldflags -export-dynamic
+fi
##########################################
# imlib check
echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
fi
echo "EXTRALIBS=$extralibs" >> config.mak
-version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
- cut -d '"' -f 2`
-echo "VERSION=$version" >>config.mak
+
# If you do not want to use encoders, disable them.
echo "#define CONFIG_ENCODERS 1" >> $TMPH
echo "CONFIG_ENCODERS=yes" >> config.mak