]> git.sesse.net Git - ffmpeg/blobdiff - configure
remove STATS code (probably hasnt been used for years ..., and its not completely...
[ffmpeg] / configure
index 717b23d192abf3cb96fae72e5c286f0355c30769..904c97fc6b6fccae7b9de7faee6bf56b663fd765 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,13 +3,27 @@
 # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
 #
 
+# make sure we are running under a compatible shell
+(: ${foo%%bar}) 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" "$@"
+    fi
+    echo "No compatible shell script interpreter found."
+    exit 1
+fi
+
 show_help(){
   echo "Usage: configure [options]"
   echo "Options: [defaults in brackets after descriptions]"
   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]"
@@ -48,6 +62,7 @@ show_help(){
   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]"
@@ -70,7 +85,6 @@ show_help(){
   echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
   echo "  --disable-network        disable network support [default=no]"
   echo "  --disable-zlib           disable zlib [default=no]"
-  echo "  --disable-lzo            disable lzo [default=no]"
   echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
   echo "  --disable-vhook          disable video hooking support"
   echo "  --enable-gprof           enable profiling with gprof [$gprof]"
@@ -101,15 +115,35 @@ log(){
     echo "$@" >>$logfile
 }
 
-logfile(){
+log_file(){
     log BEGIN $1
     cat -n $1 >>$logfile
     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 logging; 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
 }
@@ -175,7 +209,7 @@ add_extralibs(){
 check_cc(){
     log check_cc "$@"
     cat >$TMPC
-    logfile $TMPC
+    log_file $TMPC
     log $cc $CFLAGS "$@" -c -o $TMPO $TMPC
     $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
 }
@@ -183,7 +217,7 @@ check_cc(){
 check_cpp(){
     log check_cpp "$@"
     cat >$TMPC
-    logfile $TMPC
+    log_file $TMPC
     log $cc $CFLAGS "$@" -E -o $TMPO $TMPC
     $cc $CFLAGS "$@" -E -o $TMPO $TMPC >>$logfile 2>&1
 }
@@ -191,7 +225,7 @@ check_cpp(){
 check_ld(){
     log check_ld "$@"
     cat >$TMPC
-    logfile $TMPC
+    log_file $TMPC
     log $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs
     $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >>$logfile 2>&1
 }
@@ -247,7 +281,7 @@ check_lib(){
 }
 
 check_exec(){
-    check_ld "$@" && { test -n "$cross_prefix" || $TMPE; }
+    check_ld "$@" && { test "$cross_compile" = yes || $TMPE 2>&1 >>$logfile; }
 }
 
 require(){
@@ -278,14 +312,15 @@ TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
 
 # default parameters
-log="no"
-logfile="/dev/null"
+logging="yes"
+logfile="config.err"
 prefix="/usr/local"
 libdir=""
 incdir=""
 mandir=""
 bindir=""
 cross_prefix=""
+cross_compile="no"
 cc="gcc"
 ar="ar"
 ranlib="ranlib"
@@ -321,7 +356,7 @@ case "$cpu" in
   "Power Macintosh"|ppc|powerpc)
     cpu="powerpc"
   ;;
-  mips|mipsel)
+  mips|mipsel|IP*)
     cpu="mips"
   ;;
   sun4u|sparc64)
@@ -359,7 +394,6 @@ dv1394="yes"
 dc1394="no"
 network="yes"
 zlib="yes"
-lzo="yes"
 libgsm="no"
 mp3lame="no"
 libogg="no"
@@ -466,6 +500,7 @@ dv1394="no"
 make="gmake"
 FFLDFLAGS=""
 FFSLDFLAGS=""
+SHFLAGS="-shared -Wl,-h,\$@"
 need_inet_aton="yes"
 extralibs="$extralibs -lsocket -lnsl"
 ;;
@@ -476,7 +511,6 @@ bktr="yes"
 audio_oss="yes"
 dv1394="no"
 make="gmake"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic"
 extralibs="$extralibs -lossaudio"
 ;;
 OpenBSD)
@@ -487,7 +521,6 @@ audio_oss="yes"
 dv1394="no"
 make="gmake"
 LIBOBJFLAGS="\$(PIC)"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
 LDCONFIG="ldconfig -m \$(libdir)"
 extralibs="$extralibs -lossaudio"
 ;;
@@ -499,7 +532,6 @@ audio_oss="yes"
 dv1394="no"
 make="gmake"
 CFLAGS="$CFLAGS -pthread"
-FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
 ;;
 GNU/kFreeBSD)
 v4l="no"
@@ -508,7 +540,6 @@ bktr="yes"
 audio_oss="yes"
 dv1394="no"
 CFLAGS="$CFLAGS -pthread"
-LDFLAGS="$LDFLAGS -rdynamic"
 ;;
 BSD/OS)
 v4l="no"
