mpv/configure

2817 lines
69 KiB
Bash
Executable File

#! /bin/sh
#
# Original version (C) 2000 Pontscho/fresh!mindworkz
# pontscho@makacs.poliod.hu
#
# History / Contributors: check the cvs log !
#
# Cleanups all over the place (c) 2001 pl
#
#
# Guidelines:
# If the option is named 'opt':
# _opt : should have a value in yes/no/auto
# _def_opt : '#define ... 1' or '#undef ...' that is: some C code
# _ld_opt : ' -L/path/dir -lopt ' that is: some GCC option
# _inc_opt : ' -I/path/dir/include '
#
# GOTCHAS:
# - config files are currently:
# config.h config.mak libvo/config.mak libao2/config.mak
# Gui/config.mak libvo2/config.mak
# - removed dvbincdir/madincdir/cssincdir: add them to extraincdir
#
#############################################################################
# Prefer these macros to full length text !
# These macros only return an error code - NO display is done
cc_check() {
echo >> "$TMPLOG"
cat "$TMPC" >> "$TMPLOG"
echo >> "$TMPLOG"
echo "$_cc $_inc_extra $_ld_static $_ld_extra $TMPC -o $TMPO $@" >> "$TMPLOG"
> "$TMPO"
( "$_cc" $_inc_extra $_ld_static $_ld_extra "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1
TMP="$?"
echo >> "$TMPLOG"
echo "ldd $TMPO" >> "$TMPLOG"
( ldd "$TMPO" ) >> "$TMPLOG" 2>&1
echo >> "$TMPLOG"
return "$TMP"
}
# Display error message, flushes tempfile, exit
die () {
echo
echo "Error: $@" >&2
echo >&2
rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"
echo "Check "$TMPLOG" if you don't understand why it failed."
exit 1
}
# OS test booleans functions
linux() { test "$system_name" = "Linux" ; return "$?" ; }
sunos() { test "$system_name" = "SunOS" ; return "$?" ; }
irix() { test "$system_name" = "IRIX" ; return "$?" ; }
cygwin() { test "$system_name" = "CYGWIN" ; return "$?" ; }
freebsd() { test "$system_name" = "FreeBSD" ; return "$?" ; }
netbsd() { test "$system_name" = "NetBSD" ; return "$?" ; }
bsdos() { test "$system_name" = "BSD/OS" ; return "$?" ; }
openbsd() { test "$system_name" = "OpenBSD" ; return "$?" ; }
bsd() { freebsd || netbsd || bsdos || openbsd ; return "$?" ; }
qnx() { test "$system_name" = "QNX" ; return "$?" ; }
# arch test boolean functions
x86() {
case "$host_arch" in
i[3-9]86|x86*) return 0 ;;
*) return 1 ;;
esac
}
# Use this before starting a check
echocheck() {
echo "============ Checking for $@ ============" >> "$TMPLOG"
echo "$_echo_n" "Checking for $@ ... $_echo_c"
}
# Use this to echo the results of a check
echores() {
echo "Result is: $@" >> "$TMPLOG"
echo "##########################################" >> "$TMPLOG"
echo "" >> "$TMPLOG"
echo "$@"
}
#############################################################################
# Check how echo works in this /bin/sh
case `echo -n` in
-n) _echo_n='' _echo_c='\c' ;; # SysV echo
*) _echo_n=-n _echo_c='' ;; # BSD echo
esac
LANGUAGES=`echo help_mp-??.h | sed "s/help_mp-\(..\).h/\1/g"`
for parm in "$@" ; do
if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then
cat << EOF
Usage: $0 [OPTIONS]...
Configuration:
-h, --help display this help and exit
Installation directories:
--prefix=DIR use this prefix for installing mplayer [/usr/local]
--datadir=DIR use this prefix for installing machine independent
data [/usr/local/share/mplayer]
Optional features:
--enable-largefiles enable support for files >2^32 bytes long [disable]
--enable-termcap use termcap database for key codes [autodetect]
--enable-lirc enable LIRC (remote control) support [autodetect]
--enable-gui enable GUI [disable]
--enable-tv enable TV Interface (tv/dvb grabbers) [disable]
--disable-win32 disable Win32 DLL support [autodetect]
--disable-dshow disable DirectShow support (if no C++ compiler and
libs are available or find the dshow codecs slower
than the old VfW ones) [autodetect]
--disable-xanim disable XAnim DLL support [autodetect]
--enable-vorbis build with OggVorbis support [autodetect]
--disable-iconv do not use iconv(3) function [autodetect]
--disable-rtc disable RTC (/dev/rtc) on Linux [autodetect]
Video:
--enable-gl build with OpenGL render support [autodetect]
--enable-dga build with DGA support [autodetect]
--enable-svga build with SVGAlib support [autodetect]
--enable-sdl build with SDL render support [autodetect]
--enable-aa build with AAlib render support [autodetect]
--enable-ggi build with GGI render support [autodetect]
--enable-dxr3 build with DXR3/H+ render support [autodetect]
--enable-dvb build with support for output via DVB-Card [autodetect]
--enable-mga build with mga_vid support
(check for /dev/mga_vid) [autodetect]
--enable-xmga build with mga_vid X Window support
(check for X & /dev/mga_vid) [autodetect]
--enable-xv build with Xv render support for X 4.x [autodetect]
--enable-vm build with XF86VidMode support for x11 driver [disable]
--enable-xinerama build with Xinerama support for x11 driver [autodetect]
--enable-x11 build with X11 render support [autodetect]
--enable-fbdev build with FBDev render support [disable]
--enable-mlib build with MLIB support (Solaris only) [disable]
--enable-3dfx build with 3dfx support [disable]
--enable-tdfxfb build with tdfxfb support [disable]
Audio:
--disable-ossaudio disable OSS sound support [autodetect]
--disable-alsa disable alsa sound support [autodetect]
--disable-sunaudio disable Sun sound support [autodetect]
--disable-mad disable mad audio support [autodetect]
--disable-select disable using select() on OSS audio device [enable]
Miscellaneous options:
--cc=COMPILER use this C compiler to build MPlayer [gcc]
--target=PLATFORM target platform (i386-linux, arm-linux, etc)
--enable-static build a statically linked binary. If more linking
options needed : --enable-static="-lslang -lncurses"
--language=xx select a language [en]
(Available: $LANGUAGES)
Advanced options:
--enable-mmx build with mmx support [autodetect]
--enable-mmx2 build with mmx2 support (PIII, Athlon) [autodetect]
--enable-3dnow build with 3dnow! support [autodetect]
--enable-3dnowex build with 3dnow-dsp! support (K7) [autodetect]
--enable-sse build with sse support [autodetect]
--disable-fastmemcpy disable 3dnow/sse/mmx optimized memcpy() [enable]
--enable-debug[=1-3] compile debugging information into mplayer [disable]
--enable-profile compile profiling information into mplayer [disable]
Hazardous options a.k.a. "DO NOT BUGREPORT ANYTHING !"
--disable-gcc-checking disable gcc version checking
Use these options if autodetection fails:
--with-extraincdir=DIR extra headers (png, dvb, mad, sdl, css, ...) in DIR
--with-extralibdir=DIR extra library files (png, SDL, ...) in DIR
--with-x11incdir=DIR X headers in DIR
--with-x11libdir=DIR X library files in DIR
--with-csslibdir=DIR libcss in DIR
--with-madlibdir=DIR libmad (libmad shared lib.) in DIR
--with-win32libdir=DIR W*ndows DLL files in DIR
--with-xanimlibdir=DIR XAnim DLL files in DIR
--with-sdl-config=PATH path to sdl*-config (e.g.: /opt/bin/sdl-config)
--with-gtk-config=PATH path to gtk*-config (e.g.: /opt/bin/gtk-config)
--with-glib-config=PATH path to glib*-config (e.g.: /opt/bin/glib-config)
EOF
exit 0
fi
done # for parm in ...
# 1st pass checking for vital options
_cc=gcc
test "$CC" && _cc="$CC"
_as=auto
for ac_option do
case "$ac_option" in
--target=*)
_target=`echo $ac_option | cut -d '=' -f 2`
;;
--cc=*)
_cc=`echo $ac_option | cut -d '=' -f 2`
;;
--as=*)
_as=`echo $ac_option | cut -d '=' -f 2`
;;
--disable-gcc-checking)
_skip_cc_check=yes
;;
--enable-static)
_ld_static='-static'
;;
--disable-static)
_ld_static=''
;;
--enable-static=*)
_ld_static="-static `echo $ac_option | cut -d '=' -f 2`"
;;
--with-extraincdir=*)
_inc_extra=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'`
;;
--with-extralibdir=*)
_ld_extra=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'`
;;
esac
done
# Determine our OS name and CPU architecture
if test -z "$_target" ; then
# OS name
system_name=`( uname -s ) 2>&1`
case "$system_name" in
Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX)
;;
IRIX*)
system_name=IRIX
;;
[cC][yY][gG][wW][iI][nN]*)
system_name=CYGWIN
;;
*)
system_name="$system_name-UNKNOWN"
;;
esac
# host's CPU/instruction set
host_arch=`( uname -p ) 2>&1`
case "$host_arch" in
i386|sparc|ppc|alpha|arm|mips)
;;
*) # uname -p on Linux returns 'unknown' for the processor type,
# OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
# Maybe uname -m (machine hardware name) returns something we
# recognize.
case "`( uname -m ) 2>&1`" in
i[3-9]86|x86*) host_arch=i386 ;;
ppc) host_arch=ppc ;;
alpha) host_arch=alpha ;;
sparc*) host_arch=sparc ;;
arm*) host_arch=arm ;;
*) host_arch=UNKNOWN ;;
esac
;;
esac
else
system_name=`echo $_target | cut -d '-' -f 2`
host_arch=`echo $_target | cut -d '-' -f 1`
fi
echo "Detected operating system: $system_name"
echo "Detected host architecture: $host_arch"
# LGB: temporary files
for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
test "$I" && break
done
TMPLOG="configure.log"
rm -f "$TMPLOG"
TMPC="$I/mplayer-conf-$RANDOM-$$.c"
TMPCPP="$I/mplayer-conf-$RANDOM-$$.cpp"
TMPO="$I/mplayer-conf-$RANDOM-$$.o"
TMPS="$I/mplayer-conf-$RANDOM-$$.S"
# config files
# FIXME: A lot of stuff is installed under /usr/local
# NK: But we should never use this stuff implicitly since we call compiler
# from /usr we should be sure that there no effects from other compilers
# (libraries) which might be installed into /usr/local. Let users use this
# stuff explicitly as command line argument. In other words: It would be
# resonable have or only /usr/include or only /usr/local/include.
if freebsd ; then
_ld_extra="$_ld_extra -L/usr/local/lib"
_inc_extra="$_inc_extra -I/usr/local/include"
fi
# Checking CC version...
# gcc-3.0 merges optimizations coming from egcs, pgcc, agcc, ...
if test "$_skip_cc_check" != yes ; then
echocheck "$_cc version"
cc_version=`$_cc -v 2>&1 | sed -n 's/^.*version \([aegcygnustp-]*[0-9.]*\).*$/\1/p'`
case $cc_version in
'')
cc_version="v. ?.??, bad"
cc_verc_fail=yes
;;
2.95.[2-9]|2.95.[2-9].[0-9]|3.[0-9]|3.[0-9].[0-9])
cc_version="$cc_version, ok"
;;
*)
cc_version="$cc_version, bad"
cc_verc_fail=yes
;;
esac
echores "$cc_version"
if test "$cc_verc_fail" ; then
cat <<EOF
*** Please downgrade/upgrade C compiler to gcc-2.95.x or gcc-3.x version! ***
You are using a different compiler than ours. We do not have the time to make
sure everything works with compilers than the one we use. Use either use the
same compiler as ours, or use --disable-gcc-checking but DO *NOT* REPORT BUGS
unless you can reproduce them after recompiling with 2.95.x or 3.0.x version!
Note for gcc 2.96 users: some versions of this compiler are known to miscompile
mplayer and lame (which is used for mencoder). If you get compile errors,
first upgrade to the latest 2.96 release (but minimum 2.96-85) and try again.
If the problem still exists, try with gcc 3.0.x (or 2.95.x) *BEFORE* reporting
bugs!
GCC 2.96 IS NOT AND WILL NOT BE SUPPORTED BY US !
*** For details please read DOCS/gcc-2.96-3.0.html ***
EOF
die "Bad gcc version"
fi
else
cat <<EOF
******************************************************************************
Hmm. You really want to compile MPlayer with an *UNSUPPORTED* C compiler?
Ok. You know. Do it. But did you already read DOCS/gcc-2.96-3.0.html ???
DO NOT SEND BUGREPORTS OR COMPLAIN, it's *YOUR* compiler's fault!
Get ready for mysterious crashes, no-picture bugs, strange noises... REALLY!
Lame which is used by mencoder produces weird errors, too.
If you have any problem, then install GCC 2.95.x or 3.x version and try again.
If the problem _still_ exists, then read DOCS/bugreports.html !
*** DO NOT SEND BUGREPORTS OR COMPLAIN it's *YOUR* compiler's fault! ***
******************************************************************************
EOF
read _answer
fi
# ---
# now that we know what compiler should be used for compilation, try to find
# out which assembler is used by the $_cc compiler
if test "$_as" = auto ; then
_as=`$_cc -print-prog-name=as`
test -z "$_as" && _as=as
fi
# Try to find the available options for the current CPU
if x86 ; then
if test -r /proc/cpuinfo ; then
# linux with /proc mounted, extract cpu information from it
_cpuinfo="cat /proc/cpuinfo"
elif test -r /compat/linux/proc/cpuinfo ; then
# FreeBSD with linux emulation /proc mounted,
# extract cpu information from it
_cpuinfo="cat /compat/linux/proc/cpuinfo"
else
# all other OS try to extract cpu information from a small helper
# program TOOLS/cpuinfo instead
$_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
_cpuinfo="TOOLS/cpuinfo"
fi
pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -1`
if test -z "$pparam" ; then
pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -1`
fi
_mmx=no
_3dnow=no
_3dnowex=no
_mmx2=no
_sse=no
_sse2=no
for i in $pparam ; do
case "$i" in
3dnow) _3dnow=yes ;;
3dnowext) _3dnow=yes _3dnowex=yes ;;
mmx) _mmx=yes ;;
mmxext) _mmx2=yes ;;
mtrr|k6_mtrr) _mtrr=yes ;;
xmm|sse|kni) _sse=yes _mmx2=yes ;;
esac
done
echocheck "CPU vendor"
echores "$pvendor ($pfamily:$pmodel:$pstepping)"
echocheck "CPU type"
echores "$pname"
fi
case "$host_arch" in
i[3-9]86|x86*)
_def_arch="#define ARCH_X86 1"
_target_arch="TARGET_ARCH_X86 = yes"
_def_words_endian="#undef WORDS_BIGENDIAN"
iproc=586
proc=pentium
case "$pvendor" in
AuthenticAMD)
case "$pfamily" in
3) proc=i386 iproc=386 ;;
4) proc=i486 iproc=486 ;;
5) proc=k5 iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
test "$pmodel" -ge 6 && proc=k6 ;;
6|7) proc=k7 iproc=686 ;;
*) proc=pentium iproc=586 ;;
esac
;;
GenuineIntel)
case "$pfamily" in
3) proc=i386 iproc=386 ;;
4) proc=i486 iproc=486 ;;
5) proc=pentium iproc=586 ;;
6) proc=i686 iproc=686 ;;
*) proc=pentium iproc=586 ;;
esac
;;
unknown)
case "$pfamily" in
3) proc=i386 iproc=386 ;;
4) proc=i486 iproc=486 ;;
*) proc=pentium iproc=586 ;;
esac
;;
*)
proc=pentium iproc=586 ;;
esac
# check that gcc supports our cpu, if not, fallback to pentium
# LGB: check -mcpu and -march swithing step by step with enabling
# to fall back till 386.
echocheck "GCC & CPU optimization abilities"
cat > $TMPC << EOF
int main(void) { return 0; }
EOF
if test "$proc" = "k7" ; then
cc_check -march=$proc -mcpu=$proc || proc=athlon
fi
if test "$proc" = "athlon" ; then
cc_check -march=$proc -mcpu=$proc || proc=pentiumpro
fi
if test "$proc" = "k6" ; then
cc_check -march=$proc -mcpu=$proc || proc=k5
fi
if test "$proc" = "k5" ; then
cc_check -march=$proc -mcpu=$proc || proc=pentium
fi
if test "$proc" = "i686" ; then
cc_check -march=$proc -mcpu=$proc || proc=pentiumpro
fi
if test "$proc" = "pentiumpro" ; then
cc_check -march=$proc -mcpu=$proc || proc=pentium
fi
if test "$proc" = "pentium" ; then
cc_check -march=$proc -mcpu=$proc || proc=i486
fi
if test "$proc" = "i486" ; then
cc_check -march=$proc -mcpu=$proc || proc=i386
fi
if test "$proc" = "i386" ; then
cc_check -march=$proc -mcpu=$proc || proc=error
fi
if test "$proc" = "error" ; then
die "Your $_cc does not support even \"i386\" for '-march' and '-mcpu'."
fi
_march="-march=$proc"
_mcpu="-mcpu=$proc"
## Gabucino : --target takes effect here (hopefully...) by overwriting
## autodetected mcpu/march parameters
if test "$_target" ; then
_march="-march=$host_arch"
_mcpu="-mcpu=$host_arch"
proc="$_target"
fi
echores "$proc"
;;
sparc)
_def_arch='#define ARCH_SPARC 1'
_target_arch='TARGET_ARCH_SPARC = yes'
_def_words_endian='#define WORDS_BIGENDIAN 1'
iproc='sparc'
proc='v8'
_march=''
_mcpu="-mcpu=$proc"
;;
arm)
_def_arch="#define ARCH_ARM 1"
_target_arch='TARGET_ARCH_ARM = yes'
_def_words_endian='#undef WORDS_BIGENDIAN'
iproc=arm
proc=''
_march=''
_mcpu=''
;;
ppc)
_def_arch='#define ARCH_PPC 1'
_target_arch='TARGET_ARCH_PPC = yes'
_def_words_endian='#define WORDS_BIGENDIAN 1'
iproc='ppc'
proc=''
_march=''
_mcpu=''
;;
alpha)
_def_arch='#define ARCH_ALPHA 1'
_target_arch='TARGET_ARCH_ALPHA = yes'
_def_words_endian='#undef WORDS_BIGENDIAN'
iproc='alpha'
proc=''
_march=''
_mcpu='-mcpu=ev56'
;;
mips)
_def_arch="#define ARCH_SGI_MIPS 1"
_target_arch="TARGET_ARCH_SGI_MIPS = yes"
_def_words_endian='#define WORDS_BIGENDIAN 1'
iproc='sgi-mips'
proc=''
_march=''
_mcpu=''
;;
*)
echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
echo "It seems noone has ported MPlayer to your OS or CPU type yet."
die "unsupported architecture $host_arch"
;;
esac
echocheck "binutils"
_binutils=no
$_as libac3/downmix/downmix_i386.S -o $TMPO > /dev/null 2>&1 && _binutils=yes
echores "$_binutils"
if x86 ; then
extcheck() {
if test "$1" = yes ; then
echocheck "kernel support of $2"
cat > $TMPC <<EOF
int main(void){__asm__ __volatile__ ("$3":::"memory");return(0);}
EOF
if ( cc_check && $TMPO ) > /dev/null 2>&1 ; then
echores "yes"
return 0
else
echores "failed"
echo "It seems that your kernel does not correctly support $2."
echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
return 1
fi
fi
return 1
}
extcheck $_mmx "mmx" "emms" && _mmx=yes
extcheck $_3dnow "3dnow" "femms" && _3dnow=yes
extcheck $_3dnowex "3dnowex" "pswapd %%mm0, %%mm0" && _3dnowex=yes
extcheck $_mmx2 "mmx2" "sfence" && _mmx2=yes
extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" && _sse=yes
extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" && _sse2=yes
echocheck "mtrr support"
echores "$_mtrr"
fi
_prefix="/usr/local"
_libavcodec=auto
_libavcodecso=auto
_x11=auto
_dga=auto
_dga2=auto
_xv=auto
_sdl=auto
_png=auto
_gl=auto
_ggi=auto
_aa=auto
_svga=auto
_fbdev=no
_dvb=auto
_dxr3=auto
_iconv=auto
_rtc=auto
_ossaudio=auto
_mad=auto
_vorbis=auto
_css=auto
_dvdread=auto
_xanim=auto
_xinerama=auto
_mga=auto
_xmga=auto
_vm=auto
_mlib=auto
_sgiaudio=auto
_sunaudio=auto
_alsa=auto
_fastmemcpy=yes
_win32=auto
_dshow=auto
_def_select='#define HAVE_AUDIO_SELECT'
_tv=no
_streaming=no
_divx4linux=auto
_lirc=auto
_gui=no
_termcap=auto
_termios=auto
_3dfx=no
_tdfxfb=no
_largefiles=no
_vo2=no
_language=en
_shm=auto
for ac_option do
case "$ac_option" in
# Skip 1st pass
--target=*) ;;
--cc=*) ;;
--as=*) ;;
--disable-gcc-checking) ;;
--enable-static*) ;;
--disable-static*) ;;
--with-extraincdir=*) ;;
--with-extralibdir=*) ;;
# Real 2nd pass
--enable-x11) _x11=yes ;;
--disable-x11) _x11=no ;;
--enable-dga) _dga=yes ;;
--disable-dga) _dga=no ;;
--enable-dga2) _dga2=yes ;;
--disable-dga2) _dga2=no ;;
--enable-xv) _xv=yes ;;
--disable-xv) _xv=no ;;
--enable-sdl) _sdl=yes ;;
--disable-sdl) _sdl=no ;;
--enable-png) _png=yes ;;
--disable-png) _png=no ;;
--enable-gl) _gl=yes ;;
--disable-gl) _gl=no ;;
--enable-ggi) _ggi=yes ;;
--disable-ggi) _ggi=no ;;
--enable-aa) _aa=yes ;;
--disable-aa) _aa=no ;;
--enable-svga) _svga=yes ;;
--disable-svga) _svga=no ;;
--enable-fbdev) _fbdev=yes ;;
--disable-fbdev) _fbdev=no ;;
--enable-dvb) _dvb=yes ;;
--disable-dvb) _dvb=no ;;
--enable-dxr3) _dxr3=yes ;;
--disable-dxr3) _dxr3=no ;;
--enable-iconv) _iconv=yes ;;
--disable-iconv) _iconv=no ;;
--enable-rtc) _rtc=yes ;;
--disable-rtc) _rtc=no ;;
--enable-ossaudio) _ossaudio=yes ;;
--disable-ossaudio) _ossaudio=no ;;
--enable-mad) _mad=yes ;;
--disable-mad) _mad=no ;;
--enable-vorbis) _vorbis=yes ;;
--disable-vorbis) _vorbis=no ;;
--enable-css) _css=yes ;;
--disable-css) _css=no ;;
--enable-dvdread) _dvdread=yes ;;
--disable-dvdread) _dvdread=no ;;
--enable-xanim) _xanim=yes ;;
--disable-xanim) _xanim=no ;;
--enable-xinerama) _xinerama=yes ;;
--disable-xinerama) _xinerama=no ;;
--enable-mga) _mga=yes ;;
--disable-mga) _mga=no ;;
--enable-xmga) _xmga=yes ;;
--disable-xmga) _xmga=no ;;
--enable-vm) _vm=yes ;;
--disable-vm) _vm=no ;;
--enable-mlib) _mlib=yes ;;
--disable-mlib) _mlib=no ;;
--enable-sunaudio) _sunaudio=yes ;;
--disable-sunaudio) _sunaudio=no ;;
--enable-sgiaudio) _sgiaudio=yes ;;
--disable-sgiaudio) _sgiaudio=no ;;
--enable-alsa) _alsa=yes ;;
--disable-alsa) _alsa=no ;;
--enable-tv) _tv=yes ;;
--disable-tv) _tv=no ;;
--enable-fastmemcpy) _fastmemcpy=yes ;;
--disable-fastmemcpy) _fastmemcpy=no ;;
--enable-streaming) _streaming=yes ;;
--disable-streaming) _streaming=no ;;
--enable-divx4linux) _divx4linux=yes ;;
--disable-divx4linux) _divx4linux=no ;;
--enable-lirc) _lirc=yes ;;
--disable-lirc) _lirc=no ;;
--enable-gui) _gui=yes ;;
--disable-gui) _gui=no ;;
--enable-termcap) _termcap=yes ;;
--disable-termcap) _termcap=no ;;
--enable-termios) _termios=yes ;;
--disable-termios) _termios=no ;;
--enable-3dfx) _3dfx=yes ;;
--disable-3dfx) _3dfx=no ;;
--enable-tdfxfb) _tdfxfb=yes ;;
--disable-tdfxfb) _tdfxfb=no ;;
--enable-mtrr) _mtrr=yes ;;
--disable-mtrr) _mtrr=no ;;
--enable-largefiles) _largefiles=yes ;;
--disable-largefiles) _largefiles=no ;;
--enable-vo2) _vo2=yes ;;
--disable-vo2) _vo2=no ;;
--enable-shm) _shm=yes ;;
--disable-shm) _shm=no ;;
--enable-select) _def_select='#define HAVE_AUDIO_SELECT' ;;
--disable-select) _def_select='#undef HAVE_AUDIO_SELECT' ;;
--language=*)
LINGUAS=`echo $ac_option | cut -d '=' -f 2`
;;
--with-win32libdir=*)
_win32libdir=`echo $ac_option | cut -d '=' -f 2`
_win32=yes
;;
--with-xanimlibdir=*)
_xanimlibdir=`echo $ac_option | cut -d '=' -f 2`
_xanim=yes
;;
--with-csslibdir=*)
_csslibdir=`echo $ac_option | cut -d '=' -f 2`
_css=yes
;;
--with-mlibdir=*)
_mlibdir=`echo $ac_option | cut -d '=' -f 2`
_mlib=yes
;;
--enable-profile)
_profile='-p'
;;
--enable-debug)
_debug='-g'
;;
--enable-debug=*)
_debug=`echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2`
;;
--enable-sse) _sse=yes ;;
--disable-sse) _sse=no ;;
--enable-mmx2) _mmx2=yes ;;
--disable-mmx2) _mmx2=no ;;
--enable-3dnow) _3dnow=yes ;;
--disable-3dnow) _3dnow=no _3dnowex=no ;;
--enable-3dnowex) _3dnow=yes _3dnowex=yes ;;
--disable-3dnowex) _3dnowex=no ;;
--enable-mmx) _mmx=yes ;;
--disable-mmx) # without mmx 3Dnow! and stuff is also not possible
_3dnow=no _3dnowex=no _mmx=no _mmx2=no ;;
--enable-win32) _win32=yes ;;
--disable-win32) _win32=no _dshow=no ;;
--enable-dshow) _win32=yes _dshow=yes ;;
--disable-dshow) _dshow=no ;;
--with-x11incdir=*)
_inc_x11=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'`
;;
--with-x11libdir=*)
_ld_x11=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'`
;;
--with-sdl-config=*)
_sdlconfig=`echo $ac_option | cut -d '=' -f 2`
;;
--with-gtk-config=*)
_gtkconfig=`echo $ac_option | cut -d '=' -f 2`
;;
--with-glib-config=*)
_glibconfig=`echo $ac_option | cut -d '=' -f 2`
;;
--with-madlibdir=*)
_ld_mad=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'`
;;
--prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2`
;;
--datadir=*)
_datadir=`echo $ac_option | cut -d '=' -f 2`
;;
*)
echo "Unknown parameter: $ac_option"
;;
esac
done
# Atmos: moved this here, to be correct, if --prefix is specified
test -z "$_datadir" && _datadir=$_prefix"/share/mplayer"
if x86 ; then
# Checking assembler (_as) compatibility...
# Added workaround for older as that reads from stdin by default - atmos
as_version=`echo '' | $_as -version 2>&1 | sed -n 's/^.*assembler \(version \)*\([0-9.]*\).*$/\2/p'`
echocheck "assembler ($_as $as_version)"
_pref_as_version='2.9.1'
echo 'nop' > $TMPS
if test "$_mmx" = yes ; then
echo 'emms' >> $TMPS
fi
if test "$_3dnow" = yes ; then
_pref_as_version='2.10.1'
echo 'femms' >> $TMPS
fi
if test "$_3dnowex" = yes ; then
_pref_as_version='2.10.1'
echo 'pswapd %mm0, %mm0' >> $TMPS
fi
if test "$_mmx2" = yes ; then
_pref_as_version='2.10.1'
echo 'movntq %mm0, (%eax)' >> $TMPS
fi
if test "$_sse" = yes ; then
_pref_as_version='2.10.1'
echo 'xorps %xmm0, %xmm0' >> $TMPS
fi
#if test "$_sse2" = yes ; then
# _pref_as_version='2.11'
# echo 'xorpd %xmm0, %xmm0' >> $TMPS
#fi
$_as $TMPS -o $TMPO > /dev/null 2>&1 || as_verc_fail=yes
if test "$as_verc_fail" != yes ; then
echores "ok"
else
echores "failed"
echo "Upgrade binutils to ${_pref_as_version} ..."
die "obsolete binutils version"
fi
fi
_def_mmx='#undef HAVE_MMX'
test "$_mmx" = yes && _def_mmx='#define HAVE_MMX 1'
_def_mmx2='#undef HAVE_MMX2'
test "$_mmx2" = yes && _def_mmx2='#define HAVE_MMX2 1'
_def_3dnow='#undef HAVE_3DNOW'
test "$_3dnow" = yes && _def_3dnow='#define HAVE_3DNOW 1'
_def_3dnowex='#undef HAVE_3DNOWEX'
test "$_3dnowex" = yes && _def_3dnowex='#define HAVE_3DNOWEX 1'
_def_sse='#undef HAVE_SSE'
test "$_sse" = yes && _def_sse='#define HAVE_SSE 1'
# Checking kernel version...
if x86 && linux ; then
_k_verc_problem=no
kernel_version=`uname -r 2>&1`
echocheck "$system_name kernel version"
case "$kernel_version" in
'') kernel_version="?.??"; _k_verc_fail=yes;;
[0-1].[0-9].[0-9]*|2.[0-3].[0-9]*)
_k_verc_problem=yes;;
esac
if test "$_k_verc_problem" = yes && test "$_sse" = yes ; then
_k_verc_fail=yes
fi
if test "$_k_verc_fail" ; then
echores "$kernel_version, fail"
echo "WARNING! If you want to run mplayer on this system, get prepared for problems!"
echo "2.2.x has a limited SSE support. Upgrade kernel or use --disable-sse"
echo "Older kernel won't work correctly with mplayer"
else
echores "$kernel_version, ok"
fi
fi
######################
# MAIN TESTS GO HERE #
######################
echocheck "Extra headers"
echores "$_extraincdir"
echocheck "Extra libs"
echores "$_extralibdir"
echocheck "kstat"
cat > $TMPC << EOF
#include <kstat.h>
int main(void) { (void) kstat_open(); (void) kstat_close(0); return 0; }
EOF
_kstat=no
cc_check -lkstat && _kstat=yes
if test "$_kstat" = yes ; then
_ld_arch="-lkstat ${_ld_arch}"
fi
if test "$_kstat" = yes ; then
_def_kstat="#define HAVE_LIBKSTAT 1"
else
_def_kstat="#undef HAVE_LIBKSTAT"
fi
echores "$_kstat"
echocheck "posix4"
# required for nanosleep on some systems
cat > $TMPC << EOF
#include <time.h>
int main(void) { (void) nanosleep(0, 0); return 0; }
EOF
_posix4=no
cc_check -lposix4 && _posix4=yes
if test "$_posix4" = yes ; then
_ld_arch="-lposix4 ${_ld_arch}"
fi
echores "$_posix4"
echocheck "socklib"
# for Solaris (socket stuff is in -lsocket, gethostbyname and friends in -lnsl):
cat > $TMPC << EOF
#include <netdb.h>
int main(void) { (void) gethostbyname(0); return 0; }
EOF
cc_check $_ld_sock -lsocket && _ld_sock="$_ld_sock -lsocket"
cc_check $_ld_sock -lnsl && _ld_sock="$_ld_sock -lnsl"
if test "$_ld_sock" ; then
echores "using $_ld_sock"
else
echores "not needed"
fi
echocheck "malloc.h"
cat > $TMPC << EOF
#include <malloc.h>
int main(void) { (void) malloc(0); return 0; }
EOF
_malloc=no
cc_check && _malloc=yes
if test "$_malloc" = yes ; then
_def_malloc='#define HAVE_MALLOC_H 1'
else
_def_malloc='#undef HAVE_MALLOC_H'
fi
# malloc.h emits a warning in FreeBSD
freebsd && _def_malloc='#undef HAVE_MALLOC_H'
echores "$_malloc"
echocheck "memalign()"
# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ?
cat > $TMPC << EOF
#include <malloc.h>
int main (void) { (void) memalign(64, sizeof(char)); return 0; }
EOF
_memalign=no
cc_check && _memalign=yes
if test "$_memalign" = yes ; then
_def_memalign='#define HAVE_MEMALIGN 1'
else
_def_memalign='#undef HAVE_MEMALIGN'
fi
echores "$_memalign"
echocheck "alloca.h"
cat > $TMPC << EOF
#include <alloca.h>
int main(void) { (void) alloca(0); return 0; }
EOF
_alloca=no
cc_check && _alloca=yes
if cc_check ; then
_def_alloca='#define HAVE_ALLOCA_H 1'
else
_def_alloca='#undef HAVE_ALLOCA_H'
fi
echores "$_alloca"
echocheck "mman.h"
cat > $TMPC << EOF
#include <sys/types.h>
#include <sys/mman.h>
int main(void) { (void) mmap(0, 0, 0, 0, 0, 0); return 0; }
EOF
_mman=no
cc_check && _mman=yes
if test "$_mman" = yes ; then
_def_mman='#define HAVE_SYS_MMAN_H 1'
else
_def_mman='#undef HAVE_SYS_MMAN_H'
fi
echores "$_mman"
echocheck "dynamic loader"
cat > $TMPC << EOF
#include <dlfcn.h>
int main(void) { dlopen(0, 0); dlclose(0); dlsym(0, 0); return 0; }
EOF
_dl=no
if cc_check ; then
_dl=yes
elif cc_check -ldl ; then
_dl=yes
_ld_dl='-ldl'
fi
if test "$_dl" = yes ; then
_def_dl='#define HAVE_LIBDL 1'
else
_def_dl='#undef HAVE_LIBDL'
fi
echores "$_dl"
echocheck "dynamic linking"
# FIXME !! make this dynamic detection to work
# also gcc flags are different, but ld flags aren't (-Bdynamic/-Bstatic/-Bsymbolic)
_ld_dl_dynamic=''
if qnx ; then
_ld_dl_dynamic=''
else
_ld_dl_dynamic='-rdynamic'
fi
#cat > $TMPC << EOF
#int main(void) { return 0; }
#EOF
#if cc_check -rdynamic ; then
# _ld_dl_dynamic='-rdynamic'
#elif cc_check -Bdynamic ; then
# _ld_dl_dynamic='-Bdynamic'
#elif cc_check ; then
# _ld_dl_dynamic=''
#fi
echores "using $_ld_dl_dynamic"
echocheck "pthread"
cat > $TMPC << EOF
#include <pthread.h>
int main(void) { (void) pthread_create (0, 0, 0, 0); return 0; }
EOF
if cc_check ; then # QNX
_ld_pthread=''
elif cc_check -lpthread ; then
_ld_pthread='-lpthread'
elif cc_check -pthread ; then
_ld_pthread='-pthread'
else
die "Lib pthread not found. (needed by windows and networking stuff)"
fi
echores "using $_ld_pthread"
echocheck "sys/soundcard.h"
cat > $TMPC << EOF
#include <sys/soundcard.h>
int main(void) { return 0; }
EOF
_sys_soundcard=no
cc_check && _sys_soundcard=yes
if test "$_sys_soundcard" = yes ; then
_def_sys_soundcard='#define HAVE_SYS_SOUNDCARD_H 1'
else
_def_sys_soundcard='#undef HAVE_SYS_SOUNDCARD_H'
fi
echores "$_sys_soundcard"
echocheck "termcap"
if test "$_termcap" = auto ; then
_termcap=no
cat > $TMPC <<EOF
int main(void) { return 0; }
EOF
cc_check -ltermcap && _termcap=yes
else
_termcap=no
fi
if test "$_termcap" = yes ; then
_def_termcap='#define USE_TERMCAP 1'
_ld_termcap='-ltermcap'
else
_def_termcap='#undef USE_TERMCAP'
fi
echores "$_termcap"
echocheck "termios"
if test "$_termios" = auto ; then
_termios=no
cat > $TMPC <<EOF
#include <sys/termios.h>
int main(void) { return 0; }
EOF
cc_check && _termios=yes
else
_termios=no
fi
if test "$_termios" = yes ; then
_def_termios='#define USE_TERMIOS 1'
else
_def_termios='#undef USE_TERMIOS'
fi
echores "$_termios"
echocheck "shm"
if test "$_shm" = auto ; then
_shm=no
cat > $TMPC << EOF
#include <sys/types.h>
#include <sys/shm.h>
int main(void) { shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0); return 0; }
EOF
cc_check && _shm=yes
fi
if test "$_shm" = yes ; then
_def_shm='#define HAVE_SHM 1'
else
_def_shm='#undef HAVE_SHM'
fi
echores "$_shm"
echocheck "3dfx"
if test "$_3dfx" = yes ; then
_def_3dfx='#define HAVE_3DFX 1'
_vosrc="$_vosrc vo_3dfx.c"
else
_def_3dfx='#undef HAVE_3DFX'
fi
echores "$_3dfx"
echocheck "tdfxfb"
if test "$_tdfxfb" = yes ; then
_def_tdfxfb='#define HAVE_TDFXFB 1'
_vosrc="$_vosrc vo_tdfxfb.c"
else
_def_tdfxfb='#undef HAVE_TDFXFB'
fi
echores "$_tdfxfb"
# Checking for localization ...
echocheck "language"
test -z "$LINGUAS" && LINGUAS="en"
if test -f "help_mp-${LINGUAS}.h" ; then
echores "using ${LINGUAS}"
else
echores "${LINGUAS} not found, using en"
LINGUAS="en"
fi
_mp_help="help_mp-${LINGUAS}.h"
test -f help_mp-${LINGUAS}.h || die "help_mp-${LINGUAS}.h not found"
echocheck "vsscanf()"
cat > $TMPC << EOF
#include <stdarg.h>
int main(void) { vsscanf(); return 0; }
EOF
_vsscanf=no
cc_check && _vsscanf=yes
if test "$_vsscanf" = yes ; then
_def_vsscanf='#define HAVE_VSSCANF 1'
else
_def_vsscanf='#undef HAVE_VSSCANF'
fi
echores "$_vsscanf"
echocheck "X11 headers"
if test -z "$_x11incdir" ; then
for I in /usr/include /usr/X11R6/include /usr/X11/include /usr/openwin/include ; do
if test -d "$I/X11" ; then
_x11incdir="$I"
echores "found $I"
break
fi
done
fi
if test -z "$_x11incdir" ; then
_x11=no
echores "not found"
elif test "$_x11incdir" != "/usr/include" ; then
_inc_x11="-I$_x11incdir"
fi
echocheck "X11 libs"
if test -z "$_x11libdir" ; then
for I in /usr/X11R6/lib /usr/X11/lib /usr/lib32 /usr/openwin/lib ; do
if test -d "$I" ; then
_x11libdir="$I"
echores "found $I"
break;
fi
done
fi
if test -z "$_x11libdir" ; then
_x11=no
echores "not found"
fi
_ld_x11="-L$_x11libdir -lX11 -lXext $_ld_sock"
#########
# VIDEO #
#########
echocheck "X11"
if test "$_x11" = auto || test "$_x11" = yes ; then
cat > $TMPC <<EOF
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(void) { (void) XCreateWindow(0,0,0,0,0,0,0,0,0,0,0,0); return 0; }
EOF
_x11=no
cc_check $_inc_x11 $_ld_x11 && _x11=yes
fi
if test "$_x11" = yes ; then
_def_x11='#define HAVE_X11 1'
_vosrc="$_vosrc vo_x11.c"
else
_def_x11='#undef HAVE_X11'
_inc_x11=''
_ld_x11=''
fi
echores "$_x11"
echocheck "DPMS"
_xdpms3=no
if test "$_x11" = yes ; then
cat > $TMPC <<EOF
#include <X11/Xmd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/dpms.h>
int main(void) {
(void) DPMSQueryExtension(0, 0, 0);
}
EOF
cc_check $_inc_x11 $_ld_x11 -lXdpms && _xdpms3=yes
fi
_xdpms4=no
if test "$_x11" = yes ; then
cat > $TMPC <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/dpms.h>
int main(void) {
(void) DPMSQueryExtension(0, 0, 0);
}
EOF
cc_check $_inc_x11 $_ld_x11 && _xdpms4=yes
fi
if test "$_xdpms4" = yes ; then
_def_xdpms='#define HAVE_XDPMS 1'
echores "using xdpms4"
elif test "$_xdpms3" = yes ; then
_def_xdpms='#define HAVE_XDPMS 1'
_ld_x11="$_ld_x11 -lXdpms"
echores "using xdpms3"
else
_def_xdpms='#undef HAVE_XDPMS'
echores "no"
fi
echocheck "Xv"
if test "$_x11" = yes && test "$_xv" = auto ; then
cat > $TMPC <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>
int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); return 0; }
EOF
_xv=no
cc_check $_inc_x11 $_ld_x11 -lXv && _xv=yes
else
_xv=no
fi
if test "$_xv" = yes ; then
_def_xv='#define HAVE_XV 1'
_ld_xv='-lXv'
_vosrc="$_vosrc vo_xv.c"
else
_def_xv='#undef HAVE_XV'
fi
echores "$_xv"
echocheck "Xinerama"
if test "$_x11" = yes && test "$_xinerama" = auto ; then
cat > $TMPC <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
int main(void) { (void) XineramaIsActive(0); return 0; }
EOF
_xinerama=no
cc_check $_inc_x11 $_ld_x11 -lXinerama && _xinerama=yes
else
_xinerama=no
fi
if test "$_xinerama" = yes ; then
_def_xinerama='#define HAVE_XINERAMA 1'
_ld_xinerama='-lXinerama'
else
_def_xinerama='#undef HAVE_XINERAMA'
fi
echores "$_xinerama"
# Note: the -lXxf86vm library is the VideoMode extension and though it's not
# needed for DGA, AFAIK every distribution packages together with DGA stuffs
# named 'X extensions' or something similar.
# This check may be useful for future mplayer versions (to change resolution)
# If you run into problems, remove '-lXxf86vm'.
echocheck "Xxf86vm"
if test "$_x11" = yes && test "$_vm" = auto ; then
cat > $TMPC <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
int main(void) { (void) XF86VidModeQueryExtension(0, 0, 0); return 0; }
EOF
_vm=no
cc_check $_inc_x11 $_ld_x11 -lXxf86vm && _vm=yes
else
_vm=no
fi
if test "$_vm" = yes ; then
_def_vm='#define HAVE_XF86VM 1'
_ld_vm='-lXxf86vm'
else
_def_vm='#undef HAVE_XF86VM'
fi
echores "$_vm"
echocheck "DGA"
if test "$_x11" = yes && test "$_dga" = auto ; then
cat > $TMPC << EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
int main (void) { (void) XDGAQueryExtension(0, 0, 0); return 0; }
EOF
_dga=no
cc_check $_inc_x11 $_ld_x11 -lXxf86dga -lXxf86vm && _dga=yes
else
_dga=no
fi
if test "$_dga" = yes ; then
_def_dga='#define HAVE_DGA 1'
_ld_dga='-lXxf86dga -lXxf86vm'
_vosrc="$_vosrc vo_dga.c"
else
_def_dga='#undef HAVE_DGA'
fi
echores "$_dga"
echocheck "DGA 2.0"
if test "$_x11" = yes && test "$_dga2" = auto ; then
cat > $TMPC << EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
int main (void) { XDGAMode mode; XDGADevice device; return 0; }
EOF
_dga2=no
cc_check $_inc_x11 $_ld_x11 -lXxf86dga -lXxf86vm && _dga2=yes
else
_dga2=no
fi
if test "$_dga2" = yes ; then
_def_dga2='#define HAVE_DGA2 1'
_ld_dga2='-lXxf86dga -lXxf86vm'
_vosrc="$_vosrc vo_dga.c"
else
_def_dga2='#undef HAVE_DGA2'
fi
echores "$_dga2"
echocheck "OpenGL"
#Note: this test is run even with --enable-gl since we autodetect $_ld_gl
if test "$_x11" = yes && test "$_gl" != no ; then
cat > $TMPC << EOF
#include <GL/gl.h>
int main(void) { return 0; }
EOF
_gl=no
if cc_check $_inc_x11 $_ld_x11 -lGL -lm ; then
_gl=yes
_ld_gl="-lGL -lm"
elif cc_check $_inc_x11 $_ld_x11 -lGL -lm $_ld_pthread ; then
_gl=yes
_ld_gl="-lGL -lm $_ld_pthread"
fi
else
_gl=no
fi
if test "$_gl" = yes ; then
_def_gl='#define HAVE_GL 1'
_vosrc="$_vosrc vo_gl.c vo_gl2.c"
else
_def_gl='#undef HAVE_GL'
fi
echores "$_gl"
echocheck "/dev/mga_vid"
if test "$_mga" = auto ; then
_mga=no
test -c /dev/mga_vid && _mga=yes
fi
if test "$_mga" = yes ; then
_def_mga='#define HAVE_MGA 1'
_vosrc="$_vosrc vo_mga.c"
else
_def_mga='#undef HAVE_MGA'
fi
echores "$_mga"
echocheck "syncfb"
_syncfb=no
test "$_mga" = yes && _syncfb=yes
if test "$_syncfb" = yes ; then
_def_syncfb='#define HAVE_SYNCFB 1'
_vosrc="$_vosrc vo_syncfb.c"
else
_def_syncfb='#undef HAVE_SYNCFB'
fi
echores "$_syncfb"
echocheck "xmga"
if test "$_xmga" = auto ; then
_xmga=no
test "$_x11" = yes && test "$_mga" = yes && _xmga=yes
fi
if test "$_xmga" = yes ; then
_def_xmga='#define HAVE_XMGA 1'
_vosrc="$_vosrc vo_xmga.c"
else
_def_xmga='#undef HAVE_XMGA'
fi
echores "$_xmga"
echocheck "GGI"
if test "$_ggi" = auto ; then
cat > $TMPC << EOF
#include <ggi/ggi.h>
int main(void) { return 0; }
EOF
_ggi=no
cc_check -lggi && _ggi=yes
fi
if test "$_ggi" = yes ; then
_def_ggi='#define HAVE_GGI 1'
_ld_ggi='-lggi'
_vosrc="$_vosrc vo_ggi.c"
else
_def_ggi='#undef HAVE_GGI'
fi
echores "$_ggi"
echocheck "AA"
if test "$_aa" = auto ; then
cat > $TMPC << EOF
#include <aalib.h>
int main(void) { (void) aa_init(0, 0, 0); return 0; }
EOF
_aa=no
cc_check -laa && _aa=yes
fi
if test "$_aa" = yes ; then
_def_aa='#define HAVE_AA 1'
_ld_aa='-laa'
_vosrc="$_vosrc vo_aa.c"
else
_def_aa='#undef HAVE_AA'
fi
echores "$_aa"
echocheck "SVGAlib"
if test "$_svga" = auto ; then
cat > $TMPC << EOF
#include <vga.h>
#include <vgagl.h>
int main(void) { return 0; }
EOF
_svga=no
cc_check -lvgagl -lvga && _svga=yes
fi
if test "$_svga" = yes ; then
_def_svga='#define HAVE_SVGALIB 1'
_ld_svga='-lvgagl -lvga'
_vosrc="$_vosrc vo_svga.c"
else
_def_svga='#undef HAVE_SVGALIB'
fi
echores "$_svga"
echocheck "FBDev"
if test "$_fbdev" = auto ; then
_fbdev=no
linux && _fbdev=yes
fi
if test "$_fbdev" = yes ; then
_def_fbdev='#define HAVE_FBDEV 1'
_vosrc="$_vosrc vo_fbdev.c"
else
_def_fbdev='#undef HAVE_FBDEV'
fi
echores "$_fbdev"
echocheck "DVB"
if test "$_dvb" != no ; then
_dvb=no
test -c /dev/ost/video && _dvb=yes
fi
if test "$_dvb" = yes ; then
_def_dvb='#define HAVE_DVB 1'
else
_def_dvb='#undef HAVE_DVB'
fi
echores "$_dvb"
echocheck "PNG support"
if test "$_png" = auto ; then
_png=no
if irix ; then
# Don't check for -lpng on irix since it has its own libpng
# incompatible with the GNU libpng
echores "disabled on irix (not GNU libpng)"
else
cat > $TMPC << EOF
#include <png.h>
int main(void) { return 0; }
EOF
cc_check -lpng -lz -lm && _png=yes
echores yes
fi
else
echores "$_png"
fi
if test "$_png" = yes ; then
_def_png='#define HAVE_PNG 1'
_ld_png='-lpng -lz'
_vosrc="$_vosrc vo_png.c"
else
_def_png='#undef HAVE_PNG'
fi
#################
# VIDEO + AUDIO #
#################
echocheck "SDL"
if test -z "$_sdlconfig" ; then
if ( sdl-config --version ) >/dev/null 2>&1 ; then
_sdlconfig="sdl-config"
elif ( sdl11-config --version ) >/dev/null 2>&1 ; then
_sdlconfig="sdl11-config"
else
_sdlconfig=false
fi
fi
if test "$_sdl" = auto || test "$_sdl" = yes ; then
cat > $TMPC << EOF
#include <SDL.h>
int main(void) { return 0; }
EOF
_sdl=no
if "$_sdlconfig" --version >/dev/null 2>&1 ; then
if cc_check `$_sdlconfig --cflags` `$_sdlconfig --libs` ; then
_sdlversion=`$_sdlconfig --version | sed 's/[^0-9]//g'`
if test "$_sdlversion" -gt 116 ; then
if test "$_sdlversion" -lt 121 ; then
_def_sdlbuggy='#define BUGGY_SDL'
else
_def_sdlbuggy='#undef BUGGY_SDL'
fi
_sdl=yes
else
_sdl=outdated
fi
fi
fi
fi
if test "$_sdl" = yes ; then
_def_sdl='#define HAVE_SDL 1'
_ld_sdl=`$_sdlconfig --libs`
_inc_sdl=`$_sdlconfig --cflags`
_vosrc="$_vosrc vo_sdl.c"
_aosrc="$_aosrc ao_sdl.c"
else
_def_sdl='#undef HAVE_SDL'
fi
echores "$_sdl (with $_sdlconfig)"
echocheck "DXR3/H+"
if test "$_dxr3" = auto ; then
cat > $TMPC << EOF
#include <libdxr3/api.h>
int main(void) { return 0; }
EOF
_dxr3=no
cc_check -ldxr3 && _dxr3=yes
fi
if test "$_dxr3" = yes ; then
_def_dxr3='#define HAVE_DXR3 1'
_ld_dxr3='-ldxr3'
_vosrc="$_vosrc vo_dxr3.c"
_aosrc="$_aosrc ao_dxr3.c"
else
_def_dxr3='#undef HAVE_DXR3'
fi
echores "$_dxr3"
#########
# AUDIO #
#########
echocheck "OSS Audio"
if test "$_ossaudio" = auto ; then
cat > $TMPC << EOF
#include <sys/soundcard.h>
int main(void) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }
EOF
_ossaudio=no
cc_check && _ossaudio=yes
fi
if test "$_ossaudio" = yes ; then
_def_ossaudio='#define USE_OSS_AUDIO 1'
_aosrc="$_aosrc ao_oss.c"
else
_def_ossaudio='#undef USE_OSS_AUDIO'
fi
echores "$_ossaudio"
echocheck "ALSA audio"
if test "$_alsa" = auto || test "$_alsa" = yes; then
_alsa=no
cat > $TMPC << EOF
#include <sys/asoundlib.h>
#include <sys/soundcard.h>
int main(void) { return (!(SND_LIB_MAJOR==0 && SND_LIB_MINOR==5)); }
EOF
cc_check -lasound $_ld_dl $_ld_pthread && $TMPO && _alsaver='0.5.x'
cat > $TMPC << EOF
#include <sys/asoundlib.h>
#include <sys/soundcard.h>
int main(void) { return (!(SND_LIB_MAJOR==0 && SND_LIB_MINOR==9)); }
EOF
cc_check -lasound $_ld_dl $_ld_pthread && $TMPO && _alsaver='0.9.x'
if test "$_alsaver" ; then
_alsa=yes
echores "yes ($_alsaver)"
else
echores "no"
fi
else
echores "no"
fi
_def_alsa5='#undef HAVE_ALSA5'
_def_alsa9='#undef HAVE_ALSA9'
if test "$_alsa" = yes ; then
if test "$_alsaver" = '0.5.x' ; then
_aosrc="$_aosrc ao_alsa5.c"
_def_alsa5='#define HAVE_ALSA5 1'
elif test "$_alsaver" = '0.9.x' ; then
_aosrc="$_aosrc ao_alsa9.c"
_def_alsa9='#define HAVE_ALSA9 1'
fi
_ld_alsa='-lasound'
fi
echocheck "Sun audio"
if test "$_sunaudio" = auto ; then
cat > $TMPC << EOF
#include <sys/types.h>
#include <sys/audioio.h>
int main(void) { audio_info_t info; AUDIO_INITINFO(&info); return 0; }
EOF
_sunaudio=no
cc_check && _sunaudio=yes
fi
if test "$_sunaudio" = yes ; then
_def_sunaudio='#define USE_SUN_AUDIO 1'
_aosrc="$_aosrc ao_sun.c"
else
_def_sunaudio='#undef USE_SUN_AUDIO'
fi
echores "$_sunaudio"
echocheck "Sun mediaLib"
if test "$_mlib" = auto ; then
_mlib=no
test -z "$_mlibdir" && _mlibdir=/opt/SUNWmlib
cat > $TMPC << EOF
#include <mlib.h>
int main(void) { mlib_VideoColorYUV2ABGR420(0,0,0,0,0,0,0,0,0); return 0; }
EOF
cc_check -I${_mlibdir}/include -L${_mlibdir}/lib -lmlib && _mlib=yes
fi
if test "$_mlib" = yes ; then
_def_mlib='#define HAVE_MLIB 1'
_inc_mlib=" -I${_mlibdir}/include "
_ld_mlibl=" -L${_mlibdir}/lib -R${_mlibdir}/lib -lmlib "
else
_def_mlib='#undef HAVE_MLIB'
fi
echores "$_mlib"
echocheck "SGI Audio"
if test "$_sgiaudio" = auto ; then
# check for SGI audio
cat > $TMPC << EOF
#include <dmedia/audio.h>
int main(void) { return 0; }
EOF
_sgiaudio=no
cc_check && _sgiaudio=yes
fi
if test "$_sgiaudio" = "yes" ; then
_def_sgiaudio='#define USE_SGI_AUDIO 1'
_ld_sgiaudio='-laudio'
_aosrc="$_aosrc ao_sgi.c"
else
_def_sgiaudio='#undef USE_SGI_AUDIO'
fi
echores "$_sgiaudio"
echocheck "DVD support"
if test "$_dvdread" = auto ; then
cat > $TMPC << EOF
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
#include <dvdread/nav_read.h>
int main(void) { return 0; }
EOF
_dvdread=no
cc_check \
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -ldvdread && \
_dvdread=yes
fi
if test "$_css" = auto ; then
cat > $TMPC <<EOF
#include <css.h>
int main(void) { (void) CSSisEncrypted(0); return 0; }
EOF
_css=no
cc_check -lcss && _css=yes
fi
# dvdread preferred to DeCSS
if test "$_dvdread" = yes ; then
_largefiles=yes
_def_dvdread='#define USE_DVDREAD 1'
_def_css='#undef HAVE_LIBCSS'
_ld_css='-ldvdread'
echores "libdvdread"
elif test "$_css" = yes ; then
_def_dvdread='#undef USE_DVDREAD'
_def_css='#define HAVE_LIBCSS 1'
test "$_csslibdir" && _ld_css="-L${_csslibdir} ${_ld_css}"
echores "libcss"
else
_def_dvdread='#undef USE_DVDREAD'
_def_css='#undef HAVE_LIBCSS'
echores "no"
fi
echocheck "zlib"
cat > $TMPC << EOF
#include <zlib.h>
int main(void) { (void) inflate(0, Z_NO_FLUSH); return 0; }
EOF
_zlib=no
cc_check -lz && _zlib=yes
if test "$_zlib" = yes ; then
_def_zlib='#define HAVE_ZLIB 1'
_ld_zlib='-lz'
else
_def_zlib='#undef HAVE_ZLIB'
fi
echores "$_zlib"
echocheck "RTC"
if linux ; then
if test "$_rtc" = auto ; then
cat > $TMPC << EOF
#include <sys/ioctl.h>
#include <linux/rtc.h>
int main(void) { return RTC_IRQP_READ; }
EOF
_rtc=no
cc_check && _rtc=yes
fi
echores "$_rtc"
else
_rtc=no
echores "no (linux-specific)"
fi
if test "$_rtc" = yes ; then
_def_rtc='#define HAVE_RTC 1'
else
_def_rtc='#undef HAVE_RTC'
fi
echocheck "mad support"
if test "$_mad" = auto ; then
_mad=no
cat > $TMPC << EOF
#include <mad.h>
int main(void) { return 0; }
EOF
cc_check $_madlibdir -lmad && _mad=yes
fi
if test "$_mad" = yes ; then
_def_mad='#define USE_LIBMAD 1'
_ld_mad='-lmad'
else
_def_mad='#undef USE_LIBMAD'
fi
echores "$_mad"
echocheck "OggVorbis support"
if test "$_vorbis" = auto ; then
_vorbis=no
cat > $TMPC << EOF
#include <vorbis/codec.h>
int main(void) { return 0; }
EOF
cc_check -lvorbis -logg -lm && _vorbis=yes
fi
if test "$_vorbis" = yes ; then
_def_vorbis='#define HAVE_OGGVORBIS 1'
_ld_vorbis='-lvorbis -logg -lm'
else
_def_vorbis='#undef HAVE_OGGVORBIS'
fi
echores "$_vorbis"
echocheck "Win32 DLL support"
if test "$_win32" = auto ; then
_win32=no
if x86 ; then
if test -z "$_win32libdir" ; then
for I in /usr/local/lib/win32 /usr/lib/win32 ; do
if test -d "$I" ; then
_win32libdir="$I"
break;
fi;
done
fi
test "$_win32libdir" && _win32=yes
fi
fi
if test "$_win32" = yes ; then
_def_win32='#define USE_WIN32DLL 1'
_ld_win32='-Lloader -lloader'
_dep_win32='loader/libloader.a'
else
_def_win32='#undef USE_WIN32DLL'
fi
echores "$_win32"
echocheck "DirectShow"
if test "$_win32" = yes && test "$_dshow" = auto ; then
_dshow=no
# check if compiler supports C++ and C++-libs are installed correctly
cat > "$TMPCPP" << EOF
#include <string>
class myclass {
private: int ret;
public: int myreturn(void);
};
int myclass::myreturn(void) { ret = 0; return ret ; }
int main(void) { myclass myobject; return myobject.myreturn(); }
EOF
echo "------------------------------------------------" >> "$TMPLOG"
cat "$TMPCPP" >> "$TMPLOG"
if ( "$_cc" "$TMPCPP" -o "$TMPO" && "$TMPO" ) >> "$TMPLOG" 2>&1 ; then
_dshow=yes
echores "yes (C++ is ok)"
else
echores "no"
cat << EOF
Your C++ runtime environment is broken.
Hints: Does $_cc support C++ ? Have you a C++ compiler installed ?
Are the C++ libraries correctly installed ?
Check for libstdc++ and in (/etc/)ld.so.conf
If you don't need DirectShow support, you can also use:
./configure --disable-dshow <your-normal-configure-options>
to disable building of the C++ based DirectShow code.
EOF
die "$_cc's C++ is broken"
fi
else
_dshow=no
echores "$_dshow"
fi
if test "$_dshow" = yes ; then
_def_dshow='#define USE_DIRECTSHOW 1'
_ld_dshow='-Lloader/DirectShow -lDS_Filter -lstdc++'
_dep_dshow='loader/DirectShow/libDS_Filter.a'
else
_def_dshow='#undef USE_DIRECTSHOW'
fi
echocheck "XAnim DLL"
if test "$_xanim" = auto ; then
_xanim=no
if test "$_dl" = yes ; then
if x86 ; then
if test -z "$_xanimlibdir" ; then
for I in /usr/local/lib/xanim/mods /usr/lib/xanim/mods ; do
if test -d "$I" ; then
_xanimlibdir="$I"
break;
fi;
done
fi
test "$_xanimlibdir" && _xanim=yes
echores "yes"
else
echores "not supported on non x86"
fi
else
echores "dl support needed"
fi
else
echores "$_xanim"
fi
if test "$_xanim" = yes ; then
_def_xanim='#define USE_XANIM 1'
_def_xanim_path="#define XACODEC_PATH \"$_xanimlibdir\""
else
_def_xanim='#undef USE_XANIM'
_def_xanim_path='#undef XACODEC_PATH'
fi
echocheck "iconv"
if test "$_iconv" = auto ; then
if freebsd ; then
_iconv_tmp='#include <giconv.h>'
else
_iconv_tmp='#include <iconv.h>'
fi
cat > $TMPC << EOF
#include <stdio.h>
#include <unistd.h>
$_iconv_tmp
#define INBUFSIZE 1024
#define OUTBUFSIZE 4096
char inbuffer[INBUFSIZE];
char outbuffer[OUTBUFSIZE];
int main(void) {
ssize_t numread;
iconv_t icdsc;
char *tocode="UTF-8";
char *fromcode="cp1250";
if ((icdsc = iconv_open (tocode, fromcode)) != (iconv_t)(-1)) {
while ((numread = read (0, inbuffer, INBUFSIZE))) {
char *iptr=inbuffer;
char *optr=outbuffer;
size_t inleft=numread;
size_t outleft=OUTBUFSIZE;
if (iconv(icdsc, (const char **)&iptr, &inleft, &optr, &outleft)
!= (size_t)(-1)) {
write (1, outbuffer, OUTBUFSIZE - outleft);
}
}
if (iconv_close(icdsc) == -1)
;
}
}
EOF
_iconv=no
if freebsd ; then
cc_check -lm -lgiconv && _iconv=yes
elif bsdos ; then
cc_check -lm -liconv && _iconv=yes
else
cc_check -lm && _iconv=yes
fi
fi
if test "$_iconv" = yes ; then
_def_iconv='#define USE_ICONV 1'
freebsd && _ld_iconv='-lgiconv'
bsdos && _ld_iconv='-liconv'
else
_def_iconv='#undef USE_ICONV'
fi
echores "$_iconv"
echocheck "FFmpeg codec"
if test "$_libavcodec" = auto ; then
# Note: static link is preferred to dynamic link
_libavcodec=no
test -d libavcodec && test -f libavcodec/Makefile && _libavcodec=yes
fi
if test "$_libavcodecso" = auto ; then
_libavcodecso=no
cat > $TMPC << EOF
#include <libffmpeg/avcodec.h>
int main(void) { return 0; }
EOF
cc_check -lffmpeg -lm && _libavcodecso=yes
fi
_def_libavcodec='#undef USE_LIBAVCODEC'
_def_libavcodecso='#undef USE_LIBAVCODEC_SO'
_def_ffpostprocess='#undef FF_POSTPROCESS'
if test "$_libavcodec" = yes ; then
_def_libavcodec='#define USE_LIBAVCODEC 1'
_ld_libavcodec='-Llibavcodec -lavcodec'
_dep_libavcodec='libavcodec/libavcodec.a'
_def_ffpostprocess='#define FF_POSTPROCESS 1'
echores "static libavcodec"
elif test "$_libavcodecso" = yes ; then
_def_libavcodecso='#define USE_LIBAVCODEC_SO 1'
_ld_libavcodec='-lffmpeg'
_def_ffpostprocess='#define FF_POSTPROCESS 1'
echores "dynamic libffmpeg.so"
else
echores "not found"
fi
# FIXME : variables don't have a "standard" name so check this one day
if test "$_divx4linux" = auto ; then
_divx4linux=no
echocheck "Divx4linux decore"
cat > $TMPC << EOF
#include <decore.h>
int main(void) { (void) decore(0, 0, 0, 0); return DEC_OPT_FRAME_311; }
EOF
_divx4linux_decore=no
if cc_check -ldivxdecore -lm ; then
_divx4linux_decore=yes
else
_divx4linux_decore='not found'
fi
echores "$_divx4linux_decore"
test "$_divx4linux_decore" = yes && _divx4linux=yes
echocheck "Divx4linux encore (for mencoder)"
cat > $TMPC <<EOF
#include <encore2.h>
int main(void) { (void) encore(0, 0, 0, 0); return 0; }
EOF
_divx4linux_encore=no
cc_check -ldivxencore -lm && _divx4linux_encore=yes
echores "$_divx4linux_encore"
fi
_def_decore='#undef NEW_DECORE'
_ld_decore='-Lopendivx -ldecore'
_def_encore='#undef NEW_ENCORE'
if test "$_divx4linux_decore" = yes ; then
_def_decore='#define NEW_DECORE 1'
_ld_decore='-ldivxdecore opendivx/postprocess.o'
if test "$_divx4linux_encore" = yes ; then
_def_encore='#define NEW_ENCORE 1'
_ld_encore='-ldivxencore'
fi
fi
echocheck "lirc"
if test "$_lirc" = auto ; then
_lirc=no
test -c /dev/lirc && _lirc=yes
fi
if test "$_lirc" = yes ; then
_def_lirc='#define HAVE_LIRC 1'
_ld_lirc='-llirc_client'
else
_def_lirc='#undef HAVE_LIRC'
fi
echores "$_lirc"
echocheck "fastmemcpy"
# fastmemcpy check is done earlier with tests of CPU & binutils features
if test "$_fastmemcpy" = yes ; then
_def_fastmemcpy='#define USE_FASTMEMCPY 1'
else
_def_fastmemcpy='#undef USE_FASTMEMCPY'
fi
echores "$_fastmemcpy"
echocheck "TV interface"
# FIXME tv check
if test "$_tv" = yes ; then
_def_tv='#define USE_TV 1'
else
_def_tv='#undef USE_TV'
fi
echores "$_tv"
echocheck "streaming"
# FIXME streaming check
if test "$_streaming" = yes ; then
_def_streaming='#define STREAMING 1'
# FIXME _streamingsrcs='asf_streaming.c network.c url.c http.c'
else
_def_streaming='#undef STREAMING'
fi
echores "$_streaming"
# --------------- GUI specific tests begin -------------------
echocheck "GUI"
echo "$_gui"
if test "$_gui" = yes ; then
echocheck "XShape extension"
_xshape=no
if test "$_x11" = yes ; then
cat > $TMPC << EOF
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/extensions/shape.h>
#include <stdlib.h>
int main(void) {
char *name = ":0.0";
Display *wsDisplay;
int exitvar = 0;
int eventbase, errorbase;
if (getenv("DISPLAY"))
name=getenv("DISPLAY");
wsDisplay=XOpenDisplay(name);
if (!XShapeQueryExtension(wsDisplay,&eventbase,&errorbase))
exitvar=1;
XCloseDisplay(wsDisplay);
return exitvar;
}
EOF
cc_check $_inc_x11 $_ld_x11 && _xshape=yes
fi
if test "$_xshape" = yes ; then
_def_xshape='#define HAVE_XSHAPE 1'
else
die "the GUI requires the X11 extension XShape (which was not found)"
fi
echores "$_xshape"
# Check for GTK:
echocheck "gtk version"
if test -z "$_gtkconfig" ; then
if ( gtk-config --version ) >/dev/null 2>&1 ; then
_gtkconfig="gtk-config"
elif ( gtk12-config --version ) >/dev/null 2>&1 ; then
_gtkconfig="gtk12-config"
else
die "the GUI requires GTK (which was not found)"
fi
fi
_gtk=`$_gtkconfig --version 2>&1`
_inc_gtk=`$_gtkconfig --cflags 2>&1`
_ld_gtk=`$_gtkconfig --libs 2>&1`
echores "$_gtk (with $_gtkconfig)"
# Check for GLIB
echocheck "glib version"
if test -z "$_glibconfig" ; then
if ( glib-config --version ) >/dev/null 2>&1 ; then
_glibconfig="glib-config"
elif ( glib12-config --version ) >/dev/null 2>&1 ; then
_glibconfig="glib12-config"
else
die "the GUI requires GLIB (which was not found)"
fi
fi
_glib=`$_glibconfig --version 2>&1`
_inc_glib=`$_glibconfig --cflags 2>&1`
_ld_glib=`$_glibconfig --libs 2>&1`
echores "$_glib (with $_glibconfig)"
_def_gui='#define HAVE_NEW_GUI 1'
_ld_gui='-LGui -lgui $(GTKLIB) $(GLIBLIB)'
echo
echo "Creating Gui/config.mak"
cat > Gui/config.mak << EOF
# -------- Generated by configure -----------
GTKINC = $_inc_gtk
GTKLIBS = $_ld_gtk
GLIBINC = $_inc_glib
GLIBLIBS = $_ld_glib
EOF
else
_def_gui='#undef HAVE_NEW_GUI'
fi
# --------------- GUI specific tests end -------------------
#############################################################################
# Checking for CFLAGS
if test "$_profile" || test "$_debug" ; then
CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
elif test -z "$CFLAGS" ; then
if test "$host_arch" != "mips" ; then
CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer"
else
CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer"
fi
else
cat <<EOF
MPlayer compilation will use CFLAGS set by you, but:
DO NOT BUGREPORT IF IT DOES NOT WORK
It is strongly recommended you let MPlayer choose the correct CFLAGS!
To do so, execute 'CFLAGS= ./configure <options>'
EOF
fi
# Thread support
if linux ; then
CFLAGS="$CFLAGS -D_REENTRANT"
elif bsd ; then
# FIXME bsd needs this so maybe other OS'es
CFLAGS="$CFLAGS -D_THREAD_SAFE"
fi
# 64 bit file offsets?
if test "$_largefiles" = yes || freebsd ; then
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
if test "$_dvdread" = yes ; then
# dvdread support requires this (for off64_t)
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
fi
fi
# Determine OS dependent libs
if cygwin ; then
_confcygwin='TARGET_CYGWIN = yes'
_def_confwin32='#define WIN32'
else
_confcygwin="TARGET_CYGWIN = no"
fi
_ld_arch="$_ld_pthread $_ld_dl $_ld_dl_dynamic"
#bsd && _ld_arch="-rdynamic $_ld_arch"
bsdos && _ld_arch="$_ld_arch -ldvd"
_def_debug='#undef MP_DEBUG'
test "$_debug" && _def_debug='#define MP_DEBUG 1'
_def_linux='#undef TARGET_LINUX'
linux && _def_linux='#define TARGET_LINUX 1'
#############################################################################
echo "Creating config.mak"
cat > config.mak << EOF
# -------- Generated by configure -----------
LANG = C
TARGET_OS = $system_name
prefix = $_prefix
AR = ar
CC = $_cc
# OPTFLAGS = -O4 $_profile $_debug $_march $_mcpu -pipe -fomit-frame-pointer -ffast-math
OPTFLAGS = $CFLAGS
EXTRA_INC = $_inc_extra $_inc_gtk
WIN32_PATH = -DWIN32_PATH=\\"$_win32libdir\\"
STREAMING = $_streaming
VO2 = $_vo2
X11_INC = $_inc_x11
X11DIR = $_ld_static $_ld_x11
X_LIBS = $_ld_static $_ld_x11 $_ld_extra $_ld_gl $_ld_ggi $_ld_dxr3 $_ld_sdl $_ld_dga $_ld_dga2 $_ld_xv $_ld_vm $_ld_svga $_ld_png $_ld_sock $_ld_aa $_ld_vorbis $_ld_xinerama $_ld_mad $_ld_zlib
TERMCAP_LIB = $_ld_static $_ld_termcap
LIRC_LIBS = $_ld_static $_ld_lirc
CSS_USE = $_css
CSS_LIB = $_ld_static $_ld_css
SDL_INC = $_inc_sdl
W32_DEP = $_dep_win32
W32_LIB = $_ld_static $_ld_win32
DS_DEP = $_dep_dshow
DS_LIB = $_ld_static $_ld_dshow
AV_DEP = $_dep_libavcodec
AV_LIB = $_ld_static $_ld_libavcodec
ALSA_LIB = $_ld_alsa
SGI_AUDIO_LIB = $_ld_sgiaudio
ARCH_LIBS = $_ld_static $_ld_arch $_ld_iconv
DIVX4LINUX = $_ld_static $_divx4linux
DECORE_LIBS = $_ld_static $_ld_decore
ENCORE_LIBS = $_ld_static $_ld_encore
HAVE_MLIB = $_mlib
MLIB_INC = $_inc_mlib
MLIB_LIB = $_ld_static $_ld_mlib
MADLIB_LIB = $_madlibdir
STATIC = $_ld_static
# --- Some stuff for autoconfigure ----
$_target_arch
$_confcygwin
TARGET_CPU=$iproc
TARGET_MMX = $_mmx
TARGET_MMX2 = $_mmx2
TARGET_3DNOW = $_3dnow
TARGET_3DNOWEX = $_3dnowex
TARGET_SSE = $_sse
BINUTILS = $_binutils
# --- GUI stuff ---
GTKLIB = $_ld_static $_ld_gtk
GLIBLIB = $_ld_static $_ld_glib
GUI_LIBS = $_ld_static $_ld_gui
GUI = $_gui
DEBUG = -DDEBUG
EOF
#############################################################################
echo "Creating config.h"
cat > config.h << EOF
/* -------- Generated by configure ----------- */
/* define this to use simple idct with patched libavcodec */
#define SIMPLE_IDCT 1
#define USE_OSD 1
#define USE_SUB 1
$_def_debug
$_def_dvdread
/* Common data directory (for fonts, etc) */
#define DATADIR "$_datadir"
/* Define this to compile stream-caching support, it can be enabled via
-cache <kilobytes> */
#define USE_STREAM_CACHE 1
/* Define for using new DivX4Linux library, instead of open-source OpenDivX */
/* You have to change DECORE_LIBS in config.mak too! */
$_def_decore
$_def_encore
/* Define this to enable avg. byte/sec-based AVI sync method by default:
(use -bps or -nobps commandline option for run-time method selection)
-bps gives better sync for vbr mp3 audio, it is now default */
#define AVI_SYNC_BPS 1
/* Undefine this if you want soundcard-only timing by default:
You can still change this with the -alsa or -noalsa command-line option!
(This function was originally impemented to solve ALSA driver's big
buffer problems, but it seems to be useful for every soundcard drivers) */
#define ALSA_TIMER 1
/* Undefine this if you don't want to select mono audio (left or right)
with a stereo MPEG layer 2/3 audio stream. The command-line option
-stereo has three possible values (0 for stereo, 1 for left-only, 2 for
right-only), with 0 being the default.
*/
#define USE_FAKE_MONO 1
/* Undefine this if your soundcard driver has no working select().
If you have kernel Oops, player hangups, or just no audio, you should
try to recompile MPlayer with this option disabled! */
$_def_select
/* define this to use iconv(3) function to codepage conversions */
$_def_iconv
/* define this to use RTC (/dev/rtc) for video timers (LINUX only) */
$_def_rtc
/* set up max. outburst. use 65536 for ALSA 0.5, for others 16384 is enough */
#define MAX_OUTBURST 65536
/* set up audio OUTBURST. Do not change this! */
#ifdef USE_XMMP_AUDIO
#define OUTBURST 4096
#else
//#define OUTBURST 1024
#define OUTBURST 512
#endif
/* Define this if your system has the header file for the OSS sound interface */
$_def_sys_soundcard
/* Define this if your system has the "malloc.h" header file */
$_def_malloc
/* memalign is mapped to malloc if unsupported */
$_def_memalign
#ifndef HAVE_MEMALIGN
# define memalign(a,b) malloc(b)
#endif
/* Define this if your system has the "alloca.h" header file */
$_def_alloca
/* Define this if your system has the "sys/mman.h" header file */
$_def_mman
/* Define this if you have the elf dynamic linker -ldl library */
$_def_dl
/* Define this if you have the kstat kernel statistics library */
$_def_kstat
/* Define this if you have zlib */
$_def_zlib
/* Define this if you have shm support */
$_def_shm
/* Define this if your system has vsscanf */
$_def_vsscanf
/* LIRC (remote control, see www.lirc.org) support: */
$_def_lirc
/* DeCSS support using libcss */
$_def_css
/* Define this to enable MPEG 1/2 image postprocessing (requires FAST cpu!) */
#define MPEG12_POSTPROC 1
/* Define this to enable image postprocessing in libavcodec (requires FAST cpu!) */
$_def_ffpostprocess
#define HAVE_ODIVX_POSTPROCESS 1
/* Win32 DLL support */
$_def_win32
/* DirectShow support */
$_def_dshow
/* ffmpeg's libavcodec support (requires libavcodec source) */
$_def_libavcodec
$_def_libavcodecso
/* use only decoders from libavcodec: */
#define CONFIG_DECODERS 1
/* XAnim DLL support */
$_def_xanim
$_def_xanim_path
/* Use 3dnow/mmxext/sse/mmx optimized fast memcpy() [maybe buggy... signal 4]*/
$_def_fastmemcpy
/* gui support, please do not edit this option */
$_def_gui
#define PREFIX "$_prefix"
/* Audio lib drivers */
$_def_ossaudio
$_def_alsa5
$_def_alsa9
$_def_sunaudio
$_def_sgiaudio
/* Enable fast OSD/SUB renderer (looks ugly, but uses less CPU power) */
#undef FAST_OSD
#undef FAST_OSD_TABLE
/* Enable TV Interface support */
$_def_tv
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
$_def_words_endian
$_def_arch
/* Define this for Cygwin build for win32 */
$_def_confwin32
/* Define this to any prefered value from 386 up to infinity with step 100 */
#define __CPU__ $iproc
$_def_linux
#ifdef sun
#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0"
#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE
#else
#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
#define DEFAULT_DVD_DEVICE "/dev/dvd"
#endif
/*----------------------------------------------------------------------------
**
** NOTE: Instead of modifying these definitions here, use the
** --enable/--disable options of the ./configure script!
** See ./configure --help for details.
**
*---------------------------------------------------------------------------*/
/* termcap flag for getch2.c */
$_def_termcap
/* termios flag for getch2.c */
$_def_termios
/* enable PNG support */
$_def_png
/* libmad support */
$_def_mad
/* enable OggVorbis support */
$_def_vorbis
$_def_streaming
/* Extension defines */
$_def_3dnow // only define if you have 3DNOW (AMD k6-2, AMD Athlon, iDT WinChip, etc.)
$_def_3dnowex // only define if you have 3DNOWEX (AMD Athlon, etc.)
$_def_mmx // only define if you have MMX (newer x86 chips, not P54C/PPro)
$_def_mmx2 // only define if you have MMX2 (Athlon/PIII/4/CelII)
$_def_sse // only define if you have SSE (Intel Pentium III/4 or Celeron II)
#ifdef HAVE_MMX
#define USE_MMX_IDCT 1
#endif
$_def_mlib // Sun mediaLib, available only on solaris
/* libmpeg2 uses a different feature test macro for mediaLib */
#ifdef HAVE_MLIB
#define LIBMPEG2_MLIB 1
#endif
/* libvo options */
#define SCREEN_SIZE_X 1
#define SCREEN_SIZE_Y 1
$_def_x11
$_def_xv
$_def_vm
$_def_xinerama
$_def_gl
$_def_dga
$_def_dga2
$_def_sdl
/* defined for SDLlib with keyrepeat bugs (before 1.2.1) */
$_def_sdlbuggy
$_def_ggi
$_def_3dfx
$_def_tdfxfb
$_def_mga
$_def_xmga
$_def_syncfb
$_def_fbdev
$_def_dxr3
$_def_dvb
$_def_svga
$_def_xdpms
$_def_aa
/* used by GUI: */
$_def_xshape
#if defined(HAVE_GL) || defined(HAVE_X11) || defined(HAVE_XV)
#define X11_FULLSCREEN 1
#endif
EOF
#############################################################################
echo "Creating libvo/config.mak"
_voobj=`echo $_vosrc | sed -e 's/\.c/\.o/g'`
cat > libvo/config.mak << EOF
include ../config.mak
OPTIONAL_SRCS = $_vosrc
OPTIONAL_OBJS = $_voobj
EOF
#############################################################################
echo "Creating libvo2/config.mak"
_vo2obj=`echo $_vo2src | sed -e 's/\.c/\.o/g'`
cat > libvo2/config.mak << EOF
include ../config.mak
OPTIONAL_SRCS = $_vo2src
OPTIONAL_OBJS = $_vo2obj
EOF
#############################################################################
echo "Creating libao2/config.mak"
_aoobj=`echo $_aosrc | sed -e 's/\.c/\.o/g'`
cat > libao2/config.mak << EOF
include ../config.mak
OPTIONAL_SRCS = $_aosrc
OPTIONAL_OBJS = $_aoobj
EOF
#############################################################################
echo "Creating help_mp.h"
cat > help_mp.h << EOF
#include "$_mp_help"
EOF
#############################################################################
cat << EOF
Config files successfully generated by ./configure !
Install prefix: $_prefix
Data directory: $_datadir
'config.h' and 'config.mak' contain your configuration options.
Note: if you alter theses files (for instance CFLAGS) MPlayer may no longer
compile *** DON'T BUGREPORT if you tweak these files ***
'make' will now compile MPlayer and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
EOF
if test "$_mtrr" = yes ; then
echo "Please check mtrr settings at /proc/mtrr (see DOCS/video.html#2.2.1.1)"
echo
fi
if test "$_sdl" = "outdated" ; then
cat <<EOF
You have an outdated version of libSDL installed (older than v1.1.7) and SDL
support has therefore been disabled.
Please upgrade to a more recent version (version 1.1.8 and above are known to
work). You may get this library from: http://www.libsdl.org
You need to re-run ./configure and recompile after updating SDL. If you are
only interested in the libSDL audio drivers, then older version might work.
Use --enable-sdl to force usage of libSDL.
EOF
fi
if x86 ; then
if test "$_win32" = no ; then
if test "$_win32libdir" ; then
cat <<EOF
Failed to find a WIN32 codecs dir at $_win32libdir!
Create it and copy the DLL files there! (You can get them from your windows
directory or download them from:
ftp://ftp.MPlayerHQ.hu/MPlayer/releases/w32codec.zip
EOF
fi
else
if test "$_win32libdir" ; then
echo "Ok, found Win32 codecs directory at $_win32libdir."
else
cat <<EOF
Failed to find a WIN32 codecs dir!
Create it and copy the DLL files there! (You can get them from your windows
directory or download them from:
ftp://ftp.MPlayerHQ.hu/MPlayer/releases/w32codec.zip
EOF
fi
fi
else
cat <<EOF
NOTE: WIN32 codec DLLs are not supported on your CPU ($host_arch).
You may encounter a few AVI files that cannot be played due to missing
opensource video/audio codec support.
EOF
fi
cat <<EOF
If you cannot understand why a test failed please check $TMPLOG.
If you believe it is a bug in configure, please report it.
EOF
# Last move:
rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"