2001-07-22 14:18:56 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2001-09-13 07:16:59 +00:00
|
|
|
TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
|
|
|
|
TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
|
|
|
|
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
|
|
|
|
|
|
|
|
if [ ! -z "$TMPDIR" ]; then
|
|
|
|
TMPC="${TMPDIR}/${TMPC}"
|
|
|
|
TMPCPP="${TMPDIR}/${TMPCPP}"
|
|
|
|
TMPO="${TMPDIR}/${TMPO}"
|
|
|
|
TMPS="${TMPDIR}/${TMPS}"
|
|
|
|
elif [ ! -z "$TEMPDIR" ]; then
|
|
|
|
TMPC="${TEMPDIR}/${TMPC}"
|
|
|
|
TMPCPP="${TEMPDIR}/${TMPCPP}"
|
|
|
|
TMPO="${TEMPDIR}/${TMPO}"
|
|
|
|
TMPS="${TEMPDIR}/${TMPS}"
|
|
|
|
else
|
|
|
|
TMPC="/tmp/${TMPC}"
|
|
|
|
TMPCPP="/tmp/${TMPCPP}"
|
|
|
|
TMPO="/tmp/${TMPO}"
|
|
|
|
TMPS="/tmp/${TMPS}"
|
|
|
|
fi
|
|
|
|
|
2001-07-22 14:18:56 +00:00
|
|
|
# default parameters
|
|
|
|
prefix="/usr/local"
|
|
|
|
cc="gcc"
|
|
|
|
ar="ar"
|
|
|
|
cpu=`uname -m`
|
|
|
|
case "$cpu" in
|
2002-03-08 09:09:57 +00:00
|
|
|
i386|i486|i586|i686|i86pc|BePC)
|
2001-07-22 14:18:56 +00:00
|
|
|
cpu="x86"
|
|
|
|
mmx="yes"
|
|
|
|
;;
|
2001-08-13 21:42:31 +00:00
|
|
|
armv4l)
|
|
|
|
cpu="armv4l"
|
|
|
|
mmx="no"
|
|
|
|
;;
|
2002-01-20 14:55:42 +00:00
|
|
|
alpha)
|
|
|
|
cpu="alpha"
|
|
|
|
mmx="no"
|
|
|
|
;;
|
2001-07-22 14:18:56 +00:00
|
|
|
*)
|
|
|
|
mmx="no"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
gprof="no"
|
2001-08-13 21:42:31 +00:00
|
|
|
grab="yes"
|
2001-08-15 22:29:44 +00:00
|
|
|
win32="no"
|
2002-03-08 09:09:57 +00: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 14:18:56 +00: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 21:42:31 +00:00
|
|
|
echo " --disable-grab disable audio/video grabbing code"
|
2001-08-15 22:29:44 +00:00
|
|
|
echo " --enable-win32 enable win32 cross compile"
|
2001-10-27 12:12:38 +00:00
|
|
|
echo " --enable-shared build shared libraries [default=no]"
|
2001-07-22 14:18:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2001-10-27 12:12:38 +00:00
|
|
|
lshared=no
|
2001-07-22 14:18:56 +00: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 21:42:31 +00:00
|
|
|
--disable-grab) grab="no"
|
|
|
|
;;
|
2001-08-15 22:29:44 +00:00
|
|
|
--enable-win32) win32="yes"
|
|
|
|
;;
|
2001-10-27 12:12:38 +00:00
|
|
|
--enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
|
|
|
|
;;
|
2001-07-22 14:18:56 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2001-08-15 22:29:44 +00: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 07:16:59 +00: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 14:18:56 +00:00
|
|
|
echo "Install prefix $prefix"
|
|
|
|
echo "C compiler $cc"
|
|
|
|
echo "CPU $cpu"
|
|
|
|
echo "MMX enabled $mmx"
|
|
|
|
echo "gprof enabled $gprof"
|
2001-08-13 21:42:31 +00:00
|
|
|
echo "grab enabled $grab"
|
2001-07-22 14:18:56 +00:00
|
|
|
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "Creating config.mak and config.h"
|
2001-07-22 14:18:56 +00:00
|
|
|
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "# Automatically generated by configure - do not modify" > config.mak
|
2001-07-22 14:18:56 +00:00
|
|
|
echo "/* Automatically generated by configure - do not modify */" > config.h
|
|
|
|
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "prefix=$prefix" >> config.mak
|
2001-08-11 18:57:27 +00:00
|
|
|
echo "MAKE=make" >> config.mak
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "CC=$cc" >> config.mak
|
|
|
|
echo "AR=$ar" >> config.mak
|
2001-07-30 09:04:34 +00:00
|
|
|
echo "OPTFLAGS=$CFLAGS" >> config.mak
|
2001-07-22 14:18:56 +00:00
|
|
|
if [ "$cpu" = "x86" ] ; then
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "TARGET_ARCH_X86=yes" >> config.mak
|
|
|
|
echo "#define ARCH_X86 1" >> config.h
|
2001-07-22 14:18:56 +00:00
|
|
|
fi
|
2001-08-13 21:42:31 +00:00
|
|
|
if [ "$cpu" = "armv4l" ]; then
|
|
|
|
echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
|
|
|
|
echo "#define ARCH_ARMV4L 1" >> config.h
|
|
|
|
fi
|
2002-01-20 14:55:42 +00:00
|
|
|
if [ "$cpu" = "alpha" ]; then
|
|
|
|
echo "TARGET_ARCH_ALPHA=yes" >> config.mak
|
|
|
|
echo "#define ARCH_ALPHA 1" >> config.h
|
|
|
|
fi
|
2001-07-22 14:18:56 +00:00
|
|
|
if [ "$mmx" = "yes" ] ; then
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "TARGET_MMX=yes" >> config.mak
|
|
|
|
echo "#define HAVE_MMX 1" >> config.h
|
2001-07-22 14:18:56 +00:00
|
|
|
fi
|
|
|
|
if [ "$gprof" = "yes" ] ; then
|
2001-07-23 20:06:54 +00:00
|
|
|
echo "TARGET_GPROF=yes" >> config.mak
|
|
|
|
echo "#define HAVE_GPROF 1" >> config.h
|
2001-07-22 14:18:56 +00:00
|
|
|
fi
|
2001-10-27 12:12:38 +00:00
|
|
|
if [ "$lshared" = "yes" ] ; then
|
|
|
|
echo "BUILD_SHARED=yes" >> config.mak
|
|
|
|
else
|
|
|
|
echo "BUILD_SHARED=no" >> config.mak
|
|
|
|
fi
|
2002-03-08 09:09:57 +00:00
|
|
|
echo "EXTRALIBS=$extralibs" >> config.mak
|
2001-10-27 12:12:38 +00:00
|
|
|
echo -n "VERSION=" >>config.mak
|
|
|
|
head VERSION >>config.mak
|
|
|
|
echo "" >>config.mak
|
2001-07-23 20:58:31 +00:00
|
|
|
# if you do not want to use encoders, disable that.
|
|
|
|
echo "#define CONFIG_ENCODERS 1" >> config.h
|
|
|
|
echo "CONFIG_ENCODERS=yes" >> config.mak
|
|
|
|
|
|
|
|
# if you do not want to use decoders, disable that.
|
|
|
|
echo "#define CONFIG_DECODERS 1" >> config.h
|
|
|
|
echo "CONFIG_DECODERS=yes" >> config.mak
|
|
|
|
|
2001-09-23 17:13:48 +00:00
|
|
|
# special AC3 stuff in case you already have it
|
2001-07-23 20:58:31 +00:00
|
|
|
# without libavcodec.
|
|
|
|
echo "#define CONFIG_AC3 1" >> config.h
|
|
|
|
echo "CONFIG_AC3=yes" >> config.mak
|
|
|
|
|
2001-08-13 21:42:31 +00:00
|
|
|
if [ "$grab" = "yes" ] ; then
|
|
|
|
echo "#define CONFIG_GRAB 1" >> config.h
|
|
|
|
echo "CONFIG_GRAB=yes" >> config.mak
|
|
|
|
fi
|
2001-08-15 22:29:44 +00:00
|
|
|
|
|
|
|
if [ "$win32" = "yes" ] ; then
|
|
|
|
echo "#define CONFIG_WIN32 1" >> config.h
|
|
|
|
echo "CONFIG_WIN32=yes" >> config.mak
|
|
|
|
fi
|
2001-09-13 07:16:59 +00:00
|
|
|
|
|
|
|
if [ "$_malloc_h" = "yes" ]; then
|
|
|
|
echo "#define HAVE_MALLOC_H 1" >> config.h
|
|
|
|
else
|
|
|
|
echo "#undef HAVE_MALLOC_H" >> config.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$_memalign" = "yes" ]; then
|
|
|
|
echo "#define HAVE_MEMALIGN 1" >> config.h
|
|
|
|
else
|
|
|
|
echo "#undef HAVE_MEMALIGN" >> config.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $TMPO $TMPC $TMPS
|