[MPlayer-cvslog] r22082 - trunk/configure

diego subversion at mplayerhq.hu
Wed Jan 31 00:18:51 CET 2007


Author: diego
Date: Wed Jan 31 00:18:51 2007
New Revision: 22082

Modified:
   trunk/configure

Log:
Unification of parameter handling part 1 of many:
Move second pass next to the first.


Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Wed Jan 31 00:18:51 2007
@@ -550,63 +550,709 @@
   esac
 done
 
-# Determine our OS name and CPU architecture
-if test -z "$_target" ; then
-  # OS name
-  system_name=`uname -s 2>&1`
-  case "$system_name" in
-  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX)
-    ;;
-  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|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)'
+_prefix="/usr/local"
 
-      # Maybe uname -m (machine hardware name) returns something we
-      # recognize.
+# 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
+_libavutil=auto
+_libavutil_so=auto
+_libavcodec=auto
+_amr_nb=auto
+_amr_nb_fixed=auto
+_amr_wb=auto
+_libavdecoders_all=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "libavcodec/allcodecs.c"`
+_libavdecoders=` echo $_libavdecoders_all | sed -e s/aac_decoder// -e s/mpeg4aac_decoder//  -e s/ac3_decoder// -e s/libgsm_decoder// -e s/libvorbis_decoder// `
+_libavencoders_all=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "libavcodec/allcodecs.c"`
+_libavencoders=` echo $_libavencoders_all | sed -e s/libgsm_encoder// -e s/libtheora_encoder// `
+_libavparsers_all=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "libavcodec/allcodecs.c"`
+_libavparsers=$_libavparsers_all
+_libavdemuxers_all=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c `
+_libavdemuxers=`echo $_libavdemuxers_all | sed -e s/audio_demuxer// -e s/dc1394_demuxer// -e s/dv1394_demuxer// -e s/redir_demuxer// -e s/rtsp_demuxer//  -e s/sdp_demuxer// -e s/video_grab_device_demuxer// -e s/x11_grab_device_demuxer// -e s/v4l2_demuxer// `
+_libavmuxers_all=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c`
+_libavmuxers=`echo $_libavmuxers_all | sed -e s/audio_muxer// -e s/rtp_muxer// `
+_libavcodec_so=auto
+_libavformat=auto
+_libavformat_so=auto
+_libpostproc=auto
+_libpostproc_so=auto
+_libavcodec_mpegaudio_hp=yes
+_mencoder=yes
+_mplayer=yes
+_x11=auto
+_xshape=auto
+_dga=auto	# 1 2 no auto
+_xv=auto
+_xvmc=no  #auto when complete
+_sdl=auto
+_directx=auto
+_win32waveout=auto
+_nas=auto
+_png=auto
+_jpeg=auto
+_pnm=yes
+_md5sum=yes
+_gif=auto
+_gl=auto
+_ggi=auto
+_ggiwmh=auto
+_aa=auto
+_caca=auto
+_svga=auto
+_vesa=auto
+_fbdev=auto
+_dvb=auto
+_dvbhead=auto
+_dxr2=auto
+_dxr3=auto
+_ivtv=auto
+_iconv=auto
+_langinfo=auto
+_rtc=auto
+_ossaudio=auto
+_arts=auto
+_esd=auto
+_polyp=auto
+_jack=auto
+_openal=auto
+_libcdio=auto
+_liblzo=auto
+_mad=auto
+_toolame=auto
+_twolame=auto
+_tremor_internal=yes
+_tremor_low=no
+_tremor_external=auto
+_libvorbis=auto
+_speex=auto
+_theora=auto
+_mp3lib=yes
+_liba52=yes
+_libdts=auto
+_libmpeg2=yes
+_faad_internal=auto
+_faad_external=auto
+_faad_fixed=no
+_faac=auto
+_ladspa=auto
+_xmms=no
+_dvdnav=auto
+_dvdnavconfig=dvdnav-config
+_dvdread=auto
+_dvdread_internal=auto
+_libdvdcss_internal=auto
+_xanim=auto
+_real=auto
+_live=auto
+_xinerama=auto
+_mga=auto
+_xmga=auto
+_vm=auto
+_xf86keysym=auto
+_mlib=no #broken, thus disabled
+_sgiaudio=auto
+_sunaudio=auto
+_alsa=auto
+_fastmemcpy=yes
+_unrarlib=yes
+_win32=auto
+_select=yes
+_radio=no
+_radio_capture=no
+_radio_v4l=auto
+_radio_v4l2=auto
+_radio_bsdbt848=auto
+_tv=yes
+_tv_v4l1=auto
+_tv_v4l2=auto
+_tv_bsdbt848=auto
+_pvr=auto
+_network=yes
+_winsock2=auto
+_smbsupport=auto
+_vidix_internal=auto
+_vidix_external=auto
+_joystick=no
+_xvid=auto
+_x264=auto
+_nut=auto
+_lirc=auto
+_lircc=auto
+_gui=no
+_gtk1=no
+_termcap=auto
+_termios=auto
+_3dfx=no
+_s3fb=no
+_tdfxfb=no
+_tdfxvid=no
+_tga=yes
+_directfb=auto
+_zr=auto
+_bl=no
+_largefiles=no
+#_language=en
+_shm=auto
+_linux_devfs=no
+_charset="UTF-8"
+_dynamic_plugins=no
+_crash_debug=no
+_sighandler=yes
+_libdv=auto
+_cdparanoia=auto
+_cddb=auto
+_big_endian=auto
+_bitmap_font=yes
+_freetype=auto
+_fontconfig=auto
+_menu=no
+_qtx=auto
+_macosx=auto
+_maemo=auto
+_macosx_finder_support=no
+_macosx_bundle=auto
+_sortsub=yes
+_freetypeconfig='freetype-config'
+_fribidi=auto
+_fribidiconfig='fribidi-config'
+_enca=auto
+_inet6=auto
+_gethostbyname2=auto
+_ftp=yes
+_musepack=auto
+_vstream=auto
+_pthreads=auto
+_ass=auto
+_rpath=no
+_asmalign_pot=auto
+_color_console=no
+for ac_option do
+  case "$ac_option" in
+  # Skip 1st pass
+  --target=*) ;;
+  --cc=*) ;;
+  --host-cc=*) ;;
+  --as=*) ;;
+  --enable-gcc-check) ;;
+  --disable-gcc-check) ;;
+  --enable-static*) ;;
+  --disable-static*) ;;
+  --with-extraincdir=*) ;;
+  --with-extralibdir=*) ;;
+  --extra-libs=*) ;;
+  --extra-libs-mplayer=*) ;;
+  --extra-libs-mencoder=*) ;;
+  --enable-runtime-cpudetection) ;;
+  --disable-runtime-cpudetection) ;;
+  --enable-cross-compile) ;;
+  --disable-cross-compile) ;;
+  --with-install=*) ;;
+  --enable-profile) ;;
+  --disable-profile) ;;
+  --enable-debug) ;;
+  --enable-debug=*) ;;
+  --disable-debug) ;;
 
