#! /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 do not understand why it failed." exit 1 } # OS test booleans functions issystem() { test "`echo $system_name | tr A-Z a-z`" = "`echo $1 | tr A-Z a-z`" } linux() { issystem "Linux" ; return "$?" ; } sunos() { issystem "SunOS" ; return "$?" ; } irix() { issystem "IRIX" ; return "$?" ; } cygwin() { issystem "CYGWIN" ; return "$?" ; } freebsd() { issystem "FreeBSD" ; return "$?" ; } netbsd() { issystem "NetBSD" ; return "$?" ; } bsdos() { issystem "BSD/OS" ; return "$?" ; } openbsd() { issystem "OpenBSD" ; return "$?" ; } bsd() { freebsd || netbsd || bsdos || openbsd ; return "$?" ; } qnx() { issystem "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 files (fonts, skins) [PREFIX/share/mplayer] --confdir=DIR use this prefix for installing configuration files [same as datadir] Optional features: --disable-mencoder disable mencoder [autodetect] --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] --disable-tv disable TV Interface (tv/dvb grabbers) [enable] --disable-tv-v4l disable Video 4 Linux TV Interface support [autodetect] --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] --disable-mp1e disable libmp1e support (use this option if it does not compile) [enable] --disable-streaming disable network streaming support (support for: http/mms/rtp) [enable] Video: --enable-gl build with OpenGL render support [autodetect] --enable-dga[=n] build with DGA [n in {1, 2} ] 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 [autodetect] --enable-xinerama build with Xinerama support for X11 [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) [autodetect] --enable-3dfx build with 3dfx support [disable] --enable-tdfxfb build with tdfxfb support [disable] --enable-directfb build with DirectFB support [autodetect] 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] --enable-sse2 build with sse2 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" # also check for name (the version checking is only for _gcc_ up for now) # FIXME implement this in ver. check. cc_name=`$_cc -v 2>&1 | tail -1 | cut -d ' ' -f 1` 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 gcc version is crappy RH one, then check if the user has installed the optional # (at least in Rh7.2) gcc3 packages to save them some pain - malc@tmbg.co.uk if test "$cc_verc_fail" ; then echocheck "gcc3 version" _cc=gcc3 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 fi if test "$cc_verc_fail" ; then 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 < /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=no extcheck $_3dnow "3dnow" "femms" || _3dnow=no extcheck $_3dnowex "3dnowex" "pswapd %%mm0, %%mm0" || _3dnowex=no extcheck $_mmx2 "mmx2" "sfence" || _mmx2=no extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _sse=no extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _sse2=no echocheck "mtrr support" echores "$_mtrr" fi _prefix="/usr/local" # GOTCHA: the variables below defines the default behavior for autodetection # and have - unless stated otherwise - at least 2 states : yes no # If autodetection is available then the third state is: auto _libavcodec=auto _libavcodecso=no # changed default to no as it causes problems - atmos _mp1e=auto _mencoder=auto _x11=auto _dga=auto # 1 2 no auto _xv=auto _sdl=auto _nas=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=yes _select=yes _tv=yes _tv_v4l=auto _streaming=yes _divx4linux=auto _lirc=auto _gui=no _termcap=auto _termios=auto _3dfx=no _tdfxfb=no _directfb=auto _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-mencoder) _mencoder=yes ;; --disable-mencoder) _mencoder=no ;; --enable-x11) _x11=yes ;; --disable-x11) _x11=no ;; --enable-xv) _xv=yes ;; --disable-xv) _xv=no ;; --enable-sdl) _sdl=yes ;; --disable-sdl) _sdl=no ;; --enable-nas) _nas=yes ;; --disable-nas) _nas=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-mp1e) _mp1e=yes ;; --disable-mp1e) _mp1e=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-tv-v4l) _tv_v4l=yes ;; --disable-tv-v4l) _tv_v4l=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-directfb) _directfb=yes ;; --disable-directfb) _directfb=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) _select=yes ;; --disable-select) _select=no ;; --enable-dga) _dga=auto ;; # as we don't know if it's 1 or 2 --enable-dga=*) _dga=`echo $ac_option | cut -d '=' -f 2` ;; --disable-dga) _dga=no ;; --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-sse2) _sse2=yes ;; --disable-sse2) _sse2=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` ;; --confdir=*) _confdir=`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" test -z "$_confdir" && _confdir=$_datadir 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' _def_sse2='#undef HAVE_SSE2' test "$_sse2" = yes && _def_sse2='#define HAVE_SSE2 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 limited SSE support. Upgrade kernel or use --disable-sse if you" echo "experience crashes. MPlayer tries to autodetect if your kernel correctly supports" echo "SSE, but you have been warned! If you are using kernel older then 2.2.x you must" echo "upgrade it to get SSE support!" # die "old kernel for this cpu" # works fine on some 2.2.x so don't die (later check will test) else echores "$kernel_version, ok" fi fi ###################### # MAIN TESTS GO HERE # ###################### echocheck "extra headers" if test "$_extraincdir" ; then echores "$_extraincdir" else echores "none" fi echocheck "extra libs" if test "$_extralibdir" ; then echores "$_extralibdir" else echores "none" fi echocheck "kstat" cat > $TMPC << EOF #include 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 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 "nanosleep" # also check for nanosleep cat > $TMPC << EOF #include int main(void) { (void) nanosleep(0, 0); return 0; } EOF _nanosleep=no cc_check $_ld_arch && _nanosleep=yes if test "$_nanosleep" = yes ; then _def_nanosleep='#define HAVE_NANOSLEEP 1' else _def_nanosleep='#undef HAVE_NANOSLEEP' fi echores "$_nanosleep" echocheck "socklib" # for Solaris (socket stuff is in -lsocket, gethostbyname and friends in -lnsl): cat > $TMPC << EOF #include int main(void) { (void) gethostbyname(0); return 0; } EOF cc_check -lsocket && _ld_sock="-lsocket" cc_check -lnsl && _ld_sock="-lnsl" cc_check -lsocket -lnsl && _ld_sock="-lsocket -lnsl" if test "$_ld_sock" ; then echores "yes (using $_ld_sock)" else echores "no" fi echocheck "malloc.h" cat > $TMPC << EOF #include 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 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 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 #include 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 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 and modify at the end (search _ld_dl_dynamic) # also gcc flags are different, but ld flags aren't (-Bdynamic/-Bstatic/-Bsymbolic) #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 void* func(void *arg) { return arg; } int main(void) { pthread_t tid; return pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; } EOF if ( cc_check && $TMPO ) ; then # QNX _ld_pthread='' elif ( cc_check -lpthread && $TMPO ) ; then _ld_pthread='-lpthread' elif ( cc_check -pthread && $TMPO ) ; then _ld_pthread='-pthread' else die "Lib pthread not found. (needed by windows and networking stuff)" fi echores "yes (using $_ld_pthread)" echocheck "sys/soundcard.h" cat > $TMPC << EOF #include 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 cat > $TMPC < $TMPC < int main(void) { return 0; } EOF _termios=no cc_check && _termios=yes _def_termios_h_name='sys/termios.h' fi # second test: if test "$_termios" = no ; then cat > $TMPC < int main(void) { return 0; } EOF _termios=no cc_check && _termios=yes _def_termios_h_name='termios.h' fi if test "$_termios" = yes ; then _def_termios='#define HAVE_TERMIOS 1' _def_termios_h='#undef HAVE_TERMIOS_H' _def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H' if test "$_def_termios_h_name" = 'sys/termios.h' ; then _def_termios_sys_h='#define HAVE_SYS_TERMIOS_H 1' elif test "$_def_termios_h_name" = 'termios.h' ; then _def_termios_h='#define HAVE_TERMIOS_H 1' fi else _def_termios='#undef HAVE_TERMIOS' _def_termios_h_name='' fi echores "$_termios (using: $_def_termios_h_name)" echocheck "shm" if test "$_shm" = auto ; then cat > $TMPC << EOF #include #include int main(void) { shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0); return 0; } EOF _shm=no 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" _vomodules="3dfx $_vomodules" 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" _vomodules="tdfxfb $_vomodules" else _def_tdfxfb='#undef HAVE_TDFXFB' fi echores "$_tdfxfb" echocheck "DirectFB" if test "$_directfb" = auto ; then _directfb=no cat > $TMPC < int main(void) { IDirectFB *foo; return 0; } EOF cc_check -ldirectfb && _directfb=yes fi if test "$_directfb" = yes ; then _def_directfb='#define HAVE_DIRECTFB 1' _vosrc="$_vosrc vo_directfb.c" _vomodules="directfb $_vomodules" _ld_directfb='-ldirectfb' else _def_directfb='#undef HAVE_DIRECTFB' fi echores "$_directfb" # 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 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 "$_inc_x11" ; then for I in /usr/include /usr/X11R6/include /usr/X11/include /usr/openwin/include ; do if test -d "$I/X11" ; then _inc_x11="-I$I" echores "yes (found: $I)" break fi done if test -z "$_inc_x11" ; then _x11=no echores "not found" fi else echores "yes (use: $_inc_x11)" fi if test "$_inc_x11" = "-I/usr/include" ; then _inc_x11="" fi echocheck "X11 libs" if test -z "$_ld_x11" ; then for I in /usr/X11R6/lib /usr/X11/lib /usr/lib32 /usr/openwin/lib ; do if test -d "$I" ; then _ld_x11="-L$I" echores "yes (found: $I)" break; fi done if test -z "$_ld_x11" ; then _x11=no echores "not found" fi else echores "yes (use: $_ld_x11)" fi _ld_x11="$_ld_x11 -lX11 -lXext $_ld_sock" ######### # VIDEO # ######### echocheck "X11" if test "$_x11" = auto || test "$_x11" = yes ; then cat > $TMPC < #include 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" _vomodules="x11 $_vomodules" else _def_x11='#undef HAVE_X11' _inc_x11='' _ld_x11='' fi echores "$_x11" echocheck "DPMS" _xdpms3=no if test "$_x11" = yes ; then cat > $TMPC < #include #include #include #include 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 < #include 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 "yes (using Xdpms 4)" elif test "$_xdpms3" = yes ; then _def_xdpms='#define HAVE_XDPMS 1' _ld_x11="$_ld_x11 -lXdpms" echores "yes (using Xdpms 3)" else _def_xdpms='#undef HAVE_XDPMS' echores "no" fi echocheck "Xv" if test "$_x11" = yes && test "$_xv" != no ; then cat > $TMPC < #include 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" _vomodules="xv $_vomodules" else _def_xv='#undef HAVE_XV' fi echores "$_xv" echocheck "Xinerama" if test "$_x11" = yes && test "$_xinerama" != no ; then cat > $TMPC < #include 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" != no ; then cat > $TMPC < #include 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" # Version 2 is preferred to version 1 if available if test "$_dga" = auto ; then cat > $TMPC << EOF #include #include int main (void) { (void) XF86DGASetViewPort(0, 0, 0, 0); return 0; } EOF _dga=no cc_check $_inc_x11 $_ld_x11 -lXxf86dga -lXxf86vm && _dga=1 cat > $TMPC << EOF #include #include int main (void) { (void) XDGASetViewport(0, 0, 0, 0, 0); return 0; } EOF cc_check $_inc_x11 $_ld_x11 -lXxf86dga && _dga=2 fi _def_dga='#undef HAVE_DGA' _def_dga2='#undef HAVE_DGA2' if test "$_dga" = 1 ; then _def_dga='#define HAVE_DGA 1' _ld_dga='-lXxf86dga' _vosrc="$_vosrc vo_dga.c" _vomodules="dga $_vomodules" echores "yes (using DGA 1.0)" elif test "$_dga" = 2 ; then _def_dga='#define HAVE_DGA 1' _def_dga2='#define HAVE_DGA2 1' _ld_dga='-lXxf86dga' _vosrc="$_vosrc vo_dga.c" _vomodules="dga $_vomodules" echores "yes (using DGA 2.0)" elif test "$_dga" = no ; then echores "no" else die "DGA version must be 1 or 2" fi 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 int main(void) { return 0; } EOF _gl=no if cc_check $_inc_x11 $_ld_x11 -lGL -lm ; then _gl=yes _ld_gl="-lGL" elif cc_check $_inc_x11 $_ld_x11 -lGL -lm $_ld_pthread ; then _gl=yes _ld_gl="-lGL $_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" _vomodules="opengl $_vomodules" 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" _vomodules="mga $_vomodules" 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" _vomodules="xmga $_vomodules" else _def_xmga='#undef HAVE_XMGA' fi echores "$_xmga" echocheck "GGI" if test "$_ggi" = auto ; then cat > $TMPC << EOF #include 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" _vomodules="ggi $_vomodules" else _def_ggi='#undef HAVE_GGI' fi echores "$_ggi" echocheck "AA" if test "$_aa" = auto ; then cat > $TMPC << EOF #include 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" _vomodules="aa $_vomodules" else _def_aa='#undef HAVE_AA' fi echores "$_aa" echocheck "SVGAlib" if test "$_svga" = auto ; then cat > $TMPC << EOF #include #include 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" _vomodules="svga $_vomodules" 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" _vomodules="fbdev $_vomodules" 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' _vomodules="mpegpes(dvb) $_vomodules" else _def_dvb='#undef HAVE_DVB' _vomodules="mpegpes(file) $_vomodules" 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 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" _vomodules="png $_vomodules" else _def_png='#undef HAVE_PNG' fi echocheck "VESA support" if x86 && linux ; then _vosrc="$_vosrc vo_vesa.c vesa_lvo.c" _vomodules="vesa $_vomodules" echores "yes" else echores "no (not supported on this OS/architecture)" 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 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" _vomodules="sdl $_vomodules" _aosrc="$_aosrc ao_sdl.c" _aomodules="sdl $_aomodules" else _def_sdl='#undef HAVE_SDL' fi echores "$_sdl (with $_sdlconfig)" echocheck "NAS" if test "$_nas" = auto || test "$_nas" = yes ; then cat > $TMPC << EOF #include