@@ -554,7 +585,6 @@ cygwin="yes"
 EXESUF=".exe"
 ;;
 Linux)
-FFLDFLAGS="$FFLDFLAGS -rdynamic"
 ;;
 IRIX*)
 ranlib="echo ignoring ranlib"
@@ -631,7 +661,9 @@ CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c
 
 for opt do
   case "$opt" in
-  --log) log=yes
+  --log)
+  ;;
+  --log=*) logging="${opt#*=}"
   ;;
   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
   ;;
@@ -645,6 +677,8 @@ for opt do
   ;;
   --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`
@@ -687,8 +721,6 @@ for opt do
   ;;
   --disable-zlib) zlib="no"
   ;;
-  --disable-lzo) lzo="no"
-  ;;
   --enable-a52) a52="yes"
   ;;
   --enable-a52bin) a52bin="yes"
@@ -797,15 +829,18 @@ for opt do
   esac
 done
 
-if enabled log; then
-    logfile=config.err
+if test "$logging" != no; then
+    test "$logging" = yes || logfile="$logging"
     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}"
@@ -1009,6 +1044,20 @@ if test $tune != "generic"; then
     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
@@ -1107,13 +1156,13 @@ EOF
     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){
@@ -1159,7 +1208,6 @@ fi
 
 check_func localtime_r && localtime_r=yes || localtime_r=no
 enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
-enabled lzo && enabled gpl && check_lib lzo1x.h lzo_version -llzo || lzo="no"
 
 # check for some common methods of building with pthread support
 # do this before the optional library checks as some of them require pthreads
@@ -1175,8 +1223,8 @@ fi
 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 xvid    && require XviD xvid.h xvid_global -lxvidcore
 enabled x264    && require x264 x264.h x264_encoder_open -lx264
@@ -1253,6 +1301,10 @@ if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
     add_extralibs $ldl
 fi
 
+if enabled vhook; then
+    check_ldflags -rdynamic
+    check_ldflags -export-dynamic
+fi
 
 ##########################################
 # imlib check
@@ -1376,9 +1428,9 @@ fi
 if test "$lshared" = "yes" ; then
     # LIBOBJFLAGS may have already been set in the OS configuration
     if test -z "$LIBOBJFLAGS" ; then
-        if test "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "alpha" ; then
-            LIBOBJFLAGS="\$(PIC)"
-        fi
+        case "$cpu" in
+            x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
+        esac
     fi
 fi
 
@@ -1425,7 +1477,6 @@ if test $cpu = "powerpc"; then
 fi
 echo "gprof enabled    $gprof"
 echo "zlib enabled     $zlib"
-echo "lzo enabled      $lzo"
 echo "libgsm enabled   $libgsm"
 echo "mp3lame enabled  $mp3lame"
 echo "libogg enabled   $libogg"
@@ -1681,12 +1732,16 @@ fi
 echo "EXTRALIBS=$extralibs" >> config.mak
 
 # If you do not want to use encoders, disable them.
-echo "#define CONFIG_ENCODERS 1" >> $TMPH
-echo "CONFIG_ENCODERS=yes" >> config.mak
+if echo "$CODEC_LIST" | grep -q encoder; then
+    echo "#define CONFIG_ENCODERS 1" >> $TMPH
+    echo "CONFIG_ENCODERS=yes" >> config.mak
+fi
 
 # If you do not want to use decoders, disable them.
-echo "#define CONFIG_DECODERS 1" >> $TMPH
-echo "CONFIG_DECODERS=yes" >> config.mak
+if echo "$CODEC_LIST" | grep -q decoder; then
+    echo "#define CONFIG_DECODERS 1" >> $TMPH
+    echo "CONFIG_DECODERS=yes" >> config.mak
+fi
 
 # muxers
 if test "$muxers" = "yes" ; then
@@ -1785,11 +1840,6 @@ if test "$zlib" = "yes" ; then
   echo "CONFIG_ZLIB=yes" >> config.mak
 fi
 
-if test "$lzo" = "yes" ; then
-  echo "#define CONFIG_LZO 1" >> $TMPH
-  echo "CONFIG_LZO=yes" >> config.mak
-fi
-
 if test "$libgsm" = "yes" ; then
   echo "#define CONFIG_LIBGSM 1" >> $TMPH
   echo "CONFIG_LIBGSM=yes" >> config.mak
@@ -1937,6 +1987,7 @@ echo "#define restrict $_restrict" >> $TMPH
 
 if test "$optimize" = "small"; then
   echo "#define always_inline"  >> $TMPH
+  echo "#define CONFIG_SMALL 1" >> $TMPH
 fi
 
 # build tree in object directory if source path is different from current one