-      # 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 ;;
+  # Real 2nd pass
+  --enable-mencoder)	_mencoder=yes	;;
+  --disable-mencoder)	_mencoder=no	;;
+  --enable-mplayer)	_mplayer=yes	;;
+  --disable-mplayer)	_mplayer=no	;;
+  --enable-dynamic-plugins) _dynamic_plugins=yes ;;
+  --disable-dynamic-plugins) _dynamic_plugins=no ;;
+  --enable-x11)		_x11=yes	;;
+  --disable-x11)	_x11=no		;;
+  --enable-xshape)	_xshape=yes	;;
+  --disable-xshape)	_xshape=no	;;
+  --enable-xv)		_xv=yes		;;
+  --disable-xv)		_xv=no		;;
+  --enable-xvmc)        _xvmc=yes       ;;
+  --disable-xvmc)       _xvmc=no        ;;
+  --enable-sdl)		_sdl=yes	;;
+  --disable-sdl)	_sdl=no		;;
+  --enable-directx)     _directx=yes    ;;
+  --disable-directx)    _directx=no     ;;
+  --enable-win32waveout)  _win32waveout=yes ;;
+  --disable-win32waveout) _win32waveout=no  ;;
+  --enable-nas)		_nas=yes	;;
+  --disable-nas)	_nas=no		;;
+  --enable-png)		_png=yes	;;
+  --disable-png)	_png=no		;;
+  --enable-jpeg)	_jpeg=yes	;;
+  --disable-jpeg)	_jpeg=no		;;
+  --enable-pnm)		_pnm=yes	;;
+  --disable-pnm)	_pnm=no		;;
+  --enable-md5sum)	_md5sum=yes	;;
+  --disable-md5sum)	_md5sum=no	;;
+  --enable-gif)	_gif=yes	;;
+  --disable-gif)	_gif=no		;;
+  --enable-gl)		_gl=yes		;;
+  --disable-gl)		_gl=no		;;
+  --enable-ggi)		_ggi=yes	;;
+  --disable-ggi)	_ggi=no		;;
+  --enable-ggiwmh)	_ggiwmh=yes	;;
+  --disable-ggiwmh)	_ggiwmh=no	;;
+  --enable-aa)		_aa=yes		;;
+  --disable-aa)		_aa=no		;;
+  --enable-caca)	_caca=yes	;;
+  --disable-caca)	_caca=no	;;
+  --enable-svga)	_svga=yes	;;
+  --disable-svga)	_svga=no	;;
+  --enable-vesa)	_vesa=yes	;;
+  --disable-vesa)	_vesa=no	;;
+  --enable-fbdev)	_fbdev=yes	;;
+  --disable-fbdev)	_fbdev=no	;;
+  --enable-dvb)		_dvb=yes	;;
+  --disable-dvb)        _dvb=no		;;
+  --enable-dvbhead)	_dvbhead=yes	;;
+  --disable-dvbhead)    _dvbhead=no	;;
+  --enable-dxr2)	_dxr2=yes	;;
+  --disable-dxr2)	_dxr2=no	;;
+  --enable-dxr3)	_dxr3=yes	;;
+  --disable-dxr3)	_dxr3=no	;;
+  --enable-ivtv)        _ivtv=yes       ;;
+  --disable-ivtv)       _ivtv=no        ;;
+  --enable-iconv)	_iconv=yes	;;
+  --disable-iconv)	_iconv=no	;;
+  --enable-langinfo)	_langinfo=yes	;;
+  --disable-langinfo)	_langinfo=no	;;
+  --enable-rtc)	        _rtc=yes	;;
+  --disable-rtc)	_rtc=no	        ;;
+  --enable-libdv)	_libdv=yes	;;
+  --disable-libdv)	_libdv=no	;;
+  --enable-ossaudio)	_ossaudio=yes	;;
+  --disable-ossaudio)	_ossaudio=no	;;
+  --enable-arts)	_arts=yes	;;
+  --disable-arts)	_arts=no	;;
+  --enable-esd)		_esd=yes	;;
+  --disable-esd)	_esd=no		;;
+  --enable-polyp)	_polyp=yes	;;
+  --disable-polyp)	_polyp=no		;;
+  --enable-jack)	_jack=yes	;;
+  --disable-jack)	_jack=no	;;
+  --enable-openal)	_openal=yes	;;
+  --disable-openal)	_openal=no	;;
+  --enable-mad)		_mad=yes	;;
+  --disable-mad)	_mad=no		;;
+  --enable-toolame)	_toolame=yes	;;
+  --disable-toolame)	_toolame=no	;;
+  --enable-twolame)	_twolame=yes	;;
+  --disable-twolame)	_twolame=no	;;
+  --enable-libcdio)	_libcdio=yes	;;
+  --disable-libcdio)	_libcdio=no	;;
+  --enable-liblzo)	_liblzo=yes	;;
+  --disable-liblzo)	_liblzo=no		;;
+  --enable-libvorbis)	_libvorbis=yes	;;
+  --disable-libvorbis)	_libvorbis=no	;;
+  --enable-speex)	_speex=yes	;;
+  --disable-speex)	_speex=no	;;
+  --enable-tremor-internal)	_tremor_internal=yes	;;
+  --disable-tremor-internal)	_tremor_internal=no	;;
+  --enable-tremor-low)	_tremor_low=yes	;;
+  --disable-tremor-low)	_tremor_low=no	;;
+  --enable-tremor-external)	_tremor_external=yes	;;
+  --disable-tremor-external)	_tremor_external=no	;;
+  --enable-theora)	_theora=yes	;;
+  --disable-theora)	_theora=no	;;
+  --enable-mp3lib)	_mp3lib=yes	;;
+  --disable-mp3lib)	_mp3lib=no	;;
+  --enable-liba52)	_liba52=yes	;;
+  --disable-liba52)	_liba52=no	;;
+  --enable-libdts)	_libdts=yes     ;;
+  --disable-libdts)	_libdts=no      ;;
+  --enable-libmpeg2)	_libmpeg2=yes	;;
+  --disable-libmpeg2)	_libmpeg2=no	;;
+  --enable-musepack)	_musepack=yes	;;
+  --disable-musepack)	_musepack=no	;;
+  --enable-faad-internal)	_faad_internal=yes	;;
+  --disable-faad-internal)	_faad_internal=no	;;
+  --enable-faad-external)	_faad_external=yes	;;
+  --disable-faad-external)	_faad_external=no	;;
+  --enable-faad-fixed)	_faad_fixed=yes	;;
+  --disable-faad-fixed)	_faad_fixed=no	;;
+  --enable-faac)	_faac=yes	;;
+  --disable-faac)	_faac=no	;;
+  --enable-ladspa)	_ladspa=yes	;;
+  --disable-ladspa)	_ladspa=no		;;
+  --enable-xmms)	_xmms=yes	;;
+  --disable-xmms)	_xmms=no	;;
+  --enable-dvdread)	_dvdread=yes	;;
+  --disable-dvdread)	_dvdread=no	;;
+  --enable-dvdread-internal)	_dvdread_internal=yes	;;
+  --disable-dvdread-internal)	_dvdread_internal=no	;;
+  --enable-libdvdcss-internal)	_libdvdcss_internal=yes	;;
+  --disable-libdvdcss-internal)	_libdvdcss_internal=no	;;
+  --enable-dvdnav)	_dvdnav=yes	;;
+  --disable-dvdnav)	_dvdnav=no	;;
+  --enable-xanim)	_xanim=yes	;;
+  --disable-xanim)	_xanim=no	;;
+  --enable-real)	_real=yes	;;
+  --disable-real)	_real=no	;;
+  --enable-live)	_live=yes	;;
+  --disable-live)	_live=no	;;
+  --enable-xinerama)	_xinerama=yes	;;
+  --disable-xinerama)	_xinerama=no	;;
+  --enable-mga)		_mga=yes	;;
+  --disable-mga)	_mga=no		;;
+  --enable-xmga)	_xmga=yes	;;
+  --disable-xmga)	_xmga=no	;;
+  --enable-vm)		_vm=yes		;;
+  --disable-vm)		_vm=no		;;
+  --enable-xf86keysym)	_xf86keysym=yes	;;
+  --disable-xf86keysym)	_xf86keysym=no	;;
+  --enable-mlib)	_mlib=yes	;;
+  --disable-mlib)	_mlib=no	;;
+  --enable-sunaudio)	_sunaudio=yes	;;
+  --disable-sunaudio)	_sunaudio=no	;;
+  --enable-sgiaudio)	_sgiaudio=yes	;;
+  --disable-sgiaudio)	_sgiaudio=no	;;
+  --enable-alsa)	_alsa=yes	;;
+  --disable-alsa)	_alsa=no	;;
+  --enable-tv)		_tv=yes		;;
+  --disable-tv)		_tv=no		;;
+  --enable-tv-bsdbt848)	_tv_bsdbt848=yes	;;
+  --disable-tv-bsdbt848)	_tv_bsdbt848=no	;;
+  --enable-tv-v4l1)	_tv_v4l1=yes	;;
+  --disable-tv-v4l1)	_tv_v4l1=no	;;
+  --enable-tv-v4l2)	_tv_v4l2=yes	;;
+  --disable-tv-v4l2)	_tv_v4l2=no	;;
+  --enable-radio)       _radio=yes	;;
+  --enable-radio-capture)       _radio_capture=yes	;;
+  --disable-radio-capture)       _radio_capture=no	;;
+  --disable-radio)	_radio=no	;;
+  --enable-radio-v4l)	_radio_v4l=yes	;;
+  --disable-radio-v4l)	_radio_v4l=no	;;
+  --enable-radio-v4l2)	_radio_v4l2=yes	;;
+  --disable-radio-v4l2)	_radio_v4l2=no	;;
+  --enable-radio-bsdbt848)	_radio_bsdbt848=yes	;;
+  --disable-radio-bsdbt848)	_radio_bsdbt848=no	;;
+  --enable-pvr)  	_pvr=yes	;;
+  --disable-pvr)	_pvr=no 	;;
+  --enable-fastmemcpy)	_fastmemcpy=yes	;;
+  --disable-fastmemcpy)	_fastmemcpy=no	;;
+  --enable-network)	_network=yes	;;
+  --disable-network)	_network=no	;;
+  --enable-winsock2)	_winsock2=yes	;;
+  --disable-winsock2)	_winsock2=no	;;
+  --enable-smb)		_smbsupport=yes	;;
+  --disable-smb)	_smbsupport=no	;;
+  --enable-vidix-internal)	_vidix_internal=yes	;;
+  --disable-vidix-internal)	_vidix_internal=no	;;
+  --enable-vidix-external)	_vidix_external=yes	;;
+  --disable-vidix-external)	_vidix_external=no	;;
+  --enable-joystick)	_joystick=yes	;;
+  --disable-joystick)	_joystick=no	;;
+  --enable-xvid)	_xvid=yes	;;
+  --disable-xvid)	_xvid=no	;;
+  --enable-x264)        _x264=yes       ;;
+  --disable-x264)       _x264=no        ;;
+  --enable-nut)		_nut=yes	;;
+  --disable-nut)	_nut=no		;;
+  --enable-libavutil)	_libavutil=yes	;;
+  --disable-libavutil)	_libavutil=no	;;
+  --enable-libavutil_so)	_libavutil_so=yes	;;
+  --disable-libavutil_so)	_libavutil_so=no	;;
+  --enable-libavcodec)	_libavcodec=yes	;;
+  --disable-libavcodec)	_libavcodec=no	;;
+  --enable-libavcodec_so)	_libavcodec_so=yes	;;
+  --disable-libavcodec_so)	_libavcodec_so=no	;;
+  --enable-amr_nb)	_amr_nb=yes	;;
+  --disable-amr_nb)	_amr_nb=no	;;
+  --enable-amr_nb-fixed)	_amr_nb_fixed=yes ;;
+  --disable-amr_nb-fixed)	_amr_nb_fixed=no ;;
+  --enable-amr_wb)	_amr_wb=yes	;;
+  --disable-amr_wb)	_amr_wb=no	;;
+  --enable-decoder=*)	_libavdecoders="$_libavdecoders `echo $ac_option | cut -d '=' -f 2`" ;;
+  --disable-decoder=*)	_libavdecoders=`echo $_libavdecoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
+  --enable-encoder=*)	_libavencoders="$_libavencoders `echo $ac_option | cut -d '=' -f 2`" ;;
+  --disable-encoder=*)	_libavencoders=`echo $_libavencoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
+  --enable-parser=*)	_libavparsers="$_libavparsers `echo $ac_option | cut -d '=' -f 2`" ;;
+  --disable-parser=*)	_libavparsers=`echo $_libavparsers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
+  --enable-demuxer=*)	_libavdemuxers="$_libavdemuxers `echo $ac_option | cut -d '=' -f 2`" ;;
+  --disable-demuxer=*)	_libavdemuxers=`echo $_libavdemuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
+  --enable-muxer=*)	_libavmuxers="$_libavmuxers `echo $ac_option | cut -d '=' -f 2`" ;;
+  --disable-muxer=*)	_libavmuxers=`echo $_libavmuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
+  --enable-libavformat)	_libavformat=yes;;
+  --disable-libavformat)	_libavformat=no	;;
+  --enable-libavformat_so)	_libavformat_so=yes	;;
+  --disable-libavformat_so)	_libavformat_so=no	;;
+  --enable-libpostproc)		_libpostproc=yes	;;
+  --disable-libpostproc)	_libpostproc=no		;;
+  --enable-libpostproc_so)	_libpostproc_so=yes	;;
+  --disable-libpostproc_so)	_libpostproc_so=no	;;
+  --enable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=yes	;;
+  --disable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=no	;;
+
+  --enable-lirc)	_lirc=yes	;;
+  --disable-lirc)	_lirc=no	;;
+  --enable-lircc)	_lircc=yes	;;
+  --disable-lircc)	_lircc=no	;;
+  --enable-gui)		_gui=yes	;;
+  --disable-gui)	_gui=no		;;
+  --enable-gtk1)	_gtk1=yes	;;
+  --disable-gtk1)	_gtk1=no	;;
+  --enable-termcap)	_termcap=yes	;;
+  --disable-termcap)	_termcap=no	;;
+  --enable-termios)	_termios=yes    ;;
+  --disable-termios)    _termios=no     ;;
+  --enable-3dfx)	_3dfx=yes	;;
+  --disable-3dfx)	_3dfx=no	;;
+  --enable-s3fb)	_s3fb=yes	;;
+  --disable-s3fb)	_s3fb=no	;;
+  --enable-tdfxfb)	_tdfxfb=yes	;;
+  --disable-tdfxfb)	_tdfxfb=no	;;
+  --disable-tdfxvid)	_tdfxvid=no	;;
+  --enable-tdfxvid)	_tdfxvid=yes	;;
+  --disable-tga)	_tga=no	  	;;
+  --enable-tga)		_tga=yes	;;
+  --enable-directfb)	_directfb=yes	;;
+  --disable-directfb)	_directfb=no	;;
+  --enable-zr)		_zr=yes		;;
+  --disable-zr)		_zr=no		;;
+  --enable-bl)		_bl=yes		;;
+  --disable-bl)		_bl=no		;;
+  --enable-mtrr)	_mtrr=yes	;;
+  --disable-mtrr)	_mtrr=no	;;
+  --enable-largefiles)	_largefiles=yes	;;
+  --disable-largefiles)	_largefiles=no	;;
+  --enable-shm)		_shm=yes	;;
+  --disable-shm)	_shm=no         ;;
+  --enable-select)	_select=yes	;;
+  --disable-select)	_select=no	;;
+  --enable-linux-devfs)	_linux_devfs=yes	;;
+  --disable-linux-devfs)	_linux_devfs=no	;;
+  --enable-cdparanoia)	_cdparanoia=yes	;;
+  --disable-cdparanoia)	_cdparanoia=no	;;
+  --enable-cddb)	_cddb=yes	;;
+  --disable-cddb)	_cddb=no	;;
+  --enable-big-endian)  _big_endian=yes ;;
+  --disable-big-endian) _big_endian=no  ;;
+  --enable-bitmap-font)    _bitmap_font=yes   ;;
+  --disable-bitmap-font)   _bitmap_font=no    ;;
+  --enable-freetype)    _freetype=yes   ;;
+  --disable-freetype)   _freetype=no    ;;
+  --enable-fontconfig)  _fontconfig=yes ;;
+  --disable-fontconfig) _fontconfig=no  ;;
+  --enable-unrarlib)	_unrarlib=yes	;;
+  --disable-unrarlib)	_unrarlib=no	;;
+  --enable-ftp)         _ftp=yes        ;;
+  --disable-ftp)        _ftp=no         ;;
+  --enable-vstream)     _vstream=yes    ;;
+  --disable-vstream)    _vstream=no     ;;
+  --enable-pthreads)    _pthreads=yes   ;;
+  --disable-pthreads)   _pthreads=no    ;;
+  --enable-ass)         _ass=yes        ;;
+  --disable-ass)        _ass=no         ;;
+  --enable-rpath)       _rpath=yes      ;;
+  --disable-rpath)      _rpath=no       ;;
+  --enable-color-console)  _color_console=yes ;;
+  --disable-color-console) _color_console=no  ;;
+
+  --enable-fribidi)     _fribidi=yes    ;;
+  --disable-fribidi)    _fribidi=no     ;;
+
+  --enable-enca)        _enca=yes    ;;
+  --disable-enca)       _enca=no     ;;
+
+  --enable-inet6)	_inet6=yes	;;
+  --disable-inet6)	_inet6=no	;;
+
+  --enable-gethostbyname2)	_gethostbyname2=yes	;;
+  --disable-gethostbyname2)	_gethostbyname2=no	;;
+
+  --enable-dga) _dga=auto ;; # as we don't know if it's 1 or 2
+  --enable-dga=*) _dga=`echo $ac_option | cut -d '=' -f 2` ;;
+  --disable-dga) _dga=no ;;
+
+  --enable-menu) _menu=yes ;;
+  --disable-menu) _menu=no ;;
+
+  --enable-qtx) _qtx=yes ;;
+  --disable-qtx) _qtx=no ;;
+
+  --enable-macosx) _macosx=yes ;;
+  --disable-macosx) _macosx=no ;;
+  --enable-macosx-finder-support) _macosx_finder_support=yes ;;
+  --disable-macosx-finder-support) _macosx_finder_support=no ;;
+  --enable-macosx-bundle) _macosx_bundle=yes;;
+  --disable-macosx-bundle) _macosx_bundle=no;;
+
+  --enable-maemo) _maemo=yes ;;
+  --disable-maemo) _maemo=no ;;
+
+  --enable-sortsub) _sortsub=yes ;;
+  --disable-sortsub) _sortsub=no ;;
+
+  --charset=*)
+    _charset=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --language=*)
+    _language=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+
+  --codecsdir=*)
+    _codecsdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --win32codecsdir=*)
+    _win32codecsdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --xanimcodecsdir=*)
+    _xanimcodecsdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --realcodecsdir=*)
+    _realcodecsdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+
+  --enable-crash-debug)
+    _crash_debug=yes
+    ;;
+  --disable-crash-debug)
+    _crash_debug=no
+    ;;
+  --enable-sighandler)
+    _sighandler=yes
+    ;;
+  --disable-sighandler)
+    _sighandler=no
+    ;;
+
+  --enable-sse)	_sse=yes ;;
+  --disable-sse) _sse=no ;;
+  --enable-sse2) _sse2=yes ;;
+  --disable-sse2) _sse2=no ;;
+  --enable-mmxext) _mmxext=yes ;;
+  --disable-mmxext) _mmxext=no ;;
+  --enable-3dnow) _3dnow=yes ;;
+  --disable-3dnow) _3dnow=no _3dnowext=no ;;
+  --enable-3dnowext) _3dnow=yes _3dnowext=yes ;;
+  --disable-3dnowext) _3dnowext=no ;;
+  --enable-cmov) _cmov=yes ;;
+  --disable-cmov) _cmov=no ;;
+  --enable-altivec) _altivec=yes ;;
+  --disable-altivec) _altivec=no ;;
+  --enable-armv5te) _armv5te=yes ;;
+  --disable-armv5te) _armv5te=no ;;
+  --enable-iwmmxt) _iwmmxt=yes ;;
+  --disable-iwmmxt) _iwmmxt=no ;;
+  --enable-mmx)	_mmx=yes ;;
+  --disable-mmx) # 3Dnow! and MMX2 require MMX
+        _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;;
+
+  --enable-win32) _win32=yes ;;
+  --disable-win32) _win32=no ;;
+
+  --with-xvmclib=*)
+    _xvmclib=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-sdl-config=*)
+    _sdlconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-freetype-config=*)
+    _freetypeconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-fribidi-config=*)
+    _fribidiconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-gtk-config=*)
+    _gtkconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-glib-config=*)
+    _glibconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --with-dvdnav-config=*)
+    _dvdnavconfig=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --prefix=*)
+    _prefix=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --bindir=*)
+    _bindir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --datadir=*)
+    _datadir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --mandir=*)
+    _mandir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --confdir=*)
+    _confdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+  --libdir=*)
+    _libdir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
+
+  *)
+    echo "Unknown parameter: $ac_option"
+    exit 1
+    ;;
+
+  esac
+done
+
+# Atmos: moved this here, to be correct, if --prefix is specified
+test -z "$_bindir" && _bindir="$_prefix/bin"
+test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
+test -z "$_mandir" && _mandir="$_prefix/man"
+test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
+test -z "$_libdir" && _libdir="$_prefix/lib"
+
+# 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)
+    ;;
+  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|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 ;;
@@ -855,1417 +1501,772 @@
   _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 TOOLS/cpuinfo instead
-  $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
-  _cpuinfo="TOOLS/cpuinfo"
-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 _$ext=auto && eval _$ext=yes
-  done
-
-  # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
-  test $_sse = yes && _mmxext=yes
-
-  echocheck "CPU vendor"
-  echores "$pvendor ($pfamily:$pmodel:$pstepping)"
-
-  echocheck "CPU type"
-  echores "$pname"
-fi
-
-fi # test "$_runtime_cpudetection" = no
-
-
-case "$host_arch" in
-  i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
-  _def_arch_x86="#define ARCH_X86 1"
-  _target_arch_x86="TARGET_ARCH_X86 = yes"
-  _def_arch="#define ARCH_X86_32 1"
-  _target_arch="TARGET_ARCH_X86_32 = yes"
-  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" -eq 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
-	;;
-    *) 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
-    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
-    # i686 is probably the most common CPU - optimize for it
-    _mcpu="$cpuopt=i686"
-    # at least i486 required, for bswap instruction
-    _march="-march=i486"
-    cc_check $_mcpu || _mcpu=""
-    cc_check $_march $_mcpu || _march=""
-  fi
+  # 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 TOOLS/cpuinfo instead
+  $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
+  _cpuinfo="TOOLS/cpuinfo"
+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"
+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`
 
