#! /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 ' # # In this file, a tab is 8 chars and indentation shift is 2 characters # # GOTCHAS: # - config files are currently: # config.h config.mak libvo/config.mak libao2/config.mak Gui/config.mak # ############################################################################# # 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 $CFLAGS $_inc_extra $_ld_static $_ld_extra $TMPC -o $TMPO $@" >> "$TMPLOG" rm -f "$TMPO" ( $_cc $CFLAGS $_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 "$?" ; } hpux() { issystem "HP-UX" ; 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 "$?" ; } darwin() { issystem "Darwin" ; return "$?" ; } gnu() { issystem "GNU" ; return "$?" ; } mingw32() { issystem "MINGW32" ; return "$?" ; } # arch test boolean functions # x86/x86pc is used by QNX x86() { case "$host_arch" in i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;; *) return 1 ;; esac } ppc() { case "$host_arch" in ppc) return 0;; *) return 1;; esac } # not boolean test: implement the posix shell "!" operator for a # non-posix /bin/sh. # usage: not {command} # returns exit status "success" when the execution of "command" # fails. not() { eval "$@" test $? -ne 0 } # 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/help_mp-??.h help/help_mp-??_??.h | sed "s/help\/help_mp-\(..\).h/\1/g" |sed "s/help\/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] --bindir=DIR use this prefix for installing mplayer binary [PREFIX/bin] --datadir=DIR use this prefix for installing machine independent data files (fonts, skins) [PREFIX/share/mplayer] --mandir=DIR use this prefix for installing manpages [PREFIX/man] --confdir=DIR use this prefix for installing configuration files [PREFIX/etc/mplayer] --libdir=DIR use this prefix for object code libraries [PREFIX/lib] Optional features: --disable-mencoder disable mencoder (a/v encoder) compilation [enable] --enable-gui enable gmplayer compilation (gtk-1.2 GUI) [disable] --enable-largefiles enable support for files > 2 GBytes [disable] --enable-linux-devfs set default devices to devfs ones [disable] --enable-termcap use termcap database for key codes [autodetect] --disable-iconv do not use iconv(3) function [autodetect] --disable-setlocale disable setlocale using in mplayer [autodetect] --enable-lirc enable LIRC (remote control) support [autodetect] --enable-joystick enable joystick support [disable] --disable-tv disable TV Interface (tv/dvb grabbers) [enable] --disable-tv-v4l disable Video4Linux TV Interface support [autodetect] --disable-tv-bsdbt848 disable BSD BT848 Interface support [autodetect] --disable-edl disable EDL (edit decision list) support [enable] --disable-rtc disable RTC (/dev/rtc) on Linux [autodetect] --disable-network disable network support (for: http/mms/rtp) [enable] --enable-smb enable Samba (SMB) input support [autodetect] --enable-live enable LIVE.COM Streaming Media support [disable] --enable-dvdnav enable dvdnav support [disable] --disable-dvdread Disable libdvdread support [autodetect] --disable-mpdvdkit Disable mpdvdkit/mpdvdkit2 support [autodetect] --disable-css Disable old-style libcss DVD support [autodetect] --disable-cdparanoia Disable cdparanoia support [autodetect] --disable-freetype Disable freetype2 font rendering support [autodetect] --disable-unrarlib Disable Unique RAR File Library [enabled] --disable-new-conf Disable new experimental config parser code [enabled] --enable-menu Enable osd menu support (needs new config) [disabled] --disable-sortsub Disable subtitles sorting [enabled] --enable-fribidi Enable using the FriBiDi libs [disabled] --disable-macosx Disable Mac OS X specific features [autodetect] --disable-inet6 Disable IPv6 support [autodetect] --disable-gethostbyname2 gethostbyname() is not provided by the c library [autodetect] Codecs: --enable-gif enable gif support [autodetect] --enable-png enable png input/output support [autodetect] --enable-jpeg enable jpeg input/output support [autodetect] --enable-liblzo enable external liblzo support [autodetect] --disable-win32 disable Win32 DLL support [autodetect] --disable-dshow disable Win32/DirectShow support [autodetect] --disable-qtx-codecs disable Quicktime codecs [autodetect] --disable-xanim disable XAnim DLL support [autodetect] --disable-real disable RealPlayer DLL support [autodetect] --disable-xvid disable XviD codec [autodetect] --disable-divx4linux disable DivX4linux/Divx5linux codec [autodetect] --enable-opendivx enable _old_ OpenDivx codec [disable] --disable-libavcodec disable libavcodec [autodetect] --enable-libfame enable libfame realtime encoder [autodetect] --enable-vorbis build with OggVorbis support [autodetect] --enable-tremor build with integer-only OggVorbis support [disabled] --enable-theora build with OggTheora support [autodetect] --enable-matroska build with Matroska support [autodetect] --enable-faad build with FAAD2 (MP4/AAC) support [autodetect] --disable-libdv disable libdv 0.9.5 en/decoding support [autodetect] --disable-mad disable libmad (mpeg audio) support [autodetect] --enable-xmms build with XMMS inputplugin support [disabled] Video output: --disable-vidix disable VIDIX stuff [enable on x86 *nix] --enable-gl build with OpenGL render support [autodetect] --enable-dga[=n] build with DGA [n in {1, 2} ] support [autodetect] --enable-vesa build with VESA 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-directx build with Directx support [autodetect] --enable-dxr2 build with DXR2 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 (for Matrox G200/G4x0/G550) 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 [autodetect] --enable-fbdev=nocopy yuv12 converts directly into framebuffer --enable-mlib build with MLIB support (Solaris only) [autodetect] --enable-3dfx build with obsolete /dev/3dfx support [disable] --enable-tdfxfb build with tdfxfb (Voodoo 3/banshee) support [disable] --enable-directfb build with DirectFB support [autodetect] --enable-zr build with ZR360[56]7/ZR36060 support [autodetect] --enable-bl build with Blinkenlights support [disable] --enable-tdfxvid build with tdfx vid support [disable] Audio output: --disable-ossaudio disable OSS sound support [autodetect] --disable-arts disable aRts sound support [autodetect] --disable-esd disable esd sound support [autodetect] --disable-alsa disable alsa sound support [autodetect] --disable-sunaudio disable Sun sound support [autodetect] --disable-nas disable NAS sound support [autodetect] --disable-win32waveout disable Windows waveout sound support [autodetect] --disable-select disable using select() on audio device [enable] Miscellaneous options: --enable-runtime-cpudetection Enable runtime CPU detection [disable] --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. Set further linking options with --enable-static="-lslang -lncurses" --language=list a white space or comma separated list of languages for translated man pages, the first language is the primary and therefore used for translated messages and GUI (also the environment variable \$LINGUAS is honored) [en] (Available: $LANGUAGES all) --enable-shared-pp install & use shared postprocessing lib --install-path=PATH the path to a custom install program (useful if your OS uses a GNU-incompatible install utility by default and you want to point to the GNU version) 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] --disable-big-endian Force byte order to little endian [autodetect] --enable-big-endian Force byte order to big endian [autodetect] --enable-debug[=1-3] compile debugging information into mplayer [disable] --enable-profile compile profiling information into mplayer [disable] --disable-sighandler disable sighandler for crashes [enable] --enable-i18n _experimental_ gnu gettext() support [autodetect] --enable-dynamic-plugins Enable support for dynamic a/v plugins [disable] Hazardous options a.k.a. "DO NOT REPORT ANY BUGS!" --disable-gcc-checking disable gcc version checking [enable] 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-dxr2incdir=DIR DXR2 headers in DIR --with-csslibdir=DIR libcss in DIR --with-madlibdir=DIR libmad (libmad shared library) in DIR --with-mlibdir=DIR libmlib (MLIB support) in DIR (Solaris only) --with-libdvdnav=DIR libdvdnav in DIR --with-codecsdir=DIR Binary codec files in DIR --with-win32libdir=DIR W*ndows DLL files in DIR --with-xanimlibdir=DIR XAnim DLL files in DIR --with-reallibdir=DIR RealPlayer DLL files in DIR --with-xvidcore=PATH path to XviD libxvidcore.a (e.g. /opt/lib/libxvidcore.a) --with-sdl-config=PATH path to sdl*-config (e.g. /opt/bin/sdl-config) --with-freetype-config=PATH path to freetype-config (e.g. /opt/bin/freetype-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) --with-dvdnav-config=PATH path to dvdnav-config --with-livelibdir=DIR path to LIVE.COM Streaming Media libraries --with-xmmsplugindir=DIR path to xmms plugins --with-xmmslibdir=DIR path to libxmms.so.1 --with-cdparanoiaincdir=DIR cdparanoia headers in DIR --with-cdparanoialibdir=DIR cdparanoia libraries (libcdda_*) in DIR --with-fribidi-config=PATH path to fribidi-config (e.g. /opt/bin/fribidi-config) EOF exit 0 fi done # for parm in ... # 1st pass checking for vital options _install=install _ranlib=ranlib _cc=gcc test "$CC" && _cc="$CC" _as=auto _runtime_cpudetection=no 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` ;; --enable-gcc-checking) _skip_cc_check=no ;; --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'` # _ld_extra="${_ld_extra} -Wl,-R"`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -Wl\,-R,g'`" -L"`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` ;; --enable-runtime-cpudetection) _runtime_cpudetection=yes ;; --disable-runtime-cpudetection) _runtime_cpudetection=no ;; --install-path=*) _install=`echo $ac_option | cut -d '=' -f 2 | sed 's/\/$//'`"/install" ;; 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|Darwin|GNU) ;; IRIX*) system_name=IRIX ;; HP-UX*) system_name=HP-UX ;; [cC][yY][gG][wW][iI][nN]*) system_name=CYGWIN ;; MINGW32*) system_name=MINGW32 ;; *) 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) ;; powerpc) # Darwin returns 'powerpc' host_arch=ppc ;; *) # 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. # x86/x86pc is used by QNX case "`( uname -m ) 2>&1`" in i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;; ia64) host_arch=ia64 ;; x86_64) host_arch=x86_64 ;; ppc) host_arch=ppc ;; alpha) host_arch=alpha ;; sparc*) host_arch=sparc ;; 9000*) host_arch=hppa ;; arm*) host_arch=arm ;; s390) host_arch=s390 ;; s390x) host_arch=s390x ;; mips) host_arch=mips ;; *) host_arch=UNKNOWN ;; esac ;; esac else system_name=`echo $_target | cut -d '-' -f 2` case "`echo $system_name | tr A-Z a-z`" in linux) system_name=Linux ;; freebsd) system_name=FreeBSD ;; netbsd) system_name=NetBSD ;; bsd/os) system_name=BSD/OS ;; openbsd) system_name=OpenBSD ;; sunos) system_name=SunOS ;; qnx) system_name=QNX ;; esac # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed host_arch=`echo $_target | cut -d '-' -f 1 | tr '_' '-'` 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 to have 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 _ldd=ldd if darwin; then _ldd="otool -L" fi # Checking CC version... if test "$_skip_cc_check" != yes ; then for _cc in "$_cc" gcc-3.1 gcc3 gcc-3.0 cc ; do echocheck "$_cc version" cc_name=`( $_cc -v ) 2>&1 | tail -1 | cut -d ' ' -f 1` cc_version=`( $_cc -dumpversion ) 2>&1` if test "$?" -gt 0; then cc_version="not found" fi case $cc_version in '') cc_version="v. ?.??, bad" cc_verc_fail=yes ;; 2.95.[2-9]|2.95.[2-9][-.]*|3.[0-9]|3.[0-9].[0-9]) _cc_major=`echo $cc_version | cut -d '.' -f 1` _cc_minor=`echo $cc_version | cut -d '.' -f 2` _cc_mini=`echo $cc_version | cut -d '.' -f 3` cc_version="$cc_version, ok" cc_verc_fail=no ;; 'not found') cc_verc_fail=yes ;; *) cc_version="$cc_version, bad" cc_verc_fail=yes ;; esac echores "$cc_version" (test "$cc_verc_fail" = "no") && break done if test "$cc_verc_fail" = yes ; then cat < $TMPC << EOF int main() { unsigned long ver, mask; asm ("implver %0" : "=r" (ver)); asm ("amask %1, %0" : "=r" (mask) : "r" (-1)); printf("%ld-%x\n", ver, ~mask); return 0; } EOF $_cc -o "$TMPO" "$TMPC" case `"$TMPO"` in 0-0) proc="ev4" ;; 1-0) proc="ev5" ;; 1-1) proc="ev56" ;; 1-101) proc="pca56" ;; 2-303) proc="ev6" ;; 2-307) proc="ev67" ;; 2-1307) proc="ev68" ;; esac echores "$proc" fi # x86/x86pc is used by QNX case "$host_arch" in i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) _def_arch="#define ARCH_X86 1" _target_arch="TARGET_ARCH_X86 = yes" case "$pvendor" in AuthenticAMD) case "$pfamily" in 3) proc=i386 iproc=386 ;; 4) proc=i486 iproc=486 ;; 5) iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 # TODO: how to determine if model 13 is a k6-2 or a k6-3? Couldn't find anything on amd.com if test "$pmodel" -eq 9; then proc=k6-3 elif test "$pmodel" -ge 8; then proc=k6-2 elif test "$pmodel" -ge 6; then proc=k6 else proc=i586 iproc=586 fi ;; 6) iproc=686 if test "$pmodel" -ge 7; then proc=athlon-4 elif test "$pmodel" -ge 6; then # only Athlon XP supports ssem MP, Duron etc not # but most of them are CPUID 666, so check if sse detected # btw. there is also athlon-mp opt, but we need extended # CPUID to detect if CPU is SMP capable -> athlon-mp ::atmos if test "$_sse" = yes && test "$pstepping" -ge 2; then proc=athlon-xp else proc=athlon-4 fi elif test "$pmodel" -ge 4; then proc=athlon-tbird else proc=athlon # TODO: should the Duron Spitfire be considered a Thunderbird instead? fi ;; *) proc=athlon-xp iproc=686 ;; esac ;; GenuineIntel) case "$pfamily" in 3) proc=i386 iproc=386 ;; 4) proc=i486 iproc=486 ;; 5) iproc=586 if test "$pmodel" -eq 4 || test "$pmodel" -eq 8; then proc=pentium-mmx # 4 is desktop, 8 is mobile else proc=i586 fi ;; 6) iproc=686 if test "$pmodel" -ge 7; then proc=pentium3 elif test "$pmodel" -ge 3; then proc=pentium2 else proc=i686 fi ;; 15) proc=pentium4 iproc=686 ;; *) proc=pentium4 iproc=686 ;; esac ;; unknown) case "$pfamily" in 3) proc=i386 iproc=386 ;; 4) proc=i486 iproc=486 ;; *) proc=i586 iproc=586 ;; esac ;; *) proc=i586 iproc=586 ;; esac # check that gcc supports our CPU, if not, fall back to earlier ones # 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 "$_runtime_cpudetection" = no ; then if test "$proc" = "athlon-xp" || test "$proc" = "athlon-4" || test "$proc" = "athlon-tbird"; then cc_check -march=$proc -mcpu=$proc || proc=athlon fi if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then cc_check -march=$proc -mcpu=$proc || proc=k6 fi if test "$proc" = "k6"; then if not cc_check -march=$proc -mcpu=$proc; then if cc_check -march=i586 -mcpu=i686; then proc=i586-i686 else proc=i586 fi fi fi if test "$proc" = "pentium4" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon"; then cc_check -march=$proc -mcpu=$proc || proc=i686 fi if test "$proc" = "i686" || test "$proc" = "pentium-mmx"; then cc_check -march=$proc -mcpu=$proc || proc=i586 fi if test "$proc" = "i586" ; 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 echores "Your $_cc does not even support \"i386\" for '-march' and '-mcpu'." _mcpu="" _march="" _optimizing="" elif test "$proc" = "i586-i686"; then _march="-march=i586" _mcpu="-mcpu=i686" _optimizing="$proc" else _march="-march=$proc" _mcpu="-mcpu=$proc" _optimizing="$proc" fi else # i686 is probably the most common CPU - optimize for it _mcpu="-mcpu=i686" # at least i486 required, for bswap instruction _march="-march=i486" cc_check $_mcpu || _mcpu="" cc_check $_march $_mcpu || _march="" fi ## Gabucino : --target takes effect here (hopefully...) by overwriting ## autodetected mcpu/march parameters if test "$_target" ; then # TODO: it may be a good idea to check GCC and fall back in all cases if test "$host_arch" = "i586-i686"; then _march="-march=i586" _mcpu="-mcpu=i686" else _march="-march=$host_arch" _mcpu="-mcpu=$host_arch" fi proc="$host_arch" case "$proc" in i386) iproc=386 ;; i486) iproc=486 ;; i586|k5|k6|k6-2|k6-3|pentium|pentium-mmx) iproc=586 ;; i686|athlon*|pentium*) iproc=686 ;; *) iproc=586 ;; esac fi echores "$proc" ;; ia64) _def_arch='#define ARCH_IA64 1' _target_arch='TARGET_ARCH_IA64 = yes' iproc='ia64' proc='' _march='' _mcpu='' ;; x86_64) _def_arch='#define ARCH_X86_64 1' _target_arch='TARGET_ARCH_X86_64 = yes' iproc='x86_64' proc='' _march='' _mcpu='' ;; sparc) _def_arch='#define ARCH_SPARC 1' _target_arch='TARGET_ARCH_SPARC = yes' iproc='sparc' proc='v8' _march='' _mcpu="-mcpu=$proc" ;; arm) _def_arch='#define ARCH_ARM 1' _target_arch='TARGET_ARCH_ARM = yes' iproc=arm proc='' _march='' _mcpu='' ;; ppc) _def_arch='#define ARCH_POWERPC 1' _target_arch='TARGET_ARCH_POWERPC = yes' iproc='ppc' proc='' _march='' _mcpu='' cpu750=`$_cpuinfo | grep "cpu.*750"` if test -n "$cpu750"; then _march='-mcpu=750' _mcpu='-mtune=750' fi if darwin ; then if [[ `sysctl -n hw.vectorunit` == 1 ]]; then _altivec=yes fi fi ;; alpha) _def_arch='#define ARCH_ALPHA 1' _target_arch='TARGET_ARCH_ALPHA = yes' iproc='alpha' _march='' echocheck "GCC & CPU optimization abilities" if test "$proc" = "ev68" ; then cc_check -mcpu=$proc || proc=ev67 fi if test "$proc" = "ev67" ; then cc_check -mcpu=$proc || proc=ev6 fi _mcpu="-mcpu=$proc" echores "$proc" ;; mips) _def_arch='#define ARCH_SGI_MIPS 1' _target_arch='TARGET_ARCH_SGI_MIPS = yes' iproc='sgi-mips' proc='' _march='' _mcpu='' ;; hppa) _def_arch='#define ARCH_PA_RISC 1' _target_arch='TARGET_ARCH_PA_RISC = yes' iproc='PA-RISC' proc='' _march='' _mcpu='' ;; s390) _def_arch='#define ARCH_S390 1' _target_arch='TARGET_ARCH_S390 = yes' iproc='390' proc='' _march='' _mcpu='' ;; s390x) _def_arch='#define ARCH_S390X 1' _target_arch='TARGET_ARCH_S390X = yes' iproc='390x' proc='' _march='' _mcpu='' ;; *) echo "The architecture of your CPU ($host_arch) is not supported by this configure script" echo "It seems nobody has ported MPlayer to your OS or CPU type yet." die "unsupported architecture $host_arch" ;; esac if x86 && test "$_runtime_cpudetection" = no ; then extcheck() { if test "$1" = yes ; then echocheck "kernel support of $2" cat > $TMPC < void catch() { exit(1); } int main(void){ signal(SIGILL, catch); __asm__ __volatile__ ("$3":::"memory");return(0); } EOF if ( cc_check && $TMPO ) > /dev/null 2>&1 ; then echores "yes" _optimizing="$_optimizing $2" 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 0 } extcheck $_mmx "mmx" "emms" || _mmx=no extcheck $_mmx2 "mmx2" "sfence" || _mmx2=no extcheck $_3dnow "3dnow" "femms" || _3dnow=no extcheck $_3dnowex "3dnowex" "pswapd %%mm0, %%mm0" || _3dnowex=no extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _sse=no _gcc3_ext="$_gcc3_ext -mno-sse" extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _sse2=no _gcc3_ext="$_gcc3_ext -mno-sse2" echocheck "mtrr support" echores "$_mtrr" if test "$_mtrr" = yes ; then _optimizing="$_optimizing mtrr" fi if test "$_gcc3_ext" != ""; then # if we had to disable sse/sse2 because the active kernel does not # support this instruction set extension, we also have to tell # gcc3 to not generate sse/sse2 instructions for normal C code cat > $TMPC << EOF int main(void) { return 0; } EOF cc_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext" fi 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=auto _fame=auto _mp1e=no _mencoder=yes _x11=auto _dga=auto # 1 2 no auto _xv=auto _sdl=auto _directx=auto _win32waveout=auto _nas=auto _png=auto _jpg=auto _gif=auto _gl=auto _ggi=auto _aa=auto _svga=auto _vesa=auto _fbdev=auto _fbdev_nocopy=no _dvb=auto _dvbhead=auto _dxr2=auto _dxr3=auto _iconv=auto _rtc=auto _ossaudio=auto _arts=auto _esd=auto _liblzo=auto _mad=auto _vorbis=auto _theora=auto _matroska=auto _tremor=no _faad=auto _xmms=no _css=auto _dvdnav=no _dvdread=auto _dvdkit=auto _xanim=auto _real=auto _live=no _xinerama=auto _mga=auto _xmga=auto _vm=auto _mlib=auto _sgiaudio=auto _sunaudio=auto _alsa=auto _fastmemcpy=yes _unrarlib=yes _win32=auto _dshow=yes _select=yes _tv=yes _tv_v4l=auto _tv_bsdbt848=auto _edl=yes _network=yes _smbsupport=auto _vidix=auto _joystick=no _xvid=auto _divx4linux=auto _opendivx=no _lirc=auto _gui=no _termcap=auto _termios=auto _3dfx=no _tdfxfb=no _tdfxvid=no _directfb=auto _zr=auto _bl=no _largefiles=no #_language=en _shm=auto _linux_devfs=no _i18n=auto _dynamic_plugins=no _setlocale=auto _sighandler=yes _libdv=auto _cdparanoia=auto _big_endian=auto _freetype=auto _shared_pp=no _new_conf=yes _menu=no _qtx_codecs=auto _macosx=auto _sortsub=yes _freetypeconfig='freetype-config' _fribidi=no _fribidiconfig='fribidi-config' _inet6=auto _gethostbyname2=auto for ac_option do case "$ac_option" in # Skip 1st pass --target=*) ;; --cc=*) ;; --as=*) ;; --enable-gcc-checking) ;; --disable-gcc-checking) ;; --enable-static*) ;; --disable-static*) ;; --with-extraincdir=*) ;; --with-extralibdir=*) ;; --enable-runtime-cpudetection) ;; --disable-runtime-cpudetection) ;; --install-path=*) ;; # Real 2nd pass --enable-mencoder) _mencoder=yes ;; --disable-mencoder) _mencoder=no ;; --enable-i18n) _i18n=yes ;; --disable-i18n) _i18n=no ;; --enable-dynamic-plugins) _dynamic_plugins=yes ;; --disable-dynamic-plugins) _dynamic_plugins=no ;; --enable-setlocale) _setlocale=yes ;; --disable-setlocale) _setlocale=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-directx) _directx=yes ;; --disable-directx) _directx=no ;; --enable-win32waveout) _win32waveout=yes ;; --disable-win32waveout) _win32waveout=no ;; --enable-nas) _nas=yes ;; --disable-nas) _nas=no ;; --enable-png) _png=yes ;; --disable-png) _png=no ;; --enable-jpeg) _jpg=yes ;; --disable-jpeg) _jpg=no ;; --enable-gif) _gif=yes ;; --disable-gif) _gif=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-vesa) _vesa=yes ;; --disable-vesa) _vesa=no ;; --enable-fbdev) _fbdev=yes ;; --enable-fbdev=nocopy) _fbdev=yes; _fbdev_nocopy=yes ;; --disable-fbdev) _fbdev=no ;; --enable-dvb) _dvb=yes ;; --disable-dvb) _dvb=no ;; --enable-dvbhead) _dvbhead=yes ;; --disable-dvbhead) _dvbhead=no ;; --enable-dxr2) _dxr2=yes ;; --disable-dxr2) _dxr2=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-libdv) _libdv=yes ;; --disable-libdv) _libdv=no ;; --enable-ossaudio) _ossaudio=yes ;; --disable-ossaudio) _ossaudio=no ;; --enable-arts) _arts=yes ;; --disable-arts) _arts=no ;; --enable-esd) _esd=yes ;; --disable-esd) _esd=no ;; --enable-mad) _mad=yes ;; --disable-mad) _mad=no ;; --enable-liblzo) _liblzo=yes ;; --disable-liblzo) _liblzo=no ;; --enable-vorbis) _vorbis=yes ;; --disable-vorbis) _vorbis=no ;; --enable-tremor) _tremor=yes ;; --disable-tremor) _tremor=no ;; --enable-theora) _theora=yes ;; --disable-theora) _theora=no ;; --enable-matroska) _matroska=yes ;; --disable-matroska) _matroska=no ;; --enable-faad) _faad=yes ;; --disable-faad) _faad=no ;; --enable-xmms) _xmms=yes ;; --enable-css) _css=yes ;; --disable-css) _css=no ;; --enable-dvdread) _dvdread=yes ;; --disable-dvdread) _dvdread=no ;; --enable-mpdvdkit) _dvdkit=yes ;; --disable-mpdvdkit) _dvdkit=no ;; --enable-dvdnav) _dvdnav=yes ;; --disable-dvdnav) _dvdnav=no ;; --enable-xanim) _xanim=yes ;; --disable-xanim) _xanim=no ;; --enable-real) _real=yes ;; --disable-real) _real=no ;; --enable-live) _live=yes ;; --disable-live) _live=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-edl) _edl=yes ;; --disable-edl) _edl=no ;; --enable-tv-bsdbt848) _tv_bsdbt848=yes ;; --disable-tv-bsdbt848) _tv_bsdbt848=no ;; --enable-tv-v4l) _tv_v4l=yes ;; --disable-tv-v4l) _tv_v4l=no ;; --enable-fastmemcpy) _fastmemcpy=yes ;; --disable-fastmemcpy) _fastmemcpy=no ;; --enable-network) _network=yes ;; --disable-network) _network=no ;; --enable-smb) _smbsupport=yes ;; --disable-smb) _smbsupport=no ;; --enable-vidix) _vidix=yes ;; --disable-vidix) _vidix=no ;; --enable-joystick) _joystick=yes ;; --disable-joystick) _joystick=no ;; --enable-xvid) _xvid=yes ;; --disable-xvid) _xvid=no ;; --enable-divx4linux) _divx4linux=yes ;; --disable-divx4linux) _divx4linux=no ;; --enable-opendivx) _opendivx=yes ;; --disable-opendivx) _opendivx=no ;; --enable-libavcodec) _libavcodec=yes ;; --disable-libavcodec) _libavcodec=no ;; --enable-libfame) _fame=yes ;; --disable-libfame) _fame=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-tdfxvid) _tdfxvid=no ;; --enable-tdfxvid) _tdfxvid=yes ;; --disable-tdfxfb) _tdfxfb=no ;; --enable-directfb) _directfb=yes ;; --disable-directfb) _directfb=no ;; --enable-zr) _zr=yes ;; --disable-zr) _zr=no ;; --enable-bl) _bl=yes ;; --disable-bl) _bl=no ;; --enable-mtrr) _mtrr=yes ;; --disable-mtrr) _mtrr=no ;; --enable-largefiles) _largefiles=yes ;; --disable-largefiles) _largefiles=no ;; --enable-shm) _shm=yes ;; --disable-shm) _shm=no ;; --enable-select) _select=yes ;; --disable-select) _select=no ;; --enable-linux-devfs) _linux_devfs=yes ;; --disable-linux-devfs) _linux_devfs=no ;; --enable-cdparanoia) _cdparanoia=yes ;; --disable-cdparanoia) _cdparanoia=no ;; --enable-big-endian) _big_endian=yes ;; --disable-big-endian) _big_endian=no ;; --enable-freetype) _freetype=yes ;; --disable-freetype) _freetype=no ;; --enable-unrarlib) _unrarlib=yes ;; --disable-unrarlib) _unrarlib=no ;; --enable-fribidi) _fribidi=yes ;; --disable-fribidi) _fribidi=no ;; --enable-inet6) _inet6=yes ;; --disable-inet6) _inet6=no ;; --enable-gethostbyname2) _gethostbyname2=yes ;; --disable-gethostbyname2) _gethostbyname2=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 ;; --enable-shared-pp) _shared_pp=yes ;; --disable-shared-pp) _shared_pp=no ;; --enable-new-conf) _new_conf=yes ;; --disable-new-conf) _new_conf=no ;; --enable-menu) _menu=yes ;; --disable-menu) _menu=no ;; --enable-qtx-codecs) _qtx_codecs=yes ;; --disable-qtx-codecs) _qtx_codecs=no ;; --enable-macosx) _macosx=yes ;; --disable-macosx) _macosx=no ;; --enable-sortsub) _sortsub=yes ;; --disable-sortsub) _sortsub=no ;; --language=*) _language=`echo $ac_option | cut -d '=' -f 2` ;; --with-libdvdnav=*) _dvdnavdir=`echo $ac_option | cut -d '=' -f 2` _dvdnav=yes ;; --with-codecsdir=*) _win32libdir=`echo $ac_option | cut -d '=' -f 2` _xanimlibdir=`echo $ac_option | cut -d '=' -f 2` _reallibdir=`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-reallibdir=*) _reallibdir=`echo $ac_option | cut -d '=' -f 2` _real=yes ;; --with-livelibdir=*) _livelibdir=`echo $ac_option | cut -d '=' -f 2` _live=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 ;; --with-xmmslibdir=*) _xmmslibdir=`echo $ac_option | cut -d '=' -f 2` ;; --with-xmmsplugindir=*) _xmmsplugindir=`echo $ac_option | cut -d '=' -f 2` ;; --disable-profile) _profile= ;; --enable-profile) _profile='-p' ;; --enable-debug) _debug='-g' ;; --enable-debug=*) _debug=`echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2` ;; --disable-sighandler) _sighandler=no ;; --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-altivec) _altivec=yes ;; --disable-altivec) _altivec=no ;; --enable-mmx) _mmx=yes ;; --disable-mmx) # 3Dnow! and MMX2 require MMX _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-dxr2incdir=*) _inc_dxr2=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` ;; --with-xvidcore=*) _xvidcore=`echo $ac_option | cut -d '=' -f 2` ;; --with-sdl-config=*) _sdlconfig=`echo $ac_option | cut -d '=' -f 2` ;; --with-freetype-config=*) _freetypeconfig=`echo $ac_option | cut -d '=' -f 2` ;; --with-fribidi-config=*) _fribidiconfig=`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-dvdnav-config=*) _dvdnavconfig=`echo $ac_option | cut -d '=' -f 2` ;; --with-madlibdir=*) _ld_mad=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` ;; --with-cdparanoiaincdir=*) _inc_cdparanoia=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` ;; --with-cdparanoialibdir=*) _ld_cdparanoia=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` ;; --prefix=*) _prefix=`echo $ac_option | cut -d '=' -f 2` ;; --bindir=*) _bindir=`echo $ac_option | cut -d '=' -f 2` ;; --datadir=*) _datadir=`echo $ac_option | cut -d '=' -f 2` ;; --mandir=*) _mandir=`echo $ac_option | cut -d '=' -f 2` ;; --confdir=*) _confdir=`echo $ac_option | cut -d '=' -f 2` ;; --libdir=*) _libdir=`echo $ac_option | cut -d '=' -f 2` ;; *) echo "Unknown parameter: $ac_option" exit 1 ;; esac done # Atmos: moved this here, to be correct, if --prefix is specified test -z "$_bindir" && _bindir="$_prefix/bin" test -z "$_datadir" && _datadir="$_prefix/share/mplayer" test -z "$_mandir" && _mandir="$_prefix/man" test -z "$_confdir" && _confdir="$_prefix/etc/mplayer" test -z "$_libdir" && _libdir="$_prefix/lib" test -z "$_mlibdir" && _mlibdir="$MLIBHOME" 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' _def_altivec='#undef HAVE_ALTIVEC' test "$_altivec" = yes && _def_altivec='#define HAVE_ALTIVEC 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 the kernel or use --disable-sse if you" echo "experience crashes. MPlayer tries to autodetect if your kernel correctly" echo "supports SSE, but you have been warned! If you are using a kernel older than" echo "2.2.x you must upgrade it to get SSE support!" # die "Your kernel is too old 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 if test "$_vidix" = auto ; then _vidix=no # should check for x86 systems supporting VIDIX (does QNX have VIDIX?) x86 && _vidix=yes ppc && linux && _vidix=yes cygwin && _vidix=no mingw32 && _vidix=no qnx && _vidix=no sunos && _vidix=no fi if mingw32 ; then _def_stream_cache='#undef USE_STREAM_CACHE' else _def_stream_cache='#define USE_STREAM_CACHE 1' fi # On QNX we must link to libph - Gabucino if qnx ; then _ld_arch="$_ld_arch -lph" fi # checking for a working awk, I'm using mawk first, because it's fastest - atmos _awk= if test "$_vidix" = yes ; then _awk_verc_fail=yes echocheck "awk" for _awk in mawk gawk nawk awk; do if ( $_awk 'BEGIN{testme();}function testme(){print"";}' ) >> "$TMPLOG" 2>&1; then _awk_verc_fail=no break fi done test "$_awk_verc_fail" = yes && _awk=no echores "$_awk" if test "$_awk_verc_fail" = yes; then echo "VIDIX needs awk, but no working implementation was found!" echo "Try the GNU version, which can be downloaded from:" echo "ftp://ftp.gnu.org/gnu/gawk/" echo "If you don't need VIDIX, you can use configure --disable-vidix instead." die "no awk" fi fi # If IRIX we must use ar instead of ranlib (not present on IRIX systems) if irix ; then _ranlib='ar -r' fi ###################### # MAIN TESTS GO HERE # ###################### echocheck "extra headers" if test "$_inc_extra" ; then echores "$_inc_extra" else echores "none" fi echocheck "extra libs" if test "$_ld_extra" ; then echores "$_ld_extra" else echores "none" fi # Checking for localization ... # CSAK EGY MARADHAT - A HEGYLAKO echocheck "i18n" if test "$_i18n" != no ; then cat > $TMPC < int main(void) { gettext("test"); return 0; } EOF _i18n=no _i18n_libs="" if test "$_i18n" = auto ; then cc_check && _i18n=yes else for i18n_lib in "" "-lintl"; do cc_check $i18n_lib && _i18n=yes && _i18n_libs=$i18n_lib && break done fi fi if test "$_i18n" = yes ; then _def_i18n='#define USE_I18N 1' else _def_i18n='#undef USE_I18N' fi if test -z "$_i18n_libs" ; then echores "$_i18n" else echores "$_i18n (using $_i18n_libs)" fi # Checking for setlocale() ... # CSAK EGY MARADHAT - A HEGYLAKO # Nemnem. a TV Maci ! echocheck "setlocale()" if test "$_setlocale" = auto ; then cat > $TMPC < int main(void) { setlocale( LC_ALL,"" ); return 0; } EOF _setlocale=no cc_check && _setlocale=yes fi if test "$_setlocale" = yes ; then _def_setlocale='#define USE_SETLOCALE 1' else _def_setlocale='#undef USE_SETLOCALE' fi echores "$_setlocale" echocheck "language" test -z "$_language" && _language=$LINGUAS _language=`echo $_language | sed 's/,/ /g'` echo $_language | grep all > /dev/null || LANGUAGES="$_language en" for i in $_language ; do test "$i" = all && i=en if test -f "help/help_mp-${i}.h" ; then _language=$i break else echo -n "$i not found, " _language=`echo $_language | sed "s/$i *//g"` fi done test -z "$_language" && _language=en for i in $LANGUAGES ; do if test -f "DOCS/$i/mplayer.1" ; then LANGUAGES=`echo $LANGUAGES | sed "s/$i *//2" | sed 's/ *$//'` else LANGUAGES=`echo $LANGUAGES | sed "s/$i *//g" | sed 's/ *$//'` fi done echores "using $_language (man pages: $LANGUAGES)" _mp_help="help/help_mp-${_language}.h" test -f $_mp_help || die "$_mp_help not found" echocheck "enable sighandler" if test "$_sighandler" = yes ; then _def_sighandler='#define ENABLE_SIGHANDLER 1' else _def_sighandler='#undef ENABLE_SIGHANDLER' fi echores "$_sighandler" echocheck "runtime cpudetection" if test "$_runtime_cpudetection" = yes ; then _def_runtime_cpudetection='#define RUNTIME_CPUDETECT 1' else _def_runtime_cpudetection='#undef RUNTIME_CPUDETECT' fi echores "$_runtime_cpudetection" echocheck "restrict keyword" for restrict_keyword in restrict __restrict __restrict__ ; do echo "void foo(char * $restrict_keyword p); int main(){}" > $TMPC if cc_check; then _def_restrict_keyword=$restrict_keyword break; fi done if [ -n "$_def_restrict_keyword" ]; then echores "$_def_restrict_keyword" 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 "lrintf" cat > $TMPC << EOF #include int main(void) { (void) lrintf(0.0); return 0; } EOF _lrintf=no cc_check -lm && _lrintf=yes if test "$_lrintf" = yes ; then _def_lrintf="#define HAVE_LRINTF 1" else _def_lrintf="#undef HAVE_LRINTF" fi echores "$_lrintf" 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 _use_aton=no echocheck "inet_pton()" cat > $TMPC << EOF #include #include #include int main(void) { (void) inet_pton(0, 0, 0); return 0; } EOF if cc_check $_ld_sock ; then # NOTE: Linux has libresolv but does not need it : echores "yes (using $_ld_sock)" elif cc_check $_ld_sock -lresolv ; then # NOTE: needed for SunOS at least _ld_sock="$_ld_sock -lresolv" echores "yes (using $_ld_sock)" else echores "no (=> i'll try inet_aton next)" echocheck "inet_aton()" cat > $TMPC << EOF #include #include #include int main(void) { (void) inet_aton(0, 0); return 0; } EOF _use_aton=yes if cc_check $_ld_sock ; then # NOTE: Linux has libresolv but does not need it : echores "yes (using $_ld_sock)" elif cc_check $_ld_sock -lresolv ; then # NOTE: needed for SunOS at least _ld_sock="$_ld_sock -lresolv" echores "yes (using $_ld_sock)" else _use_aton=no _network=no echores "no (=> network support disabled)" fi fi _def_use_aton='#undef USE_ATON' if test "$_use_aton" != no; then _def_use_aton='#define USE_ATON 1' fi echocheck "inttypes.h (required)" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _inttypes=no cc_check && _inttypes=yes if test "$_inttypes" = yes ; then # nothing to do : else die "cannot find header inttypes.h (see DOCS/faq.html)" fi echores "$_inttypes" echocheck "word size" _mp_wordsize="#undef MP_WORDSIZE" cat > $TMPC << EOF #include #include int main(void) { printf("%d\n", sizeof(size_t)*8); return 0; } EOF cc_check && _wordsize=`$TMPO` && _mp_wordsize="#define MP_WORDSIZE $_wordsize" echores "$_wordsize" echocheck "stddef.h" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _stddef=no cc_check && _stddef=yes if test "$_stddef" = yes ; then _def_stddef='#define HAVE_STDDEF_H 1' else _def_stddef='#undef HAVE_STDDEF_H' fi echores "$_stddef" 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 and OpenBSD (freebsd || openbsd) && _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 a/v plugins support" if test "$_dl" = no ; then _dynamic_plugins=no fi if test "$_dynamic_plugins" = yes ; then _def_dynamic_plugins='#define DYNAMIC_PLUGINS 1' else _def_dynamic_plugins='#undef DYNAMIC_PLUGINS' fi echores "$_dynamic_plugins" #echocheck "dynamic linking" # FIXME !! make this dynamic detection 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 mingw32 ; then _ld_pthread='' elif ( 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 if test "$_ld_static" ; then # for crosscompilation, we cannot execute the program, be happy if we can link statically if ( cc_check -lpthread ) ; then _ld_pthread='-lpthread' elif ( cc_check -pthread ) ; then _ld_pthread='-pthread' else die "Static lib pthread not found (needed by Windows and networking stufff)." fi else die "Lib pthread not found (needed by Windows and networking stuff)." fi 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' _inc_soundcard='#include ' else _def_sys_soundcard='#undef HAVE_SYS_SOUNDCARD_H' fi echores "$_sys_soundcard" if test "$_sys_soundcard" != yes ; then echocheck "soundcard.h" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _soundcard=no cc_check && _soundcard=yes if linux || test "$_ossaudio" != no ; then # use soundcard.h on Linux, or when OSS support is enabled echores "$_soundcard" else # we don't want to use soundcard.h on non-Linux if OSS support not enabled! echores "$_soundcard, but ignored!" _soundcard=no fi if test "$_soundcard" = yes ; then _def_soundcard='#define HAVE_SOUNDCARD_H 1' _inc_soundcard='#include ' else _def_soundcard='#undef HAVE_SOUNDCARD_H' fi else _def_soundcard='#undef HAVE_SOUNDCARD_H' fi echocheck "sys/dvdio.h" cat > $TMPC << EOF #include #include int main(void) { return 0; } EOF _dvdio=no cc_check && _dvdio=yes if test "$_dvdio" = yes ; then _def_dvdio='#define DVD_STRUCT_IN_SYS_DVDIO_H 1' else _def_dvdio='#undef DVD_STRUCT_IN_SYS_DVDIO_H' fi echores "$_dvdio" echocheck "sys/cdio.h" cat > $TMPC << EOF #include #include int main(void) { return 0; } EOF _cdio=no cc_check && _cdio=yes if test "$_cdio" = yes ; then _def_cdio='#define DVD_STRUCT_IN_SYS_CDIO_H 1' else _def_cdio='#undef DVD_STRUCT_IN_SYS_CDIO_H' fi echores "$_cdio" echocheck "linux/cdrom.h" cat > $TMPC << EOF #include #include int main(void) { return 0; } EOF _cdrom=no cc_check && _cdrom=yes if test "$_cdrom" = yes ; then _def_cdrom='#define DVD_STRUCT_IN_LINUX_CDROM_H 1' else _def_cdrom='#undef DVD_STRUCT_IN_LINUX_CDROM_H' fi echores "$_cdrom" echocheck "dvd.h" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _dvd=no cc_check && _dvd=yes if test "$_dvd" = yes ; then _def_dvd='#define DVD_STRUCT_IN_DVD_H 1' else _def_dvd='#undef DVD_STRUCT_IN_DVD_H' fi echores "$_dvd" echocheck "BSDI dvd.h" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _bsdi_dvd=no cc_check && _bsdi_dvd=yes if test "$_bsdi_dvd" = yes ; then _def_bsdi_dvd='#define DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H 1' else _def_bsdi_dvd='#undef DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H' fi echores "$_bsdi_dvd" echocheck "HPUX SCSI header" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _hpux_scsi_h=no cc_check && _hpux_scsi_h=yes if test "$_hpux_scsi_h" = yes ; then _def_hpux_scsi_h='#define HPUX_SCTL_IO 1' else _def_hpux_scsi_h='#undef HPUX_SCTL_IO' fi echores "$_hpux_scsi_h" echocheck "userspace SCSI headers (Solaris)" cat > $TMPC << EOF # include # include # include # include int main(void) { return 0; } EOF _sol_scsi_h=no cc_check && _sol_scsi_h=yes if test "$_sol_scsi_h" = yes ; then _def_sol_scsi_h='#define SOLARIS_USCSI 1' else _def_sol_scsi_h='#undef SOLARIS_USCSI' fi echores "$_sol_scsi_h" 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 echores "yes (using $_def_termios_h_name)" else _def_termios='#undef HAVE_TERMIOS' _def_termios_h_name='' echores "no" fi 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" # XXX: FIXME, add runtime checking echocheck "linux devfs" echores "$_linux_devfs" echocheck "scandir()" cat > $TMPC << EOF int main (void) { scandir("", 0, 0, 0); alphasort(0, 0); return 0; } EOF _scandir=no cc_check && _scandir=yes if test "$_scandir" = yes ; then _def_scandir='#define HAVE_SCANDIR 1' else _def_scandir='#undef HAVE_SCANDIR' fi echores "$_scandir" echocheck "strsep()" cat > $TMPC << EOF #include int main (void) { char *s = "Hello, world!"; (void) strsep(&s, ","); return 0; } EOF _strsep=no cc_check && _strsep=yes if test "$_strsep" = yes ; then _def_strsep='#define HAVE_STRSEP 1' else _def_strsep='#undef HAVE_STRSEP' fi echores "$_strsep" 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 "posix select()" cat > $TMPC << EOF #include #include #include #include #include #include int main(void) {int nfds = 1; fd_set readfds; struct timeval timeout; select(nfds,&readfds,NULL,NULL,&timeout); return 0; } EOF _posix_select=no cc_check && _posix_select=yes if test "$_posix_select" = no ; then _def_no_posix_select='#define HAVE_NO_POSIX_SELECT 1' else _def_no_posix_select='#undef HAVE_NO_POSIX_SELECT' fi echores "$_posix_select" echocheck "gettimeofday()" cat > $TMPC << EOF #include #include int main(void) {struct timeval tv_start; gettimeofday(&tv_start, NULL); return 0; } EOF _gettimeofday=no cc_check && _gettimeofday=yes if test "$_gettimeofday" = yes ; then _def_gettimeofday='#define HAVE_GETTIMEOFDAY 1' else _def_gettimeofday='#undef HAVE_GETTIMEOFDAY' fi echores "$_gettimeofday" echocheck "glob()" cat > $TMPC << EOF #include #include int main(void) { glob_t gg; glob("filename",0,NULL,&gg); return 0; } EOF _glob=no cc_check && _glob=yes if test "$_glob" = yes ; then _def_glob='#define HAVE_GLOB 1' else _def_glob='#undef HAVE_GLOB' fi echores "$_glob" echocheck "sys/sysinfo.h" cat > $TMPC << EOF #include int main(void) { struct sysinfo s_info; sysinfo(&s_info); return 0; } EOF _sys_sysinfo=no cc_check && _sys_sysinfo=yes if test "$_sys_sysinfo" = yes ; then _def_sys_sysinfo='#define HAVE_SYS_SYSINFO_H 1' _inc_sysinfo='#include ' else _def_sys_sysinfo='#undef HAVE_SYS_SYSINFO_H' fi echores "$_sys_sysinfo" echocheck "Mac OS X APIs" if test "$_macosx" = auto ; then if darwin && ppc; then _macosx=yes else _macosx=no _def_macosx='#undef MACOSX' _noaomodules="macosx $_noaomodules" fi fi if test "$_macosx" = yes ; then cat > $TMPC < #include #include int main(void) { EnterMovies(); ExitMovies(); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); } EOF if cc_check -framework Carbon -framework QuickTime -framework CoreAudio; then _macosx=yes _macosx_frameworks="-framework Carbon -framework QuickTime -framework CoreAudio" _def_macosx='#define MACOSX 1' _aosrc="$_aosrc ao_macosx.c" _aomodules="macosx $_aomodules" else _macosx=no _def_macosx='#undef MACOSX' _noaomodules="macosx $_noaomodules" fi fi echores "$_macosx" echocheck "Samba support (libsmbclient)" if test "$_smbsupport" = auto; then _smbsupport=no cat > $TMPC << EOF #include int main(void) { smbc_opendir("smb://"); return 0; } EOF if cc_check -lsmbclient ; then # this is not working for me becouse it needs -ldl and some NIS (YP) libs # $_ld_dl and -lyp ? should be added _smbsupport=yes fi fi if test "$_smbsupport" = yes; then _ld_smb="-lsmbclient" _def_smbsupport="#define LIBSMBCLIENT" _inputmodules="smb $_inputmodules" else _def_smbsupport="#undef LIBSMBCLIENT" _noinputmodules="smb $_noinputmodules" fi echores "$_smbsupport" ######### # VIDEO # ######### 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' _novomodules="3dfx $_novomodules" 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' _novomodules="tdfxfb $_novomodules" fi echores "$_tdfxfb" echocheck "tdfxvid" if test "$_tdfxvid" = yes ; then _def_tdfxvid='#define HAVE_TDFX_VID 1' _vosrc="$_vosrc vo_tdfx_vid.c" _vomodules="tdfx_vid $_vomodules" else _def_tdfxvid='#undef HAVE_TDFX_VID' _novomodules="tdfx_vid $_novomodules" fi echores "$_tdfxfb" echocheck "DirectFB headers presence" if test -z "$_inc_directfb" ; then for I in /usr/include /usr/local/include; do if test -d "$I/directfb" && test -f "$I/directfb/directfb.h" ; then _inc_directfb="-I$I/directfb" echores "yes (using $_inc_directfb)" break fi if test -d "$I" && test -f "$I/directfb.h" ; then _inc_directfb="-I$I" echores "yes (using $_inc_directfb)" break fi done if test -z "$_inc_directfb" ; then _directfb=no echores "not found" fi else echores "yes (using $_inc_directfb)" fi if test "$_inc_directfb" = "-I/usr/include" ; then _inc_directfb="" fi echocheck "DirectFB" if test "$_directfb" = auto ; then _directfb=no cat > $TMPC < int main(void) { IDirectFB *foo; return 0; } EOF linux && test -c /dev/fb0 && cc_check $_inc_directfb -ldirectfb && _directfb=yes fi if test "$_directfb" = yes; then cat > $TMPC < int main(void) { printf ("%i",(directfb_major_version*100+directfb_minor_version)*100+directfb_micro_version); return 0; } EOF if cc_check $_inc_directfb -ldirectfb && "$TMPO" >> "$TMPLOG" ; then _directfb_version=`"$TMPO"` _def_directfb_version="#define DIRECTFBVERSION $_directfb_version" echores "yes ($_directfb_version)" else _directfb=no echores "no (failed to get version)" fi else echores "$_directfb" fi if test "$_directfb" = yes ; then _def_directfb='#define HAVE_DIRECTFB 1' if test "$_directfb_version" -ge 913; then _vosrc="$_vosrc vo_directfb2.c" else _vosrc="$_vosrc vo_directfb.c" fi _vomodules="directfb $_vomodules" _ld_directfb='-ldirectfb' if test "$_directfb_version" -ge 915; then _vosrc="$_vosrc vo_dfbmga.c" _vomodules="dfbmga $_vomodules" fi else _def_directfb='#undef HAVE_DIRECTFB' _novomodules="directfb $_novomodules" _inc_directfb="" fi echocheck "X11 headers presence" if test -z "$_inc_x11" ; then for I in /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/include /usr/openwin/include ; do if test -d "$I/X11" && test -f "$I/X11/Xlib.h" ; then _inc_x11="-I$I" echores "yes (using $I)" break fi done if test -z "$_inc_x11" ; then _x11=no echores "not found (check if the dev(el) packages are installed)" fi else echores "yes (using $_inc_x11)" fi if test "$_inc_x11" = "-I/usr/include" ; then _inc_x11="" fi echocheck "X11 libs presence" if test -z "$_ld_x11" ; then for I in /usr/X11R6/lib /usr/lib/X11R6 /usr/X11/lib /usr/lib32 /usr/openwin/lib /usr/X11R6/lib64 ; do if test -d "$I" && ( test -f "$I/libX11.so" || test -f "$I/libX11.a" ) ; then _ld_x11="-L$I" echores "yes (using $I)" break; fi done if test -z "$_ld_x11" ; then _x11=no echores "not found (check if the dev(el) packages are installed)" fi else echores "yes (using $_ld_x11)" fi _ld_x11="$_ld_x11 -lXext -lX11 $_ld_sock" echocheck "X11" if test "$_x11" != no ; 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 x11_common.c vo_x11.c vo_xover.c" _vomodules="x11 xover $_vomodules" else _def_x11='#undef HAVE_X11' _inc_x11='' _ld_x11='' _novomodules="x11 $_novomodules" 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 -lXdpms $_ld_x11 && _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="-lXdpms $_ld_x11" 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 -lXv $_ld_x11 && _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' _novomodules="xv $_novomodules" 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 -lXinerama $_ld_x11 && _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 #include int main(void) { (void) XF86VidModeQueryExtension(0, 0, 0); return 0; } EOF _vm=no cc_check $_inc_x11 -lXxf86vm $_ld_x11 && _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 -lXxf86dga -lXxf86vm $_ld_x11 && _dga=1 cat > $TMPC << EOF #include #include int main (void) { (void) XDGASetViewport(0, 0, 0, 0, 0); return 0; } EOF cc_check $_inc_x11 -lXxf86dga $_ld_x11 && _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" _novomodules="dga $_novomodules" else die "DGA version must be 1 or 2" fi echocheck "OpenGL" cygwin && _gl=no #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' _novomodules="opengl $_novomodules" 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' _novomodules="mga $_novomodules" 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' _novomodules="xmga $_novomodules" 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' _novomodules="ggi $_novomodules" 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' if cygwin ; then _ld_aa=`aalib-config --libs | cut -d " " -f 2,5,6` else _ld_aa='-laa' fi _vosrc="$_vosrc vo_aa.c" _vomodules="aa $_vomodules" else _def_aa='#undef HAVE_AA' _novomodules="aa $_novomodules" 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 -lm && _svga=yes fi if test "$_svga" = yes ; then _def_svga='#define HAVE_SVGALIB 1' _ld_svga='-lvgagl -lvga -lm' _vosrc="$_vosrc vo_svga.c" _vomodules="svga $_vomodules" else _def_svga='#undef HAVE_SVGALIB' _novomodules="svga $_novomodules" fi echores "$_svga" echocheck "FBDev" if test "$_fbdev" = auto ; then _fbdev=no linux && test -c /dev/fb0 && _fbdev=yes fi if test "$_fbdev" = yes ; then _def_fbdev='#define HAVE_FBDEV 1' _vosrc="$_vosrc vo_fbdev.c" _vomodules="fbdev $_vomodules" if test "$_fbdev_nocopy" = yes ; then _def_fbdev_nocopy='#define USE_CONVERT2FB 1' fi else _def_fbdev='#undef HAVE_FBDEV' _def_fbdev_nocopy='#undef USE_CONVERT2FB' _novomodules="fbdev $_novomodules" fi echores "$_fbdev" echocheck "DVB" if test "$_dvb" != no ; then _dvb=no cat >$TMPC << EOF #include #include #include #include #include #include #include #include #include #include int main(void) {return 0;} EOF if cc_check ; then _dvb=yes echores "yes" else for I in "-I/usr/src/DVB/ost/include" "$_inc_extra/ost/include" ; do if cc_check "$I" ; then _dvb=yes _inc_dvb="$I" echores "yes (using $_inc_dvb)" break fi done test "$_dvb" = no && echores "no (specify path to DVB/ost/include with --with-extraincdir=DIR)" fi else echores "no" fi if test "$_dvb" = yes ; then _def_dvb='#define HAVE_DVB 1' _def_dvb_in='#define HAS_DVBIN_SUPPORT 1' _aomodules="mpegpes(dvb) $_aomodules" _vomodules="mpegpes(dvb) $_vomodules" fi if test "$_dvbhead" != no ; then echocheck "DVB HEAD" if test "$_dvbhead" != no ; then _dvbhead=no cat >$TMPC << EOF #include #include #include #include #include #include #include #include #include int main(void) {return 0;} EOF if cc_check ; then _dvbhead=yes echores "yes" else for I in "-I/usr/src/DVB/include" "$_inc_extra/include/linux" ; do if cc_check "$I" ; then _dvbhead=yes _inc_dvb="$I" echores "yes (using $_inc_dvb)" break fi done test "$_dvbhead" = no && echores "no (specify path to DVB/include (HEAD Version) with --with-extraincdir=DIR)" fi else echores "no" fi if test "$_dvbhead" = yes ; then _def_dvb='#define HAVE_DVB_HEAD 1' _def_dvb_in='#define HAS_DVBIN_SUPPORT 1' _aomodules="mpegpes(dvb) $_aomodules" _vomodules="mpegpes(dvb) $_vomodules" fi fi if test "$_dvbhead" = no && test "$_dvb" = no ; then _def_dvb='#undef HAVE_DVB' _def_dvb_in='#undef HAS_DVBIN_SUPPORT ' _aomodules="mpegpes(file) $_aomodules" _vomodules="mpegpes(file) $_vomodules" fi if test "$_dvb" = yes || test "$_dvbhead" = yes ; then _dvbin=yes else _dvbin=no fi 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 #include int main(void) { printf("png.h : %s\n", PNG_LIBPNG_VER_STRING); printf("libpng: %s\n", png_libpng_ver); return (strcmp(PNG_LIBPNG_VER_STRING, png_libpng_ver)); } EOF if cc_check -lpng -lz -lm ; then if "$TMPO" >> "$TMPLOG" ; then _png=yes echores yes else echores "no (mismatch of library and header versions)" fi else echores no fi 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" _mkf_png="yes" else _def_png='#undef HAVE_PNG' _novomodules="png $_novomodules" _mkf_png="no" fi echocheck "JPEG support" if test "$_jpg" = auto ; then _jpg=no cat > $TMPC << EOF #include #include #include #include #include int main(void) { return 0; } EOF if cc_check -ljpeg -lm ; then if "$TMPO" >> "$TMPLOG" ; then _jpg=yes fi fi fi echores "$_jpg" if test "$_jpg" = yes ; then _def_jpg='#define HAVE_JPEG 1' _vosrc="$_vosrc vo_jpeg.c" _vomodules="jpeg $_vomodules" _ld_jpg="-ljpeg" _mkf_jpg="yes" else _def_jpg='#undef HAVE_JPEG' _novomodules="jpeg $_novomodules" _mkf_jpg="no" fi echocheck "GIF support" if test "$_gif" = auto ; then _gif=no cat > $TMPC << EOF #include int main(void) { return 0; } EOF if cc_check -lungif && "$TMPO" >> "$TMPLOG" ; then _gif=yes _ld_gif="-lungif" elif cc_check -lungif $_ld_x11 && "$TMPO" >> "$TMPLOG" ; then _gif=yes _ld_gif="-lungif $_ld_x11" elif cc_check -lgif && "$TMPO" >> "$TMPLOG" ; then _gif=yes _ld_gif="-lgif" elif cc_check -lgif $_ld_x11 && "$TMPO" >> "$TMPLOG" ; then _gif=yes _ld_gif="-lgif $_ld_x11" fi fi if test "$_gif" = yes ; then _def_gif='#define HAVE_GIF 1' _vosrc="$_vosrc vo_gif89a.c" _codecmodules="gif $_codecmodules" _vomodules="gif89a $_vomodules" _mkf_gif="yes" _gif="yes (old version, some encoding functions disabled)" _def_gif_4='#undef HAVE_GIF_4' cat > $TMPC << EOF #include #include void catch() { exit(1); } int main(void) { signal(SIGSEGV, catch); // catch segfault printf("EGifPutExtensionFirst is at address %p\n", EGifPutExtensionFirst); EGifSetGifVersion("89a"); // this will segfault a buggy gif lib. return 0; } EOF if cc_check "$_ld_gif" && ( "$TMPO" ) >>"$TMPLOG" 2>&1 ; then _def_gif_4='#define HAVE_GIF_4 1' _gif="yes" fi else _def_gif='#undef HAVE_GIF' _def_gif_4='#undef HAVE_GIF_4' _novomodules="gif89a $_novomodules" _nocodecmodules="gif $_codecmodules" _mkf_gif="no" fi echores "$_gif" case "$_gif" in yes*) echocheck "broken giflib workaround" _def_gif_tvt_hack='#define HAVE_GIF_TVT_HACK 1' cat > $TMPC << EOF #include int main(void) { GifFileType gif; printf("UserData is at address %p\n", gif.UserData); return 0; } EOF if cc_check "$_ld_gif" && ( "$TMPO" ) >>"$TMPLOG" 2>&1 ; then _def_gif_tvt_hack='#undef HAVE_GIF_TVT_HACK' echores "disabled" else echores "enabled" fi ;; esac if test "$_vesa" != no ; then echocheck "VESA support" if x86 && linux ; then _def_vesa='#define HAVE_VESA 1' _vosrc="$_vosrc vo_vesa.c vesa_lvo.c" _vomodules="vesa $_vomodules" echores "yes" else _def_vesa='#undef HAVE_VESA' _novomodules="vesa $_novomodules" echores "no (not supported on this OS/architecture)" fi else _def_vesa='#undef HAVE_VESA' fi ################# # VIDEO + AUDIO # ################# echocheck "SDL" if test -z "$_sdlconfig" ; then if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then _sdlconfig="sdl-config" elif ( sdl11-config --version ) >>"$TMPLOG" 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(int argc, char *argv[]) { return 0; } EOF _sdl=no if "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then if cc_check `$_sdlconfig --cflags` `$_sdlconfig --libs` >>"$TMPLOG" 2>&1 ; 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' if cygwin ; then _ld_sdl=`$_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/` _inc_sdl=`$_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/` else _ld_sdl=`$_sdlconfig --libs` _inc_sdl=`$_sdlconfig --cflags` fi _vosrc="$_vosrc vo_sdl.c" _vomodules="sdl $_vomodules" _aosrc="$_aosrc ao_sdl.c" _aomodules="sdl $_aomodules" echores "yes (using $_sdlconfig)" else _def_sdl='#undef HAVE_SDL' _novomodules="sdl $_novomodules" _noaomodules="sdl $_noaomodules" echores "no" fi echocheck "Windows waveout" if test "$_win32waveout" = auto ; then cat > $TMPC << EOF #include #include int main(void) { return 0; } EOF _win32waveout=no cc_check -lwinmm && _win32waveout=yes fi if test "$_win32waveout" = yes ; then _def_win32waveout='#define HAVE_WIN32WAVEOUT 1' _ld_win32libs="-lwinmm $_ld_win32libs" _aosrc="$_aosrc ao_win32.c" _aomodules="win32 $_aomodules" else _def_win32waveout='#undef HAVE_WIN32WAVEOUT' _noaomodules="win32 $_noaomodules" fi echores "$_win32waveout" echocheck "Directx" if test "$_directx" = auto ; then cat > $TMPC << EOF #include #include int main(void) { return 0; } EOF _directx=no cc_check -lgdi32 && _directx=yes fi if test "$_directx" = yes ; then _def_directx='#define HAVE_DIRECTX 1' _ld_win32libs="-lgdi32 $_ld_win32libs" _vosrc="$_vosrc vo_directx.c" _vomodules="directx $_vomodules" else _def_directx='#undef HAVE_DIRECTX' _novomodules="directx $_novomodules" fi echores "$_directx" echocheck "NAS" if test "$_nas" = auto || test "$_nas" = yes ; then cat > $TMPC << EOF #include