2001-07-22 16:18:56 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2001-09-13 09:16:59 +02:00
|
|
|
TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
|
|
|
|
TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
|
|
|
|
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
|
2002-04-11 22:11:36 +02:00
|
|
|
TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
|
2001-09-13 09:16:59 +02:00
|
|
|
|
|
|
|
if [ ! -z "$TMPDIR" ]; then
|
|
|
|
TMPC="${TMPDIR}/${TMPC}"
|
|
|
|
TMPCPP="${TMPDIR}/${TMPCPP}"
|
|
|
|
TMPO="${TMPDIR}/${TMPO}"
|
|
|
|
TMPS="${TMPDIR}/${TMPS}"
|
2002-04-11 22:11:36 +02:00
|
|
|
TMPH="${TMPDIR}/${TMPH}"
|
2001-09-13 09:16:59 +02:00
|
|
|
elif [ ! -z "$TEMPDIR" ]; then
|
|
|
|
TMPC="${TEMPDIR}/${TMPC}"
|
|
|
|
TMPCPP="${TEMPDIR}/${TMPCPP}"
|
|
|
|
TMPO="${TEMPDIR}/${TMPO}"
|
|
|
|
TMPS="${TEMPDIR}/${TMPS}"
|
2002-04-11 22:11:36 +02:00
|
|
|
TMPH="${TEMPDIR}/${TMPH}"
|
2001-09-13 09:16:59 +02:00
|
|
|
else
|
|
|
|
TMPC="/tmp/${TMPC}"
|
|
|
|
TMPCPP="/tmp/${TMPCPP}"
|
|
|
|
TMPO="/tmp/${TMPO}"
|
|
|
|
TMPS="/tmp/${TMPS}"
|
2002-04-11 22:11:36 +02:00
|
|
|
TMPH="/tmp/${TMPH}"
|
2001-09-13 09:16:59 +02:00
|
|
|
fi
|
|
|
|
|
2001-07-22 16:18:56 +02:00
|
|
|
# default parameters
|
|
|
|
prefix="/usr/local"
|
|
|
|
cc="gcc"
|
|
|
|
ar="ar"
|
|
|
|
cpu=`uname -m`
|
|
|
|
case "$cpu" in
|
2002-03-08 10:09:57 +01:00
|
|
|
i386|i486|i586|i686|i86pc|BePC)
|
2001-07-22 16:18:56 +02:00
|
|
|
cpu="x86"
|
|
|
|
mmx="yes"
|
|
|
|
;;
|
2001-08-13 23:42:31 +02:00
|
|
|
armv4l)
|
|
|
|
cpu="armv4l"
|
|
|
|
mmx="no"
|
|
|
|
;;
|
2002-01-20 15:55:42 +01:00
|
|
|
alpha)
|
|
|
|
cpu="alpha"
|
|
|
|
mmx="no"
|
|
|
|
;;
|
2001-07-22 16:18:56 +02:00
|
|
|
*)
|
|
|
|
mmx="no"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
gprof="no"
|
2001-08-13 23:42:31 +02:00
|
|
|
grab="yes"
|
2002-03-10 15:44:19 +01:00
|
|
|
mp3lame="no"
|
2001-08-16 00:29:44 +02:00
|
|
|
win32="no"
|
2002-03-08 10:09:57 +01:00
|
|
|
extralibs="-lm"
|
|
|
|
|
|
|
|
# OS specific
|
|
|
|
targetos=`uname -s`
|
|
|
|
case $targetos in
|
|
|
|
BeOS)
|
|
|
|
prefix="/boot/home/config"
|
|
|
|
# helps building libavcodec
|
|
|
|
grab="no"
|
|
|
|
CFLAGS="-O2 -DPIC"
|
|
|
|
# no need for libm, but the inet stuff
|
|
|
|
# Check for BONE
|
|
|
|
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
|
|
|
|
extralibs="-lbind -lsocket"
|
|
|
|
else
|
|
|
|
echo "Not sure building for net_server will succeed... good luck."
|
|
|
|
extralibs="-lsocket"
|
|
|
|
fi ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
2001-07-22 16:18:56 +02:00
|
|
|
|
|
|
|
if [ "$1" = "-h" -o "$1" = "--help" ] ; then
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
Usage: configure [options]
|
|
|
|
Options: [defaults in brackets after descriptions]
|
|
|
|
|
|
|
|
--help print this message
|
|
|
|
EOF
|
|
|
|
echo " --prefix=PREFIX install in PREFIX [$prefix]"
|
|
|
|
echo " --cc=CC use C compiler CC [$cc]"
|
|
|
|
echo " --cpu=CPU force cpu to CPU [$cpu]"
|
|
|
|
echo " --disable-mmx disable mmx usage"
|
|
|
|
echo " --enable-gprof enable profiling with gprof [$gprof]"
|
2001-08-13 23:42:31 +02:00
|
|
|
echo " --disable-grab disable audio/video grabbing code"
|
2002-04-14 20:57:51 +02:00
|
|
|
echo " --enable-simple_idct use simple IDCT routines"
|
2002-03-10 15:44:19 +01:00
|
|
|
echo " --enable-mp3lame enable mp3 encoding via libmp3lame"
|
2001-08-16 00:29:44 +02:00
|
|
|
echo " --enable-win32 enable win32 cross compile"
|
2001-10-27 14:12:38 +02:00
|
|
|
echo " --enable-shared build shared libraries [default=no]"
|
2001-07-22 16:18:56 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2001-10-27 14:12:38 +02:00
|
|
|
lshared=no
|
2001-07-22 16:18:56 +02:00
|
|
|
for opt do
|
|
|
|
case "$opt" in
|
|
|
|
--prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
|
|
|
|
;;
|
|
|
|
--cc=*) cc=`echo $opt | cut -d '=' -f 2`
|
|
|
|
;;
|
|
|
|
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
|
|
|
|
;;
|
|
|
|
--disable-mmx) mmx="no"
|
|
|
|
;;
|
|
|
|
--enable-gprof) gprof="yes"
|
|
|
|
;;
|
2001-08-13 23:42:31 +02:00
|
|
|
--disable-grab) grab="no"
|
|
|
|
;;
|
2002-03-10 15:44:19 +01:00
|
|
|
--enable-mp3lame) mp3lame="yes"
|
|
|
|
;;
|
2002-04-11 22:11:36 +02:00
|
|
|
--enable-simple_idct) simpleidct="yes"
|
|
|
|
;;
|
2001-08-16 00:29:44 +02:00
|
|
|
--enable-win32) win32="yes"
|
|
|
|
;;
|
2001-10-27 14:12:38 +02:00
|
|
|
--enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
|
|
|
|
;;
|
2001-07-22 16:18:56 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2001-08-16 00:29:44 +02:00
|
|
|
# Checking for CFLAGS
|
|
|
|
if test -z "$CFLAGS"; then
|
|
|
|
CFLAGS="-O2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$win32" = "yes" ] ; then
|
|
|
|
cross_prefix="i386-mingw32msvc-"
|
|
|
|
cc="${cross_prefix}gcc"
|
|
|
|
ar="${cross_prefix}ar"
|
|
|
|
grab="no"
|
|
|
|
fi
|
|
|
|
|
2001-09-13 09:16:59 +02:00
|
|
|
# ---
|
|
|
|
# check availability of some header files
|
|
|
|
|
|
|
|
cat > $TMPC << EOF
|
|
|
|
#include <malloc.h>
|
|
|
|
int main( void ) { return 0; }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
_memalign=no
|
|
|
|
_malloc_h=no
|
|
|
|
if $cc -o $TMPO $TMPC 2> /dev/null ; then
|
|
|
|
_malloc_h=yes
|
|
|
|
_memalign=yes
|
|
|
|
# check for memalign - atmos
|
|
|
|
cat > $TMPC << EOF
|
|
|
|
#include <malloc.h>
|
|
|
|
int main ( void ) {
|
|
|
|
char *string = NULL;
|
|
|
|
string = memalign(64, sizeof(char));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
|
|
|
|
fi
|
|
|
|
|
2001-07-22 16:18:56 +02:00
|
|
|
echo "Install prefix $prefix"
|
|
|
|
echo "C compiler $cc"
|
|
|
|
echo "CPU $cpu"
|
|
|
|
echo "MMX enabled $mmx"
|
|
|
|
echo "gprof enabled $gprof"
|
2001-08-13 23:42:31 +02:00
|
|
|
echo "grab enabled $grab"
|
2002-03-10 15:44:19 +01:00
|
|
|
echo "mp3lame enabled $mp3lame"
|
2001-07-22 16:18:56 +02:00
|
|
|
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "Creating config.mak and config.h"
|
2001-07-22 16:18:56 +02:00
|
|
|
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "# Automatically generated by configure - do not modify" > config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "/* Automatically generated by configure - do not modify */" > $TMPH
|
2001-07-22 16:18:56 +02:00
|
|
|
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "prefix=$prefix" >> config.mak
|
2001-08-11 20:57:27 +02:00
|
|
|
echo "MAKE=make" >> config.mak
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "CC=$cc" >> config.mak
|
|
|
|
echo "AR=$ar" >> config.mak
|
2001-07-30 11:04:34 +02:00
|
|
|
echo "OPTFLAGS=$CFLAGS" >> config.mak
|
2001-07-22 16:18:56 +02:00
|
|
|
if [ "$cpu" = "x86" ] ; then
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "TARGET_ARCH_X86=yes" >> config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define ARCH_X86 1" >> $TMPH
|
2001-07-22 16:18:56 +02:00
|
|
|
fi
|
2001-08-13 23:42:31 +02:00
|
|
|
if [ "$cpu" = "armv4l" ]; then
|
|
|
|
echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define ARCH_ARMV4L 1" >> $TMPH
|
2001-08-13 23:42:31 +02:00
|
|
|
fi
|
2002-01-20 15:55:42 +01:00
|
|
|
if [ "$cpu" = "alpha" ]; then
|
|
|
|
echo "TARGET_ARCH_ALPHA=yes" >> config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define ARCH_ALPHA 1" >> $TMPH
|
2002-01-20 15:55:42 +01:00
|
|
|
fi
|
2001-07-22 16:18:56 +02:00
|
|
|
if [ "$mmx" = "yes" ] ; then
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "TARGET_MMX=yes" >> config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define HAVE_MMX 1" >> $TMPH
|
2001-07-22 16:18:56 +02:00
|
|
|
fi
|
|
|
|
if [ "$gprof" = "yes" ] ; then
|
2001-07-23 22:06:54 +02:00
|
|
|
echo "TARGET_GPROF=yes" >> config.mak
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define HAVE_GPROF 1" >> $TMPH
|
2001-07-22 16:18:56 +02:00
|
|
|
fi
|
2001-10-27 14:12:38 +02:00
|
|
|
if [ "$lshared" = "yes" ] ; then
|
|
|
|
echo "BUILD_SHARED=yes" >> config.mak
|
|
|
|
else
|
|
|
|
echo "BUILD_SHARED=no" >> config.mak
|
|
|
|
fi
|
2002-03-08 10:09:57 +01:00
|
|
|
echo "EXTRALIBS=$extralibs" >> config.mak
|
2001-10-27 14:12:38 +02:00
|
|
|
echo -n "VERSION=" >>config.mak
|
|
|
|
head VERSION >>config.mak
|
|
|
|
echo "" >>config.mak
|
2001-07-23 22:58:31 +02:00
|
|
|
# if you do not want to use encoders, disable that.
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_ENCODERS 1" >> $TMPH
|
2001-07-23 22:58:31 +02:00
|
|
|
echo "CONFIG_ENCODERS=yes" >> config.mak
|
|
|
|
|
|
|
|
# if you do not want to use decoders, disable that.
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_DECODERS 1" >> $TMPH
|
2001-07-23 22:58:31 +02:00
|
|
|
echo "CONFIG_DECODERS=yes" >> config.mak
|
|
|
|
|
2001-09-23 19:13:48 +02:00
|
|
|
# special AC3 stuff in case you already have it
|
2001-07-23 22:58:31 +02:00
|
|
|
# without libavcodec.
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_AC3 1" >> $TMPH
|
2001-07-23 22:58:31 +02:00
|
|
|
echo "CONFIG_AC3=yes" >> config.mak
|
|
|
|
|
2001-08-13 23:42:31 +02:00
|
|
|
if [ "$grab" = "yes" ] ; then
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_GRAB 1" >> $TMPH
|
2001-08-13 23:42:31 +02:00
|
|
|
echo "CONFIG_GRAB=yes" >> config.mak
|
|
|
|
fi
|
2001-08-16 00:29:44 +02:00
|
|
|
|
2002-03-10 15:44:19 +01:00
|
|
|
if [ "$mp3lame" = "yes" ] ; then
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_MP3LAME 1" >> $TMPH
|
2002-03-10 15:44:19 +01:00
|
|
|
echo "CONFIG_MP3LAME=yes" >> config.mak
|
|
|
|
fi
|
|
|
|
|
2001-08-16 00:29:44 +02:00
|
|
|
if [ "$win32" = "yes" ] ; then
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define CONFIG_WIN32 1" >> $TMPH
|
2001-08-16 00:29:44 +02:00
|
|
|
echo "CONFIG_WIN32=yes" >> config.mak
|
|
|
|
fi
|
2001-09-13 09:16:59 +02:00
|
|
|
|
|
|
|
if [ "$_malloc_h" = "yes" ]; then
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define HAVE_MALLOC_H 1" >> $TMPH
|
2001-09-13 09:16:59 +02:00
|
|
|
else
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#undef HAVE_MALLOC_H" >> $TMPH
|
2001-09-13 09:16:59 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$_memalign" = "yes" ]; then
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "#define HAVE_MEMALIGN 1" >> $TMPH
|
|
|
|
else
|
|
|
|
echo "#undef HAVE_MEMALIGN" >> $TMPH
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$simpleidct" = "yes" ]; then
|
|
|
|
echo "#define SIMPLE_IDCT 1" >> $TMPH
|
|
|
|
fi
|
|
|
|
|
2002-04-11 22:21:57 +02:00
|
|
|
diff -q $TMPH config.h >/dev/null 2>&1
|
2002-04-11 22:11:36 +02:00
|
|
|
if test $? -ne 0 ; then
|
|
|
|
mv -f $TMPH config.h
|
2001-09-13 09:16:59 +02:00
|
|
|
else
|
2002-04-11 22:11:36 +02:00
|
|
|
echo "config.h is unchanged"
|
2001-09-13 09:16:59 +02:00
|
|
|
fi
|
|
|
|
|
2002-04-11 22:11:36 +02:00
|
|
|
rm -f $TMPO $TMPC $TMPS $TMPH
|