-      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
+  exts=`$_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | _head 1`
 
-    echores "$proc"
-    ;;
+  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/`
 
-  ia64)
-    _def_arch='#define ARCH_IA64 1'
-    _target_arch='TARGET_ARCH_IA64 = yes'
-    iproc='ia64'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
-    ;;
+  for ext in $pparam ; do
+    eval _$ext=auto && eval _$ext=yes
+  done
 
-  x86_64|amd64)
-    _def_arch='#define ARCH_X86_64 1'
-    _target_arch='TARGET_ARCH_X86_64 = yes'
-    _def_arch_x86="#define ARCH_X86 1"
-    _target_arch_x86="TARGET_ARCH_X86 = yes"
-    iproc='x86_64'
+  # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
+  test $_sse = yes && _mmxext=yes
 
-    # 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 "$pmodel" 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;;
-        esac
-        ;;
-      *)
-        proc=error;;
-      esac
-    fi # test "$_runtime_cpudetection" = no
+  echocheck "CPU vendor"
+  echores "$pvendor ($pfamily:$pmodel:$pstepping)"
 
-    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
-      # --- 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 || proc=error
-      fi
-      # --- Intel processors ---
-      if test "$proc" = "core2"; then
-        cc_check -march=$proc $cpuopt=$proc || proc=nocona
-      fi
-      if test "$proc" = "nocona"; then
-        cc_check -march=$proc $cpuopt=$proc || proc=pentium4
-      fi
-      if test "$proc" = "pentium4"; then
-        cc_check -march=$proc $cpuopt=$proc || proc=error
-      fi
+  echocheck "CPU type"
+  echores "$pname"
+fi
 
-      _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=x86-64"
-      cc_check $_mcpu || _mcpu=""
-      cc_check $_march $_mcpu || _march=""
-    fi
-    
-    _optimizing=""
+fi # test "$_runtime_cpudetection" = no
 
-    echores "$proc"
-    ;;
 
-  sparc)
-    _def_arch='#define ARCH_SPARC 1'
-    _target_arch='TARGET_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=v9 _vis='yes' _def_vis='#define HAVE_VIS = yes' ;;
-	    sun4v) proc=v9 ;;
-	    *) proc=v8 ;;
-	esac
-	echores "$proc"
-    else
-	proc=v8
-    fi
-    _march=''
-    _mcpu="-mcpu=$proc"
-    _optimizing="$proc"
-    ;;
+case "$host_arch" in
+  i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
+  _def_arch_x86="#define ARCH_X86 1"
+  _target_arch_x86="TARGET_ARCH_X86 = yes"
+  _def_arch="#define ARCH_X86_32 1"
+  _target_arch="TARGET_ARCH_X86_32 = yes"
+  iproc=486
+  proc=i486
 
-  sparc64)
-    _def_arch='#define ARCH_SPARC 1'
-    _target_arch='TARGET_ARCH_SPARC = yes'
-    _vis='yes'
-    _def_vis='#define HAVE_VIS = yes'
-    iproc='sparc'
-    proc='v9'
-    _march=''
-    _mcpu="-mcpu=$proc"
-    _optimizing="$proc"
-    ;;
 
-  arm|armv4l|armv5tel)
-    _def_arch='#define ARCH_ARMV4L 1'
-    _target_arch='TARGET_ARCH_ARMV4L = yes'
-    iproc='arm'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
+  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" -eq 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
+	;;
+    *) proc=prescott iproc=686 ;;
+    esac
     ;;
-
-  ppc)
-    _def_arch='#define ARCH_POWERPC 1'
-    _def_dcbzl='#define NO_DCBZL 1'
-    _target_arch='TARGET_ARCH_POWERPC = yes'
-    iproc='ppc'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
-    _altivec=no
-
-    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
-	    _altivec=yes
+  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
-        ;;
-      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
-	    _altivec=yes
+	;;
+    6) iproc=686
+	if test "$pmodel" -ge 9; then
+		proc=c3-2
+	else
+		proc=c3
+		iproc=586
 	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
-		    _altivec=yes
-		fi
-		;;
-	esac
-        ;;
-      AIX)
-	proc=`$_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//'`
 	;;
