This document was uploaded by user and they confirmed that they have the permission to share
it. If you are author or own the copyright of this book, please report to us by using this DMCA
report form. Report DMCA
#! /bin/sh # # Original version (C) 2000 Pontscho/fresh!mindworkz # [email protected] # # History / Contributors: check the cvs log ! # # Cleanups all over the place (c) 2001 pl # # # This configure script is *not* autoconf-based and has different semantics. # It attempts to autodetect all settings and options where possible. It is # possible to override autodetection with the --enable-option/--disable-option # command line parameters. --enable-option forces the option on skipping # autodetection. Yes, this means that compilation may fail and yes, this is not # how autoconf-based configure scripts behave. # # configure generates a series of configuration files: # - config.h contains #defines that are used in the C code. # - config.mak is included from the Makefiles. # # If you want to add a new check for $feature, here is a simple skeleton: # # echocheck "$feature" # if "$_feature" = auto; then # cat > $TMPC << EOF # #include # int main(void) { return 0; } # EOF # _feature=no # cc_check && _feature=yes # if test "$_feature" = yes ; then # _def_feature='#define HAVE_FEATURE 1' # else # _def_feature='#undef HAVE_FEATURE' # fi # echores "$_feature" # # Furthermore you need to add the variable _feature to the list of default # settings and set it to one of yes/no/auto. Also add appropriate # --enable-feature/--disable-feature command line options. # The results of the check should be written to config.h and config.mak # at the end of this script. The variable names used for this should be # uniform, i.e. if the option is named 'feature': # # _feature : should have a value of yes/no/auto # _def_feature : '#define ... 1' or '#undef ...' for conditional compilation # _ld_feature : '-L/path/dir -lfeature' GCC options # ############################################################################# # Prevent locale nonsense from breaking basic text processing utils LC_ALL=C export LC_ALL # Store the configure line that was used _configuration="$*"
# arch test boolean functions # x86/x86pc is used by QNX x86_32() { 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 } x86_64() { case "$host_arch" in x86_64|amd64) return 0 ;; *) return 1 ;; esac } x86() { x86_32 || x86_64 } ppc() { case "$host_arch" in ppc|powerpc) return 0;; *) return 1;; esac } alpha() { case "$host_arch" in alpha) return 0;; *) return 1;; esac } arm() { case "$host_arch" in arm) return 0;; *) return 1;; esac } sh3() { case "$host_arch" in sh3) 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() { if test "$_res_comment" ; then _res_comment="($_res_comment)" fi echo "Result is: $@ $_res_comment" >> "$TMPLOG" echo "##########################################" >> "$TMPLOG" echo "" >> "$TMPLOG" echo "$@ $_res_comment" _res_comment="" } ############################################################################# # Check how echo works in this /bin/sh case `echo -n` in -n) _echo_n= _echo_c='\c' ;; *) _echo_n='-n ' _echo_c= ;; esac
# SysV echo # BSD echo
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"` show_help(){ cat << EOF Usage: $0 [OPTIONS]... Configuration: -h, --help
display this help and exit
Installation directories: --prefix=DIR prefix directory for installation [/usr/local] --bindir=DIR directory for installing binaries [PREFIX/bin] --datadir=DIR directory for installing machine independent data files (skins, etc) [PREFIX/share/mplayer] --mandir=DIR directory for installing man pages [PREFIX/share/man] --confdir=DIR directory for installing configuration files [PREFIX/etc/mplayer] --libdir=DIR directory for object code libraries [PREFIX/lib] --codecsdir=DIR directory for binary codecs [LIBDIR/codecs] --win32codecsdir=DIR directory for Windows DLLs [LIBDIR/codecs] --xanimcodecsdir=DIR directory for XAnim codecs [LIBDIR/codecs] --realcodecsdir=DIR directory for RealPlayer codecs [LIBDIR/codecs] Optional features: --disable-mencoder --disable-mplayer --enable-gui
--enable-gtk1 force using GTK 1.2 for the GUI [disable] --enable-largefiles enable support for files > 2GB [disable] --enable-linux-devfs set default devices to devfs [disable] --enable-termcap use termcap database for key codes [autodetect] --enable-termios use termios database for key codes [autodetect] --disable-iconv disable iconv for encoding conversion [autodetect] --disable-langinfo do not use langinfo [autodetect] --enable-lirc enable LIRC (remote control) support [autodetect] --enable-lircc enable LIRCCD (LIRC client daemon) input [autodetect] --enable-joystick enable joystick support [disable] --enable-apple-remote enable Apple Remote input (Mac OS X only) [autodetect] --disable-vm disable X video mode extensions [autodetect] --disable-xf86keysym disable support for multimedia keys [autodetect] --enable-radio enable radio interface [disable] --enable-radio-capture enable radio capture (through PCI/line-in) [disable] --disable-radio-v4l2 disable Video4Linux2 radio interface [autodetect] --disable-radio-bsdbt848 disable BSD BT848 radio interface [autodetect] --disable-tv disable TV interface (TV/DVB grabbers) [enable] --disable-tv-v4l1 disable Video4Linux TV interface [autodetect] --disable-tv-v4l2 disable Video4Linux2 TV interface [autodetect] --disable-tv-bsdbt848 disable BSD BT848 interface [autodetect] --disable-tv-teletext disable TV teletext interface [autodetect] --disable-pvr disable Video4Linux2 MPEG PVR [autodetect] --disable-rtc disable RTC (/dev/rtc) on Linux [autodetect] --disable-network disable networking [enable] --enable-winsock2 enable winsock2 [autodetect] --enable-smb enable Samba (SMB) input [autodetect] --enable-live enable LIVE555 Streaming Media [autodetect] --enable-nemesi enable Nemesi Streaming Media [autodetect] --disable-dvdnav disable libdvdnav [autodetect] --disable-dvdread disable libdvdread [autodetect] --disable-dvdread-internal disable internal libdvdread [autodetect] --disable-libdvdcss-internal disable internal libdvdcss [autodetect] --disable-cdparanoia disable cdparanoia [autodetect] --disable-cddb disable cddb [autodetect] --disable-bitmap-font disable bitmap font support [enable] --disable-freetype disable FreeType 2 font rendering [autodetect] --disable-fontconfig disable fontconfig font lookup [autodetect] --disable-unrarlib disable Unique RAR File Library [enabled] --enable-menu enable OSD menu (not DVD menu) [disabled] --disable-sortsub disable subtitle sorting [enabled] --enable-fribidi enable the FriBiDi libs [autodetect] --disable-enca disable ENCA charset oracle library [autodetect] --disable-macosx disable Mac OS X specific features [autodetect] --disable-maemo disable maemo specific features [autodetect] --enable-macosx-finder-support enable Mac OS X Finder invocation parameter parsing [disabled] --enable-macosx-bundle enable Mac OS X bundle file locations [autodetect] --disable-inet6 disable IPv6 support [autodetect] --disable-gethostbyname2 gethostbyname2 part of the C library [autodetect] --disable-ftp disable FTP support [enabled] --disable-vstream disable TiVo vstream client support [autodetect] --disable-pthreads disable Posix threads support [autodetect] --disable-w32threads disable Win32 threads support [autodetect] --disable-ass disable internal SSA/ASS subtitle support [autodetect] --enable-rpath enable runtime linker path for extra libs [disabled] Codecs:
ALSA audio output [autodetect] OSS audio output [autodetect] aRts audio output [autodetect] esd audio output [autodetect] Polypaudio audio output [autodetect] JACK audio output [autodetect] OpenAL audio output [autodetect] NAS audio output [autodetect] SGI audio output [autodetect] Sun audio output [autodetect] Windows waveout audio output [autodetect] using select() on the audio device [enable]
--enable-runtime-cpudetection enable runtime CPU detection [disable] --enable-cross-compile enable cross-compilation [autodetect] --cc=COMPILER C compiler to build MPlayer [gcc] --host-cc=COMPILER C compiler for tools needed while building [gcc] --as=ASSEMBLER assembler to build MPlayer [as] --ar=AR librarian to build MPlayer [ar] --ranlib=RANLIB ranlib to build MPlayer [ranlib] --target=PLATFORM target platform (i386-linux, arm-linux, etc) --enable-static build a statically linked binary --charset=charset convert the console messages to this character set --language=list a white space or comma separated list of languages for translated man pages, the first language is used for messages and the GUI (the environment variable \$LINGUAS is also honored) [en] (Available: $LANGUAGES all) --with-install=PATH path to a custom install program --enable-color-console enable color console output (UNSUPPORTED) [disable] Advanced options: --enable-mmx --enable-mmxext --enable-3dnow --enable-3dnowext --enable-sse --enable-sse2 --enable-ssse3 --enable-shm --enable-altivec --enable-armv5te --enable-armv6 --enable-iwmmxt --disable-fastmemcpy --enable-big-endian --enable-debug[=1-3] --enable-profile --disable-sighandler --enable-crash-debug --enable-dynamic-plugins
Hazardous options AKA "DO NOT REPORT ANY BUGS!" --disable-gcc-check disable gcc version checking [enable] Use these options if autodetection fails (Options marked with (*) accept multiple paths separated by ':'): --extra-libs=FLAGS extra linker flags --extra-libs-mplayer=FLAGS extra linker flags for MPlayer --extra-libs-mencoder=FLAGS extra linker flags for MEncoder --with-extraincdir=DIR extra header search paths in DIR (*) --with-extralibdir=DIR extra linker search paths in DIR (*) --with-xvmclib=NAME adapter-specific library name (e.g. XvMCNVIDIA) --with-freetype-config=PATH --with-fribidi-config=PATH --with-glib-config=PATH --with-gtk-config=PATH --with-sdl-config=PATH --with-dvdnav-config=PATH
This configure script is NOT autoconf-based, even though its output is similar. It will try to autodetect all configuration options. If you --enable an option it will be forcefully turned on, skipping autodetection. This can break compilation, so you need to know what you are doing. EOF exit 0 } #show_help() # 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 _mmx=auto _3dnow=auto _3dnowext=auto _mmxext=auto _sse=auto _sse2=auto _ssse3=auto _cmov=auto _fast_cmov=auto _armv5te=auto _armv6=auto _iwmmxt=auto _mtrr=auto _altivec=auto _install=ginstall _ranlib=ranlib _ldconfig=ldconfig _cc=cc _ar=ar test "$CC" && _cc="$CC" _gcc_check=yes _as=auto _runtime_cpudetection=no _cross_compile=auto _prefix="/usr/local" _libavutil_a=auto _libavutil_so=auto _libavcodec_a=auto _libamr_nb=auto _libamr_wb=auto _libavdecoders_all=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'` _libavdecoders=` echo $_libavdecoders_all | sed -e s/LIBFAAD_DECODER// -e s/MPEG4AAC_DECODER// -e s/LIBA52_DECODER// -e s/LIBGSM_DECODER// -e s/LIBGSM_MS_DECODER// -e s/LIBVORBIS_DECODER// ` _libavencoders_all=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'` _libavencoders=` echo $_libavencoders_all | sed -e s/LIBGSM_ENCODER// -e s/LIBGSM_MS_ENCODER// -e s/LIBTHEORA_ENCODER// ` _libavparsers_all=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'` _libavparsers=$_libavparsers_all _libavbsfs_all=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'` _libavbsfs=$_libavbsfs_all _libavdemuxers_all=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]'`
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/share/man" test -z "$_confdir" && _confdir="$_prefix/etc/mplayer" test -z "$_libdir" && _libdir="$_prefix/lib" # 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|BeOS|MorphOS|AIX| AmigaOS) ;; IRIX*) system_name=IRIX ;; GNU/kFreeBSD) system_name=FreeBSD ;; 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|sh3|mips|vax) ;; 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|BePC) host_arch=i386 ;; ia64) host_arch=ia64 ;; x86_64|amd64) if [ -n "`$_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p'`" -a \ -z "`echo $CFLAGS | grep -- -m32`" ]; then host_arch=x86_64 else host_arch=i386 fi ;; macppc|ppc|ppc64) host_arch=ppc ;; alpha) host_arch=alpha ;; sparc) host_arch=sparc ;; sparc64) host_arch=sparc64 ;; parisc*|hppa*|9000*) host_arch=hppa ;; arm*|zaurus|cats) host_arch=arm ;; sh3) host_arch=sh3 ;; s390) host_arch=s390 ;; s390x) host_arch=s390x ;; mips*) host_arch=mips ;; vax) host_arch=vax ;; *) host_arch=UNKNOWN ;; esac ;; esac else # if test -z "$_target" 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 ;; gnu/kfreebsd) 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 ;; morphos) system_name=MorphOS ;; amigaos) system_name=AmigaOS ;; mingw32msvc) system_name=MINGW32 ;; 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` if test `echo $host_arch` != "x86_64" ; then host_arch=`echo $host_arch | tr '_' '-'` fi fi echo "Detected operating system: $system_name" echo "Detected host architecture: $host_arch" if test "$_runtime_cpudetection" = yes && not x86 && not ppc; then die "Runtime CPU detection only works for x86, x86-64 and PPC!" fi
if openbsd ; then _ldconfig="ldconfig -R" fi if freebsd ; then _ld_extra="$_ld_extra -L/usr/local/lib" _inc_extra="$_inc_extra -I/usr/local/include" fi if darwin; then _ld_extra="$_ld_extra -L/usr/local/lib" _inc_extra="$_inc_extra -I/usr/local/include" fi if aix ; then _ld_extra="$_ld_extra -lC" fi if irix ; then _ranlib='ar -r' elif linux ; then _ranlib='true' fi if win32 ; then _exesuf=".exe" # -lwinmm is always needed for osdep/timer-win2.c _ld_extra="$_ld_extra -lwinmm" _confwin32='TARGET_WIN32 = yes' else _confwin32='TARGET_WIN32 = no' fi if mingw32 ; then _need_shmem=no fi if cygwin ; then _def_confwin32='#define WIN32' fi if amigaos ; then _select=no _sighandler=no _stream_cache=no _def_stream_cache="#undef USE_STREAM_CACHE" fi if qnx ; then _ld_extra="$_ld_extra -lph" fi for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do test "$I" && break done TMPLOG="configure.log"
TMPC="$I/mplayer-conf-$RANDOM-$$.c" TMPCPP="$I/mplayer-conf-$RANDOM-$$.cpp" TMPEXE="$I/mplayer-conf-$RANDOM-$$$_exesuf" TMPH="$I/mplayer-conf-$RANDOM-$$.h" TMPS="$I/mplayer-conf-$RANDOM-$$.S" rm -f "$TMPLOG" echo configuration: $_configuration > "$TMPLOG" echo >> "$TMPLOG" # Check how to call 'head' and 'tail'. Newer versions spit out warnings # if used as 'head -1' instead of 'head -n 1', but older versions don't # know about '-n'. if test "`(echo line1 ; echo line2) | head -1 2>/dev/null`" = "line1" ; then _head() { head -$1 2>/dev/null ; } else _head() { head -n $1 2>/dev/null ; } fi if test "`(echo line1 ; echo line2) | tail -1 2>/dev/null`" = "line2" ; then _tail() { tail -$1 2>/dev/null ; } else _tail() { tail -n $1 2>/dev/null ; } fi # Checking CC version... if test "$_gcc_check" = yes ; then # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure) if test "`basename $_cc`" = "icc" || test "`basename $_cc`" = "ecc"; then echocheck "$_cc version" cc_vendor=intel cc_name=`$_cc -V 2>&1 | _head 1 | cut -d ',' -f 1` cc_version=`$_cc -V 2>&1 | _head 1 | cut -d ',' -f 2 | cut -d ' ' -f 3` _cc_major=`echo $cc_version | cut -d '.' -f 1` _cc_minor=`echo $cc_version | cut -d '.' -f 2` # TODO verify older icc/ecc compatibility case $cc_version in '') cc_version="v. ?.??, bad" cc_verc_fail=yes ;; 8.0|9.1|10.0) cc_version="$cc_version, ok" cc_verc_fail=no ;; *) cc_version="$cc_version, bad" cc_verc_fail=yes ;; esac echores "$cc_version" else for _cc in "$_cc" gcc gcc-3.4 gcc-3.3 gcc-3.2 gcc-3.1 gcc3 gcc-3.0 cc ; do echocheck "$_cc version" cc_vendor=gnu 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-4].*) _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 fi # icc if test "$cc_verc_fail" = yes ; then cat <<EOF *** Please downgrade/upgrade C compiler to version gcc-2.95, 3.x or 4.x! *** You are not using a supported compiler. We do not have everything works with compilers other than the ones we same compiler as we do, or use --disable-gcc-check but unless you can reproduce them after recompiling with a
the time to make sure use. Use either the DO *NOT* REPORT BUGS 2.95.x or 3/4.x version!
Note for gcc 2.96 users: Some versions of this compiler are known to miscompile mplayer and lame (which is used for mencoder). If you get compile errors, first upgrade to the latest 2.96 release (minimum 2.96-85) and try again. If the problem still exists, try with gcc 3.x (or 2.95.x) *BEFORE* reporting bugs! GCC 2.96 IS NOT AND WILL NOT BE SUPPORTED BY US ! EOF die "Bad gcc version" fi else cat <<EOF ****************************************************************************** Hmm. You really want to compile MPlayer with an *UNSUPPORTED* C compiler? Ok. You know. Do it. DO NOT SEND BUGREPORTS OR COMPLAIN, it's *YOUR* compiler's fault! Get ready for mysterious crashes, no-picture bugs, strange noises... REALLY! Lame which is used by mencoder produces weird errors, too.
If you have any problem, install a GCC 2.95.x or 3.x version and try again. If the problem _still_ exists, then read DOCS/HTML/en/bugreports.html ! *** DO NOT SEND BUG REPORTS OR COMPLAIN it's *YOUR* compiler's fault! *** ****************************************************************************** EOF read _answer fi echocheck "host cc" test "$_host_cc" || _host_cc=$_cc echores $_host_cc echocheck "cross compilation" if test $_cross_compile = auto ; then cat > $TMPC << EOF int main() { return 0; } EOF _cross_compile=yes cc_check && "$TMPEXE" && _cross_compile=no fi echores $_cross_compile if test $_cross_compile = yes; then tmp_run() { return 0 } fi # --# now that we know what compiler should be used for compilation, try to find # out which assembler is used by the $_cc compiler if test "$_as" = auto ; then _as=`$_cc -print-prog-name=as` test -z "$_as" && _as=as fi # XXX: this should be ok.. _cpuinfo="echo" if test "$_runtime_cpudetection" = no ; then # Cygwin has /proc/cpuinfo, but only supports Intel CPUs # FIXME: Remove the cygwin check once AMD CPUs are supported if test -r /proc/cpuinfo && not cygwin; then # Linux with /proc mounted, extract CPU information from it _cpuinfo="cat /proc/cpuinfo" elif test -r /compat/linux/proc/cpuinfo && not x86_32 ; then # FreeBSD with Linux emulation /proc mounted, # extract CPU information from it _cpuinfo="cat /compat/linux/proc/cpuinfo" elif darwin && not x86_32 ; then # use hostinfo on Darwin
_cpuinfo="hostinfo" elif aix; then # use 'lsattr' on AIX _cpuinfo="lsattr -E -l proc0 -a type" elif x86; then # all other OSes try to extract CPU information from a small helper # program cpuinfo instead $_cc -o cpuinfo$_exesuf cpuinfo.c _cpuinfo="./cpuinfo$_exesuf" fi if x86 ; then # gather more CPU information pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | _head 1` pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` exts=`$_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | _head 1` pparam=`echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ -e s/centaur_mcr/mtrr/ \ -e s/xmm/sse/ -e s/kni/sse/` for ext in $pparam ; do eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check done # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag. test $_sse = kernel_check && _mmxext=kernel_check echocheck "CPU vendor" echores "$pvendor ($pfamily:$pmodel:$pstepping)" echocheck "CPU type" echores "$pname" fi fi # test "$_runtime_cpudetection" = no if x86 && test "$_runtime_cpudetection" = no ; then extcheck() { if test "$1" = kernel_check ; then echocheck "kernel support of $2" cat > $TMPC <<EOF #include <signal.h> void catch() { exit(1); } int main(void){ signal(SIGILL, catch); __asm__ __volatile__ ("$3":::"memory");return(0); } EOF
if cc_check && tmp_run ; then eval _$2=yes echores "yes" _optimizing="$_optimizing $2" return 0 else eval _$2=no 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 extcheck extcheck extcheck extcheck -mno-sse" extcheck -mno-sse2" extcheck extcheck
echocheck "mtrr support" if test "$_mtrr" = kernel_check ; then _mtrr="yes" _optimizing="$_optimizing mtrr" fi echores "$_mtrr" 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 _arch_all='X86 X86_32 X86_64 IA64 SPARC ARM ARMV4L SH3 POWERPC PPC ALPHA SGI_MIPS PA_RISC S390 S390X VAX BFIN GENERIC' case "$host_arch" in i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) _arch='X86 X86_32' _target_arch_x86="ARCH_X86 = yes" _target_arch="ARCH_X86_32 = yes" _def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' iproc=486 proc=i486
if test "$_runtime_cpudetection" = no ; then 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 # K6 model 13 are the K6-2+ and K6-III+, only differing in cache size. if test "$pmodel" -eq 9 -o "$pmodel" -eq 13; then proc=k6-3 elif test "$pmodel" -eq 5 -o "$pmodel" -eq 10; then proc=geode elif test "$pmodel" -ge 8; then proc=k6-2 elif test "$pmodel" -ge 6; then proc=k6 else proc=i586 fi ;; 6) iproc=686 # It's a bit difficult to determine the correct type of Family 6 # AMD CPUs just from their signature. Instead, we check directly # whether it supports SSE. if test "$_sse" = yes; then # gcc treats athlon-xp, athlon-4 and athlon-mp similarly. proc=athlon-xp else # Again, gcc treats athlon and athlon-tbird similarly. proc=athlon fi ;; 15) iproc=686 # k8 cpu-type only supported in gcc >= 3.4.0, but that will be # caught and remedied in the optimization tests below. proc=k8 ;; *) proc=k8 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 15; then proc=core2 elif test "$pmodel" -eq 9 -o "$pmodel" -ge 13; then
proc=pentium-m elif test "$pmodel" -ge 7; then proc=pentium3 elif test "$pmodel" -ge 3; then proc=pentium2 else proc=i686 fi ;; 15) iproc=686 # A nocona in 32-bit mode has no more capabilities than a prescott. if test "$pmodel" -ge 3; then proc=prescott else proc=pentium4 fi test $_fast_cmov = "auto" && _fast_cmov=no ;; *) proc=prescott iproc=686 ;; esac ;; CentaurHauls) case "$pfamily" in 5) iproc=586 if test "$pmodel" -ge 8; then proc=winchip2 elif test "$pmodel" -ge 4; then proc=winchip-c6 else proc=i586 fi ;; 6) iproc=686 if test "$pmodel" -ge 9; then proc=c3-2 else proc=c3 iproc=586 fi ;; *) proc=i686 iproc=i686 ;; 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 fi # test "$_runtime_cpudetection" = no # 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. # gcc >= 3.4.0
doesn't support -mcpu, we have to use -mtune instead
if [ "$cc_vendor" = "gnu" ] && ([ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ])) ; then cpuopt=-mtune else cpuopt=-mcpu fi echocheck "GCC & CPU optimization abilities" cat > $TMPC << EOF int main(void) { return 0; } EOF if test "$_runtime_cpudetection" = no ; then cc_check -march=native && proc=native if test "$proc" = "k8"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp fi if test "$proc" = "athlon-xp"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon fi if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then cc_check -march=$proc $cpuopt=$proc || proc=k6 fi if test "$proc" = "k6" || test "$proc" = "c3"; then if not cc_check -march=$proc $cpuopt=$proc; then if cc_check -march=i586 $cpuopt=i686; then proc=i586-i686 else proc=i586 fi fi fi if test "$proc" = "prescott" ; then cc_check -march=$proc $cpuopt=$proc || proc=pentium4 fi if test "$proc" = "core2" ; then cc_check -march=$proc $cpuopt=$proc || proc=pentium-m fi if test "$proc" = "pentium4" || test "$proc" = "pentium-m" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon" || test "$proc" = "c3-2" || test "$proc" = "geode"; then cc_check -march=$proc $cpuopt=$proc || proc=i686 fi if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then cc_check -march=$proc $cpuopt=$proc || proc=i586 fi if test "$proc" = "i586"; then cc_check -march=$proc $cpuopt=$proc || proc=i486 fi if test "$proc" = "i486" ; then cc_check -march=$proc $cpuopt=$proc || proc=i386 fi if test "$proc" = "i386" ; then cc_check -march=$proc $cpuopt=$proc || proc=error
fi if test "$proc" = "error" ; then echores "CPU optimization disabled. CPU not recognized or your compiler is too old." _mcpu="" _march="" _optimizing="" elif test "$proc" = "i586-i686"; then _march="-march=i586" _mcpu="$cpuopt=i686" _optimizing="$proc" else _march="-march=$proc" _mcpu="$cpuopt=$proc" _optimizing="$proc" fi else # if test "$_runtime_cpudetection" = no _mcpu="$cpuopt=generic" # at least i486 required, for bswap instruction _march="-march=i486" cc_check $_mcpu || _mcpu="$cpuopt=i686" 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="$cpuopt=i686" else _march="-march=$host_arch" _mcpu="$cpuopt=$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
if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then _fast_cmov="yes" else _fast_cmov="no" fi echores "$proc" ;; ia64)
_arch='IA64' _target_arch='ARCH_IA64 = yes' iproc='ia64' proc='' _march='' _mcpu='' _optimizing='' ;; x86_64|amd64) _arch='X86 X86_64' _target_arch='ARCH_X86_64 = yes' _target_arch_x86="ARCH_X86 = yes" _def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' iproc='x86_64' # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then cpuopt=-mtune else cpuopt=-mcpu fi if test "$_runtime_cpudetection" = no ; then case "$pvendor" in AuthenticAMD) proc=k8;; GenuineIntel) case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they # have the same capabilities as a nocona. proc=nocona test $_fast_cmov = "auto" && _fast_cmov=no ;; esac ;; *) proc=error;; esac fi # test "$_runtime_cpudetection" = no echocheck "GCC & CPU optimization abilities" cat > $TMPC << EOF int main(void) { return 0; } EOF # This is a stripped-down version of the i386 fallback. if test "$_runtime_cpudetection" = no ; then cc_check -march=native && proc=native # --- AMD processors --if test "$proc" = "k8"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp fi # This will fail if gcc version < 3.3, which is ok because earlier # versions don't really support 64-bit on amd64. # Is this a valid assumption? -Corey if test "$proc" = "athlon-xp"; then
cc_check -march=$proc $cpuopt=$proc fi # --- Intel processors --if test "$proc" = "core2"; then cc_check -march=$proc $cpuopt=$proc fi if test "$proc" = "nocona"; then cc_check -march=$proc $cpuopt=$proc fi if test "$proc" = "pentium4"; then cc_check -march=$proc $cpuopt=$proc fi
|| proc=error
|| proc=nocona || proc=pentium4 || proc=error
_march="-march=$proc" _mcpu="$cpuopt=$proc" if test "$proc" = "error" ; then echores "CPU optimization disabled. CPU not recognized or your compiler is too old." _mcpu="" _march="" fi else # if test "$_runtime_cpudetection" = no # x86-64 is an undocumented option, an intersection of k8 and nocona. _march="-march=x86-64" _mcpu="$cpuopt=generic" cc_check $_mcpu || _mcpu="x86-64" cc_check $_mcpu || _mcpu="" cc_check $_march $_mcpu || _march="" fi _optimizing="" echores "$proc" ;; sparc) _arch='SPARC' _target_arch='ARCH_SPARC = yes' iproc='sparc' if sunos ; then echocheck "CPU type" karch=`uname -m` case "`echo $karch`" in sun4) proc=v7 ;; sun4c) proc=v7 ;; sun4d) proc=v8 ;; sun4m) proc=v8 ;; sun4u) proc=ultrasparc _vis='yes' ;; sun4v) proc=v9 ;; *) proc=v8 ;; esac echores "$proc" else proc=v8 fi _march='' _mcpu="-mcpu=$proc" _optimizing="$proc"
;; sparc64) _arch='SPARC' _target_arch='ARCH_SPARC = yes' _vis='yes' iproc='sparc' proc='ultrasparc' _march='' _mcpu="-mcpu=$proc" _optimizing="$proc" ;; arm|armv4l|armv5tel) _arch='ARM ARMV4L' _target_arch='ARCH_ARMV4L = yes' iproc='arm' proc='' _march='' _mcpu='' _optimizing='' ;; sh3) _arch='SH3' _target_arch='ARCH_SH3 = yes' iproc='sh3' proc='' _march='-m3' _mcpu='-ml' _optimizing='' ;; ppc|powerpc) _arch='POWERPC PPC' _def_dcbzl='#define NO_DCBZL 1' _target_arch='ARCH_POWERPC = yes' iproc='ppc' proc='' _march='' _mcpu='' _optimizing='' echocheck "CPU type" case $system_name in Linux) proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2| _head 1` if test -n "`$_cpuinfo | grep altivec`"; then test $_altivec = auto && _altivec=yes fi ;; Darwin) proc=`$_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//'` if [ `sysctl -n hw.vectorunit` -eq 1 -o \ "`sysctl -n hw.optional.altivec 2> /dev/null`" = "1" ]; then test $_altivec = auto && _altivec=yes fi
;; NetBSD) # only gcc 3.4 works reliably with AltiVec code under NetBSD case $cc_version in 2*|3.0*|3.1*|3.2*|3.3*) ;; *) if [ `sysctl -n machdep.altivec` -eq 1 ]; then test $_altivec = auto && _altivec=yes fi ;; esac ;; AIX) proc=`$_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//'` ;; esac if test "$_altivec" = yes; then echores "$proc altivec" else _altivec=no echores "$proc" fi echocheck "GCC & CPU optimization abilities" if test -n "$proc"; then case "$proc" in 601) _march='-mcpu=601' _mcpu='-mtune=601' ;; 603) _march='-mcpu=603' _mcpu='-mtune=603' ;; 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;; 604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;; 740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;; 750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;; POWER) _march='-mcpu=power' _mcpu='-mtune=power' ;; POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;; POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;; *) ;; esac # gcc 3.1(.1) and up supports 7400 and 7450 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1" || test "$_cc_major" -ge "4"; then case "$proc" in 7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;; 7447*|7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;; *) ;; esac fi # gcc 3.2 and up supports 970 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then case "$proc" in 970*|PPC970*) _march='-mcpu=970' _mcpu='-mtune=970' _def_dcbzl='#undef NO_DCBZL' ;; *) ;; esac fi # gcc 3.3 and up supports POWER4
if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then case "$proc" in POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4' ;; *) ;; esac fi # gcc 3.4 and up supports 440* if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "4" || test "$_cc_major" -ge "4"; then case "$proc" in 440EP*) _march='-mcpu=440fp' _mcpu='-mtune=440fp' ;; 440G* ) _march='-mcpu=440' _mcpu='-mtune=440' ;; *) ;; esac fi # gcc 4.0 and up supports POWER5 if test "$_cc_major" -ge "4"; then case "$proc" in POWER5*) _march='-mcpu=power5' _mcpu='-mtune=power5' ;; *) ;; esac fi fi if test -n "$_mcpu"; then _optimizing=`echo $_mcpu | cut -c 8-` echores "$_optimizing" else echores "none" fi ;; alpha) _arch='ALPHA' _target_arch='ARCH_ALPHA = yes' iproc='alpha' _march='' echocheck "CPU type" 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 "$TMPEXE" "$TMPC" case `"$TMPEXE"` in 0-0) 1-0) 1-1) 1-101) 2-303)
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" _optimizing="$proc" echocheck "MVI instruction support in GCC" if test "$_cc_major" -ge "3" && test "$_mvi" = "1" ; then _def_gcc_mvi_support="#define CAN_COMPILE_ALPHA_MVI 1" echores "yes" else _def_gcc_mvi_support="#undef CAN_COMPILE_ALPHA_MVI" echores "no, GCC = `$_cc -dumpversion 2>&1` (must be >= 3), CPU = $proc (must be pca56 or later)" fi ;; mips) _arch='SGI_MIPS' _target_arch='ARCH_SGI_MIPS = yes' iproc='sgi-mips' proc='' _march='' _mcpu='' _optimizing='' if irix ; then echocheck "CPU type" proc=`hinv -c processor | grep CPU | cut -d " " -f3` case "`echo $proc`" in R3000) _march='-mips1' _mcpu='-mtune=r2000' ;; R4000) _march='-mips3' _mcpu='-mtune=r4000' ;; R4400) _march='-mips3' _mcpu='-mtune=r4400' ;; R4600) _march='-mips3' _mcpu='-mtune=r4600' ;; R5000) _march='-mips4' _mcpu='-mtune=r5000' ;; R8000|R10000|R12000|R14000|R16000) _march='-mips4' _mcpu='-mtune=r8000' ;;
esac # gcc < 3.x does not support -mtune. if test "$cc_vendor" = "gnu" && test "$_cc_major" -lt 3 ; then _mcpu='' fi echores "$proc" fi ;;
hppa) _arch='PA_RISC' _target_arch='ARCH_PA_RISC = yes' iproc='PA-RISC' proc='' _march='' _mcpu='' _optimizing='' ;; s390) _arch='S390' _target_arch='ARCH_S390 = yes' iproc='390' proc='' _march='' _mcpu='' _optimizing='' ;; s390x) _arch='S390X' _target_arch='ARCH_S390X = yes' iproc='390x' proc='' _march='' _mcpu='' _optimizing='' ;; vax) _arch='VAX' _target_arch='ARCH_VAX = yes' iproc='vax' proc='' _march='' _mcpu='' _optimizing='' ;; generic) _arch='GENERIC' _target_arch='ARCH_GENERIC = yes' iproc='' proc='' _march='' _mcpu='' _optimizing='' ;; *) 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 # case "$host_arch" in
if test "$_runtime_cpudetection" = yes ; then if x86 ; then test "$_cmov" != no && _cmov=yes x86_32 && _cmov=no test "$_mmx" != no && _mmx=yes test "$_3dnow" != no && _3dnow=yes test "$_3dnowext" != no && _3dnowext=yes test "$_mmxext" != no && _mmxext=yes test "$_sse" != no && _sse=yes test "$_sse2" != no && _sse2=yes test "$_ssse3" != no && _ssse3=yes test "$_mtrr" != no && _mtrr=yes fi if ppc; then _altivec=yes fi fi
echocheck "assembler support of -pipe option" cat > $TMPC << EOF int main(void) { return 0; } EOF cc_check -pipe && _pipe="-pipe" && echores "yes" || echores "no" echocheck "compiler support of named assembler arguments" _named_asm_args=yes _def_named_asm_args="#define NAMED_ASM_ARGS 1" if test "$cc_vendor" = "gnu" && test "$_cc_major" -lt 3 \ -o "$_cc_major" -eq 3 -a "$_cc_minor" = 0 ; then _named_asm_args=no _def_named_asm_args="#undef NAMED_ASM_ARGS" fi echores $_named_asm_args if darwin && test "$cc_vendor" = "gnu" ; then echocheck "GCC support of -mstackrealign" # GCC 4.2 and some earlier Apple versions support this flag on x86. Since # Mac OS X/Intel has an ABI different from Windows this is needed to avoid # crashes when loading Win32 DLLs. Unfortunately some gcc versions create # wrong code with this flag, but this can be worked around by adding # -fno-unit-at-a-time as described in the blog post at # http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/ cat > $TMPC << EOF __attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; } int main(void) { return foo3(1,2,3) == 3 ? 0 : 1; } EOF cc_check -O4 -mstackrealign && tmp_run && _stackrealign=-mstackrealign test -z "$_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \ && tmp_run && _stackrealign="-mstackrealign -fno-unit-at-a-time" test -n "$_stackrealign" && echores "yes" || echores "no" fi # if darwin && test "$cc_vendor" = "gnu" ; then # Checking for CFLAGS
_install_strip="-s" if test "$_profile" != "" || test "$_debug" != "" ; then CFLAGS="-W -Wall -O2 $_march $_mcpu $_pipe $_debug $_profile" _install_strip= elif test -z "$CFLAGS" ; then if test "$cc_vendor" = "intel" ; then CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer -wd167 -wd556 -wd144" elif test "$cc_vendor" != "gnu" ; then CFLAGS="-O2 $_march $_mcpu $_pipe" else CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer" fi else _warn_CFLAGS=yes fi if test -n "$LDFLAGS" ; then _ld_extra="$_ld_extra $LDFLAGS" _warn_CFLAGS=yes elif test "$cc_vendor" = "intel" ; then _ld_extra="$_ld_extra -i-static" fi if test -n "$CPPFLAGS" ; then _inc_extra="$_inc_extra $CPPFLAGS" _warn_CFLAGS=yes fi
if x86_32 ; 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 "$_3dnowext" = yes ; then _pref_as_version='2.10.1' echo 'pswapd %mm0, %mm0' >> $TMPS fi if test "$_mmxext" = 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 if test "$_cmov" = yes ; then _pref_as_version='2.10.1' echo 'cmovb %eax, %ebx' >> $TMPS fi if test "$_ssse3" = yes ; then _pref_as_version='2.16.92' echo 'pabsd %xmm0, %xmm1' >> $TMPS fi $_as $TMPS -o $TMPEXE > /dev/null 2>&1 || as_verc_fail=yes if test "$as_verc_fail" != yes ; then echores "ok" else _res_comment="Upgrade binutils to ${_pref_as_version} or use --disable-ssse3 etc." echores "failed" die "obsolete binutils version" fi fi #if x86_32 echocheck ".align is a power of two" if test "$_asmalign_pot" = auto ; then _asmalign_pot=no cat > $TMPC << EOF main() { asm (".align 3"); } EOF cc_check && _asmalign_pot=yes fi if test "$_asmalign_pot" = "yes" ; then _def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t"' else _def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t"' fi echores $_asmalign_pot #FIXME: This should happen before the check for CFLAGS.. if ppc ; then # check if altivec is supported by the compiler, and how to enable it _altivec_gcc_flags='' if test "$_altivec" = yes -o "$_runtime_cpudetection" = yes ; then echocheck "GCC altivec support" p='' cat > $TMPC << EOF int main() { return 0; } EOF FSF_flags='-maltivec -mabi=altivec' Darwin_flags='-faltivec -D__APPLE_ALTIVEC__'
# check for Darwin-style flags first, since # gcc-3.3 (August Update from Apple) on MacOS 10.2.8 # accepts but ignores FSF-style flags... if test -z "$p"; then cc_check $Darwin_flags && p='Darwin' fi if test -z "$p"; then cc_check $FSF_flags && p='FSF' fi case $p in FSF) _altivec_gcc_flags="$FSF_flags" _altivec=yes ;; Darwin) _altivec_gcc_flags="$Darwin_flags" _altivec=yes ;; *) _altivec=no ;; esac if test -z "$p"; then p=none else p="$p-style ($_altivec_gcc_flags)" fi echores "$p" fi # check if should be included _def_altivec_h='#undef HAVE_ALTIVEC_H' if test "$_altivec" = yes ; then echocheck "altivec.h" cat > $TMPC << EOF #include int main(void) { return 0; } EOF _have_altivec_h=no cc_check $_altivec_gcc_flags && _have_altivec_h=yes if test "$_have_altivec_h" = yes ; then _def_altivec_h='#define HAVE_ALTIVEC_H 1' fi echores "$_have_altivec_h" fi # disable runtime cpudetection if # - we cannot generate altivec code # - altivec is disabled by the user if test "$_runtime_cpudetection" = yes -a "$_altivec" = no ; then _runtime_cpudetection=no fi # show that we are optimizing for altivec (if enabled and supported) if test "$_runtime_cpudetection" = no -a "$_altivec" = yes ; then _optimizing="$_optimizing altivec" fi
# if altivec is enabled, make sure the correct flags turn up in CFLAGS
fi
if test "$_altivec" = yes ; then #FIXME: _mcpu is used for CFLAGS, this needs to be set earlier #_mcpu="$_mcpu $_altivec_gcc_flags" CFLAGS="$CFLAGS $_altivec_gcc_flags" fi
if arm ; then echocheck "ARMv5TE (Enhanced DSP Extensions)" if test $_armv5te = "auto" ; then cat > $TMPC << EOF int main(void) { __asm__ __volatile__ ("qadd r0, r0, r0"); } EOF _armv5te=no cc_check && _armv5te=yes fi echores "$_armv5te" echocheck "ARMv6 (SIMD instructions)" if test $_armv6 = "auto" ; then cat > $TMPC << EOF int main(void) { __asm__ __volatile__ ("sadd16 r0, r0, r0"); } EOF _armv6=no cc_check && _armv6=yes fi echores "$_armv6" echocheck "iWMMXt (Intel XScale SIMD instructions)" if test $_iwmmxt = "auto" ; then cat > $TMPC << EOF int main(void) { __asm__ __volatile__ ("wunpckelub wr6, wr4"); } EOF _iwmmxt=no cc_check && _iwmmxt=yes fi echores "$_iwmmxt" fi _cpuexts_all='ALTIVEC MMX MMX2 3DNOW 3DNOWEX SSE SSE2 SSSE3 FAST_CMOV CMOV ARMV5TE ARMV6 IWMMXT MLIB MMI SH4 VIS MVI' test "$_altivec" = yes && _cpuexts="ALTIVEC $_cpuexts" test "$_mmx" = yes && _cpuexts="MMX $_cpuexts" test "$_mmxext" = yes && _cpuexts="MMX2 $_cpuexts" test "$_3dnow" = yes && _cpuexts="3DNOW $_cpuexts" test "$_3dnowext" = yes && _cpuexts="3DNOWEX $_cpuexts" test "$_sse" = yes && _cpuexts="SSE $_cpuexts" test "$_sse2" = yes && _cpuexts="SSE2 $_cpuexts" test "$_ssse3" = yes && _cpuexts="SSSE3 $_cpuexts" test "$_cmov" = yes && _cpuexts="CMOV $_cpuexts" test "$_fast_cmov" = yes && _cpuexts="FAST_CMOV $_cpuexts"
# Checking kernel version... if x86_32 && 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 ###################### # MAIN TESTS GO HERE # ###################### echocheck "-lposix" cat > $TMPC <<EOF int main(void) { return 0; } EOF if cc_check -lposix ; then _ld_extra="$_ld_extra -lposix" echores "yes" else echores "no" fi echocheck "-lm" cat > $TMPC <<EOF int main(void) { return 0; } EOF if cc_check -lm ; then
_ld_lm="-lm" echores "yes" else _ld_lm="" echores "no" fi echocheck "langinfo" if test "$_langinfo" = auto ; then cat > $TMPC <<EOF #include int main(void) { nl_langinfo(CODESET); return 0; } EOF _langinfo=no cc_check && _langinfo=yes fi if test "$_langinfo" = yes ; then _def_langinfo='#define USE_LANGINFO 1' else _def_langinfo='#undef USE_LANGINFO' fi echores "$_langinfo" echocheck "language" test -z "$_language" && _language=$LINGUAS _language=`echo $_language | sed 's/,/ /g'` echo $_language | grep all > /dev/null || LANGUAGES="$_language en" for lang in $_language ; do test "$lang" = all && lang=en if test -f "help/help_mp-${lang}.h" ; then _language=$lang break else echo ${_echo_n} "$lang not found, ${_echo_c}" _language=`echo $_language | sed "s/$lang *//"` fi done test -z "$_language" && _language=en _mp_help="help/help_mp-${_language}.h" test -f $_mp_help || die "$_mp_help not found" for lang in $LANGUAGES ; do if test -f "DOCS/man/$lang/mplayer.1" ; then MAN_LANG="$lang $MAN_LANG" fi done _doc_lang=$_language test -d DOCS/xml/$_doc_lang || _doc_lang=en echores "using $_language (man pages: $MAN_LANG)" 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 _optimizing="Runtime CPU-Detection enabled" _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 # Avoid infinite recursion loop ("#define restrict restrict") if [ "$_def_restrict_keyword" != "restrict" ]; then _def_restrict_keyword="#define restrict $_def_restrict_keyword" else _def_restrict_keyword="" fi echocheck "__builtin_expect" # GCC branch prediction hint cat > $TMPC << EOF int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; } int main() { return foo(10) && foo(0); } EOF _builtin_expect=no cc_check && _builtin_expect=yes if test "$_builtin_expect" = yes ; then _def_builtin_expect='#define HAVE_BUILTIN_EXPECT 1' else _def_builtin_expect='#undef HAVE_BUILTIN_EXPECT' fi echores "$_builtin_expect" 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 _def_kstat="#define HAVE_LIBKSTAT 1" _ld_extra="$_ld_extra -lkstat" 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_extra="$_ld_extra -lposix4" fi echores "$_posix4" echocheck "lrintf" cat > $TMPC << EOF #include <math.h> int main(void) { long (*foo)(float); foo = lrintf; (void)(*foo)(0.0); return 0; } EOF _lrintf=no cc_check -D_GNU_SOURCE $_ld_lm && _lrintf=yes if test "$_lrintf" = yes ; then _def_lrintf="#define HAVE_LRINTF 1" else _def_lrintf="#undef HAVE_LRINTF" fi echores "$_lrintf" echocheck "mkstemp" cat > $TMPC << EOF #include <stdlib.h> int main(void) { char a; mkstemp(&a); return 0; } EOF _mkstemp=no cc_check && _mkstemp=yes if test "$_mkstemp" = yes ; then _def_mkstemp='#define HAVE_MKSTEMP 1' else _def_mkstemp='#undef HAVE_MKSTEMP' fi echores "$_mkstemp" echocheck "nanosleep" # also check for nanosleep cat > $TMPC << EOF #include int main(void) { (void) nanosleep(0, 0); return 0; }
EOF _nanosleep=no cc_check && _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): # for BeOS (socket stuff is in -lsocket, gethostbyname and friends in -lbind): cat > $TMPC << EOF #include #include <sys/socket.h> int main(void) { (void) gethostbyname(0); (void) socket(AF_INET, SOCK_STREAM, 0); return 0; } EOF _socklib=no for _ld_tmp in "" "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && _socklib=yes && break done if test $_winsock2 = auto && not cygwin ; then _winsock2=no cat > $TMPC << EOF #include <winsock2.h> int main(void) { (void) gethostbyname(0); return 0; } EOF cc_check -lws2_32 && _ld_sock="-lws2_32" && _winsock2=yes fi test "$_ld_sock" && _res_comment="using $_ld_sock" echores "$_socklib" if test $_winsock2 = yes ; then _ld_sock="-lws2_32" _def_winsock2='#define HAVE_WINSOCK2 1' else _def_winsock2='#undef HAVE_WINSOCK2' fi _use_aton=no echocheck "inet_pton()" cat > $TMPC << EOF #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> int main(void) { (void) inet_pton(0, 0, 0); return 0; } EOF if test "$_winsock2" = yes ; then _res_comment="using winsock2 functions instead" echores "no" elif cc_check $_ld_sock ; then # NOTE: Linux has libresolv but does not need it
: _res_comment="using $_ld_sock" echores "yes" elif cc_check $_ld_sock -lresolv ; then # NOTE: needed for SunOS at least _ld_sock="$_ld_sock -lresolv" _res_comment="using $_ld_sock" echores "yes" else _res_comment="trying inet_aton next" echores "no" echocheck "inet_aton()" cat > $TMPC << EOF #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> 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 : _res_comment="using $_ld_sock" elif cc_check $_ld_sock -lresolv ; then # NOTE: needed for SunOS at least _ld_sock="$_ld_sock -lresolv" _res_comment="using $_ld_sock" else _use_aton=no _network=no _res_comment="network support disabled" fi echores "$_use_aton" fi _def_use_aton='#undef USE_ATON' if test "$_use_aton" = yes; then _def_use_aton='#define USE_ATON 1' fi echocheck "network" # FIXME network check if test "$_network" = yes ; then _def_network='#define MPLAYER_NETWORK 1' _ld_extra="$_ld_extra $_ld_sock" _inputmodules="network $_inputmodules" else _noinputmodules="network $_noinputmodules" _def_network='#undef MPLAYER_NETWORK' _ftp=no fi echores "$_network" echocheck "inttypes.h (required)" cat > $TMPC << EOF #include int main(void) { return 0; }
EOF _inttypes=no cc_check && _inttypes=yes echores "$_inttypes" if test "$_inttypes" = no ; then echocheck "bitypes.h (inttypes.h predecessor)" cat > $TMPC << EOF #include <sys/bitypes.h> int main(void) { return 0; } EOF cc_check && _inttypes=yes if test "$_inttypes" = yes ; then die "You don't have inttypes.h, but sys/bitypes.h is present. Please copy etc/inttypes.h into the include path, and re-run configure." else die "Cannot find header either inttypes.h or bitypes.h. There is no chance for compilation to succeed." fi fi echocheck "int_fastXY_t in inttypes.h" cat > $TMPC << EOF #include int main(void) { volatile int_fast16_t v= 0; return v; } EOF _fast_inttypes=no cc_check && _fast_inttypes=yes if test "$_fast_inttypes" = yes ; then # nothing to do : else _def_fast_inttypes=' typedef signed char int_fast8_t; typedef signed int int_fast16_t; typedef signed int int_fast32_t; typedef signed long long int_fast64_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; typedef unsigned long long uint_fast64_t;' fi echores "$_fast_inttypes" echocheck "word size" _mp_wordsize="#undef MP_WORDSIZE" cat > $TMPC << EOF #include <stdio.h> #include <sys/types.h> int main(void) { printf("%d\n", sizeof(size_t)*8); return 0; } EOF cc_check && _wordsize=`$TMPEXE` && _mp_wordsize="#define MP_WORDSIZE $_wordsize" echores "$_wordsize"
echocheck "malloc.h" cat > $TMPC << EOF #include <malloc.h> int main(void) { (void) malloc(0); return 0; } EOF _malloc=no cc_check && _malloc=yes if test "$_malloc" = yes ; then _def_malloc='#define HAVE_MALLOC_H 1' else _def_malloc='#undef HAVE_MALLOC_H' fi # malloc.h emits a warning in FreeBSD 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 <malloc.h> int main (void) { (void) memalign(64, sizeof(char)); return 0; } EOF _memalign=no cc_check && _memalign=yes if test "$_memalign" = yes ; then _def_memalign='#define HAVE_MEMALIGN 1' else _def_memalign='#undef HAVE_MEMALIGN' _def_map_memalign='#define memalign(a,b) malloc(b)' not darwin && _def_memalign_hack='#define CONFIG_MEMALIGN_HACK 1' 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 <sys/types.h> #include <sys/mman.h> int main(void) { (void) mmap(0, 0, 0, 0, 0, 0); return 0; } EOF _mman=no
cc_check && _mman=yes if test "$_mman" = yes ; then _def_mman='#define HAVE_SYS_MMAN_H 1' else _def_mman='#undef HAVE_SYS_MMAN_H' fi echores "$_mman" cat > $TMPC << EOF #include <sys/types.h> #include <sys/mman.h> int main(void) { void *p = MAP_FAILED; return 0; } EOF _mman_has_map_failed=no cc_check && _mman_has_map_failed=yes if test "$_mman_has_map_failed" = yes ; then _def_mman_has_map_failed='' else _def_mman_has_map_failed='#define MAP_FAILED ((void *) -1)' fi echocheck "dynamic loader" cat > $TMPC << EOF #include int main(void) { dlopen(0, 0); dlclose(0); dlsym(0, 0); return 0; } EOF _dl=no for _ld_tmp in "" "-ldl" ; do cc_check $_ld_tmp && _ld_dl="$_ld_tmp" && _dl=yes && break done 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" _def_threads='#undef HAVE_THREADS' echocheck "pthread" if test "$_pthreads" = auto ; then 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 _pthreads=no if not hpux ; then for _ld_tmp in "-lpthreadGC2" "" "-lpthread" "-pthread" ; do # for crosscompilation, we cannot execute the program, be happy if we can link statically cc_check $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break done fi fi if test "$_pthreads" = yes ; then _res_comment="using $_ld_pthread" _def_pthreads='#define HAVE_PTHREADS 1' _def_threads='#define HAVE_THREADS 1' else _res_comment="v4l, vo_gl, ao_alsa, ao_nas, ao_macosx, win32 loader disabled" _def_pthreads='#undef HAVE_PTHREADS' _nas=no ; _tv_v4l1=no ; _macosx=no if not mingw32 ; then _win32dll=no fi fi echores "$_pthreads" echocheck "w32threads" if test "$_pthreads" = yes ; then _res_comment="using pthread instead" _w32threads=no fi if test "$_w32threads" = auto ; then _w32threads=no mingw32 && _w32threads=yes fi test "$_w32threads" = yes && _def_threads='#define HAVE_THREADS 1' echores "$_w32threads" echocheck "rpath" netbsd &&_rpath=yes if test "$_rpath" = yes ; then for I in `echo $_ld_extra | sed 's/-L//g'` ; do tmp="$tmp ` echo $I | sed 's/.*/ -L& -Wl,-R&/'`" done _ld_extra=$tmp fi echores "$_rpath" echocheck "iconv" if test "$_iconv" = auto ; then cat > $TMPC << EOF #include <stdio.h> #include #include #define INBUFSIZE 1024 #define OUTBUFSIZE 4096 char inbuffer[INBUFSIZE];
char outbuffer[OUTBUFSIZE]; int main(void) { size_t numread; iconv_t icdsc; char *tocode="UTF-8"; char *fromcode="cp1250"; if ((icdsc = iconv_open (tocode, fromcode)) != (iconv_t)(-1)) { while ((numread = read (0, inbuffer, INBUFSIZE))) { char *iptr=inbuffer; char *optr=outbuffer; size_t inleft=numread; size_t outleft=OUTBUFSIZE; if (iconv(icdsc, (const char **)&iptr, &inleft, &optr, &outleft) != (size_t)(-1)) { write (1, outbuffer, OUTBUFSIZE - outleft); } } if (iconv_close(icdsc) == -1) ; } } EOF _iconv=no for _ld_tmp in "" "-liconv" "-liconv $_ld_dl" ; do cc_check $_ld_lm $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" && \ _iconv=yes && break done fi if test "$_iconv" = yes ; then _def_iconv='#define USE_ICONV 1' else _def_iconv='#undef USE_ICONV' fi echores "$_iconv" echocheck "soundcard.h" _soundcard_h=no _def_soundcard='#undef HAVE_SOUNDCARD_H' _def_sys_soundcard='#undef HAVE_SYS_SOUNDCARD_H' for _soundcard_header in "sys/soundcard.h" "soundcard.h"; do cat > $TMPC << EOF #include <$_soundcard_header> int main(void) { return 0; } EOF cc_check && _soundcard_h=yes && _res_comment="$_soundcard_header" && break done if test "$_soundcard_h" = yes ; then if test $_soundcard_header = "sys/soundcard.h"; then _def_sys_soundcard='#define HAVE_SYS_SOUNDCARD_H 1' else _def_soundcard='#define HAVE_SOUNDCARD_H 1' fi fi echores "$_soundcard_h"
echocheck "sys/dvdio.h" cat > $TMPC << EOF #include #include <sys/dvdio.h> 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 <sys/cdio.h> 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 <sys/types.h> #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" if bsdos; then 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" fi #if bsdos if hpux; then # also used by AIX, but AIX does not support VCD and/or libdvdread echocheck "HP-UX SCSI header" cat > $TMPC << EOF #include <sys/scsi.h> 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" fi #if hpux if sunos; then echocheck "userspace SCSI headers (Solaris)" cat > $TMPC << EOF # include # include <stropts.h> # include <sys/scsi/scsi_types.h> # include <sys/scsi/impl/uscsi.h> 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"
fi #if sunos echocheck "termcap" if test "$_termcap" = auto ; then cat > $TMPC <<EOF int main(void) { tgetent(); return 0; } EOF _termcap=no for _ld_tmp in "-lncurses" "-ltinfo" "-ltermcap"; do cc_check $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" \ && _termcap=yes && break done fi if test "$_termcap" = yes ; then _def_termcap='#define USE_TERMCAP 1' _res_comment="using $_ld_tmp" else _def_termcap='#undef USE_TERMCAP' fi echores "$_termcap" echocheck "termios" _def_termios='#undef HAVE_TERMIOS' _def_termios_h='#undef HAVE_TERMIOS_H' _def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H' if test "$_termios" = auto ; then _termios=no for _termios_header in "sys/termios.h" "termios.h"; do cat > $TMPC <<EOF #include <$_termios_header> int main(void) { return 0; } EOF cc_check && _termios=yes && _res_comment="$_termios_header" && break done fi if test "$_termios" = yes ; then _def_termios='#define HAVE_TERMIOS 1' if test "$_termios_header" = "termios.h" ; then _def_termios_h='#define HAVE_TERMIOS_H 1' else _def_termios_sys_h='#define HAVE_SYS_TERMIOS_H 1' fi fi echores "$_termios" echocheck "shm" if test "$_shm" = auto ; then cat > $TMPC << EOF #include <sys/types.h> #include <sys/shm.h> int main(void) { shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0); return 0; } EOF _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 "strsep()" cat > $TMPC << EOF #include <string.h> 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' _need_strsep=no else _def_strsep='#undef HAVE_STRSEP' _need_strsep=yes fi echores "$_strsep" echocheck "vsscanf()" cat > $TMPC << EOF #include <stdarg.h> int main(void) { vsscanf(0, 0, 0); return 0; } EOF _vsscanf=no cc_check && _vsscanf=yes if test "$_vsscanf" = yes ; then _def_vsscanf='#define HAVE_VSSCANF 1' _need_vsscanf=no else _def_vsscanf='#undef HAVE_VSSCANF' _need_vsscanf=yes fi echores "$_vsscanf" echocheck "swab()" cat > $TMPC << EOF #include int main(void) { swab(0, 0, 0); return 0; } EOF _swab=no cc_check && _swab=yes if test "$_swab" = yes ; then _def_swab='#define HAVE_SWAB 1' _need_swab=no else _def_swab='#undef HAVE_SWAB' _need_swab=yes fi echores "$_swab"
#include <stdlib.h> int main (void){ setenv("","",0); return 0; } EOF _setenv=no cc_check && _setenv=yes if test "$_setenv" = yes ; then _def_setenv='#define HAVE_SETENV 1' _need_setenv=no else _def_setenv='#undef HAVE_SETENV' _need_setenv=yes fi echores "$_setenv" if sunos; then echocheck "sysi86()" cat > $TMPC << EOF #include <sys/sysi86.h> int main (void) { sysi86(0); return 0; } EOF _sysi86=no cc_check && _sysi86=yes if test "$_sysi86" = yes ; then _def_sysi86='#define HAVE_SYSI86 1' cat > $TMPC << EOF #include <sys/sysi86.h> int main (void) { int sysi86(int, void*); sysi86(0); return 0; } EOF cc_check && _def_sysi86_iv='#define HAVE_SYSI86_iv 1' else _def_sysi86='#undef HAVE_SYSI86' fi echores "$_sysi86" fi #if sunos echocheck "sys/sysinfo.h" cat > $TMPC << EOF #include <sys/sysinfo.h> 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' else _def_sys_sysinfo='#undef HAVE_SYS_SYSINFO_H' fi echores "$_sys_sysinfo" if darwin; then
echocheck "Mac OS X APIs" if test "$_macosx" = auto ; then productName=`/usr/bin/sw_vers -productName` if test "$productName" = "Mac OS X" || test "$productName" = "Mac OS X Server" ; then _macosx=yes else _macosx=no _def_macosx='#undef MACOSX' _noaomodules="macosx $_noaomodules" _novomodules="quartz $_novomodules" fi fi if test "$_macosx" = yes ; then cat > $TMPC <<EOF #include #include #include int main(void) { EnterMovies(); ExitMovies(); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); } EOF if cc_check -framework Carbon -framework QuickTime -framework CoreAudio; then _ld_extra="$_ld_extra -framework Carbon -framework QuickTime -framework CoreAudio -framework AudioUnit -framework AudioToolbox" _def_macosx='#define MACOSX 1' _aosrc="$_aosrc ao_macosx.c" _aomodules="macosx $_aomodules" _vosrc="$_vosrc vo_quartz.c" _vomodules="quartz $_vomodules" else _macosx=no _def_macosx='#undef MACOSX' _noaomodules="macosx $_noaomodules" _novomodules="quartz $_novomodules" fi cat > $TMPC <<EOF #include #include int main(void) {} EOF if cc_check -framework Carbon -framework QuartzCore -framework OpenGL; then _vosrc="$_vosrc vo_macosx.m" _vomodules="macosx $_vomodules" _ld_extra="$_ld_extra -framework Cocoa -framework QuartzCore -framework OpenGL" _def_macosx_corevideo='#define MACOSX_COREVIDEO 1' _macosx_corevideo=yes else _novomodules="macosx $_novomodules" _def_macosx_corevideo='#undef MACOSX_COREVIDEO' _macosx_corevideo=no fi fi echores "$_macosx"
echocheck "Mac OS X Finder Support" if test "$_macosx_finder_support" = auto ; then _macosx_finder_support=$_macosx fi if test "$_macosx_finder_support" = yes; then _def_macosx_finder_support='#define MACOSX_FINDER_SUPPORT 1' _macosx_finder_support=yes else _def_macosx_finder_support='#undef MACOSX_FINDER_SUPPORT' _macosx_finder_support=no fi echores "$_macosx_finder_support" echocheck "Mac OS X Bundle file locations" if test "$_macosx_bundle" = auto ; then _macosx_bundle=$_macosx_finder_support fi if test "$_macosx_bundle" = yes; then _def_macosx_bundle='#define MACOSX_BUNDLE 1' else _def_macosx_bundle='#undef MACOSX_BUNDLE' _macosx_bundle=no fi echores "$_macosx_bundle" echocheck "Apple Remote" if test "$_apple_remote" = auto ; then _apple_remote=no cat > $TMPC <<EOF #include <stdio.h> #include int main (int argc, const char * argv[]) { io_iterator_t hidObjectIterator = (io_iterator_t)NULL; CFMutableDictionaryRef hidMatchDictionary; IOReturn ioReturnValue; // Set up a matching dictionary to search the I/O Registry by class. // name for all HID class devices hidMatchDictionary = IOServiceMatching("AppleIRController"); // Now search I/O Registry for matching devices. ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault, hidMatchDictionary, &hidObjectIterator); // If search is unsuccessful, return nonzero. if (ioReturnValue != kIOReturnSuccess || !IOIteratorIsValid(hidObjectIterator)) { return 1; } return 0; } EOF cc_check -framework IOKit && tmp_run && _apple_remote=yes fi if test "$_apple_remote" = yes ; then _def_apple_remote='#define HAVE_APPLE_REMOTE 1' _ld_extra="$_ld_extra -framework IOKit"
else _def_apple_remote='#undef HAVE_APPLE_REMOTE' fi echores "$_apple_remote" fi #if darwin echocheck "pkg-config" _pkg_config=pkg-config if `$_pkg_config --version > /dev/null 2>&1`; then if test "$_ld_static"; then _pkg_config="$_pkg_config --static" fi echores "yes" else _pkg_config=false echores "no" fi echocheck "Samba support (libsmbclient)" if test "$_smbsupport" = yes; then _ld_extra="$_ld_extra -lsmbclient" fi if test "$_smbsupport" = auto; then _smbsupport=no cat > $TMPC << EOF #include int main(void) { smbc_opendir("smb://"); return 0; } EOF for _ld_tmp in "-lsmbclient" "-lsmbclient $_ld_dl" "-lsmbclient $_ld_dl -lnsl" "-lsmbclient $_ld_dl -lssl -lnsl" ; do cc_check $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" && \ _smbsupport=yes && break done fi if test "$_smbsupport" = yes; then _def_smbsupport="#define LIBSMBCLIENT" _inputmodules="smb $_inputmodules" else _def_smbsupport="#undef LIBSMBCLIENT" _noinputmodules="smb $_noinputmodules" fi echores "$_smbsupport" ######### # VIDEO # ######### 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 "s3fb" if test "$_s3fb" = yes ; then _def_s3fb='#define HAVE_S3FB 1' _vosrc="$_vosrc vo_s3fb.c" _vomodules="s3fb $_vomodules" else _def_s3fb='#undef HAVE_S3FB' _novomodules="s3fb $_novomodules" fi echores "$_s3fb" 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 "$_tdfxvid" echocheck "xvr100" if test "$_xvr100" = auto ; then cat > $TMPC << EOF #include #include <sys/fbio.h> #include <sys/visual_io.h> int main(void) { struct vis_identifier ident; struct fbgattr attr; ioctl(0, VIS_GETIDENTIFIER, &ident); ioctl(0, FBIOGATTR, &attr); } EOF _xvr100=no cc_check && _xvr100=yes fi if test "$_xvr100" = yes ; then _def_xvr100='#define HAVE_XVR100 1' _vosrc="$_vosrc vo_xvr100.c" _vomodules="xvr100 $_vomodules" else _def_tdfxvid='#undef HAVE_XVR100' _novomodules="xvr100 $_novomodules" fi echores "$_xvr100" echocheck "tga" if test "$_tga" = yes ; then _def_tga='#define HAVE_TGA 1'
_vosrc="$_vosrc vo_tga.c" _vomodules="tga $_vomodules" else _def_tga='#undef HAVE_TGA' _novomodules="tga $_novomodules" fi echores "$_tga" echocheck "md5sum support" if test "$_md5sum" = yes; then _def_md5sum="#define HAVE_MD5SUM" _vosrc="$_vosrc vo_md5sum.c" _vomodules="md5sum $_vomodules" else _def_md5sum="#undef HAVE_MD5SUM" _novomodules="md5sum $_novomodules" fi echores "$_md5sum" echocheck "bl" if test "$_bl" = yes ; then _def_bl='#define HAVE_BL 1' _vosrc="$_vosrc vo_bl.c" _vomodules="bl $_vomodules" else _def_bl='#undef HAVE_BL' _novomodules="bl $_novomodules" fi echores "$_bl" echocheck "DirectFB" if test "$_directfb" = auto ; then _directfb=no cat > $TMPC <<EOF #include int main(void) { IDirectFB *foo; DirectFBInit(0,0); return 0; } EOF for _inc_tmp in "" -I/usr/local/include/directfb \ -I/usr/include/directfb -I/usr/local/include; do cc_check $_inc_tmp -ldirectfb && _directfb=yes && \ _inc_extra="$_inc_extra $_inc_tmp" && break done fi dfb_version() { expr $1 \* 65536 + $2 \* 256 + $3 } if test "$_directfb" = yes; then cat > $TMPC << EOF #include int dfb_ver = DIRECTFB_MAJOR_VERSION.DIRECTFB_MINOR_VERSION.DIRECTFB_MICRO_VERSION ; EOF
if $_cc -E $TMPC $_inc_extra > "$TMPEXE"; then _directfb_version=`sed -n 's/^dfb_ver[^0-9]*\(.*\)/\1/p' "$TMPEXE" | tr -d '()'` _dfb_major=`echo $_directfb_version | cut -d . -f 1` _dfb_minor=`echo $_directfb_version | cut -d . -f 2` _dfb_micro=`echo $_directfb_version | cut -d . -f 3` _dfb_version=`dfb_version $_dfb_major $_dfb_minor $_dfb_micro` if test "$_dfb_version" -ge `dfb_version 0 9 13`; then _def_directfb_version="#define DIRECTFBVERSION $_dfb_version" _res_comment="$_directfb_version" else _def_directfb_version='#undef DIRECTFBVERSION' _directfb=no _res_comment="version >=0.9.13 required" fi else _directfb=no _res_comment="failed to get version" fi fi echores "$_directfb" if test "$_directfb" = yes ; then _def_directfb='#define HAVE_DIRECTFB 1' if test "$_dfb_version" -ge `dfb_version 0 9 13`; then _vosrc="$_vosrc vo_directfb2.c" _vomodules="directfb $_vomodules" _libs_mplayer="$_libs_mplayer -ldirectfb" else _novomodules="directfb $_novomodules" fi if test "$_dfb_version" -ge `dfb_version 0 9 15`; then _vosrc="$_vosrc vo_dfbmga.c" _vomodules="dfbmga $_vomodules" _def_dfbmga='#define HAVE_DFBMGA 1' else _novomodules="dfbmga $_novomodules" _def_dfbmga='#undef HAVE_DFBMGA' fi else _def_directfb='#undef HAVE_DIRECTFB' _novomodules="dfbmga directfb $_novomodules" fi echocheck "X11 headers presence" _x11_headers="no" _res_comment="check if the dev(el) packages are installed" for I in `echo $_inc_extra | sed s/-I//g` /usr/include ; do if test -f "$I/X11/Xlib.h" ; then _x11_headers="yes" _res_comment="" break fi done for I in /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/openwin/include ; do
if test -f "$I/X11/Xlib.h" ; then _inc_extra="$_inc_extra -I$I" _x11_headers="yes" _res_comment="using $I" break fi done echores "$_x11_headers" echocheck "X11" if test "$_x11" = auto && test "$_x11_headers" = yes ; then cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/Xutil.h> int main(void) { (void) XCreateWindow(0,0,0,0,0,0,0,0,0,0,0,0); return 0; } EOF for I in "" -L/usr/X11R6/lib -L/usr/lib/X11R6 -L/usr/X11/lib \ -L/usr/lib32 -L/usr/openwin/lib -L/usr/X11R6/lib64 -L/usr/lib ; do if netbsd; then _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R`echo $I | sed s/^-L//`" else _ld_tmp="$I -lXext -lX11 $_ld_pthread" fi cc_check $_ld_tmp && _libs_mplayer="$_libs_mplayer $_ld_tmp" \ && _x11=yes && break done 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 _x11=no _def_x11='#undef HAVE_X11' _novomodules="x11 $_novomodules" _res_comment="check if the dev(el) packages are installed" # disable stuff that depends on X _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no fi echores "$_x11" echocheck "DPMS" _xdpms3=no _xdpms4=no if test "$_x11" = yes ; then cat > $TMPC <<EOF #include <X11/Xmd.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/extensions/dpms.h> int main(void) { (void) DPMSQueryExtension(0, 0, 0); } EOF cc_check -lXdpms && _xdpms3=yes
cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/extensions/dpms.h> int main(void) { (void) DPMSQueryExtension(0, 0, 0); } EOF cc_check -lXext && _xdpms4=yes fi if test "$_xdpms4" = yes ; then _def_xdpms='#define HAVE_XDPMS 1' _res_comment="using Xdpms 4" echores "yes" elif test "$_xdpms3" = yes ; then _def_xdpms='#define HAVE_XDPMS 1' _libs_mplayer="$_libs_mplayer -lXdpms" _res_comment="using Xdpms 3" echores "yes" else _def_xdpms='#undef HAVE_XDPMS' echores "no" fi echocheck "Xv" if test "$_xv" = auto ; then cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/extensions/Xvlib.h> int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); (void) XvQueryPortAttributes(0, 0, 0); return 0; } EOF _xv=no cc_check -lXv && _xv=yes fi if test "$_xv" = yes ; then _def_xv='#define HAVE_XV 1' _libs_mplayer="$_libs_mplayer -lXv" _vosrc="$_vosrc vo_xv.c" _vomodules="xv $_vomodules" else _def_xv='#undef HAVE_XV' _novomodules="xv $_novomodules" fi echores "$_xv" echocheck "XvMC" if test "$_xv" = yes && test "$_xvmc" != no ; then _xvmc=no cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/extensions/Xvlib.h> #include <X11/extensions/XvMClib.h> int main(void) {
(void) XvMCQueryExtension(0,0,0); (void) XvMCCreateContext(0,0,0,0,0,0,0); return 0; } EOF for _ld_tmp in $_xvmclib XvMCNVIDIA XvMCW I810XvMC ; do cc_check -lXvMC -l$_ld_tmp && _xvmc=yes && _xvmclib="$_ld_tmp" && break done fi if test "$_xvmc" = yes ; then _def_xvmc='#define HAVE_XVMC 1' _libs_mplayer="$_libs_mplayer -lXvMC -l$_xvmclib" _vosrc="$_vosrc vo_xvmc.c" _vomodules="xvmc $_vomodules" _res_comment="using $_xvmclib" else _def_xvmc='#undef HAVE_XVMC' _novomodules="xvmc $_novomodules" _libavdecoders=`echo $_libavdecoders | sed -e s/MPEG_XVMC_DECODER// ` fi echores "$_xvmc" echocheck "Xinerama" if test "$_xinerama" = auto ; then cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/extensions/Xinerama.h> int main(void) { (void) XineramaIsActive(0); return 0; } EOF _xinerama=no cc_check -lXinerama && _xinerama=yes fi if test "$_xinerama" = yes ; then _def_xinerama='#define HAVE_XINERAMA 1' _libs_mplayer="$_libs_mplayer -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 "$_vm" = auto ; then cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/extensions/xf86vmode.h> int main(void) { (void) XF86VidModeQueryExtension(0, 0, 0); return 0; } EOF _vm=no cc_check -lXxf86vm && _vm=yes fi if test "$_vm" = yes ; then
_def_vm='#define HAVE_XF86VM 1' _libs_mplayer="$_libs_mplayer -lXxf86vm" else _def_vm='#undef HAVE_XF86VM' fi echores "$_vm" # Check for the presence of special keycodes, like audio control buttons # that XFree86 might have. Used to be bundled with the xf86vm check, but # has nothing to do with xf86vm and XFree 3.x has xf86vm but does NOT # have these new keycodes. echocheck "XF86keysym" if test "$_xf86keysym" = auto; then _xf86keysym=no cat > $TMPC <<EOF #include <X11/Xlib.h> #include <X11/XF86keysym.h> int main(void) { return XF86XK_AudioPause; } EOF cc_check && _xf86keysym=yes fi if test "$_xf86keysym" = yes ; then _def_xf86keysym='#define HAVE_XF86XK 1' else _def_xf86keysym='#undef HAVE_XF86XK' fi echores "$_xf86keysym" echocheck "DGA" if test "$_dga2" = auto && test "$_x11" = yes ; then cat > $TMPC << EOF #include <X11/Xlib.h> #include <X11/extensions/xf86dga.h> int main (void) { (void) XDGASetViewport(0, 0, 0, 0, 0); return 0; } EOF _dga2=no cc_check -lXxf86dga && _dga2=yes fi if test "$_dga1" = auto && test "$_dga2" = no && test "$_vm" = yes ; then cat > $TMPC << EOF #include <X11/Xlib.h> #include <X11/extensions/xf86dga.h> int main (void) { (void) XF86DGASetViewPort(0, 0, 0, 0); return 0; } EOF _dga1=no cc_check -lXxf86dga -lXxf86vm && _dga1=yes fi _dga=no _def_dga='#undef HAVE_DGA' _def_dga1='#undef HAVE_DGA1' _def_dga2='#undef HAVE_DGA2' if test "$_dga1" = yes ; then _dga=yes _def_dga1='#define HAVE_DGA1 1' _res_comment="using DGA 1.0" elif test "$_dga2" = yes ; then _dga=yes
fi else _gl=no fi if test "$_gl" = yes ; then _def_gl='#define HAVE_GL 1' _vosrc="$_vosrc vo_gl.c vo_gl2.c gl_common.c" if test "$_gl_win32" = yes ; then _def_gl_win32='#define GL_WIN32 1' _vosrc="$_vosrc w32_common.c" _res_comment="win32 version" fi _vomodules="opengl $_vomodules" else _def_gl='#undef HAVE_GL' _def_gl_win32='#undef GL_WIN32' _novomodules="opengl $_novomodules" fi echores "$_gl"
alpha && linux && _vidix_internal=yes qnx || beos || darwin && _vidix_internal=no
fi if test "$_vidix_internal" = yes; then _res_comment="internal" _vidix_external=no _vidix=yes elif test "$_vidix_external" = auto; then _vidix_external=no cat > $TMPC <<EOF #include int main(void) { return 0; } EOF cc_check -lvidix && _vidix_external=yes && _res_comment="external" \ && _vidix=yes fi echores "$_vidix" if test "$_vidix" = yes ; then _def_vidix='#define CONFIG_VIDIX 1' _vosrc="$_vosrc vo_cvidix.c" _vomodules="cvidix $_vomodules" test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 savage sis unichrome" test $_ivtv = "yes" || _vidix_drivers=`echo $_vidix_drivers | sed s/ivtv//` # some vidix drivers are not meant to work on powerpc, discard them ppc && _vidix_drivers=`echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome//` for driver in $_vidix_drivers ; do uc_driver=`echo $driver | tr '[a-z]' '[A-Z]'` eval _vidix_drv_${driver}=yes eval _def_vidix_drv_${driver}=\"\#define CONFIG_VIDIX_DRV_${uc_driver} 1\" done else _novomodules="cvidix $_novomodules" fi if test "$_vidix_internal" = yes ; then _def_vidix_pfx="#define MP_VIDIX_PFX \"$_libdir\" \"/mplayer/vidix/\" " elif test "$_vidix_external" = yes ; then _libs_mplayer="$_libs_mplayer -lvidix" _def_vidix_pfx='#define MP_VIDIX_PFX "" ' fi if test "$_vidix" = yes && win32; then _vosrc="$_vosrc vo_winvidix.c" _vomodules="winvidix $_vomodules" _libs_mplayer="$_libs_mplayer -lgdi32" else _novomodules="winvidix $_novomodules" fi if test "$_vidix" = yes && test "$_x11" = yes; then _vosrc="$_vosrc vo_xvidix.c" _vomodules="xvidix $_vomodules" else _novomodules="xvidix $_novomodules"
fi 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 "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) { ggiInit(); return 0; } EOF _ggi=no cc_check -lggi && _ggi=yes fi if test "$_ggi" = yes ; then _def_ggi='#define HAVE_GGI 1' _libs_mplayer="$_libs_mplayer -lggi" _vosrc="$_vosrc vo_ggi.c" _vomodules="ggi $_vomodules" else _def_ggi='#undef HAVE_GGI' _novomodules="ggi $_novomodules" fi echores "$_ggi" echocheck "GGI extension: libggiwmh" if test "$_ggiwmh" = auto ; then _ggiwmh=no
cat > $TMPC << EOF #include #include int main(void) { ggiInit(); ggiWmhInit(); return 0; } EOF cc_check -lggi -lggiwmh && _ggiwmh=yes fi # needed to get right output on obscure combination # like --disable-ggi --enable-ggiwmh if test "$_ggi" = yes && test "$_ggiwmh" = yes ; then _def_ggiwmh='#define HAVE_GGIWMH 1' _libs_mplayer="$_libs_mplayer -lggiwmh" else _ggiwmh=no _def_ggiwmh='#undef HAVE_GGIWMH' fi echores "$_ggiwmh" echocheck "AA" if test "$_aa" = auto ; then cat > $TMPC << EOF #include extern struct aa_hardware_params aa_defparams; extern struct aa_renderparams aa_defrenderparams; int main(void) { aa_context *c; aa_renderparams *p; (void) aa_init(0, 0, 0); c = aa_autoinit(&aa_defparams); p = aa_getrenderparams(); aa_autoinitkbd(c,0); return 0; } EOF _aa=no for _ld_tmp in "-laa" ; do cc_check $_ld_tmp && _libs_mplayer="$_libs_mplayer $_ld_tmp" && _aa=yes && break done fi if test "$_aa" = yes ; then _def_aa='#define HAVE_AA 1' if cygwin ; then _libs_mplayer="$_libs_mplayer `aalib-config --libs | cut -d " " -f 2,5,6`" fi _vosrc="$_vosrc vo_aa.c" _vomodules="aa $_vomodules" else _def_aa='#undef HAVE_AA' _novomodules="aa $_novomodules" fi echores "$_aa" echocheck "CACA" if test "$_caca" = auto ; then _caca=no if ( caca-config --version ) >> "$TMPLOG" 2>&1 ; then
cat > $TMPC << EOF #include #ifdef CACA_API_VERSION_1 #include #endif int main(void) { (void) caca_init(); return 0; } EOF cc_check `caca-config --libs` && _caca=yes fi fi if test "$_caca" = yes ; then _def_caca='#define HAVE_CACA 1' _inc_extra="$_inc_extra `caca-config --cflags`" _libs_mplayer="$_libs_mplayer `caca-config --libs`" _vosrc="$_vosrc vo_caca.c" _vomodules="caca $_vomodules" else _def_caca='#undef HAVE_CACA' _novomodules="caca $_novomodules" fi echores "$_caca" echocheck "SVGAlib" if test "$_svga" = auto ; then cat > $TMPC << EOF #include int main(void) { return 0; } EOF _svga=no cc_check -lvga $_ld_lm && _svga=yes fi if test "$_svga" = yes ; then _def_svga='#define HAVE_SVGALIB 1' _libs_mplayer="$_libs_mplayer -lvga" _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 && _fbdev=yes fi if test "$_fbdev" = yes ; then _def_fbdev='#define HAVE_FBDEV 1' _vosrc="$_vosrc vo_fbdev.c vo_fbdev2.c" _vomodules="fbdev $_vomodules" else _def_fbdev='#undef HAVE_FBDEV' _novomodules="fbdev $_novomodules" fi echores "$_fbdev"
echocheck "DVB" if test "$_dvb" = auto ; then _dvb=no cat >$TMPC << EOF #include <sys/poll.h> #include <sys/ioctl.h> #include <stdio.h> #include #include #include #include #include #include #include int main(void) {return 0;} EOF for _inc_tmp in "" "-I/usr/src/DVB/ost/include" ; do cc_check $_inc_tmp && _dvb=yes && \ _inc_extra="$_inc_extra $_inc_tmp" && break done fi echores "$_dvb" 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 echocheck "DVB HEAD" if test "$_dvbhead" = auto ; then _dvbhead=no cat >$TMPC << EOF #include <sys/poll.h> #include <sys/ioctl.h> #include <stdio.h> #include #include #include #include #include #include int main(void) {return 0;} EOF for _inc_tmp in "" "-I/usr/src/DVB/include" ; do cc_check $_inc_tmp && _dvbhead=yes && \ _inc_extra="$_inc_extra $_inc_tmp" && break done fi echores "$_dvbhead" 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 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 _inputmodules="dvb $_inputmodules" else _dvbin=no _noinputmodules="dvb $_noinputmodules" fi echocheck "zr" if test "$_zr" = auto ; then #36067's seem to identify themselves as 36057PQC's, so the line #below should work for 36067's and 36057's. if grep -e "Multimedia video controller: Zoran Corporation ZR36057" /proc/pci > /dev/null 2>&1; then _zr=yes else _zr=no fi fi if test "$_zr" = yes ; then if test "$_libavcodec_a" = yes ; then _def_zr='#define HAVE_ZR 1' _vosrc="$_vosrc vo_zr2.c vo_zr.c jpeg_enc.c" _vomodules="zr zr2 $_vomodules" else _res_comment="libavcodec (static) is required by zr, sorry" _novomodules="zr $_novomodules" _def_zr='#undef HAVE_ZR' fi else _def_zr='#undef HAVE_ZR' _novomodules="zr zr2 $_novomodules" fi echores "$_zr" 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 _res_comment="disabled on irix (not GNU libpng)" else cat > $TMPC << EOF
#include #include <string.h> 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 $_ld_lm ; then if tmp_run ; then _png=yes else _res_comment="mismatch of library and header versions" fi fi fi fi echores "$_png" if test "$_png" = yes ; then _def_png='#define HAVE_PNG 1' _ld_extra="$_ld_extra -lpng -lz" _vosrc="$_vosrc vo_png.c" _vomodules="png $_vomodules" else _def_png='#undef HAVE_PNG' _novomodules="png $_novomodules" fi echocheck "JPEG support" if test "$_jpeg" = auto ; then _jpeg=no cat > $TMPC << EOF #include <stdio.h> #include <stdlib.h> #include <setjmp.h> #include <string.h> #include <jpeglib.h> int main(void) { return 0; } EOF if cc_check -ljpeg $_ld_lm ; then if tmp_run ; then _jpeg=yes fi fi fi echores "$_jpeg" if test "$_jpeg" = yes ; then _def_jpeg='#define HAVE_JPEG 1' _vosrc="$_vosrc vo_jpeg.c" _vomodules="jpeg $_vomodules" _ld_extra="$_ld_extra -ljpeg" else _def_jpeg='#undef HAVE_JPEG' _novomodules="jpeg $_novomodules" fi
echocheck "PNM support" if test "$_pnm" = yes; then _def_pnm="#define HAVE_PNM" _vosrc="$_vosrc vo_pnm.c" _vomodules="pnm $_vomodules" else _def_pnm="#undef HAVE_PNM" _novomodules="pnm $_novomodules" fi echores "$_pnm"
echocheck "GIF support" # This is to appease people who want to force gif support. # If it is forced to yes, then we still do checks to determine # which gif library to use. if test "$_gif" = yes ; then _force_gif=yes _gif=auto fi if test "$_gif" = auto ; then _gif=no cat > $TMPC << EOF #include int main(void) { return 0; } EOF for _ld_gif in "-lungif" "-lgif" ; do cc_check $_ld_gif && tmp_run && _gif=yes && break done fi # If no library was found, and the user wants support forced, # then we force it on with libgif, as this is the safest # assumption IMHO. (libungif & libregif both create symbolic # links to libgif. We also assume that no x11 support is needed, # because if you are forcing this, then you _should_ know what # you are doing. [ Besides, package maintainers should never # have compiled x11 deps into libungif in the first place. ] ) # # --Joey if test "$_force_gif" = yes && test "$_gif" = no ; then _gif=yes _ld_gif="-lgif" fi if test "$_gif" = yes ; then _def_gif='#define HAVE_GIF 1' _vosrc="$_vosrc vo_gif89a.c" _codecmodules="gif $_codecmodules" _vomodules="gif89a $_vomodules" _res_comment="old version, some encoding functions disabled"
_def_gif_4='#undef HAVE_GIF_4' _ld_extra="$_ld_extra $_ld_gif" cat > $TMPC << EOF #include <signal.h> #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" && tmp_run ; then _def_gif_4='#define HAVE_GIF_4 1' _res_comment="" fi else _def_gif='#undef HAVE_GIF' _def_gif_4='#undef HAVE_GIF_4' _novomodules="gif89a $_novomodules" _nocodecmodules="gif $_nocodecmodules" 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" && tmp_run ; then _def_gif_tvt_hack='#undef HAVE_GIF_TVT_HACK' echores "disabled" else echores "enabled" fi ;; esac echocheck "VESA support" if test "$_vesa" = auto ; then cat > $TMPC << EOF #include int main(void) { vbeVersion(); return 0; } EOF _vesa=no cc_check -lvbe -llrmi && _vesa=yes fi
if test "$_vesa" = yes ; then _def_vesa='#define HAVE_VESA 1' _libs_mplayer="$_libs_mplayer -lvbe -llrmi" _vosrc="$_vosrc vo_vesa.c vesa_lvo.c gtf.c" _vomodules="vesa $_vomodules" else _def_vesa='#undef HAVE_VESA' _novomodules="vesa $_novomodules" fi echores "$_vesa" ################# # 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 <SDL.h> int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE); 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 fi fi fi fi if test "$_sdl" = yes ; then _def_sdl='#define HAVE_SDL 1' if cygwin ; then _libs_mplayer="$_libs_mplayer `$_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/`" _inc_extra="$_inc_extra `$_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/`" elif mingw32 ; then
_libs_mplayer="$_libs_mplayer `$_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//`" _inc_extra="$_inc_extra `$_sdlconfig --cflags | sed s/-Dmain=SDL_main//`" else _libs_mplayer="$_libs_mplayer `$_sdlconfig --libs`" _inc_extra="$_inc_extra `$_sdlconfig --cflags | sed s/-D_GNU_SOURCE=1//`" fi _vosrc="$_vosrc vo_sdl.c" _vomodules="sdl $_vomodules" _aosrc="$_aosrc ao_sdl.c" _aomodules="sdl $_aomodules" _res_comment="using $_sdlconfig" else _def_sdl='#undef HAVE_SDL' _novomodules="sdl $_novomodules" _noaomodules="sdl $_noaomodules" fi echores "$_sdl" if win32; then echocheck "Windows waveout" if test "$_win32waveout" = auto ; then cat > $TMPC << EOF #include <windows.h> #include <mmsystem.h> 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' _libs_mplayer="$_libs_mplayer -lwinmm" _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 <windows.h> #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' _libs_mplayer="$_libs_mplayer -lgdi32" _vosrc="$_vosrc vo_directx.c"
_vomodules="directx $_vomodules" _aosrc="$_aosrc ao_dsound.c" _aomodules="dsound $_aomodules" else _def_directx='#undef HAVE_DIRECTX' _novomodules="directx $_novomodules" _noaomodules="dsound $_noaomodules" fi echores "$_directx" fi #if win32; then echocheck "NAS" if test "$_nas" = auto ; then cat > $TMPC << EOF #include