#!/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
malloc_h
memalign
mlib
+ os2
os2threads
pthreads
sdl
;;
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"
;;
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)
# 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
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 "$os2" = "yes" ; then
- echo "#define CONFIG_OS2 1" >> $TMPH
-fi
-
if test "$targetos" = "Darwin"; then
echo "#define CONFIG_DARWIN 1" >> $TMPH
fi