+    *) proc=i686 iproc=i686 ;;
     esac
-    if test "$_altivec" = yes; then
-        echores "$proc altivec"
-    else
-        echores "$proc"
-    fi
+    ;;
+  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
 
-    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 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
+    # 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.
 
-    if test -n "$_mcpu"; then
-        _optimizing=`echo $_mcpu | cut -c 8-`
-        echores "$_optimizing"
+    # 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
-        echores "none"
+	cpuopt=-mcpu
     fi
 
-    ;;
-
-  alpha)
-    _def_arch='#define ARCH_ALPHA 1'
-    _target_arch='TARGET_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 "$TMPO" "$TMPC"
-    case `"$TMPO"` in
-
-        0-0)    proc="ev4";   cpu_understands_mvi="0";;
-        1-0)    proc="ev5";   cpu_understands_mvi="0";;
-        1-1)    proc="ev56";  cpu_understands_mvi="0";; 
-        1-101)  proc="pca56"; cpu_understands_mvi="1";;
-        2-303)  proc="ev6";   cpu_understands_mvi="1";;
-        2-307)  proc="ev67";  cpu_understands_mvi="1";;
-        2-1307) proc="ev68";  cpu_understands_mvi="1";;
-    esac
-    echores "$proc"
-    
     echocheck "GCC & CPU optimization abilities"
-    if test "$proc" = "ev68" ; then
-      cc_check -mcpu=$proc || proc=ev67
+cat > $TMPC << EOF
+int main(void) { return 0; }
+EOF
+  if test "$_runtime_cpudetection" = no ; then
+    if test "$proc" = "k8"; then
+      cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp
     fi
-    if test "$proc" = "ev67" ; then
-      cc_check -mcpu=$proc || proc=ev6
+    if test "$proc" = "athlon-xp"; then
+      cc_check -march=$proc $cpuopt=$proc || proc=athlon
     fi
-    _mcpu="-mcpu=$proc"
-    echores "$proc"
-    
-    _optimizing="$proc"
-
-    echocheck "MVI instruction support in GCC"
-    if test "$_cc_major" -ge "3" && test "$cpu_understands_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)"
+    if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
+      cc_check -march=$proc $cpuopt=$proc  || proc=k6
     fi
-    ;;
-
-  mips)
-    _def_arch='#define ARCH_SGI_MIPS 1'
-    _target_arch='TARGET_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=''
+    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
-        echores "$proc"
+      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
+    # i686 is probably the most common CPU - optimize for it
+    _mcpu="$cpuopt=i686"
+    # at least i486 required, for bswap instruction
+    _march="-march=i486"
+    cc_check $_mcpu || _mcpu=""
+    cc_check $_march $_mcpu || _march=""
+  fi
 
-    ;;
-
-  hppa)
-    _def_arch='#define ARCH_PA_RISC 1'
-    _target_arch='TARGET_ARCH_PA_RISC = yes'
-    iproc='PA-RISC'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
-    ;;
-
-  s390)
-    _def_arch='#define ARCH_S390 1'
-    _target_arch='TARGET_ARCH_S390 = yes'
-    iproc='390'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
-    ;;
+    ## 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"
 
-  s390x)
-    _def_arch='#define ARCH_S390X 1'
-    _target_arch='TARGET_ARCH_S390X = yes'
-    iproc='390x'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
-    ;;
+      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
 
-  vax)
-    _def_arch='#define ARCH_VAX 1'
-    _target_arch='TARGET_ARCH_VAX = yes'
-    iproc='vax'
-    proc=''
-    _march=''
-    _mcpu=''
-    _optimizing=''
+    echores "$proc"
     ;;
 
-  generic)
-    _def_arch='#define ARCH_GENERIC 1'
-    _target_arch='TARGET_ARCH_GENERIC = yes'
-    iproc=''
+  ia64)
+    _def_arch='#define ARCH_IA64 1'
+    _target_arch='TARGET_ARCH_IA64 = yes'
+    iproc='ia64'
     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
