diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 4065 |
1 files changed, 1852 insertions, 2213 deletions
@@ -1,144 +1,50 @@ #! /bin/sh - -# -# MPlayer configurator. (C) 2000 Pontscho/fresh!mindworkz -# pontscho@makacs.poliod.hu -# -# Changes in reversed order: -# 2001/11/15 by Gabucino -# - optional linking parameters for static linking -# -# 2001/11/14 by David Holm -# - added --enable-libvo2 for dev purposes -# -# 2001/11/14 by Gabucino -# - dunno who made the --target option but now it even works -# - fixed some Intel arch test for --target -# - added static linking with --enable-static -# -# 2001/10/26 by al3x -# - added detection of zlib (used by libmpdemux/demux_mov.c) -# -# 2001/10/22 by Jeroen Dobbelaere -# - added selection of libmad -# -# 2001/08/27 by Johannes Feigl -# - added manual selection of language -# -# 2001/08/22 by Nick Kurshev -# - added autodetection of local language -# -# 2001/07/31 by Steve Davies -# - added --enable-largefiles -# -# 2001/07/12 by Juergen Keil -# - add support for non-x86 targets -# - add autoconf checks for loader/wine -# - fix linux 2.2.x kernel check vs. SSE usage -# -# 2001/07/04 by Juergen Keil -# - autodetect the assembler binary used by the GCC C compiler -# -# 2001/07/03 by Nick Kurshev -# - added universal way of configuring SUBDIRS -# - moved configurable stuff of depended SUBDIRS to SUBDIRS -# -# 2001/06/05 by Pontscho -# - added alsa and esd detection -# -# 2001/06/05 by Nick Kurshev -# - added checking of kernel version # -# 2001/06/04 by Nick Kurshev -# - added hard checking of gcc and soft of assembler +# Original version (C) 2000 Pontscho/fresh!mindworkz +# pontscho@makacs.poliod.hu # -# 2001/05/30 by LGB -# - added --prefix support +# History / Contributors: check the cvs log ! # -# 2001/05/?? by Juergen Keil -# - autodetect OSS & Sun style audio -# - cpu feature detection for non-linux x86 systems -# - converted from bash to bourne shell script +# Cleanups all over the place (c) 2001 pl # -# 2001/05/22 by Nick Kurshev -# - added definition of CPU clone # -# 2001/04/16 by LGB -# - added libcss stuffs +# Guidelines: +# If the option is named 'opt': +# _opt : should have a value in yes/no/auto +# _def_opt : '#define ... 1' or '#undef ...' that is: some C code +# _ld_opt : ' -L/path/dir -lopt ' that is: some GCC option +# _inc_opt : ' -I/path/dir/include ' # -# 2001/04/15 by Pontscho -# - added --disable-select option -# - added X11DIR variable in config.mak and fix syncfb Makefile -L/usr/X11/lib bug +# GOTCHAS: +# - config files are currently: +# config2.h config2.mak libvo/config2.mak libao2/config2.mak +# Gui/config2.mak +# - removed xmmp/esd +# - removec dvbincdir/madincdir/cssincdir: add them to extraincdir # -# 2001/03/24 by Mike Graffam: -# - added autodetect code for XF86VidMode, along with explicit --enable-vm -# -# 2001/03/22 by Bivanbi: -# - new option: --cc (to specify C compiler path+name) -# -# 2001/03/08 by LGB: -# - DGA detect-o-matic :) -# - '--disable-dga' option to force disabling DGA vo driver compiling into mplayer -# - line about '--enable-dga' is added to the help message -# -# 2001/02/26 by A'rpi: -# - added DGA option: --enable-dga -# - no notify if --with-win32libdir used [Tibcu] -# -# 2001/02/25 by LGB: -# - TMPDIR or TEMPDIR variable is honored during tests for temporary files -# - ChangeLog inside configure was reversed ;-) -# -# some changes by A'rpi/ESP-team: -# - added 'athlon' target for the new athlongcc [Ian Kumlien] -# - applied _win32libdir=-L patch by Magnus Pfeffer -# -# some changes by LGB: -# - Ehhh, AMD K6-2 returns with cpuid 5 ;-) Changing back Arpi's last change :) -# More info: AMD K6-2 reports with family 5, duron with 6, so I attached -# much finer CPU type detection based on Linux kernel's one :) -# (k5: 5, model<6, k6: 5, model>=6, k7: 6, model=any) -# - On some exit point (error) temporary files were not deleted. Fixed. -# - $TMP and $TMP2 are renamed to $TMPC and $TMPO ;-) -# - Some useless { ... } are removed -# -# some changes by A'rpi/ESP-team: -# - the --with-win32libdir patch by Aaron Hope applied -# - some english bugfix again :) -# - cpu type selection changed: -# ( k7->k6->k5-> ) || (i686->pentiumpro-> ) pentium-> i486 -> i386 -> error! -# - cpu type for AMD/family=5 changed k6->k5 -# -# some changes by LGB (Gábor Lénárt): -# - SOME gcc may support 'k7', so I added tests for ALL CPU type optimization -# switches with the ability to find out the best optimization for your CPU. -# - Help moved to the begining to avoid tests if user only wants help. -# - A one lined help to indicate detailed help for users -# - Fixed /tmp race (PIDs can be predicted, I added random numbers as well) -# -# some changes by A'rpi/ESP-team: -# - some english bugfix :) -# - removed _??exists flags, _?? is enough... -# - creating only config.mak files instead of whole Makefiles -# -# -- +############################################################################# -# SOME MACROS/USEFUL FUNCTIONS -# Returns error code only - NO displaye +# Prefer these macros to full length text ! +# These macros only return an error code - NO display is done cc_check() { - ( "$_cc" "$TMPC" -o "$TMPO" "$@" ) >/dev/null 2>&1 - return "$?" + cat "$TMPC" >> "$TMPLOG" + echo >> "$TMPLOG" + echo "$_cc $TMPC -o $TMPO $@" >> "$TMPLOG" + ( "$_cc" $_inc_extra $_ld_extra "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1 + return "$?" } -# Display error message, flushes tempfile, exit +# Display error message, flushes tempfile, exit die () { - echo - echo "Error: $@" >&2 - echo >&2 - rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP" - exit 1 + echo + echo "Error: $@" >&2 + echo >&2 + rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP" + echo "Check "$TMPLOG" if you don't understand why it failed." + exit 1 } +# OS test booleans functions linux() { test "$system_name" = "Linux" ; return "$?" ; } sunos() { test "$system_name" = "SunOS" ; return "$?" ; } irix() { test "$system_name" = "IRIX" ; return "$?" ; } @@ -149,11 +55,25 @@ bsdos() { test "$system_name" = "BSD/OS" ; return "$?" ; } openbsd() { test "$system_name" = "OpenBSD" ; return "$?" ; } bsd() { freebsd || netbsd || bsdos || openbsd ; return "$?" ; } +# Use this before starting a check +echocheck() { + echo "============ Checking for $@ ============" >> "$TMPLOG" + echo "$_echo_n" "Checking for $@ ... $_echo_c" +} + +# Use this to echo the results of a check +echores() { + echo "Result is $@" >> "$TMPLOG" + echo "##########################################" >> "$TMPLOG" + echo "" >> "$TMPLOG" + echo "$@" +} +############################################################################# # Check how echo works in this /bin/sh case `echo -n` in --n) _echo_n= _echo_c='\c';; # seems to be a SysV echo -*) _echo_n=-n _echo_c=;; # OK, a BSD style echo + -n) _echo_n='' _echo_c='\c' ;; # SysV echo + *) _echo_n=-n _echo_c='' ;; # BSD echo esac LANGUAGES=`echo help_mp-??.h | sed "s/help_mp-\(..\).h/\1/g"` @@ -162,7 +82,7 @@ for parm in "$@" ; do if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then cat << EOF -Usage: `basename $0` [OPTIONS]... +Usage: $0 [OPTIONS]... Configuration: -h, --help display this help and exit @@ -170,18 +90,17 @@ Configuration: Installation directories: --prefix=DIR use this prefix for installing mplayer [/usr/local] --datadir=DIR use this prefix for installing machine independent - data [/usr/local/share/mplayer] + data [/usr/local/share/mplayer] Optional features: --enable-largefiles enable support for files >2^32 bytes long [disable] --enable-termcap use termcap database for key codes [disable] - --enable-xmmp use XMMP audio drivers [disable] - --enable-lirc enable LIRC (remote control) support [autodetect] + --enable-lirc enable LIRC (remote control) support [disable] --enable-gui enable GUI [disable] --enable-tv enable TV Interface (tv/dvb grabbers) [disable] --disable-win32 disable Win32 DLL support [autodetect] --disable-dshow disable DirectShow support (if no C++ compiler and - libs are available or find the dshow codecs slower + libs are available or find the dshow codecs slower than the old VfW ones) [autodetect] --disable-xanim disable XAnim DLL support [autodetect] --enable-vorbis build with OggVorbis support [autodetect] @@ -196,7 +115,7 @@ Video: --enable-ggi build with GGI render support [autodetect] --enable-dxr3 build with DXR3/H+ render support [autodetect] --enable-dvb build with support for output via DVB-Card [autodetect] - --enable-mga build with mga_vid support + --enable-mga build with mga_vid support (check for /dev/mga_vid) [autodetect] --enable-xmga build with mga_vid X Window support (check for X & /dev/mga_vid) [autodetect] @@ -210,7 +129,6 @@ Video: Audio: --disable-ossaudio disable OSS sound support [autodetect] --disable-alsa disable alsa sound support [autodetect] - --disable-esd disable esd sound support [autodetect] --disable-sunaudio disable Sun sound support [autodetect] --disable-mad disable mad audio support [autodetect] @@ -236,280 +154,177 @@ Advanced options: --enable-debug[=1-3] compile debugging information into mplayer [disable] --enable-profile compile profiling information into mplayer [disable] -Hazardous options: - If you ever use one of these options, DO NOT BUGREPORT ANYTHING ! +Hazardous options a.k.a. "DO NOT BUGREPORT ANYTHING !" --disable-gcc-checking disable gcc version checking - --disable-kernel-extchk disables checking for CPU extension support in - your kernel (MMX, SSE, ...) Use these options if autodetection fails: - --with-x11libdir=DIR X library files in DIR + --with-extraincdir=DIR extra headers (png, dvb, mad, sdl, css, ...) in DIR + --with-extralibdir=DIR extra library files (png, SDL, ...) in DIR --with-x11incdir=DIR X headers in DIR + --with-x11libdir=DIR X library files in DIR --with-win32libdir=DIR W*ndows DLL files in DIR --with-xanimlibdir=DIR XAnim DLL files in DIR - --with-csslibdir=DIR 'libcss.so' (libcss shared lib.) in DIR - --with-cssincdir=DIR 'css.h' (libcss header file) in DIR + --with-csslibdir=DIR 'libcss.so' in DIR --with-sdl-config=PATH path to sdl*-config (e.g.: /opt/bin/sdl-config) --with-gtk-config=PATH path to gtk*-config (e.g.: /opt/bin/gtk-config) --with-glib-config=PATH path to glib*-config (e.g.: /opt/bin/glib-config) - --with-extralibdir=DIR extra library files (png, SDL, ...) in DIR - --with-extraincdir=DIR extra headers (png, SDL) are in DIR - --with-dvbincdir=DIR dvb-driver files in DIR --with-madlibdir=DIR 'libmad.so' (libmad shared lib.) in DIR - --with-madincdir=DIR 'mad.h' (libmad header file) in DIR EOF exit 0 fi done # for parm in ... + +# 1st pass checking for vital options _cc=gcc test "$CC" && _cc="$CC" - _as=auto -_x11=auto -_sdlconfig= -_gtkconfig= -_glibconfig= - for ac_option do - case "$ac_option" in - --enable-static) - _static="-static" - ;; - --enable-static=*) - _static="-static `echo $ac_option | cut -d '=' -f 2`" - ;; + case "$ac_option" in --target=*) - _target=`echo $ac_option | cut -d '=' -f 2` - ;; + _target=`echo $ac_option | cut -d '=' -f 2` + ;; --cc=*) - _cc=`echo $ac_option | cut -d '=' -f 2` - ;; + _cc=`echo $ac_option | cut -d '=' -f 2` + ;; --as=*) - _as=`echo $ac_option | cut -d '=' -f 2` - ;; - --language=*) - LINGUAS=`echo $ac_option | cut -d '=' -f 2` - ;; + _as=`echo $ac_option | cut -d '=' -f 2` + ;; --disable-gcc-checking) - _skip_cc_check=yes - ;; - --disable-as-checking) - _skip_as_check=yes - ;; - --with-x11libdir=*) - _x11libdir=-L`echo $ac_option | cut -d '=' -f 2` - ;; - --with-x11incdir=*) - _x11incdir=-I`echo $ac_option | cut -d '=' -f 2` - ;; - --enable-x11) - _x11=yes - ;; - --disable-x11) - _x11=no - ;; - --with-sdl-config=*) - _sdlconfig=`echo $ac_option | cut -d '=' -f 2` - ;; - --with-gtk-config=*) - _gtkconfig=`echo $ac_option | cut -d '=' -f 2` - ;; - --with-glib-config=*) - _glibconfig=`echo $ac_option | cut -d '=' -f 2` - ;; - --with-extralibdir=*) - _extralibdir=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` - ;; + _skip_cc_check=yes + ;; --with-extraincdir=*) - _extraincdir=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` - ;; - --with-dvbincdir=*) - _dvbincdir=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` - ;; - --with-madlibdir=*) - _madlibdir=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` - ;; - --with-madincdir=*) - _madincdir=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` - ;; - esac + _inc_extra=-I`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -I,g'` + ;; + --with-extralibdir=*) + _ld_extra=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'` + ;; + esac done -# LGB: Some inital help - -cat <<EOF - -You can get detailed help on configure with: `basename $0` --help - -Please wait while ./configure discovers your software and hardware environment! - -EOF # 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) - : # well-known OSes - ;; - IRIX*) - system_name=IRIX - ;; - [cC][yY][gG][wW][iI][nN]*) - system_name=CYGWIN - ;; - *) - system_name="$system_name-UNKNOWN" - ;; - esac + # OS name + system_name=`( uname -s ) 2>&1` + case "$system_name" in + Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS) + ;; + IRIX*) + system_name=IRIX + ;; + [cC][yY][gG][wW][iI][nN]*) + system_name=CYGWIN + ;; + *) + system_name="$system_name-UNKNOWN" + ;; + esac - # host's CPU/instruction set + # host's CPU/instruction set host_arch=`( uname -p ) 2>&1` case "$host_arch" in i386|sparc|ppc|alpha|arm|mips) - # fine, uname -p output looks good, it has returned - # something this configure script recognizes - ;; - - *) # uname -p on Linux returns 'unknown' for the processor type, - # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)' - - # Maybe uname -m (machine hardware name) returns something we - # recognize. - - case "`uname -m 2>&1`" in - i[3-9]86) - host_arch=i386;; - ppc) - host_arch=ppc;; - alpha) - host_arch=alpha;; - sparc*) - host_arch=sparc;; - arm*) - host_arch=arm;; - esac - ;; - esac -else - system_name=`echo $_target | cut -d '-' -f 2` - host_arch=`echo $_target | cut -d '-' -f 1` -fi + ;; -echo "Detected operating system: $system_name" -echo "Detected host architecture: $host_arch" + *) # uname -p on Linux returns 'unknown' for the processor type, + # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)' -# Determine OS dependent libs -_confcygwin="TARGET_CYGWIN=no" -_confwin32= -if bsd ; then - _archlibs="-rdynamic -pthread" -elif cygwin ; then - _confcygwin="TARGET_CYGWIN=yes" - _confwin32="#define WIN32" - _archlibs="-lpthread" + # Maybe uname -m (machine hardware name) returns something we + # recognize. + + case "`( uname -m ) 2>&1`" in + i[3-9]86) host_arch=i386 ;; + ppc) host_arch=ppc ;; + alpha) host_arch=alpha ;; + sparc*) host_arch=sparc ;; + arm*) host_arch=arm ;; + *) host_arch=UNKNOWN ;; + esac + ;; + esac else - _archlibs="-ldl -lpthread" + system_name=`echo $_target | cut -d '-' -f 2` + host_arch=`echo $_target | cut -d '-' -f 1` fi -if bsdos ; then - _archlibs="$_archlibs -ldvd" -fi +echo "Detected operating system: $system_name" +echo "Detected host architecture: $host_arch" # LGB: temporary files for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do - test "$I" && break + test "$I" && break done -TMPC="$I/mplayer-conf-$RANDOM-$RANDOM-$$.c" -TMPCPP="$I/mplayer-conf-$RANDOM-$RANDOM-$$.cpp" -TMPO="$I/mplayer-conf-$RANDOM-$RANDOM-$$.o" -TMPS="$I/mplayer-conf-$RANDOM-$RANDOM-$$.S" -# --- +# FIXME use this when debug phases is over: +# TMPLOG="$I/configure2-$RANDOM-$$.log" +TMPLOG="configure2.log" +rm -f "$TMPLOG" +TMPC="$I/mplayer-conf-$RANDOM-$$.c" +TMPCPP="$I/mplayer-conf-$RANDOM-$$.cpp" +TMPO="$I/mplayer-conf-$RANDOM-$$.o" +TMPS="$I/mplayer-conf-$RANDOM-$$.S" # config files -CCONF='config.h' -MCONF='config.mak' -CHELP='help_mp.h' - -if test -z "$_x11libdir" ; then - for I in /usr/X11R6/lib /usr/X11/lib /usr/lib32 /usr/openwin/lib ; do - if test -d "$I" ; then - _x11libdir="-L$I" - break; - fi - done -fi - -if test -z "$_x11incdir" ; then - for I in /usr/include /usr/X11R6/include /usr/X11/include /usr/openwin/include ; do - if test -d "$I/X11" ; then - if test "$I" != /usr/include; then - _x11incdir="-I$I" - fi - break - fi - done -fi -# Lots of stuff are installed under /usr/local -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# NK: But we should never use this stuff implicitly -# since we call compiler from /usr we should be sure -# that there no effects from other compilers (libraries) -# which might be installed into /usr/local. -# Let users use this stuff explicitly as command line argument. -# In other words: It would be resonable have or only /usr/include -# or only /usr/local/include. +# FIXME: A lot of stuff is installed under /usr/local +# NK: But we should never use this stuff implicitly since we call compiler +# from /usr we should be sure that there no effects from other compilers +# (libraries) which might be installed into /usr/local. Let users use this +# stuff explicitly as command line argument. In other words: It would be +# resonable have or only /usr/include or only /usr/local/include. if freebsd ; then -_extralibdir=-L/usr/local/lib -_extraincdir=-I/usr/local/include + _ld_extra="$_ld_extra -L/usr/local/lib" + _inc_extra="$_inc_extra -I/usr/local/include" fi -test -z "$_extralibdir" && _extralibdir=-L/usr/lib -test -z "$_extraincdir" && _extraincdir=-I/usr/include - -# --- # Checking CC version... # gcc-3.0 merges optimizations coming from egcs, pgcc, agcc, ... if test "$_skip_cc_check" != yes ; then -echo $_echo_n "Checking version of $_cc ... $_echo_c" -cc_version=`$_cc -v 2>&1 | sed -n 's/^.*version \([aegcygnustp-]*[0-9.]*\).*$/\1/p'` -case $cc_version in - '') cc_version="v. ?.??, bad"; cc_verc_fail=yes;; + echocheck "$_cc version" + cc_version=`$_cc -v 2>&1 | sed -n 's/^.*version \([aegcygnustp-]*[0-9.]*\).*$/\1/p'` + case $cc_version in + '') + cc_version="v. ?.??, bad" + cc_verc_fail=yes + ;; 2.95.[2-9]|2.95.[2-9].[0-9]|3.[0-9]|3.[0-9].[0-9]) - cc_version="$cc_version, ok";; - *) cc_version="$cc_version, bad"; cc_verc_fail=yes;; -esac -echo "$cc_version" -if test "$cc_verc_fail" ; then -cat <<EOF + cc_version="$cc_version, ok" + ;; + *) + cc_version="$cc_version, bad" + cc_verc_fail=yes + ;; + esac + echores "$cc_version" + if test "$cc_verc_fail" ; then + cat <<EOF *** Please downgrade/upgrade C compiler to gcc-2.95.x or gcc-3.x version! *** -You're using a different compiler than us, and we don't have the time to make -sure everything works with every compiler out there. Please either use the -same compiler we do, or use --disable-gcc-checking but DO *NOT* report bugs -unless you can reproduce them after recompiling with 2.95.x or 3.x version! +You are using a different compiler than ours. We do not have the time to make +sure everything works with compilers than the one we use. Use either use the +same compiler as ours, or use --disable-gcc-checking but DO *NOT* REPORT BUGS +unless you can reproduce them after recompiling with 2.95.x or 3.0.x version! + +Note for gcc 2.96 users: some versions of this compiler are known to miscompile +mplayer and lame (which is used for mencoder). If you get compile errors, +first upgrade to the latest 2.96 release (but minimum 2.96-85) and try again. +If the problem still exists, try with gcc 3.0.x (or 2.95.x) *BEFORE* reporting +bugs! -Note for gcc 2.96 users: there were and are problems with this version! -If you get compile errors, first upgrade to the latest 2.96 release -(but minimum 2.96-85) and try again. If the problem still exists, try with -gcc 3.x (or 2.95.x) *BEFORE* reporting bugs! gcc 2.96 is TOTALLY UNSUPPORTED -by us! *** For details please read DOCS/gcc-2.96-3.0.html *** + GCC 2.96 IS NOT AND WILL NOT BE SUPPORTED BY US ! + + *** For details please read DOCS/gcc-2.96-3.0.html *** EOF -die "Bad gcc version" -fi + die "Bad gcc version" + fi else -# echo "YOU'VE SELECTED '--disable-gcc-checking'. PLEASE DON'T SEND US ANY BUGREPORTS!" - cat <<EOF ****************************************************************************** @@ -517,22 +332,21 @@ cat <<EOF Hmm. You really want to compile MPlayer with an *UNSUPPORTED* C compiler? Ok. You know. Do it. But did you already read DOCS/gcc-2.96-3.0.html ??? -DO NOT SEND BUGREPORTS OR COMPLAIN, it's *YOUR* fault! (exactly compiler's) +DO NOT SEND BUGREPORTS OR COMPLAIN, it's *YOUR* compiler's fault! Get ready for mysterious crashes, no-picture bugs, strange noises... REALLY! +Lame which is used by mencoder produces weird errors, too. If you have any problem, then install GCC 2.95.x or 3.x version and try again. If the problem _still_ exists, then read DOCS/bugreports.html ! + *** DO NOT SEND BUGREPORTS OR COMPLAIN it's *YOUR* compiler's fault! *** + ****************************************************************************** EOF read _answer -# if test "$_answer" != "gcc 2.96 is broken" ; then -# die "Wrong answer. Next time try 'gcc 2.96 is broken'. But you'd better to downgrade." -# fi - fi # --- @@ -540,403 +354,258 @@ fi # out which assembler is used by the $_cc compiler if test "$_as" = auto ; then _as=`$_cc -print-prog-name=as` - if test -z "$_as" ; then - _as=as + test -z "$_as" && _as=as +fi + +# Try to find the available options for the current CPU +if test "$host_arch" = i386 ; then + if test -r /proc/cpuinfo ; then + # linux with /proc mounted, extract cpu information from it + _cpuinfo="cat /proc/cpuinfo" + elif test -r /compat/linux/proc/cpuinfo ; then + # FreeBSD with linux emulation /proc mounted, + # extract cpu information from it + _cpuinfo="cat /compat/linux/proc/cpuinfo" + else + # all other OS try to extract cpu information from a small helper + # program TOOLS/cpuinfo instead + $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c + _cpuinfo="TOOLS/cpuinfo" fi -fi -if test "$host_arch" = i386 || test "$host_arch" = i486 || test "$host_arch" = i586 || test "$host_arch" = i686; then - if test -r /proc/cpuinfo ; then - # linux with /proc mounted, extract cpu information from it - _cpuinfo="cat /proc/cpuinfo" - elif test -r /compat/linux/proc/cpuinfo ; then - # FreeBSD with linux emulation /proc mounted, - # extract cpu information from it - _cpuinfo="cat /compat/linux/proc/cpuinfo" - else - # all other OS try to extract cpu information from a small helper - # program TOOLS/cpuinfo instead - $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c - _cpuinfo="TOOLS/cpuinfo" - fi + pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` + pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` - pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` - pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -1` - if test -z "$pparam" ; then - pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -1` - fi - 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` -else - # not an x86 host, cpuinfo stuff is not relevant - pname= pparam= pvendor= pfamily= pmodel= pstepping= -fi - -_mmx=no -_mmx2=no -_3dnow=no -_3dnowex=no -_mtrr=no -_sse=no -_vo2=no - -_mga=no -_gl=no -_sdl=no -_aa=no -_ggi=no -_xv=no -_vm=no -_xinerama=no -_xdpms_3=no -_xdpms_4=no -_3dfx=no -_tdfxfb=no -_syncfb=no -_mlib=no _mlibdir=/opt/SUNWmlib -_xmga=autodetect -_dga=no -_dga2=no -_svga=no -_fbdev=no -_dvb=no -_dxr3=no -linux && _fbdev=yes -_lirc=no -_css=no -_dvdread=no -_win32=no -_dshow=no -_xanim=yes -if test x"$host_arch" = x"i386" -o x"$host_arch" = x"i486" -o x"$host_arch" = x"i586" -o x"$host_arch" = x"i686" ; then - _win32=yes ; _dshow=yes -fi -_fastmemcpy=yes -_streaming=no -_libavcodec=no -_libavcodec_so=no -_kernelextcheck=yes - -_x=1 -_y=1 - -_gllib= -_sdllib= -_sdlcflags= -_aalib= -_ggilib= -_xvlib= -_x11lib= -_xineramalib= -_iconvlib= -_dxr3lib= -_volib= - -_select='#define HAVE_AUDIO_SELECT' - -_gui=no - -_tv=no - -_alsa=yes -_esd=yes -_mad=yes - -for i in $pparam; do - - case "$i" in - 3dnow) - _3dnow=yes - ;; - 3dnowext) - _3dnow=yes - _3dnowex=yes - ;; - mmx) - _mmx=yes - ;; - mmxext) - _mmx2=yes - ;; - mtrr|k6_mtrr) - _mtrr=yes - ;; - xmm|sse|kni) - _sse=yes - _mmx2=yes - ;; - esac - -done - - -# Check for win32 codecs directory -_win32libdir= -if test "$_win32" = yes ; then - for I in /usr/local/lib/win32 /usr/lib/win32 ; do - if test -d "$I" ; then - _win32libdir="$I" - break; - fi; - done -fi + pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -1` + if test -z "$pparam" ; then + pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -1` + fi -_xanimlibdir= -if test "$_xanim" = yes ; then - for I in /usr/local/lib/xanim/mods /usr/lib/xanim/mods ; do - if test -d "$I" ; then - _xanimlibdir="$I" - break; - fi; + _mmx=no + _3dnow=no + _3dnowex=no + _mmx2=no + _sse=no + _sse2=no + + for i in $pparam ; do + case "$i" in + 3dnow) _3dnow=yes ;; + 3dnowext) _3dnow=yes _3dnowex=yes ;; + mmx) _mmx=yes ;; + mmxext) _mmx2=yes ;; + mtrr|k6_mtrr) _mtrr=yes ;; + xmm|sse|kni) _sse=yes _mmx2=yes ;; + esac done -fi - -if test -d libavcodec && test -f libavcodec/Makefile ; then - _libavcodec=yes -fi -#Checking for libffmpeg.so -cat > $TMPC << EOF -#include <libffmpeg/avcodec.h> -int main( void ) { return 0; } -EOF -cc_check $_extraincdir $_extralibdir -lffmpeg -lm && _libavcodec_so=yes + echocheck "CPU vendor" + echores "$pvendor ($pfamily:$pmodel:$pstepping)" -if test -c /dev/mga_vid ; then - _mga=yes - _syncfb=yes -fi + echocheck "CPU type" + echores "$pname" -if test -c /dev/ost/video ; then - _dvb=yes fi -if test -c /dev/lirc ; then - _lirc=yes -fi -cat > $TMPC << EOF -int main( void ) { return 0; } -EOF case "$host_arch" in -i386|i486|i586|i686) - _arch="#define ARCH_X86 1" - _target_arch="TARGET_ARCH_X86=yes" - _words_endian="#undef WORDS_BIGENDIAN" - proc=pentium - iproc=586 - - case "$pvendor" in - AuthenticAMD) - case "$pfamily" in - 3) - proc=i386 - iproc=386 - ;; - 4) - proc=i486 - iproc=486 - ;; - 5) - if test "$pmodel" -ge 6 ; then # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 - proc=k6 - else - proc=k5 - fi - iproc=586 - ;; - 6|7) # LGB: Though it seems Athlon CPUs returns with "6" - proc=k7 - iproc=686 - ;; - *) - proc=pentium - iproc=586 - ;; - esac - ;; - GenuineIntel) - case "$pfamily" in - 3) - proc=i386 - iproc=386 - ;; - 4) - proc=i486 - iproc=486 - ;; - 5) - proc=pentium - iproc=586 - ;; - 6) - proc=i686 - iproc=686 - ;; - *) - proc=pentium - iproc=586 - ;; - esac - ;; - unknown) # added by Gabucino - upon Tibcu's request - case "$pfamily" in - 3) - proc=i386 - iproc=386 - ;; - 4) - proc=i486 - iproc=486 - ;; - *) - proc=pentium - iproc=586 - ;; - esac - ;; - *) - proc=pentium - iproc=586 - ;; + i386) + _def_arch="#define ARCH_X86 1" + _target_arch="TARGET_ARCH_X86 = yes" + _def_words_endian="#undef WORDS_BIGENDIAN" + iproc=586 + proc=pentium + + case "$pvendor" in + AuthenticAMD) + case "$pfamily" in + 3) proc=i386 iproc=386 ;; + 4) proc=i486 iproc=486 ;; + 5) proc=k5 iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 + test "$pmodel" -ge 6 && proc=k6 ;; + 6|7) proc=k7 iproc=686 ;; + *) proc=pentium iproc=586 ;; + esac + ;; + GenuineIntel) + case "$pfamily" in + 3) proc=i386 iproc=386 ;; + 4) proc=i486 iproc=486 ;; + 5) proc=pentium iproc=586 ;; + 6) proc=i686 iproc=686 ;; + *) proc=pentium iproc=586 ;; esac + ;; + unknown) + case "$pfamily" in + 3) proc=i386 iproc=386 ;; + 4) proc=i486 iproc=486 ;; + *) proc=pentium iproc=586 ;; + esac + ;; + *) + proc=pentium iproc=586 ;; + esac # check that gcc supports our cpu, if not, fallback to pentium # LGB: check -mcpu and -march swithing step by step with enabling # to fall back till 386. - #echo -n "Checking your GCC CPU optimalization abilities: " + echocheck "GCC & CPU optimization abilities" +cat > $TMPC << EOF +int main(void) { return 0; } +EOF + if test "$proc" = "k7" ; then - cc_check -march=$proc -mcpu=$proc || proc=athlon + cc_check -march=$proc -mcpu=$proc || proc=athlon fi if test "$proc" = "athlon" ; then - cc_check -march=$proc -mcpu=$proc || proc=pentiumpro + cc_check -march=$proc -mcpu=$proc || proc=pentiumpro fi if test "$proc" = "k6" ; then - cc_check -march=$proc -mcpu=$proc || proc=k5 + cc_check -march=$proc -mcpu=$proc || proc=k5 fi if test "$proc" = "k5" ; then - cc_check -march=$proc -mcpu=$proc || proc=pentium + cc_check -march=$proc -mcpu=$proc || proc=pentium fi if test "$proc" = "i686" ; then - cc_check -march=$proc -mcpu=$proc || proc=pentiumpro + cc_check -march=$proc -mcpu=$proc || proc=pentiumpro fi if test "$proc" = "pentiumpro" ; then - cc_check -march=$proc -mcpu=$proc || proc=pentium + cc_check -march=$proc -mcpu=$proc || proc=pentium fi if test "$proc" = "pentium" ; then - cc_check -march=$proc -mcpu=$proc || proc=i486 + cc_check -march=$proc -mcpu=$proc || proc=i486 fi if test "$proc" = "i486" ; then - cc_check -march=$proc -mcpu=$proc || proc=i386 + cc_check -march=$proc -mcpu=$proc || proc=i386 fi if test "$proc" = "i386" ; then - cc_check -march=$proc -mcpu=$proc || proc=error + cc_check -march=$proc -mcpu=$proc || proc=error fi if test "$proc" = "error" ; then - die "Your gcc does not support even \"i386\" for '-march' and '-mcpu'." + die "Your $_cc does not support even \"i386\" for '-march' and '-mcpu'." fi _march="-march=$proc" _mcpu="-mcpu=$proc" - ## ## Gabucino : --target takes effect here (hopefully...) by overwriting - ## autodetected mcpu/march parameters - ## - + ## autodetected mcpu/march parameters if test "$_target" ; then _march="-march=$host_arch" _mcpu="-mcpu=$host_arch" - proc="$_target" # a little cosmetic + proc="$_target" fi - #echo "DONE (${proc})." + echores "$proc" ;; - -sparc) - _arch="#define ARCH_SPARC 1" - _target_arch="TARGET_ARCH_SPARC=yes" - _words_endian="#define WORDS_BIGENDIAN 1" - iproc=sparc - proc=v8 - _march="" + sparc) + _def_arch='#define ARCH_SPARC 1' + _target_arch='TARGET_ARCH_SPARC = yes' + _def_words_endian='#define WORDS_BIGENDIAN 1' + iproc='sparc' + proc='v8' + _march='' _mcpu="-mcpu=$proc" ;; -arm) |