-    _cmov=yes
-    x86_32 && _cmov=no
-    _mmx=yes
-    _3dnow=yes
-    _3dnowext=yes
-    _mmxext=yes
-    _sse=yes
-    _sse2=yes
-    _mtrr=yes
-  fi
-  if ppc; then
-    _altivec=yes
-  fi
-fi
-
-if x86_32 && test "$_runtime_cpudetection" = no ; then
-  extcheck() {
-    if test "$1" = yes ; 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
+  x86_64|amd64)
+    _def_arch='#define ARCH_X86_64 1'
+    _target_arch='TARGET_ARCH_X86_64 = yes'
+    _def_arch_x86="#define ARCH_X86 1"
+    _target_arch_x86="TARGET_ARCH_X86 = yes"
+    iproc='x86_64'
 
-      if cc_check && tmp_run ; then
-        echores "yes"
-	_optimizing="$_optimizing $2"
-        return 0
-      else
-        echores "failed"
-        echo "It seems that your kernel does not correctly support $2."
-        echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
-	return 1
-      fi
+    # 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
-    return 0
-  }
-
-  extcheck $_mmx "mmx" "emms" || _mmx=no
-  extcheck $_mmxext "mmxext" "sfence" || _mmxext=no
-  extcheck $_3dnow "3dnow" "femms" || _3dnow=no
-  extcheck $_3dnowext "3dnowext" "pswapd %%mm0, %%mm0" || _3dnowext=no
-  extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _sse=no _gcc3_ext="$_gcc3_ext -mno-sse"
-  extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _sse2=no _gcc3_ext="$_gcc3_ext -mno-sse2"
-  extcheck $_cmov "cmov" "cmovb %%eax,%%ebx" || _cmov=no
-  echocheck "mtrr support"
-  echores "$_mtrr"
-
-  if test "$_mtrr" = yes ; then
-    _optimizing="$_optimizing mtrr"
-  fi
-
-  if test "$_gcc3_ext" != ""; then
-    # if we had to disable sse/sse2 because the active kernel does not
-    # support this instruction set extension, we also have to tell
-    # gcc3 to not generate sse/sse2 instructions for normal C code
-    cat > $TMPC << EOF
-int main(void) { return 0; }
-EOF
-    cc_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
-  fi
-
-fi
-
+    if test "$_runtime_cpudetection" = no ; then
+      case "$pvendor" in
+      AuthenticAMD)
+        proc=k8;;
+      GenuineIntel)
+        case "$pmodel" 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;;
+        esac
+        ;;
+      *)
+        proc=error;;
+      esac
+    fi # test "$_runtime_cpudetection" = no
 
-echocheck "assembler support of -pipe option"
+    echocheck "GCC & CPU optimization abilities"
 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
-
+    # This is a stripped-down version of the i386 fallback.
+    if test "$_runtime_cpudetection" = no ; then
+      # --- 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 || proc=error
+      fi
+      # --- Intel processors ---
+      if test "$proc" = "core2"; then
+        cc_check -march=$proc $cpuopt=$proc || proc=nocona
+      fi
+      if test "$proc" = "nocona"; then
+        cc_check -march=$proc $cpuopt=$proc || proc=pentium4
+      fi
+      if test "$proc" = "pentium4"; then
+        cc_check -march=$proc $cpuopt=$proc || proc=error
+      fi
 
-# Checking for CFLAGS
-_stripbinaries=yes
-if test "$_profile" != "" || test "$_debug" != "" ; then
-  CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
-  if test "$_cc_major" -ge "3" ; then
-    CFLAGS=`echo "$CFLAGS" | sed -e 's/\(-Wall\)/\1 -Wno-unused-parameter/'`
-  fi
-  _stripbinaries=no
-elif test -z "$CFLAGS" ; then
-  if test "$cc_vendor" = "intel" ; then
-    CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer"
-  elif test "$cc_vendor" != "gnu" ; then
-    CFLAGS="-O2 $_march $_mcpu $_pipe"
-  else
-    CFLAGS="-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
+      _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=x86-64"
+      cc_check $_mcpu || _mcpu=""
+      cc_check $_march $_mcpu || _march=""
+    fi
+    
+    _optimizing=""
 
-_prefix="/usr/local"
+    echores "$proc"
+    ;;
 
-# 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
-_libavutil=auto
-_libavutil_so=auto
-_libavcodec=auto
-_amr_nb=auto
-_amr_nb_fixed=auto
-_amr_wb=auto
-_libavdecoders_all=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "libavcodec/allcodecs.c"`
-_libavdecoders=` echo $_libavdecoders_all | sed -e s/aac_decoder// -e s/mpeg4aac_decoder//  -e s/ac3_decoder// -e s/libgsm_decoder// -e s/libvorbis_decoder// `
-_libavencoders_all=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "libavcodec/allcodecs.c"`
-_libavencoders=` echo $_libavencoders_all | sed -e s/libgsm_encoder// -e s/libtheora_encoder// `
-_libavparsers_all=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "libavcodec/allcodecs.c"`
-_libavparsers=$_libavparsers_all
-_libavdemuxers_all=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c `
-_libavdemuxers=`echo $_libavdemuxers_all | sed -e s/audio_demuxer// -e s/dc1394_demuxer// -e s/dv1394_demuxer// -e s/redir_demuxer// -e s/rtsp_demuxer//  -e s/sdp_demuxer// -e s/video_grab_device_demuxer// -e s/x11_grab_device_demuxer// -e s/v4l2_demuxer// `
-_libavmuxers_all=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c`
-_libavmuxers=`echo $_libavmuxers_all | sed -e s/audio_muxer// -e s/rtp_muxer// `
-_libavcodec_so=auto
-_libavformat=auto
-_libavformat_so=auto
-_libpostproc=auto
-_libpostproc_so=auto
-_libavcodec_mpegaudio_hp=yes
-_mencoder=yes
-_mplayer=yes
-_x11=auto
-_xshape=auto
-_dga=auto	# 1 2 no auto
-_xv=auto
-_xvmc=no  #auto when complete
-_sdl=auto
-_directx=auto
-_win32waveout=auto
-_nas=auto
-_png=auto
-_jpeg=auto
-_pnm=yes
-_md5sum=yes
-_gif=auto
-_gl=auto
-_ggi=auto
-_ggiwmh=auto
-_aa=auto
-_caca=auto
-_svga=auto
-_vesa=auto
-_fbdev=auto
-_dvb=auto
-_dvbhead=auto
-_dxr2=auto
-_dxr3=auto
-_ivtv=auto
-_iconv=auto
-_langinfo=auto
-_rtc=auto
-_ossaudio=auto
-_arts=auto
-_esd=auto
-_polyp=auto
-_jack=auto
-_openal=auto
-_libcdio=auto
-_liblzo=auto
-_mad=auto
-_toolame=auto
-_twolame=auto
-_tremor_internal=yes
-_tremor_low=no
-_tremor_external=auto
-_libvorbis=auto
-_speex=auto
-_theora=auto
-_mp3lib=yes
-_liba52=yes
-_libdts=auto
-_libmpeg2=yes
-_faad_internal=auto
-_faad_external=auto
-_faad_fixed=no
-_faac=auto
-_ladspa=auto
-_xmms=no
-_dvdnav=auto
-_dvdnavconfig=dvdnav-config
-_dvdread=auto
-_dvdread_internal=auto
-_libdvdcss_internal=auto
-_xanim=auto
-_real=auto
-_live=auto
-_xinerama=auto
-_mga=auto
-_xmga=auto
-_vm=auto
-_xf86keysym=auto
-_mlib=no #broken, thus disabled
-_sgiaudio=auto
-_sunaudio=auto
-_alsa=auto
-_fastmemcpy=yes
-_unrarlib=yes
-_win32=auto
-_select=yes
-_radio=no
-_radio_capture=no
-_radio_v4l=auto
-_radio_v4l2=auto
-_radio_bsdbt848=auto
-_tv=yes
-_tv_v4l1=auto
-_tv_v4l2=auto
-_tv_bsdbt848=auto
-_pvr=auto
-_network=yes
-_winsock2=auto
-_smbsupport=auto
-_vidix_internal=auto
-_vidix_external=auto
-_joystick=no
-_xvid=auto
-_x264=auto
-_nut=auto
-_lirc=auto
-_lircc=auto
-_gui=no
-_gtk1=no
-_termcap=auto
-_termios=auto
-_3dfx=no
-_s3fb=no
-_tdfxfb=no
-_tdfxvid=no
-_tga=yes
-_directfb=auto
-_zr=auto
-_bl=no
-_largefiles=no
-#_language=en
-_shm=auto
-_linux_devfs=no
-_charset="UTF-8"
-_dynamic_plugins=no
-_crash_debug=no
-_sighandler=yes
-_libdv=auto
-_cdparanoia=auto
-_cddb=auto
-_big_endian=auto
-_bitmap_font=yes
-_freetype=auto
-_fontconfig=auto
-_menu=no
-_qtx=auto
-_macosx=auto
-_maemo=auto
-_macosx_finder_support=no
-_macosx_bundle=auto
-_sortsub=yes
-_freetypeconfig='freetype-config'
-_fribidi=auto
-_fribidiconfig='fribidi-config'
-_enca=auto
-_inet6=auto
-_gethostbyname2=auto
-_ftp=yes
-_musepack=auto
-_vstream=auto
-_pthreads=auto
-_ass=auto
-_rpath=no
-_asmalign_pot=auto
-_color_console=no
-for ac_option do
-  case "$ac_option" in
-  # Skip 1st pass
-  --target=*) ;;
-  --cc=*) ;;
-  --host-cc=*) ;;
-  --as=*) ;;
-  --enable-gcc-check) ;;
-  --disable-gcc-check) ;;
-  --enable-static*) ;;
-  --disable-static*) ;;
-  --with-extraincdir=*) ;;
-  --with-extralibdir=*) ;;
-  --extra-libs=*) ;;
-  --extra-libs-mplayer=*) ;;
-  --extra-libs-mencoder=*) ;;
-  --enable-runtime-cpudetection) ;;
-  --disable-runtime-cpudetection) ;;
-  --enable-cross-compile) ;;
-  --disable-cross-compile) ;;
-  --with-install=*) ;;
-  --enable-profile) ;;
-  --disable-profile) ;;
-  --enable-debug) ;;
-  --enable-debug=*) ;;
-  --disable-debug) ;;
+  sparc)
+    _def_arch='#define ARCH_SPARC 1'
+    _target_arch='TARGET_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=v9 _vis='yes' _def_vis='#define HAVE_VIS = yes' ;;
+	    sun4v) proc=v9 ;;
+	    *) proc=v8 ;;
+	esac
+	echores "$proc"
+    else
+	proc=v8
+    fi
+    _march=''
+    _mcpu="-mcpu=$proc"
+    _optimizing="$proc"
+    ;;
+
+  sparc64)
+    _def_arch='#define ARCH_SPARC 1'
+    _target_arch='TARGET_ARCH_SPARC = yes'
+    _vis='yes'
+    _def_vis='#define HAVE_VIS = yes'
+    iproc='sparc'
+    proc='v9'
+    _march=''
+    _mcpu="-mcpu=$proc"
+    _optimizing="$proc"
+    ;;
+
+  arm|armv4l|armv5tel)
+    _def_arch='#define ARCH_ARMV4L 1'
+    _target_arch='TARGET_ARCH_ARMV4L = yes'
+    iproc='arm'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
 
-  # Real 2nd pass
-  --enable-mencoder)	_mencoder=yes	;;
-  --disable-mencoder)	_mencoder=no	;;
-  --enable-mplayer)	_mplayer=yes	;;
-  --disable-mplayer)	_mplayer=no	;;
-  --enable-dynamic-plugins) _dynamic_plugins=yes ;;
-  --disable-dynamic-plugins) _dynamic_plugins=no ;;
-  --enable-x11)		_x11=yes	;;
-  --disable-x11)	_x11=no		;;
-  --enable-xshape)	_xshape=yes	;;
-  --disable-xshape)	_xshape=no	;;
-  --enable-xv)		_xv=yes		;;
-  --disable-xv)		_xv=no		;;
-  --enable-xvmc)        _xvmc=yes       ;;
-  --disable-xvmc)       _xvmc=no        ;;
-  --enable-sdl)		_sdl=yes	;;
-  --disable-sdl)	_sdl=no		;;
-  --enable-directx)     _directx=yes    ;;
-  --disable-directx)    _directx=no     ;;
-  --enable-win32waveout)  _win32waveout=yes ;;
-  --disable-win32waveout) _win32waveout=no  ;;
-  --enable-nas)		_nas=yes	;;
-  --disable-nas)	_nas=no		;;
-  --enable-png)		_png=yes	;;
-  --disable-png)	_png=no		;;
-  --enable-jpeg)	_jpeg=yes	;;
-  --disable-jpeg)	_jpeg=no		;;
-  --enable-pnm)		_pnm=yes	;;
-  --disable-pnm)	_pnm=no		;;
-  --enable-md5sum)	_md5sum=yes	;;
-  --disable-md5sum)	_md5sum=no	;;
-  --enable-gif)	_gif=yes	;;
-  --disable-gif)	_gif=no		;;
-  --enable-gl)		_gl=yes		;;
-  --disable-gl)		_gl=no		;;
-  --enable-ggi)		_ggi=yes	;;
-  --disable-ggi)	_ggi=no		;;
-  --enable-ggiwmh)	_ggiwmh=yes	;;
-  --disable-ggiwmh)	_ggiwmh=no	;;
-  --enable-aa)		_aa=yes		;;
-  --disable-aa)		_aa=no		;;
-  --enable-caca)	_caca=yes	;;
-  --disable-caca)	_caca=no	;;
-  --enable-svga)	_svga=yes	;;
-  --disable-svga)	_svga=no	;;
-  --enable-vesa)	_vesa=yes	;;
-  --disable-vesa)	_vesa=no	;;
-  --enable-fbdev)	_fbdev=yes	;;
-  --disable-fbdev)	_fbdev=no	;;
-  --enable-dvb)		_dvb=yes	;;
-  --disable-dvb)        _dvb=no		;;
-  --enable-dvbhead)	_dvbhead=yes	;;
-  --disable-dvbhead)    _dvbhead=no	;;
-  --enable-dxr2)	_dxr2=yes	;;
-  --disable-dxr2)	_dxr2=no	;;
-  --enable-dxr3)	_dxr3=yes	;;
-  --disable-dxr3)	_dxr3=no	;;
-  --enable-ivtv)        _ivtv=yes       ;;
-  --disable-ivtv)       _ivtv=no        ;;
-  --enable-iconv)	_iconv=yes	;;
-  --disable-iconv)	_iconv=no	;;
-  --enable-langinfo)	_langinfo=yes	;;
-  --disable-langinfo)	_langinfo=no	;;
-  --enable-rtc)	        _rtc=yes	;;
-  --disable-rtc)	_rtc=no	        ;;
-  --enable-libdv)	_libdv=yes	;;
-  --disable-libdv)	_libdv=no	;;
-  --enable-ossaudio)	_ossaudio=yes	;;
-  --disable-ossaudio)	_ossaudio=no	;;
-  --enable-arts)	_arts=yes	;;
-  --disable-arts)	_arts=no	;;
-  --enable-esd)		_esd=yes	;;
-  --disable-esd)	_esd=no		;;
-  --enable-polyp)	_polyp=yes	;;
-  --disable-polyp)	_polyp=no		;;
-  --enable-jack)	_jack=yes	;;
-  --disable-jack)	_jack=no	;;
-  --enable-openal)	_openal=yes	;;
-  --disable-openal)	_openal=no	;;
-  --enable-mad)		_mad=yes	;;
-  --disable-mad)	_mad=no		;;
-  --enable-toolame)	_toolame=yes	;;
-  --disable-toolame)	_toolame=no	;;
-  --enable-twolame)	_twolame=yes	;;
-  --disable-twolame)	_twolame=no	;;
-  --enable-libcdio)	_libcdio=yes	;;
-  --disable-libcdio)	_libcdio=no	;;
-  --enable-liblzo)	_liblzo=yes	;;
-  --disable-liblzo)	_liblzo=no		;;
-  --enable-libvorbis)	_libvorbis=yes	;;
-  --disable-libvorbis)	_libvorbis=no	;;
-  --enable-speex)	_speex=yes	;;
-  --disable-speex)	_speex=no	;;
-  --enable-tremor-internal)	_tremor_internal=yes	;;
-  --disable-tremor-internal)	_tremor_internal=no	;;
-  --enable-tremor-low)	_tremor_low=yes	;;
-  --disable-tremor-low)	_tremor_low=no	;;
-  --enable-tremor-external)	_tremor_external=yes	;;
-  --disable-tremor-external)	_tremor_external=no	;;
-  --enable-theora)	_theora=yes	;;
-  --disable-theora)	_theora=no	;;
-  --enable-mp3lib)	_mp3lib=yes	;;
-  --disable-mp3lib)	_mp3lib=no	;;
-  --enable-liba52)	_liba52=yes	;;
-  --disable-liba52)	_liba52=no	;;
-  --enable-libdts)	_libdts=yes     ;;
-  --disable-libdts)	_libdts=no      ;;
-  --enable-libmpeg2)	_libmpeg2=yes	;;
-  --disable-libmpeg2)	_libmpeg2=no	;;
-  --enable-musepack)	_musepack=yes	;;
-  --disable-musepack)	_musepack=no	;;
-  --enable-faad-internal)	_faad_internal=yes	;;
-  --disable-faad-internal)	_faad_internal=no	;;
-  --enable-faad-external)	_faad_external=yes	;;
-  --disable-faad-external)	_faad_external=no	;;
-  --enable-faad-fixed)	_faad_fixed=yes	;;
-  --disable-faad-fixed)	_faad_fixed=no	;;
-  --enable-faac)	_faac=yes	;;
-  --disable-faac)	_faac=no	;;
-  --enable-ladspa)	_ladspa=yes	;;
-  --disable-ladspa)	_ladspa=no		;;
-  --enable-xmms)	_xmms=yes	;;
-  --disable-xmms)	_xmms=no	;;
-  --enable-dvdread)	_dvdread=yes	;;
-  --disable-dvdread)	_dvdread=no	;;
-  --enable-dvdread-internal)	_dvdread_internal=yes	;;
-  --disable-dvdread-internal)	_dvdread_internal=no	;;
-  --enable-libdvdcss-internal)	_libdvdcss_internal=yes	;;
-  --disable-libdvdcss-internal)	_libdvdcss_internal=no	;;
-  --enable-dvdnav)	_dvdnav=yes	;;
-  --disable-dvdnav)	_dvdnav=no	;;
-  --enable-xanim)	_xanim=yes	;;
-  --disable-xanim)	_xanim=no	;;
-  --enable-real)	_real=yes	;;
-  --disable-real)	_real=no	;;
-  --enable-live)	_live=yes	;;
-  --disable-live)	_live=no	;;
-  --enable-xinerama)	_xinerama=yes	;;
-  --disable-xinerama)	_xinerama=no	;;
-  --enable-mga)		_mga=yes	;;
-  --disable-mga)	_mga=no		;;
-  --enable-xmga)	_xmga=yes	;;
-  --disable-xmga)	_xmga=no	;;
-  --enable-vm)		_vm=yes		;;
-  --disable-vm)		_vm=no		;;
-  --enable-xf86keysym)	_xf86keysym=yes	;;
-  --disable-xf86keysym)	_xf86keysym=no	;;
-  --enable-mlib)	_mlib=yes	;;
-  --disable-mlib)	_mlib=no	;;
-  --enable-sunaudio)	_sunaudio=yes	;;
-  --disable-sunaudio)	_sunaudio=no	;;
-  --enable-sgiaudio)	_sgiaudio=yes	;;
-  --disable-sgiaudio)	_sgiaudio=no	;;
-  --enable-alsa)	_alsa=yes	;;
-  --disable-alsa)	_alsa=no	;;
-  --enable-tv)		_tv=yes		;;
-  --disable-tv)		_tv=no		;;
-  --enable-tv-bsdbt848)	_tv_bsdbt848=yes	;;
-  --disable-tv-bsdbt848)	_tv_bsdbt848=no	;;
-  --enable-tv-v4l1)	_tv_v4l1=yes	;;
-  --disable-tv-v4l1)	_tv_v4l1=no	;;
-  --enable-tv-v4l2)	_tv_v4l2=yes	;;
-  --disable-tv-v4l2)	_tv_v4l2=no	;;
-  --enable-radio)       _radio=yes	;;
-  --enable-radio-capture)       _radio_capture=yes	;;
-  --disable-radio-capture)       _radio_capture=no	;;
-  --disable-radio)	_radio=no	;;
-  --enable-radio-v4l)	_radio_v4l=yes	;;
-  --disable-radio-v4l)	_radio_v4l=no	;;
-  --enable-radio-v4l2)	_radio_v4l2=yes	;;
-  --disable-radio-v4l2)	_radio_v4l2=no	;;
-  --enable-radio-bsdbt848)	_radio_bsdbt848=yes	;;
-  --disable-radio-bsdbt848)	_radio_bsdbt848=no	;;
-  --enable-pvr)  	_pvr=yes	;;
-  --disable-pvr)	_pvr=no 	;;
-  --enable-fastmemcpy)	_fastmemcpy=yes	;;
-  --disable-fastmemcpy)	_fastmemcpy=no	;;
-  --enable-network)	_network=yes	;;
-  --disable-network)	_network=no	;;
-  --enable-winsock2)	_winsock2=yes	;;
-  --disable-winsock2)	_winsock2=no	;;
-  --enable-smb)		_smbsupport=yes	;;
-  --disable-smb)	_smbsupport=no	;;
-  --enable-vidix-internal)	_vidix_internal=yes	;;
-  --disable-vidix-internal)	_vidix_internal=no	;;
-  --enable-vidix-external)	_vidix_external=yes	;;
-  --disable-vidix-external)	_vidix_external=no	;;
-  --enable-joystick)	_joystick=yes	;;
-  --disable-joystick)	_joystick=no	;;
-  --enable-xvid)	_xvid=yes	;;
-  --disable-xvid)	_xvid=no	;;
-  --enable-x264)        _x264=yes       ;;
-  --disable-x264)       _x264=no        ;;
-  --enable-nut)		_nut=yes	;;
-  --disable-nut)	_nut=no		;;
-  --enable-libavutil)	_libavutil=yes	;;
-  --disable-libavutil)	_libavutil=no	;;
-  --enable-libavutil_so)	_libavutil_so=yes	;;
-  --disable-libavutil_so)	_libavutil_so=no	;;
-  --enable-libavcodec)	_libavcodec=yes	;;
-  --disable-libavcodec)	_libavcodec=no	;;
-  --enable-libavcodec_so)	_libavcodec_so=yes	;;
-  --disable-libavcodec_so)	_libavcodec_so=no	;;
-  --enable-amr_nb)	_amr_nb=yes	;;
-  --disable-amr_nb)	_amr_nb=no	;;
-  --enable-amr_nb-fixed)	_amr_nb_fixed=yes ;;
-  --disable-amr_nb-fixed)	_amr_nb_fixed=no ;;
-  --enable-amr_wb)	_amr_wb=yes	;;
-  --disable-amr_wb)	_amr_wb=no	;;
-  --enable-decoder=*)	_libavdecoders="$_libavdecoders `echo $ac_option | cut -d '=' -f 2`" ;;
-  --disable-decoder=*)	_libavdecoders=`echo $_libavdecoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
-  --enable-encoder=*)	_libavencoders="$_libavencoders `echo $ac_option | cut -d '=' -f 2`" ;;
-  --disable-encoder=*)	_libavencoders=`echo $_libavencoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
-  --enable-parser=*)	_libavparsers="$_libavparsers `echo $ac_option | cut -d '=' -f 2`" ;;
-  --disable-parser=*)	_libavparsers=`echo $_libavparsers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
-  --enable-demuxer=*)	_libavdemuxers="$_libavdemuxers `echo $ac_option | cut -d '=' -f 2`" ;;
-  --disable-demuxer=*)	_libavdemuxers=`echo $_libavdemuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
-  --enable-muxer=*)	_libavmuxers="$_libavmuxers `echo $ac_option | cut -d '=' -f 2`" ;;
-  --disable-muxer=*)	_libavmuxers=`echo $_libavmuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
-  --enable-libavformat)	_libavformat=yes;;
-  --disable-libavformat)	_libavformat=no	;;
-  --enable-libavformat_so)	_libavformat_so=yes	;;
-  --disable-libavformat_so)	_libavformat_so=no	;;
-  --enable-libpostproc)		_libpostproc=yes	;;
-  --disable-libpostproc)	_libpostproc=no		;;
-  --enable-libpostproc_so)	_libpostproc_so=yes	;;
-  --disable-libpostproc_so)	_libpostproc_so=no	;;
-  --enable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=yes	;;
-  --disable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=no	;;
+  ppc)
+    _def_arch='#define ARCH_POWERPC 1'
+    _def_dcbzl='#define NO_DCBZL 1'
+    _target_arch='TARGET_ARCH_POWERPC = yes'
+    iproc='ppc'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    _altivec=no
+
+    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
+	    _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
+	    _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
+		    _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
+        echores "$proc"
+    fi
 
-  --enable-lirc)	_lirc=yes	;;
-  --disable-lirc)	_lirc=no	;;
-  --enable-lircc)	_lircc=yes	;;
-  --disable-lircc)	_lircc=no	;;
-  --enable-gui)		_gui=yes	;;
-  --disable-gui)	_gui=no		;;
-  --enable-gtk1)	_gtk1=yes	;;
-  --disable-gtk1)	_gtk1=no	;;
-  --enable-termcap)	_termcap=yes	;;
-  --disable-termcap)	_termcap=no	;;
-  --enable-termios)	_termios=yes    ;;
-  --disable-termios)    _termios=no     ;;
-  --enable-3dfx)	_3dfx=yes	;;
-  --disable-3dfx)	_3dfx=no	;;
-  --enable-s3fb)	_s3fb=yes	;;
-  --disable-s3fb)	_s3fb=no	;;
-  --enable-tdfxfb)	_tdfxfb=yes	;;
-  --disable-tdfxfb)	_tdfxfb=no	;;
-  --disable-tdfxvid)	_tdfxvid=no	;;
-  --enable-tdfxvid)	_tdfxvid=yes	;;
-  --disable-tga)	_tga=no	  	;;
-  --enable-tga)		_tga=yes	;;
-  --enable-directfb)	_directfb=yes	;;
-  --disable-directfb)	_directfb=no	;;
-  --enable-zr)		_zr=yes		;;
-  --disable-zr)		_zr=no		;;
-  --enable-bl)		_bl=yes		;;
-  --disable-bl)		_bl=no		;;
-  --enable-mtrr)	_mtrr=yes	;;
-  --disable-mtrr)	_mtrr=no	;;
-  --enable-largefiles)	_largefiles=yes	;;
-  --disable-largefiles)	_largefiles=no	;;
-  --enable-shm)		_shm=yes	;;
-  --disable-shm)	_shm=no         ;;
-  --enable-select)	_select=yes	;;
-  --disable-select)	_select=no	;;
-  --enable-linux-devfs)	_linux_devfs=yes	;;
-  --disable-linux-devfs)	_linux_devfs=no	;;
-  --enable-cdparanoia)	_cdparanoia=yes	;;
-  --disable-cdparanoia)	_cdparanoia=no	;;
-  --enable-cddb)	_cddb=yes	;;
-  --disable-cddb)	_cddb=no	;;
-  --enable-big-endian)  _big_endian=yes ;;
-  --disable-big-endian) _big_endian=no  ;;
-  --enable-bitmap-font)    _bitmap_font=yes   ;;
-  --disable-bitmap-font)   _bitmap_font=no    ;;
-  --enable-freetype)    _freetype=yes   ;;
-  --disable-freetype)   _freetype=no    ;;
-  --enable-fontconfig)  _fontconfig=yes ;;
-  --disable-fontconfig) _fontconfig=no  ;;
-  --enable-unrarlib)	_unrarlib=yes	;;
-  --disable-unrarlib)	_unrarlib=no	;;
-  --enable-ftp)         _ftp=yes        ;;
-  --disable-ftp)        _ftp=no         ;;
-  --enable-vstream)     _vstream=yes    ;;
-  --disable-vstream)    _vstream=no     ;;
-  --enable-pthreads)    _pthreads=yes   ;;
-  --disable-pthreads)   _pthreads=no    ;;
-  --enable-ass)         _ass=yes        ;;
-  --disable-ass)        _ass=no         ;;
-  --enable-rpath)       _rpath=yes      ;;
-  --disable-rpath)      _rpath=no       ;;
-  --enable-color-console)  _color_console=yes ;;
-  --disable-color-console) _color_console=no  ;;
+    echocheck "GCC & CPU optimization abilities"
 
-  --enable-fribidi)     _fribidi=yes    ;;
-  --disable-fribidi)    _fribidi=no     ;;
+    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 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
 
-  --enable-enca)        _enca=yes    ;;
-  --disable-enca)       _enca=no     ;;
+    if test -n "$_mcpu"; then
+        _optimizing=`echo $_mcpu | cut -c 8-`
+        echores "$_optimizing"
+    else
+        echores "none"
+    fi
+
+    ;;
+
+  alpha)
+    _def_arch='#define ARCH_ALPHA 1'
+    _target_arch='TARGET_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 "$TMPO" "$TMPC"
+    case `"$TMPO"` in
+
+        0-0)    proc="ev4";   cpu_understands_mvi="0";;
+        1-0)    proc="ev5";   cpu_understands_mvi="0";;
+        1-1)    proc="ev56";  cpu_understands_mvi="0";; 
+        1-101)  proc="pca56"; cpu_understands_mvi="1";;
+        2-303)  proc="ev6";   cpu_understands_mvi="1";;
+        2-307)  proc="ev67";  cpu_understands_mvi="1";;
+        2-1307) proc="ev68";  cpu_understands_mvi="1";;
+    esac
+    echores "$proc"
+    
+    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 "$cpu_understands_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)
+    _def_arch='#define ARCH_SGI_MIPS 1'
+    _target_arch='TARGET_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)
+    _def_arch='#define ARCH_PA_RISC 1'
+    _target_arch='TARGET_ARCH_PA_RISC = yes'
+    iproc='PA-RISC'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
+
+  s390)
+    _def_arch='#define ARCH_S390 1'
+    _target_arch='TARGET_ARCH_S390 = yes'
+    iproc='390'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
+
+  s390x)
+    _def_arch='#define ARCH_S390X 1'
+    _target_arch='TARGET_ARCH_S390X = yes'
+    iproc='390x'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
 
-  --enable-inet6)	_inet6=yes	;;
-  --disable-inet6)	_inet6=no	;;
+  vax)
+    _def_arch='#define ARCH_VAX 1'
+    _target_arch='TARGET_ARCH_VAX = yes'
+    iproc='vax'
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
 
-  --enable-gethostbyname2)	_gethostbyname2=yes	;;
-  --disable-gethostbyname2)	_gethostbyname2=no	;;
+  generic)
+    _def_arch='#define ARCH_GENERIC 1'
+    _target_arch='TARGET_ARCH_GENERIC = yes'
+    iproc=''
+    proc=''
+    _march=''
+    _mcpu=''
+    _optimizing=''
+    ;;
 
-  --enable-dga) _dga=auto ;; # as we don't know if it's 1 or 2
-  --enable-dga=*) _dga=`echo $ac_option | cut -d '=' -f 2` ;;
-  --disable-dga) _dga=no ;;
+  *)
+    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
 
-  --enable-menu) _menu=yes ;;
-  --disable-menu) _menu=no ;;
+if test "$_runtime_cpudetection" = yes ; then
+  if x86 ; then
+    _cmov=yes
+    x86_32 && _cmov=no
+    _mmx=yes
+    _3dnow=yes
+    _3dnowext=yes
+    _mmxext=yes
+    _sse=yes
+    _sse2=yes
+    _mtrr=yes
+  fi
+  if ppc; then
+    _altivec=yes
+  fi
+fi
 
-  --enable-qtx) _qtx=yes ;;
-  --disable-qtx) _qtx=no ;;
+if x86_32 && test "$_runtime_cpudetection" = no ; then
+  extcheck() {
+    if test "$1" = yes ; 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
 
-  --enable-macosx) _macosx=yes ;;
-  --disable-macosx) _macosx=no ;;
-  --enable-macosx-finder-support) _macosx_finder_support=yes ;;
-  --disable-macosx-finder-support) _macosx_finder_support=no ;;
-  --enable-macosx-bundle) _macosx_bundle=yes;;
-  --disable-macosx-bundle) _macosx_bundle=no;;  
+      if cc_check && tmp_run ; then
+        echores "yes"
+	_optimizing="$_optimizing $2"
+        return 0
+      else
+        echores "failed"
+        echo "It seems that your kernel does not correctly support $2."
+        echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
+	return 1
+      fi
+    fi
+    return 0
+  }
 
-  --enable-maemo) _maemo=yes ;;
-  --disable-maemo) _maemo=no ;;
+  extcheck $_mmx "mmx" "emms" || _mmx=no
+  extcheck $_mmxext "mmxext" "sfence" || _mmxext=no
+  extcheck $_3dnow "3dnow" "femms" || _3dnow=no
+  extcheck $_3dnowext "3dnowext" "pswapd %%mm0, %%mm0" || _3dnowext=no
+  extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _sse=no _gcc3_ext="$_gcc3_ext -mno-sse"
+  extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _sse2=no _gcc3_ext="$_gcc3_ext -mno-sse2"
+  extcheck $_cmov "cmov" "cmovb %%eax,%%ebx" || _cmov=no
+  echocheck "mtrr support"
+  echores "$_mtrr"
 
-  --enable-sortsub) _sortsub=yes ;;
-  --disable-sortsub) _sortsub=no ;;
+  if test "$_mtrr" = yes ; then
+    _optimizing="$_optimizing mtrr"
+  fi
 
-  --charset=*)
-    _charset=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --language=*)
-    _language=`echo $ac_option | cut -d '=' -f 2`
-    ;;
+  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
 
-  --codecsdir=*)
-    _codecsdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --win32codecsdir=*)
-    _win32codecsdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --xanimcodecsdir=*)
-    _xanimcodecsdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --realcodecsdir=*)
-    _realcodecsdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
+fi
 
-  --enable-crash-debug)
-    _crash_debug=yes
-    ;;
-  --disable-crash-debug)
-    _crash_debug=no
-    ;;
-  --enable-sighandler)
-    _sighandler=yes
-    ;;
-  --disable-sighandler)
-    _sighandler=no
-    ;;
 
-  --enable-sse)	_sse=yes ;;
-  --disable-sse) _sse=no ;;
-  --enable-sse2) _sse2=yes ;;
-  --disable-sse2) _sse2=no ;;
-  --enable-mmxext) _mmxext=yes ;;
-  --disable-mmxext) _mmxext=no ;;
-  --enable-3dnow) _3dnow=yes ;;
-  --disable-3dnow) _3dnow=no _3dnowext=no ;;
-  --enable-3dnowext) _3dnow=yes _3dnowext=yes ;;
-  --disable-3dnowext) _3dnowext=no ;;
-  --enable-cmov) _cmov=yes ;;
-  --disable-cmov) _cmov=no ;;
-  --enable-altivec) _altivec=yes ;;
-  --disable-altivec) _altivec=no ;;
-  --enable-armv5te) _armv5te=yes ;;
-  --disable-armv5te) _armv5te=no ;;
-  --enable-iwmmxt) _iwmmxt=yes ;;
-  --disable-iwmmxt) _iwmmxt=no ;;
-  --enable-mmx)	_mmx=yes ;;
-  --disable-mmx) # 3Dnow! and MMX2 require MMX
-        _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;;
+echocheck "assembler support of -pipe option"
+cat > $TMPC << EOF
+int main(void) { return 0; }
+EOF
+cc_check -pipe && _pipe="-pipe" && echores "yes" || echores "no"
 
-  --enable-win32) _win32=yes ;;
-  --disable-win32) _win32=no ;;
 
-  --with-xvmclib=*)
-    _xvmclib=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-sdl-config=*)
-    _sdlconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-freetype-config=*)
-    _freetypeconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-fribidi-config=*)
-    _fribidiconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-gtk-config=*)
-    _gtkconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-glib-config=*)
-    _glibconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --with-dvdnav-config=*)
-    _dvdnavconfig=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --prefix=*)
-    _prefix=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --bindir=*)
-    _bindir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --datadir=*)
-    _datadir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --mandir=*)
-    _mandir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --confdir=*)
-    _confdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
-  --libdir=*)
-    _libdir=`echo $ac_option | cut -d '=' -f 2`
-    ;;
+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
 
-  *)
-    echo "Unknown parameter: $ac_option"
-    exit 1
-    ;;
 
-  esac
-done
+# Checking for CFLAGS
+_stripbinaries=yes
+if test "$_profile" != "" || test "$_debug" != "" ; then
+  CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
+  if test "$_cc_major" -ge "3" ; then
+    CFLAGS=`echo "$CFLAGS" | sed -e 's/\(-Wall\)/\1 -Wno-unused-parameter/'`
+  fi
+  _stripbinaries=no
+elif test -z "$CFLAGS" ; then
+  if test "$cc_vendor" = "intel" ; then
+    CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer"
+  elif test "$cc_vendor" != "gnu" ; then
+    CFLAGS="-O2 $_march $_mcpu $_pipe"
+  else
+    CFLAGS="-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
 
-# Atmos: moved this here, to be correct, if --prefix is specified
-test -z "$_bindir" && _bindir="$_prefix/bin"
-test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
-test -z "$_mandir" && _mandir="$_prefix/man"
-test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
-test -z "$_libdir" && _libdir="$_prefix/lib"
 
 
 if x86_32 ; then



More information about the MPlayer-cvslog mailing list