changeset 1361:19418e4422cb

New configure-based build system. Still work in progress, but much improved
author Sam Lantinga <slouken@libsdl.org>
date Thu, 16 Feb 2006 10:11:48 +0000
parents 70a9cfb4cf1b
children 88ddeb76c9c1
files Makefile.am SDL.spec.in TODO acinclude.m4 autogen.sh build-scripts/config.guess build-scripts/config.sub build-scripts/install-sh build-scripts/ltmain.sh build-scripts/makedep.sh build-scripts/mkinstalldirs build-scripts/strip_fPIC.sh config.guess config.sub configure.in include/SDL_config.h include/SDL_config.h.in include/SDL_error.h include/SDL_stdinc.h include/SDL_syswm.h ltmain.sh sdl-config.in src/Makefile.am src/SDL.c src/SDL_error.c src/SDL_loadso.c src/audio/Makefile.am src/audio/SDL_audio.c src/audio/SDL_audiomem.c src/audio/SDL_audiomem.h src/audio/SDL_sysaudio.h src/audio/SDL_wave.c src/audio/alsa/Makefile.am src/audio/alsa/SDL_alsa_audio.c src/audio/alsa/SDL_alsa_audio.h src/audio/amigaos/Makefile.am src/audio/amigaos/SDL_ahiaudio.c src/audio/amigaos/SDL_ahiaudio.h src/audio/arts/Makefile.am src/audio/arts/SDL_artsaudio.c src/audio/arts/SDL_artsaudio.h src/audio/baudio/Makefile.am src/audio/baudio/SDL_beaudio.cc src/audio/baudio/SDL_beaudio.h src/audio/dart/SDL_dart.c src/audio/dart/SDL_dart.h src/audio/dc/Makefile.am src/audio/dc/SDL_dcaudio.c src/audio/dc/SDL_dcaudio.h src/audio/disk/Makefile.am src/audio/disk/SDL_diskaudio.c src/audio/disk/SDL_diskaudio.h src/audio/dma/Makefile.am src/audio/dma/SDL_dmaaudio.c src/audio/dma/SDL_dmaaudio.h src/audio/dmedia/Makefile.am src/audio/dmedia/SDL_irixaudio.c src/audio/dmedia/SDL_irixaudio.h src/audio/dsp/Makefile.am src/audio/dsp/SDL_dspaudio.c src/audio/dsp/SDL_dspaudio.h src/audio/esd/Makefile.am src/audio/esd/SDL_esdaudio.c src/audio/esd/SDL_esdaudio.h src/audio/macosx/Makefile.am src/audio/macosx/SDL_coreaudio.c src/audio/macosx/SDL_coreaudio.h src/audio/macrom/Makefile.am src/audio/macrom/SDL_romaudio.c src/audio/macrom/SDL_romaudio.h src/audio/mint/Makefile.am src/audio/mint/SDL_mintaudio.h src/audio/mint/SDL_mintaudio_dma8.c src/audio/mint/SDL_mintaudio_gsxb.c src/audio/mint/SDL_mintaudio_mcsn.c src/audio/mint/SDL_mintaudio_stfa.c src/audio/mint/SDL_mintaudio_xbios.c src/audio/mme/Makefile.am src/audio/mme/SDL_mmeaudio.c src/audio/mme/SDL_mmeaudio.h src/audio/nas/Makefile.am src/audio/nas/SDL_nasaudio.c src/audio/nas/SDL_nasaudio.h src/audio/nto/Makefile.am src/audio/nto/SDL_nto_audio.c src/audio/nto/SDL_nto_audio.h src/audio/openbsd/Makefile.am src/audio/openbsd/SDL_openbsdaudio.c src/audio/openbsd/SDL_openbsdaudio.h src/audio/paudio/Makefile.am src/audio/paudio/SDL_paudio.c src/audio/paudio/SDL_paudio.h src/audio/sun/Makefile.am src/audio/sun/SDL_sunaudio.c src/audio/sun/SDL_sunaudio.h src/audio/ums/Makefile.am src/audio/ums/SDL_umsaudio.c src/audio/ums/SDL_umsaudio.h src/audio/windib/Makefile.am src/audio/windib/SDL_dibaudio.c src/audio/windib/SDL_dibaudio.h src/audio/windx5/Makefile.am src/audio/windx5/SDL_dx5audio.c src/audio/windx5/SDL_dx5audio.h src/cdrom/Makefile.am src/cdrom/aix/Makefile.am src/cdrom/aix/SDL_syscdrom.c src/cdrom/beos/Makefile.am src/cdrom/beos/SDL_syscdrom.cc src/cdrom/bsdi/Makefile.am src/cdrom/bsdi/SDL_syscdrom.c src/cdrom/dc/Makefile.am src/cdrom/dc/SDL_syscdrom.c src/cdrom/dummy/Makefile.am src/cdrom/dummy/SDL_syscdrom.c src/cdrom/freebsd/Makefile.am src/cdrom/freebsd/SDL_syscdrom.c src/cdrom/linux/Makefile.am src/cdrom/linux/SDL_syscdrom.c src/cdrom/macos/Makefile.am src/cdrom/macos/SDL_syscdrom.c src/cdrom/macosx/Makefile.am src/cdrom/macosx/SDL_syscdrom_c.h src/cdrom/mint/Makefile.am src/cdrom/mint/SDL_syscdrom.c src/cdrom/openbsd/Makefile.am src/cdrom/openbsd/SDL_syscdrom.c src/cdrom/os2/SDL_syscdrom.c src/cdrom/osf/Makefile.am src/cdrom/osf/SDL_syscdrom.c src/cdrom/qnx/Makefile.am src/cdrom/qnx/SDL_syscdrom.c src/cdrom/win32/Makefile.am src/cdrom/win32/SDL_syscdrom.c src/cpuinfo/Makefile.am src/cpuinfo/SDL_cpuinfo.c src/events/Makefile.am src/events/SDL_events.c src/events/SDL_mouse.c src/events/SDL_resize.c src/events/SDL_sysevents.h src/file/Makefile.am src/hermes/Makefile.am src/joystick/Makefile.am src/joystick/SDL_joystick.c src/joystick/amigaos/Makefile.am src/joystick/amigaos/SDL_sysjoystick.c src/joystick/beos/Makefile.am src/joystick/beos/SDL_bejoystick.cc src/joystick/bsd/Makefile.am src/joystick/bsd/SDL_sysjoystick.c src/joystick/darwin/Makefile.am src/joystick/darwin/SDL_sysjoystick.c src/joystick/dc/Makefile.am src/joystick/dc/SDL_sysjoystick.c src/joystick/dummy/Makefile.am src/joystick/dummy/SDL_sysjoystick.c src/joystick/linux/Makefile.am src/joystick/linux/SDL_sysjoystick.c src/joystick/macos/Makefile.am src/joystick/macos/SDL_sysjoystick.c src/joystick/mint/Makefile.am src/joystick/mint/SDL_sysjoystick.c src/joystick/os2/SDL_sysjoystick.c src/joystick/riscos/Makefile.am src/joystick/riscos/SDL_sysjoystick.c src/joystick/win32/Makefile.am src/joystick/win32/SDL_mmjoystick.c src/loadso/beos/SDL_loadso.c src/loadso/beos/SDL_sysloadso.c src/loadso/dlopen/SDL_loadso.c src/loadso/dlopen/SDL_sysloadso.c src/loadso/dummy/SDL_loadso.c src/loadso/dummy/SDL_sysloadso.c src/loadso/macos/SDL_loadso.c src/loadso/macos/SDL_sysloadso.c src/loadso/macosx/SDL_loadso.c src/loadso/macosx/SDL_sysloadso.c src/loadso/mint/SDL_loadso.c src/loadso/mint/SDL_sysloadso.c src/loadso/os2/SDL_loadso.c src/loadso/os2/SDL_sysloadso.c src/loadso/win32/SDL_sysloadso.c src/loadso/windows/SDL_loadso.c src/main/Makefile.am src/main/win32/SDL_win32_main.c src/stdlib/Makefile.am src/thread/Makefile.am src/thread/SDL_systhread.h src/thread/SDL_thread_c.h src/thread/amigaos/SDL_syssem.c src/thread/amigaos/SDL_systhread.c src/thread/amigaos/SDL_thread.c src/thread/beos/SDL_systhread.c src/thread/bsdi/SDL_syssem.c src/thread/dc/SDL_sysmutex.c src/thread/dc/SDL_syssem.c src/thread/dc/SDL_systhread.c src/thread/dc/SDL_systhread_c.h src/thread/epoc/SDL_systhread.cpp src/thread/generic/SDL_syscond_c.h src/thread/generic/SDL_sysmutex.c src/thread/generic/SDL_syssem.c src/thread/generic/SDL_syssem_c.h src/thread/generic/SDL_systhread.c src/thread/generic/SDL_systhread_c.h src/thread/irix/SDL_syssem.c src/thread/irix/SDL_systhread.c src/thread/linux/SDL_syscond.c src/thread/linux/SDL_sysmutex.c src/thread/linux/SDL_sysmutex_c.h src/thread/linux/SDL_syssem.c src/thread/linux/SDL_systhread.c src/thread/linux/SDL_systhread_c.h src/thread/linux/clone.S src/thread/os2/SDL_systhread.c src/thread/pth/SDL_syscond.c src/thread/pth/SDL_syscond_c.h src/thread/pth/SDL_systhread.c src/thread/pthread/SDL_syscond.c src/thread/pthread/SDL_sysmutex.c src/thread/pthread/SDL_sysmutex_c.h src/thread/pthread/SDL_syssem.c src/thread/pthread/SDL_systhread.c src/thread/pthread/SDL_systhread_c.h src/thread/riscos/SDL_syscond.c src/thread/riscos/SDL_sysmutex.c src/thread/riscos/SDL_sysmutex_c.h src/thread/riscos/SDL_syssem.c src/thread/riscos/SDL_systhread.c src/thread/riscos/SDL_systhread_c.h src/thread/win32/SDL_systhread.c src/timer/Makefile.am src/timer/amigaos/SDL_systimer.c src/timer/beos/SDL_systimer.c src/timer/dc/SDL_systimer.c src/timer/dummy/SDL_systimer.c src/timer/epoc/SDL_systimer.cpp src/timer/linux/SDL_systimer.c src/timer/macos/SDL_MPWtimer.c src/timer/macos/SDL_systimer.c src/timer/mint/SDL_systimer.c src/timer/os2/SDL_systimer.c src/timer/riscos/SDL_systimer.c src/timer/unix/SDL_systimer.c src/timer/win32/SDL_systimer.c src/timer/wince/SDL_systimer.c src/video/Makefile.am src/video/SDL_RLEaccel.c src/video/SDL_blit.c src/video/SDL_blit_A.c src/video/SDL_blit_N.c src/video/SDL_bmp.c src/video/SDL_cursor.c src/video/SDL_stretch.c src/video/SDL_sysvideo.h src/video/SDL_video.c src/video/SDL_yuv_mmx.c src/video/SDL_yuv_sw.c src/video/Xext/Makefile.am src/video/Xext/XME/Makefile.am src/video/Xext/XME/xme.c src/video/Xext/Xinerama/Makefile.am src/video/Xext/Xinerama/Xinerama.c src/video/Xext/Xv/Makefile.am src/video/Xext/Xv/Xv.c src/video/Xext/Xv/Xvlibint.h src/video/Xext/Xxf86dga/Makefile.am src/video/Xext/Xxf86dga/XF86DGA.c src/video/Xext/Xxf86dga/XF86DGA2.c src/video/Xext/Xxf86vm/Makefile.am src/video/Xext/Xxf86vm/XF86VMode.c src/video/Xext/extensions/Makefile.am src/video/Xext/extensions/Xvlib.h src/video/Xext/extensions/xf86dga.h src/video/Xext/extensions/xf86dgastr.h src/video/Xext/extensions/xf86vmstr.h src/video/aalib/Makefile.am src/video/aalib/SDL_aaevents.c src/video/aalib/SDL_aamouse.c src/video/aalib/SDL_aavideo.c src/video/aalib/SDL_aavideo.h src/video/ataricommon/Makefile.am src/video/ataricommon/SDL_atarievents.c src/video/ataricommon/SDL_atarievents_c.h src/video/ataricommon/SDL_atarigl.c src/video/ataricommon/SDL_atarigl_c.h src/video/ataricommon/SDL_biosevents.c src/video/ataricommon/SDL_biosevents_c.h src/video/ataricommon/SDL_gemdosevents.c src/video/ataricommon/SDL_gemdosevents_c.h src/video/ataricommon/SDL_ikbdevents.c src/video/ataricommon/SDL_ikbdevents_c.h src/video/ataricommon/SDL_xbiosevents.c src/video/ataricommon/SDL_xbiosevents_c.h src/video/bwindow/Makefile.am src/video/bwindow/SDL_BView.h src/video/bwindow/SDL_BWin.h src/video/bwindow/SDL_lowvideo.h src/video/bwindow/SDL_sysevents.cc src/video/bwindow/SDL_sysvideo.cc src/video/bwindow/SDL_sysyuv.cc src/video/cybergfx/Makefile.am src/video/cybergfx/SDL_amigaevents.c src/video/cybergfx/SDL_amigamouse.c src/video/cybergfx/SDL_cgxaccel.c src/video/cybergfx/SDL_cgxgl.c src/video/cybergfx/SDL_cgxgl_c.h src/video/cybergfx/SDL_cgxmodes.c src/video/cybergfx/SDL_cgxvideo.c src/video/cybergfx/SDL_cgxvideo.h src/video/cybergfx/SDL_cgxwm.c src/video/cybergfx/SDL_cgxyuv.c src/video/cybergfx/SDL_cgxyuv_c.h src/video/dc/Makefile.am src/video/dc/SDL_dcevents.c src/video/dc/SDL_dcmouse.c src/video/dc/SDL_dcvideo.c src/video/dc/SDL_dcvideo.h src/video/dga/Makefile.am src/video/dga/SDL_dgaevents.c src/video/dga/SDL_dgamouse.c src/video/dga/SDL_dgavideo.c src/video/dga/SDL_dgavideo.h src/video/directfb/Makefile.am src/video/directfb/SDL_DirectFB_events.c src/video/directfb/SDL_DirectFB_video.c src/video/directfb/SDL_DirectFB_video.h src/video/directfb/SDL_DirectFB_yuv.c src/video/dummy/Makefile.am src/video/dummy/SDL_nullevents.c src/video/dummy/SDL_nullmouse.c src/video/dummy/SDL_nullvideo.c src/video/dummy/SDL_nullvideo.h src/video/epoc/Makefile.am src/video/epoc/SDL_epocevents.cpp src/video/epoc/SDL_epocevents_c.h src/video/epoc/SDL_epocvideo.cpp src/video/epoc/SDL_epocvideo.h src/video/fbcon/Makefile.am src/video/fbcon/SDL_fb3dfx.c src/video/fbcon/SDL_fbevents.c src/video/fbcon/SDL_fbmatrox.c src/video/fbcon/SDL_fbmouse.c src/video/fbcon/SDL_fbriva.c src/video/fbcon/SDL_fbvideo.c src/video/fbcon/SDL_fbvideo.h src/video/gapi/Makefile.am src/video/gapi/SDL_gapivideo.c src/video/gapi/SDL_gapivideo.h src/video/gem/Makefile.am src/video/gem/SDL_gemevents.c src/video/gem/SDL_gemmouse.c src/video/gem/SDL_gemvideo.c src/video/gem/SDL_gemvideo.h src/video/ggi/Makefile.am src/video/ggi/SDL_ggievents.c src/video/ggi/SDL_ggimouse.c src/video/ggi/SDL_ggivideo.c src/video/ggi/SDL_ggivideo.h src/video/ipod/Makefile.am src/video/ipod/SDL_ipodvideo.c src/video/maccommon/Makefile.am src/video/maccommon/SDL_lowvideo.h src/video/maccommon/SDL_macevents.c src/video/maccommon/SDL_macgl.c src/video/maccommon/SDL_macgl_c.h src/video/macdsp/Makefile.am src/video/macdsp/SDL_dspvideo.c src/video/macrom/Makefile.am src/video/macrom/SDL_romvideo.c src/video/math_private.h src/video/nanox/Makefile.am src/video/nanox/SDL_nxevents.c src/video/nanox/SDL_nxmouse.c src/video/nanox/SDL_nxvideo.c src/video/nanox/SDL_nxvideo.h src/video/nanox/SDL_nxwm.c src/video/os2fslib/Makefile.am src/video/os2fslib/SDL_os2fslib.c src/video/photon/Makefile.am src/video/photon/SDL_ph_events.c src/video/photon/SDL_ph_gl.c src/video/photon/SDL_ph_gl.h src/video/photon/SDL_ph_image.c src/video/photon/SDL_ph_image_c.h src/video/photon/SDL_ph_modes.c src/video/photon/SDL_ph_mouse.c src/video/photon/SDL_ph_video.c src/video/photon/SDL_ph_video.h src/video/photon/SDL_ph_wm.c src/video/photon/SDL_phyuv.c src/video/picogui/Makefile.am src/video/picogui/SDL_pgevents.c src/video/picogui/SDL_pgvideo.c src/video/picogui/SDL_pgvideo.h src/video/ps2gs/Makefile.am src/video/ps2gs/SDL_gsevents.c src/video/ps2gs/SDL_gsmouse.c src/video/ps2gs/SDL_gsvideo.c src/video/ps2gs/SDL_gsvideo.h src/video/ps2gs/SDL_gsyuv.c src/video/qtopia/Makefile.am src/video/qtopia/SDL_QWin.h src/video/qtopia/SDL_lowvideo.h src/video/qtopia/SDL_sysevents.cc src/video/qtopia/SDL_sysvideo.cc src/video/quartz/Makefile.am src/video/quartz/SDL_QuartzVideo.h src/video/quartz/SDL_QuartzYUV.m src/video/riscos/Makefile.am src/video/riscos/SDL_riscosFullScreenVideo.c src/video/riscos/SDL_riscosevents.c src/video/riscos/SDL_riscosmouse.c src/video/riscos/SDL_riscostask.c src/video/riscos/SDL_riscosvideo.c src/video/riscos/SDL_riscosvideo.h src/video/riscos/SDL_wimppoll.c src/video/riscos/SDL_wimpvideo.c src/video/svga/Makefile.am src/video/svga/SDL_svgaevents.c src/video/svga/SDL_svgamouse.c src/video/svga/SDL_svgavideo.c src/video/svga/SDL_svgavideo.h src/video/vgl/Makefile.am src/video/vgl/SDL_vglevents.c src/video/vgl/SDL_vglmouse.c src/video/vgl/SDL_vglvideo.c src/video/vgl/SDL_vglvideo.h src/video/wincommon/Makefile.am src/video/wincommon/SDL_lowvideo.h src/video/wincommon/SDL_sysevents.c src/video/wincommon/SDL_sysmouse.c src/video/wincommon/SDL_syswm.c src/video/wincommon/SDL_wingl.c src/video/wincommon/SDL_wingl_c.h src/video/windib/Makefile.am src/video/windib/SDL_dibevents.c src/video/windib/SDL_dibevents_c.h src/video/windib/SDL_dibvideo.c src/video/windx5/Makefile.am src/video/windx5/SDL_dx5events.c src/video/windx5/SDL_dx5events_c.h src/video/windx5/SDL_dx5video.c src/video/windx5/SDL_dx5yuv.c src/video/windx5/SDL_dx5yuv_c.h src/video/wscons/Makefile.am src/video/wscons/SDL_wsconsevents.c src/video/wscons/SDL_wsconsmouse.c src/video/wscons/SDL_wsconsvideo.c src/video/wscons/SDL_wsconsvideo.h src/video/x11/Makefile.am src/video/x11/SDL_x11dga.c src/video/x11/SDL_x11dyn.c src/video/x11/SDL_x11dyn.h src/video/x11/SDL_x11events.c src/video/x11/SDL_x11gamma.c src/video/x11/SDL_x11gl.c src/video/x11/SDL_x11gl_c.h src/video/x11/SDL_x11image.c src/video/x11/SDL_x11modes.c src/video/x11/SDL_x11mouse.c src/video/x11/SDL_x11video.c src/video/x11/SDL_x11video.h src/video/x11/SDL_x11wm.c src/video/x11/SDL_x11yuv.c src/video/x11/SDL_x11yuv_c.h src/video/xbios/Makefile.am src/video/xbios/SDL_xbios.c src/video/xbios/SDL_xbios.h strip_fPIC.sh
diffstat 471 files changed, 15819 insertions(+), 18992 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-# The top-level input Makefile for SDL
-
-# require automake 1.4
-AUTOMAKE_OPTIONS = 1.4
-
-## Any directories that you want built and installed should go here.
-SUBDIRS = src include docs
-
-## Any directories you want a part of the distribution should be listed
-## here, as well as have a Makefile generated at the end of configure.in
-##
-## This only works for subdirectories one level deep.
-DIST_SUBDIRS = $(SUBDIRS)
-
-# SDL runtime configuration script
-bin_SCRIPTS = sdl-config
-
-# All the rest of the distributed files
-EXTRA_DIST =		\
-	BUGS		\
-	TODO		\
-	COPYING		\
-	CREDITS		\
-	INSTALL		\
-	README		\
-	README.AmigaOS	\
-	README.CVS	\
-	README.DC	\
-	README.Epoc	\
-	README.MacOS	\
-	README.MacOSX	\
-	README.MiNT	\
-	README.NanoX	\
-	README.PicoGUI	\
-	README.QNX	\
-	README.Qtopia	\
-	README.WinCE	\
-	README-SDL.txt	\
-	Borland.html	\
-	Borland.zip	\
-	VisualC.html	\
-	VisualC.zip	\
-	VisualCE.zip	\
-	Makefile.dc	\
-	MPWmake.sea.bin	\
-	CWprojects.sea.bin \
-	PBProjects.tar.gz \
-	EpocBuildFiles.zip \
-	Xcode.tar.gz	\
-	Xcode21.tar.gz	\
-	XcodeUniversal.tar.gz	\
-	WhatsNew	\
-	docs.html	\
-	sdl.m4		\
-	SDL.spec	\
-	autogen.sh	\
-	strip_fPIC.sh
-
-# M4 macro file for inclusion with autoconf
-m4datadir = $(datadir)/aclocal
-m4data_DATA = sdl.m4
-
-# Rule to build tar-gzipped distribution package
-$(PACKAGE)-$(VERSION).tar.gz: dist
-
-# Rule to build RPM distribution package
-rpm: $(PACKAGE)-$(VERSION).tar.gz
-	rpm -ta $(PACKAGE)-$(VERSION).tar.gz
-
-# Rule to rebuild the export lists for BeOS, MacOS and Win32.
-exports:
-	(cd src/main/beos/exports; $(MAKE))
-	(cd src/main/macos/exports; $(MAKE))
-	(cd src/main/macosx/exports; $(MAKE))
-	(cd src/main/win32/exports; $(MAKE))
-
-# Rule to build the Project Builder archive in MacOS X
-PBProjects.tar.gz:
-	rm -f `find . -name .DS_Store`
-	if [ -d PBProjects ]; then \
-	    tar zcvf $@ PBProjects; \
-	fi
-
-# Rule to install the libraries only - prevent rebuilding apps
-install-lib:
-	cd src && $(MAKE) install-libLTLIBRARIES
-
-# Run ldconfig after installing the library:
-install-hook:
-	-ldconfig
-
-# Grab the test programs for the distribution:
-dist-hook:
-	if test -f test/Makefile; then (cd test; make distclean); fi
-	rm -rf $(srcdir)/test/autom4te*
-	cp -rp $(srcdir)/test $(distdir)
-	rm -rf `find $(distdir) -type d -name CVS -print`
-
-# Create a CVS snapshot that people can run update -d on
-CVSROOT = :pserver:guest@libsdl.org:/home/sdlweb/libsdl.org/cvs
-snapshot:
-	cvs -d $(CVSROOT) login
-	cvs -d $(CVSROOT) checkout SDL12
-	(cd SDL12 && ./autogen.sh && rm -rf autom4te.cache)
-	mv SDL12 SDL-1.2
-	tar zcvf $(HOME)/SDL-1.2.tar.gz SDL-1.2
-	rm -rf SDL-1.2
-snapshot13:
-	cvs -d $(CVSROOT) login
-	cvs -d $(CVSROOT) checkout -r branch_1_3_x SDL12
-	(cd SDL12 && ./autogen.sh && rm -rf autom4te.cache)
-	mv SDL12 SDL-1.3
-	tar zcvf $(HOME)/SDL-1.3.tar.gz SDL-1.3
-	rm -rf SDL-1.3
--- a/SDL.spec.in	Fri Feb 10 07:29:08 2006 +0000
+++ b/SDL.spec.in	Thu Feb 16 10:11:48 2006 +0000
@@ -1,6 +1,6 @@
 Summary: Simple DirectMedia Layer
-Name: @PACKAGE@
-Version: @VERSION@
+Name: SDL
+Version: @SDL_VERSION@
 Release: 1
 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
 URL: http://www.libsdl.org/
@@ -45,7 +45,12 @@
 %install
 rm -rf $RPM_BUILD_ROOT
 %ifos linux
-make install prefix=$RPM_BUILD_ROOT/%{prefix}
+make install prefix=$RPM_BUILD_ROOT/%{prefix} \
+             bindir=$RPM_BUILD_ROOT/%{_bindir} \
+             libdir=$RPM_BUILD_ROOT/%{_libdir} \
+             includedir=$RPM_BUILD_ROOT/%{_includedir} \
+             datadir=$RPM_BUILD_ROOT/%{_datadir} \
+             mandir=$RPM_BUILD_ROOT/%{_mandir}
 ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT/%{prefix}/lib/libSDL-1.1.so.0
 %else
 %makeinstall
@@ -81,8 +86,8 @@
 %{_libdir}/lib*.%{__soext}
 %dir %{_includedir}/SDL
 %{_includedir}/SDL/*.h
+%{_datadir}/aclocal/*
 %{_mandir}/man3/*
-%{_datadir}/aclocal/*
 
 %changelog
 * Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
--- a/TODO	Fri Feb 10 07:29:08 2006 +0000
+++ b/TODO	Thu Feb 16 10:11:48 2006 +0000
@@ -1,3 +1,8 @@
+
+Update project files
+Create general SDL_config.h
+Create stubs for all the disabled subsystems
+Test all the platforms and drivers
 
 Wish list for the 1.3 development branch:
 
--- a/acinclude.m4	Fri Feb 10 07:29:08 2006 +0000
+++ b/acinclude.m4	Thu Feb 16 10:11:48 2006 +0000
@@ -1,24 +1,3 @@
-# Local macros for the SDL configure.in script
-
-dnl Function to link an architecture specific file
-dnl LINK_ARCH_SRC(source_dir, arch, source_file)
-AC_DEFUN([COPY_ARCH_SRC],
-[
-  old="$srcdir/$1/$2/$3"
-  new="$1/$3"
-  if test ! -d $1; then
-    echo "Creating directory $1"
-    mkdir -p $1
-  fi
-  echo "Copying $old -> $new"
-  cat >$new <<__EOF__
-/* WARNING:  This file was automatically generated!
- * Original: $old
- */
-__EOF__
-  cat >>$new <$old
-])
-
 ##############################################################################
 dnl Configure Paths for Alsa
 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
@@ -1010,6 +989,12 @@
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  beos*)
+    # On BeOS, this test takes a really really long time.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
--- a/autogen.sh	Fri Feb 10 07:29:08 2006 +0000
+++ b/autogen.sh	Thu Feb 16 10:11:48 2006 +0000
@@ -1,19 +1,11 @@
 #!/bin/sh
 #
-echo "Generating build information using aclocal, automake and autoconf"
+echo "Generating build information using aclocal and autoconf"
 echo "This may take a while ..."
 
-# Touch the timestamps on all the files since CVS messes them up
-directory=`dirname $0`
-touch $directory/configure.in
-touch $directory/include/SDL_config.h.in
-
 # Regenerate configuration files
-aclocal || exit 1
-automake --foreign --include-deps --add-missing --copy || exit 1
-autoconf || exit 1
-(cd test; aclocal; automake --foreign --include-deps --add-missing --copy; autoconf)
+(aclocal && autoconf) || exit $?
+(cd test; aclocal; autoconf)
 
 # Run configure for this platform
-#./configure $*
 echo "Now you are ready to run ./configure"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/config.guess	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,1479 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2006-01-02'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    x86:Interix*:[345]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+	exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/config.sub	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,1606 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2006-01-02'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m32c)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	m32c-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/install-sh	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-02-02.21
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/ltmain.sh	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,6457 @@
+# Based on libtool-1.5.8
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.8
+TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+  setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+  SP2NL="tr '\100' '\n'"
+  NL2SP="tr '\r\n' '\100\100'"
+  ;;
+ *) # Assume ASCII based system
+  SP2NL="tr '\040' '\012'"
+  NL2SP="tr '\015\012' '\040\040'"
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" 	
+"}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid () {
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
+      fi
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag () {
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives () {
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xdir="$my_gentop/$my_xlib"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      status=$?
+      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
+	exit $status
+      fi
+      case $host in
+      *-darwin*)
+	$show "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	if test -z "$run"; then
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename $darwin_archive`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+	  if test -n "$darwin_arches"; then 
+	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      # Remove the table of contents from the thin files.
+	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
+	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $AR -xo "${darwin_base_archive}"
+	      rm "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	    done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    rm -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    (cd $my_xdir && $AR x $my_xabs) || exit $?
+	  fi # $darwin_arches
+	fi # $run
+      ;;
+      *)
+	# We will extract separately just the conflicting names and we will
+	# no longer touch any unique names. It is faster to leave these
+	# extract automatically by $AR in one run.
+	$show "(cd $my_xdir && $AR x $my_xabs)"
+	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
+	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
+	  do
+	    i=1
+	    while test "$i" -le "$count"
+	    do
+	      # Put our $i before any first dot (extension)
+	      # Never overwrite any file
+	      name_to="$name"
+	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
+	      do
+		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+	      done
+	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
+	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
+	      i=`expr $i + 1`
+	    done
+	  done
+	fi
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $EXIT_SUCCESS
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $EXIT_SUCCESS
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $EXIT_SUCCESS
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag) prevopt="--tag" prev=tag ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case "$arg_mode" in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
+
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+      $echo $srcfile > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $srcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	status=$?
+	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $status
+	fi
+      fi
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      else
+	command="$base_compile $srcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	fi
+	build_libtool_libs=no
+	build_old_libs=yes
+	prefer_static_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat $save_arg`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		# If there is no directory component, then add one.
+		case $arg in
+		*/* | *\\*) . $arg ;;
+		*) . ./$arg ;;
+		esac
+
+		if test -z "$pic_object" || \
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none && \
+		   test "$non_pic_object" = none; then
+		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+
+		# Extract subdirectory from the argument.
+		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		if test "X$xdir" = "X$arg"; then
+		  xdir=
+		else
+		  xdir="$xdir/"
+		fi
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if test -z "$run"; then
+		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+		  exit $EXIT_FAILURE
+		else
+		  # Dry-run case.
+
+		  # Extract subdirectory from the argument.
+		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		  if test "X$xdir" = "X$arg"; then
+		    xdir=
+		  else
+		    xdir="$xdir/"
+		  fi
+
+		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      fi
+	    done
+	  else
+	    $echo "$modename: link input file \`$save_arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+	        *" $qarg.framework "*) ;;
+		*) deplibs="$deplibs $qarg.framework" # this is fixed later
+		   ;;
+              esac
+              ;;
+   	  esac
+ 	  prev=
+ 	  continue
+ 	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit $EXIT_FAILURE
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-mingw* | *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs -framework System"
+	    continue
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # gcc -m* arguments should be passed to the linker via $compiler_flags
+      # in order to pass architecture information to the linker
+      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
+      # but this is not reliable with gcc because gcc may use -mfoo to
+      # select a different linker, different libraries, etc, while
+      # -Wl,-mfoo simply passes -mfoo to the linker.
+      -m*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        if test "$with_gcc" = "yes" ; then
+          compiler_flags="$compiler_flags $arg"
+        fi
+        continue
+        ;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      -framework)
+        prev=framework
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  # If there is no directory component, then add one.
+	  case $arg in
+	  */* | *\\*) . $arg ;;
+	  *) . ./$arg ;;
+	  esac
+
+	  if test -z "$pic_object" || \
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none && \
+	     test "$non_pic_object" = none; then
+	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+ 	  else
+	    xdir="$xdir/"
+	  fi
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if test -z "$run"; then
+	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+	    exit $EXIT_FAILURE
+	  else
+	    # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+	exit $status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		  library_names=
+		  old_library=
+		  case $lib in
+		  */* | *\\*) . $lib ;;
+		  *) . ./$lib ;;
+		  esac
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+		    test "X$ladir" = "X$lib" && ladir="."
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+	        ;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.framework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    valid_a_lib=no
+	    case $deplibs_check_method in
+	      match_pattern*)
+		set dummy $deplibs_check_method
+	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+		if eval $echo \"$deplib\" 2>/dev/null \
+		    | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		  valid_a_lib=yes
+		fi
+		;;
+	      pass_all)
+		valid_a_lib=yes
+		;;
+            esac
+	    if test "$valid_a_lib" != yes; then
+	      $echo
+	      $echo "*** Warning: Trying to link with static lib archive $deplib."
+	      $echo "*** I have the capability to make that library automatically link in when"
+	      $echo "*** you link to this library.  But I can only do this if you have a"
+	      $echo "*** shared version of the library, which you do not appear to have"
+	      $echo "*** because the file extensions .$libext of this argument makes me believe"
+	      $echo "*** that it is just a static archive that I should not used here."
+	    else
+	      $echo
+	      $echo "*** Warning: Linking the shared library $output against the"
+	      $echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	case $host in
+	*-*-darwin*)
+	  # Convert "-framework foo" to "foo.framework" in dependency_libs
+	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
+	  ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit $EXIT_FAILURE
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var"; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $dir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	if test -n "$library_names" &&
+	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on
+	  # some systems (darwin)
+	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	    $echo
+	    if test "$linkmode" = prog; then
+	      $echo "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $echo "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $echo "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$extract_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$old_archive_from_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a module then we can not link against
+		    # it, someone is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
+		      $echo "** Warning, lib $linklib is a module, not a shared library"
+		      if test -z "$old_library" ; then
+		        $echo
+		        $echo "** And there doesn't seem to be a static archive available"
+		        $echo "** The link will probably fail, sorry"
+		      else
+		        add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case "$libdir" in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit $EXIT_FAILURE
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	        add="$inst_prefix_dir$libdir/$linklib"
+	      else
+	        add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case "$libdir" in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $echo
+	    $echo "*** Warning: This system can not link to static lib archive $lib."
+	    $echo "*** I have the capability to make that library automatically link in when"
+	    $echo "*** you link to this library.  But I can only do this if you have a"
+	    $echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $echo "*** But as you try to build a module library, libtool will still create "
+	      $echo "*** a static module, that should work as long as the dlopening application"
+	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$echo
+		$echo "*** However, this would only work if libtool was able to extract symbol"
+		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$echo "*** not find such a program.  So, this module is probably useless."
+		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    convenience="$convenience $dir/$old_library"
+	    old_convenience="$old_convenience $dir/$old_library"
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit $EXIT_FAILURE
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="$absdir"
+		fi
+		depdepl=
+		case $host in
+		*-*-darwin*)
+		  # we do not want to link against static libs,
+		  # but need to link against shared
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$path/$depdepl" ; then
+		      depdepl="$path/$depdepl"
+		    fi
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
+		  fi
+		  path=""
+		  ;;
+		*)
+		  path="-L$path"
+		  ;;
+		esac
+		;;
+	      -l*)
+		case $host in
+		*-*-darwin*)
+		  # Again, we only want to link against shared libraries
+		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		  for tmp in $newlib_search_path ; do
+		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		      eval depdepl="$tmp/lib$tmp_libs.dylib"
+		      break
+		    fi
+		  done
+		  path=""
+		  ;;
+	      *.framework)
+		case $host in
+		  *-*-darwin*)
+		    depdepl="$deplib"
+		    ;;
+		esac
+		;;
+		*) continue ;;
+		esac
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $depdepl "*) ;;
+	      *) deplibs="$depdepl $deplibs" ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$deplibs $path" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit $EXIT_FAILURE
+	else
+	  $echo
+	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  $echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$2"
+	  number_minor="$3"
+	  number_revision="$4"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor - 1`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$2"
+	  revision="$3"
+	  age="$4"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $revision in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $age in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+	         then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+	fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  $LTCC -o conftest conftest.c $deplibs
+	  if test "$?" -eq 0 ; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" -ne "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+	        fi
+		if test -n "$i" ; then
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $echo
+		    $echo "*** Warning: dynamic linker does not accept needed library $i."
+		    $echo "*** I have the capability to make that library automatically link in when"
+		    $echo "*** you link to this library.  But I can only do this if you have a"
+		    $echo "*** shared version of the library, which I believe you do not have"
+		    $echo "*** because a test_compile did reveal that the linker did not use it for"
+		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		$rm conftest
+		$LTCC -o conftest conftest.c $i
+		# Did it work?
+		if test "$?" -eq 0 ; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval \\$echo \"$libname_spec\"`
+		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		    set dummy $deplib_matches
+		    deplib_match=$2
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $echo
+		      $echo "*** Warning: dynamic linker does not accept needed library $i."
+		      $echo "*** I have the capability to make that library automatically link in when"
+		      $echo "*** you link to this library.  But I can only do this if you have a"
+		      $echo "*** shared version of the library, which you do not appear to have"
+		      $echo "*** because a test_compile did reveal that the linker did not use this one"
+		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $echo
+		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $echo "***  make it link in!  You will probably need to install it or some"
+		  $echo "*** library that it depends on before this library will be fully"
+		  $echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval $echo \"$potent_lib\" 2>/dev/null \
+		        | ${SED} 10q \
+		        | $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	    -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+	    done
+	  fi
+	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
+	    | grep . >/dev/null; then
+	    $echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $echo
+	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $echo "*** a static module, that should work as long as the dlopening"
+	    $echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $echo
+	      $echo "*** However, this would only work if libtool was able to extract symbol"
+	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $echo "*** not find such a program.  So, this module is probably useless."
+	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $echo "*** The inter-library dependencies that have been dropped here will be"
+	    $echo "*** automatically added whenever a program is linked with this library"
+	    $echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $echo
+	      $echo "*** Since this library must not contain undefined symbols,"
+	      $echo "*** because either the platform does not support them or"
+	      $echo "*** it was explicitly requested with -no-undefined,"
+	      $echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Time to change all our "foo.framework" stuff back to "-framework foo"
+	case $host in
+	  *-*-darwin*)
+	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
+	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
+	    ;;
+	esac
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	        $show "$cmd"
+	        $run eval "$cmd" || exit $?
+	        skipped_export=false
+	      else
+	        # The command line is too long to execute in one step.
+	        $show "using reloadable object file for export list..."
+	        skipped_export=:
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+		case " $convenience " in
+		*" $test_deplib "*) ;;
+		*)
+			tmp_deplibs="$tmp_deplibs $test_deplib"
+			;;
+		esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+	
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval test_cmds=\"$archive_expsym_cmds\"
+	  cmds=$archive_expsym_cmds
+	else
+	  eval test_cmds=\"$archive_cmds\"
+	  cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise.
+	  $echo "creating reloadable object files..."
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  delfiles=
+	  last_robj=
+	  k=1
+	  output=$output_objdir/$save_output-${k}.$objext
+	  # Loop over the list of objects to be linked.
+	  for obj in $save_libobjs
+	  do
+	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	    if test "X$objlist" = X ||
+	       { len=`expr "X$test_cmds" : ".*"` &&
+		 test "$len" -le "$max_cmd_len"; }; then
+	      objlist="$objlist $obj"
+	    else
+	      # The command $test_cmds is almost too long, add a
+	      # command to the queue.
+	      if test "$k" -eq 1 ; then
+		# The first file doesn't have a previous command to add.
+		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+	      else
+		# All subsequent reloadable object files will link in
+		# the last one created.
+		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+	      fi
+	      last_robj=$output_objdir/$save_output-${k}.$objext
+	      k=`expr $k + 1`
+	      output=$output_objdir/$save_output-${k}.$objext
+	      objlist=$obj
+	      len=1
+	    fi
+	  done
+	  # Handle the remaining objects by creating one last
+	  # reloadable object file.  All subsequent reloadable object
+	  # files will link in the last one created.
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	  if ${skipped_export-false}; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    libobjs=$output
+	    # Append the command to create the export file.
+	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+	  # Set up a command to remove the reloadale object files
+	  # after they are used.
+	  i=0
+	  while test "$i" -lt "$k"
+	  do
+	    i=`expr $i + 1`
+	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+	  done
+
+	  $echo "creating a temporary reloadable object file: $output"
+
+	  # Loop through the commands generated above and execute them.
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $concat_cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    cmds=$archive_expsym_cmds
+	  else
+	    cmds=$archive_cmds
+	    fi
+	  fi
+
+	  # Append the command to remove the reloadable object files
+	  # to the just-reset $cmds.
+	  eval cmds=\"\$cmds~\$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	cmds=$reload_cmds
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+	# Time to change all our "foo.framework" stuff back to "-framework foo"
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
+        ;;
+      esac
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$output.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	    else
+	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval '$echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
+	    cwrapper=`$echo ${output}.exe`
+	    $rm $cwrappersource $cwrapper
+	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
+#endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+char * basename (const char *name);
+char * fnqualify(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup ((char *) basename (argv[0]));
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+	    cat >> $cwrappersource <<EOF
+  newargz[0] = "$SHELL";
+EOF
+
+	    cat >> $cwrappersource <<"EOF"
+  newargz[1] = fnqualify(argv[0]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+EOF
+
+	    cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+
+	    cat >> $cwrappersource <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+char *
+basename (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha (name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return (char *) base;
+}
+
+char *
+fnqualify(const char *path)
+{
+  size_t size;
+  char *p;
+  char tmp[LT_PATHMAX + 1];
+
+  assert(path != NULL);
+
+  /* Is it qualified already? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha (path[0]) && path[1] == ':')
+    return xstrdup (path);
+#endif
+  if (IS_DIR_SEPARATOR (path[0]))
+    return xstrdup (path);
+
+  /* prepend the current directory */
+  /* doesn't handle '~' */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
+  p = XMALLOC(char, size);
+  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
+  return p;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+	  # we should really use a build-platform specific compiler
+	  # here, but OTOH, the wrappers (shell script and this C one)
+	  # are only useful if you want to execute the "real" binary.
+	  # Since the "real" binary is built for $host, then this
+	  # wrapper might as well be built for $host, too.
+	  $run $LTCC -s -o $cwrapper $cwrappersource
+	  ;;
+	esac
+	$rm $output
+	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*"` &&
+	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  $echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+	  # encoded into archives.  This makes 'ar r' malfunction in
+	  # this piecewise linking case whenever conflicting object
+	  # names appear in distinct ar calls; check, warn and compensate.
+	    if (for obj in $save_oldobjs
+	    do
+	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	    :
+	  else
+	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
+	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
+	    AR_FLAGS=cq
+	  fi
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*"` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+	        RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest="$arg"
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*) ;;
+
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest="$arg"
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  if test "$inst_prefix_dir" = "$destdir"; then
+	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  cmds=$postinstall_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      file=`$echo $file|${SED} 's,.exe$,,'`
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # To insure that "foo" is sourced, and not "foo.exe",
+	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
+	  # which disallows the automatic-append-.exe behavior.
+	  case $build in
+	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+	  *) wrapperdot=${wrapper} ;;
+	  esac
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . ${wrapperdot} ;;
+	  *) . ./${wrapperdot} ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # To insure that "foo" is sourced, and not "foo.exe",
+	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
+	  # which disallows the automatic-append-.exe behavior.
+	  case $build in
+	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+	  *) wrapperdot=${wrapper} ;;
+	  esac
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . ${wrapperdot} ;;
+	  *) . ./${wrapperdot} ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir="/tmp"
+	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
+	      tmpdir="$tmpdir/libtool-$$"
+	      save_umask=`umask`
+	      umask 0077
+	      if $mkdir "$tmpdir"; then
+	        umask $save_umask
+	      else
+	        umask $save_umask
+		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+		continue
+	      fi
+	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyways
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  cmds=$finish_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "----------------------------------------------------------------------"
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "----------------------------------------------------------------------"
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+	LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+	LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+	  if test "$mode" = uninstall; then
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      cmds=$postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      cmds=$old_postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" \
+	     && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" \
+	     && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    file=`$echo $file|${SED} 's,.exe$,,'`
+	    noexename=`$echo $name|${SED} 's,.exe$,,'`
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+		    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $EXIT_SUCCESS
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/makedep.sh	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Generate dependencies from a list of source files
+
+# Check to make sure our environment variables are set
+if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$objects" = x -o x"$output" = x; then
+    echo "SOURCES, INCLUDE, objects, and output needs to be set"
+    exit 1
+fi
+cache_prefix=".#$$"
+
+generate_var()
+{
+    echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
+}
+
+search_deps()
+{
+    base=`echo $1 | sed 's|/[^/]*$||'`
+    grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
+    while read file
+    do cache=${cache_prefix}_`generate_var $file`
+       if test -f $cache; then
+          # We already ahve this cached
+          cat $cache
+          continue;
+       fi
+       for path in $base `echo $INCLUDE | sed 's|-I||g'`
+       do dep="$path/$file"
+          if test -f "$dep"; then
+             echo "	$dep \\" >$cache
+             echo "	$dep \\"
+             generate_dep $dep
+             break
+          fi
+       done
+    done
+}
+
+generate_dep()
+{
+    cat >>${output}.new <<__EOF__
+$1:	\\
+`search_deps $1`
+
+__EOF__
+}
+
+:>${output}.new
+for src in $SOURCES
+do  echo "Generating dependencies for $src"
+    generate_dep $src
+    ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
+    obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"`
+    echo "$obj: $src" >>${output}.new
+    case $ext in
+        asm) echo "	\$(BUILDASM)" >>${output}.new;;
+        cc)  echo "	\$(BUILDCC)" >>${output}.new;;
+        c)   echo "	\$(BUILDC)" >>${output}.new;;
+        m)   echo "	\$(BUILDM)" >>${output}.new;;
+        *)   echo "Unknown file extension: $ext";;
+    esac
+    echo "" >>${output}.new
+done
+rm -f ${cache_prefix}*
+mv ${output}.new ${output}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/mkinstalldirs	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,99 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+   case "${1}" in
+     -h | --help | --h* )			# -h for help
+	echo "${usage}" 1>&2; exit 0 ;;
+     -m )					# -m PERM arg
+	shift
+	test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
+	dirmode="${1}"
+	shift ;;
+     -- ) shift; break ;;			# stop option processing
+     -* ) echo "${usage}" 1>&2; exit 1 ;;	# unknown option
+     * )  break ;;				# first non-opt arg
+   esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+0) exit 0 ;;
+esac
+
+case $dirmode in
+'')
+  if mkdir -p -- . 2>/dev/null; then
+    echo "mkdir -p -- $*"
+    exec mkdir -p -- "$@"
+  fi ;;
+*)
+  if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+    echo "mkdir -m $dirmode -p -- $*"
+    exec mkdir -m "$dirmode" -p -- "$@"
+  fi ;;
+esac
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+	echo "mkdir $pathcomp"
+
+	mkdir "$pathcomp" || lasterr=$?
+
+	if test ! -d "$pathcomp"; then
+	  errstatus=$lasterr
+	else
+	  if test ! -z "$dirmode"; then
+	     echo "chmod $dirmode $pathcomp"
+
+	     lasterr=""
+	     chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+	     if test ! -z "$lasterr"; then
+	       errstatus=$lasterr
+	     fi
+	  fi
+	fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 3
+# End:
+# mkinstalldirs ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/strip_fPIC.sh	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# libtool assumes that the compiler can handle the -fPIC flag
+# This isn't always true (for example, nasm can't handle it)
+command=""
+while [ $# -gt 0 ]; do
+    case "$1" in
+        -?PIC)
+            # Ignore -fPIC and -DPIC options
+            ;;
+        *)
+            command="$command $1"
+            ;;
+    esac
+    shift
+done
+echo $command
+exec $command
--- a/config.guess	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1479 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2006-01-02'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-	PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-	# switched to ELF, *-*-netbsd* would select the old
-	# object file format.  This provides both forward
-	# compatibility and a consistent mechanism for selecting the
-	# object file format.
-	#
-	# Note: NetBSD doesn't particularly care about the vendor
-	# portion of the name.  We always set it to "unknown".
-	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
-	    armeb) machine=armeb-unknown ;;
-	    arm*) machine=arm-unknown ;;
-	    sh3el) machine=shl-unknown ;;
-	    sh3eb) machine=sh-unknown ;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-	esac
-	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
-		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
-		then
-		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-		    # Return netbsd for either.  FIX?
-		    os=netbsd
-		else
-		    os=netbsdelf
-		fi
-		;;
-	    *)
-	        os=netbsd
-		;;
-	esac
-	# The OS release
-	# Debian GNU/NetBSD machines have a different userland, and
-	# thus, need a distinct triplet. However, they do not need
-	# kernel version information, so it can be replaced with a
-	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
-	    Debian*)
-		release='-gnu'
-		;;
-	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-		;;
-	esac
-	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-	# contains redundant information, the shorter form:
-	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
-	exit ;;
-    *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-	exit ;;
-    *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-	exit ;;
-    *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
-	exit ;;
-    macppc:MirBSD:*:*)
-	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    alpha:OSF1:*:*)
-	case $UNAME_RELEASE in
-	*4.0)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-		;;
-	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-		;;
-	esac
-	# According to Compaq, /usr/sbin/psrinfo has been available on
-	# OSF/1 and Tru64 systems produced since 1995.  I hope that
-	# covers most systems running today.  This code pipes the CPU
-	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-	case "$ALPHA_CPU_TYPE" in
-	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
-	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
-	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
-	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
-	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
-	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
-	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
-	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
-	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
-	esac
-	# A Pn.n version is a patched version.
-	# A Vn.n version is a released version.
-	# A Tn.n version is a released field test version.
-	# A Xn.n version is an unreleased experimental baselevel.
-	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit ;;
-    Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
-	exit ;;
-    *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
-    *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-	exit ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
-    NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
-    DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case `/usr/bin/uname -p` in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
-    sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:6*:*)
-	# According to config.sub, this is the proper way to canonicalize
-	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
-	    Series*|S4*)
-		UNAME_RELEASE=`uname -v`
-		;;
-	esac
-	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit ;;
-    sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit ;;
-    sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-	case "`/bin/arch`" in
-	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
-		;;
-	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
-		;;
-	esac
-	exit ;;
-    aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
-	exit ;;
-    powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit ;;
-    RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
-    RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-	#if defined (host_mips) && defined (MIPSEB)
-	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-	#endif
-	#endif
-	  exit (-1);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
-	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
-	exit ;;
-    Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
-    Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
-    m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
-    m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
-    m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
-	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
-	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
-	    fi
-	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
-	fi
- 	exit ;;
-    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
-    M88*:*:R3*:*)
-	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
-    *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
-    ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:2:3)
-	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
-		#include <sys/systemcfg.h>
-
-		main()
-			{
-			if (!__power_pc())
-				exit(1);
-			puts("powerpc-ibm-aix3.2.5");
-			exit(0);
-			}
-EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-		then
-			echo "$SYSTEM_NAME"
-		else
-			echo rs6000-ibm-aix3.2.5
-		fi
-	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
-	else
-		echo rs6000-ibm-aix3.2
-	fi
-	exit ;;
-    *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-		IBM_ARCH=rs6000
-	else
-		IBM_ARCH=powerpc
-	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
-    DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
-    9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
-    9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
-EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-		    test -z "$HP_ARCH" && HP_ARCH=hppa
-		fi ;;
-	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
-	then
-	    eval $set_cc_for_build
-
-	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-	    # generating 64-bit code.  GNU and HP use different nomenclature:
-	    #
-	    # $ CC_FOR_BUILD=cc ./config.guess
-	    # => hppa2.0w-hp-hpux11.23
-	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-	    # => hppa64-hp-hpux11.23
-
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
-	    then
-		HP_ARCH="hppa2.0w"
-	    else
-		HP_ARCH="hppa64"
-	    fi
-	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit ;;
-    ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
-	exit ;;
-    3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <unistd.h>
-	int
-	main ()
-	{
-	  long cpu = sysconf (_SC_CPU_VERSION);
-	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-	     results, however.  */
-	  if (CPU_IS_PA_RISC (cpu))
-	    {
-	      switch (cpu)
-		{
-		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-		  default: puts ("hppa-hitachi-hiuxwe2"); break;
-		}
-	    }
-	  else if (CPU_IS_HP_MC68K (cpu))
-	    puts ("m68k-hitachi-hiuxwe2");
-	  else puts ("unknown-hitachi-hiuxwe2");
-	  exit (0);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-	echo hppa1.1-hp-bsd
-	exit ;;
-    9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-	echo hppa1.1-hp-osf
-	exit ;;
-    hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
-    i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
-	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
-	fi
-	exit ;;
-    parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-        exit ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-        exit ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-        exit ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-        exit ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-        exit ;;
-    CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-	      -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit ;;
-    sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	esac
-	exit ;;
-    i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
-	exit ;;
-    i*:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
-	exit ;;
-    i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
-	exit ;;
-    x86:Interix*:[345]*)
-	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-	exit ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i586-pc-interix
-	exit ;;
-    i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
-	exit ;;
-    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
-	exit ;;
-    prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    *:GNU:*:*)
-	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit ;;
-    *:GNU/*:*:*)
-	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
-	exit ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
-	exit ;;
-    arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    cris:Linux:*:*)
-	echo cris-axis-linux-gnu
-	exit ;;
-    crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
-	exit ;;
-    frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
-	exit ;;
-    ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips64
-	#undef mips64el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
-	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-	# Look for CPU level
-	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
-	esac
-	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
-	exit ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
-	exit ;;
-    sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
-	exit ;;
-    x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
-	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
-    i*86:DYNIX/ptx:4*:*)
-	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-	# earlier versions are messed up and put the nodename in both
-	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit ;;
-    i*86:OS/2:*:*)
-	# If we were able to find `uname', then EMX Unix compatibility
-	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit ;;
-    i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
-	exit ;;
-    i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
-	exit ;;
-    i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
-	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
-	exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-	fi
-	exit ;;
-    i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case `/bin/uname -X | grep "^Machine"` in
-	    *486*)	     UNAME_MACHINE=i486 ;;
-	    *Pentium)	     UNAME_MACHINE=i586 ;;
-	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-	exit ;;
-    i*86:*:3.2:*)
-	if test -f /usr/options/cb.name; then
-		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
-			&& UNAME_MACHINE=i586
-		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-	else
-		echo ${UNAME_MACHINE}-pc-sysv32
-	fi
-	exit ;;
-    pc:*:*:*)
-	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
-        exit ;;
-    Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
-    paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
-    i860:*:4.*:*) # i860-SVR4
-	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-	fi
-	exit ;;
-    mini*:CTIX:SYS*5:*)
-	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
-    M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
-    M68*:*:R3V[5678]*:*)
-	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
-	OS_REL=''
-	test -r /etc/.relid \
-	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
-    TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
-	exit ;;
-    RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    *:SINIX-*:*:*)
-	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
-	else
-		echo ns32k-sni-sysv
-	fi
-	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
-    *:UNIX_System_V:4*:FTX*)
-	# From Gerald Hewes <hewes@openmarket.com>.
-	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
-    *:*:*:FTX*)
-	# From seanf@swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
-    i*86:VOS:*:*)
-	# From Paul.Green@stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
-	exit ;;
-    *:VOS:*:*)
-	# From Paul.Green@stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
-    mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
-	exit ;;
-    news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
-	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
-	fi
-        exit ;;
-    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
-    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
-    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
-    SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
-	exit ;;
-    Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-	exit ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
-		UNAME_PROCESSOR=i386
-		UNAME_MACHINE=pc
-	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-	exit ;;
-    *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
-    BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
-    DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-	exit ;;
-    *:Plan9:*:*)
-	# "uname -m" is not consistent, so use $cputype instead. 386
-	# is converted to i386 for consistency with other x86
-	# operating systems.
-	if test "$cputype" = "386"; then
-	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
-	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
-	exit ;;
-    *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
-    *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
-    *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
-    *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-	exit ;;
-    *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit ;;
-    *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
-	esac ;;
-    *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
-    i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-	exit ;;
-    i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
-	exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
--- a/config.sub	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1606 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2006-01-02'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit ;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-	-sun*os*)
-		# Prevent following clause from handling this invalid input.
-		;;
-	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
-		os=
-		basic_machine=$1
-		;;
-	-sim | -cisco | -oki | -wec | -winbond)
-		os=
-		basic_machine=$1
-		;;
-	-scout)
-		;;
-	-wrs)
-		os=-vxworks
-		basic_machine=$1
-		;;
-	-chorusos*)
-		os=-chorusos
-		basic_machine=$1
-		;;
- 	-chorusrdb)
- 		os=-chorusrdb
-		basic_machine=$1
- 		;;
-	-hiux*)
-		os=-hiuxwe2
-		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5)
-		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco4)
-		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2.[4-9]*)
-		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2v[4-9]*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco*)
-		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-isc)
-		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-clix*)
-		basic_machine=clipper-intergraph
-		;;
-	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-lynx*)
-		os=-lynxos
-		;;
-	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-windowsnt*)
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
-		;;
-	-psos*)
-		os=-psos
-		;;
-	-mint | -mint[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-	# Recognize the basic CPU types without company name.
-	# Some are omitted here because they have special meanings below.
-	1750a | 580 \
-	| a29k \
-	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| bfin \
-	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| i370 | i860 | i960 | ia64 \
-	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
-	| mips | mipsbe | mipseb | mipsel | mipsle \
-	| mips16 \
-	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
-	| mips64orion | mips64orionel \
-	| mips64vr4100 | mips64vr4100el \
-	| mips64vr4300 | mips64vr4300el \
-	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
-	| mipsisa32 | mipsisa32el \
-	| mipsisa32r2 | mipsisa32r2el \
-	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
-	| mipsisa64sb1 | mipsisa64sb1el \
-	| mipsisa64sr71k | mipsisa64sr71kel \
-	| mipstx39 | mipstx39el \
-	| mn10200 | mn10300 \
-	| mt \
-	| msp430 \
-	| ns16k | ns32k \
-	| or32 \
-	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-	| pyramid \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
-	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b \
-	| strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
-	| v850 | v850e \
-	| we32k \
-	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
-		basic_machine=$basic_machine-unknown
-		;;
-	m32c)
-		basic_machine=$basic_machine-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
-		# Motorola 68HC11/12.
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
-
-	# We use `pc' rather than `unknown'
-	# because (1) that's what they normally are, and
-	# (2) the word "unknown" tends to confuse beginning users.
-	i*86 | x86_64)
-	  basic_machine=$basic_machine-pc
-	  ;;
-	# Object if more than one company name word.
-	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-	# Recognize the basic CPU types with company name.
-	580-* \
-	| a29k-* \
-	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* \
-	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | craynv-* | cydra-* \
-	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
-	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
-	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
-	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-	| mips16-* \
-	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
-	| mips64orion-* | mips64orionel-* \
-	| mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* \
-	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
-	| mipsisa32-* | mipsisa32el-* \
-	| mipsisa32r2-* | mipsisa32r2el-* \
-	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
-	| mipsisa64sb1-* | mipsisa64sb1el-* \
-	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
-	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
-	| msp430-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
-	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tron-* \
-	| v850-* | v850e-* | vax-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
-	| ymp-* \
-	| z8k-*)
-		;;
-	m32c-*)
-		;;
-	# Recognize the various machine names and aliases which stand
-	# for a CPU type and a company and sometimes even an OS.
-	386bsd)
-		basic_machine=i386-unknown
-		os=-bsd
-		;;
-	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-		basic_machine=m68000-att
-		;;
-	3b*)
-		basic_machine=we32k-att
-		;;
-	a29khif)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-    	abacus)
-		basic_machine=abacus-unknown
-		;;
-	adobe68k)
-		basic_machine=m68010-adobe
-		os=-scout
-		;;
-	alliant | fx80)
-		basic_machine=fx80-alliant
-		;;
-	altos | altos3068)
-		basic_machine=m68k-altos
-		;;
-	am29k)
-		basic_machine=a29k-none
-		os=-bsd
-		;;
-	amd64)
-		basic_machine=x86_64-pc
-		;;
-	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	amdahl)
-		basic_machine=580-amdahl
-		os=-sysv
-		;;
-	amiga | amiga-*)
-		basic_machine=m68k-unknown
-		;;
-	amigaos | amigados)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigaunix | amix)
-		basic_machine=m68k-unknown
-		os=-sysv4
-		;;
-	apollo68)
-		basic_machine=m68k-apollo
-		os=-sysv
-		;;
-	apollo68bsd)
-		basic_machine=m68k-apollo
-		os=-bsd
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	c90)
-		basic_machine=c90-cray
-		os=-unicos
-		;;
-	convex-c1)
-		basic_machine=c1-convex
-		os=-bsd
-		;;
-	convex-c2)
-		basic_machine=c2-convex
-		os=-bsd
-		;;
-	convex-c32)
-		basic_machine=c32-convex
-		os=-bsd
-		;;
-	convex-c34)
-		basic_machine=c34-convex
-		os=-bsd
-		;;
-	convex-c38)
-		basic_machine=c38-convex
-		os=-bsd
-		;;
-	cray | j90)
-		basic_machine=j90-cray
-		os=-unicos
-		;;
-	craynv)
-		basic_machine=craynv-cray
-		os=-unicosmp
-		;;
-	cr16c)
-		basic_machine=cr16c-unknown
-		os=-elf
-		;;
-	crds | unos)
-		basic_machine=m68k-crds
-		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
-	cris | cris-* | etrax*)
-		basic_machine=cris-axis
-		;;
-	crx)
-		basic_machine=crx-unknown
-		os=-elf
-		;;
-	da30 | da30-*)
-		basic_machine=m68k-da30
-		;;
-	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-		basic_machine=mips-dec
-		;;
-	decsystem10* | dec10*)
-		basic_machine=pdp10-dec
-		os=-tops10
-		;;
-	decsystem20* | dec20*)
-		basic_machine=pdp10-dec
-		os=-tops20
-		;;
-	delta | 3300 | motorola-3300 | motorola-delta \
-	      | 3300-motorola | delta-motorola)
-		basic_machine=m68k-motorola
-		;;
-	delta88)
-		basic_machine=m88k-motorola
-		os=-sysv3
-		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
-	dpx20 | dpx20-*)
-		basic_machine=rs6000-bull
-		os=-bosx
-		;;
-	dpx2* | dpx2*-bull)
-		basic_machine=m68k-bull
-		os=-sysv3
-		;;
-	ebmon29k)
-		basic_machine=a29k-amd
-		os=-ebmon
-		;;
-	elxsi)
-		basic_machine=elxsi-elxsi
-		os=-bsd
-		;;
-	encore | umax | mmax)
-		basic_machine=ns32k-encore
-		;;
-	es1800 | OSE68k | ose68k | ose | OSE)
-		basic_machine=m68k-ericsson
-		os=-ose
-		;;
-	fx2800)
-		basic_machine=i860-alliant
-		;;
-	genix)
-		basic_machine=ns32k-ns
-		;;
-	gmicro)
-		basic_machine=tron-gmicro
-		os=-sysv
-		;;
-	go32)
-		basic_machine=i386-pc
-		os=-go32
-		;;
-	h3050r* | hiux*)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	h8300hms)
-		basic_machine=h8300-hitachi
-		os=-hms
-		;;
-	h8300xray)
-		basic_machine=h8300-hitachi
-		os=-xray
-		;;
-	h8500hms)
-		basic_machine=h8500-hitachi
-		os=-hms
-		;;
-	harris)
-		basic_machine=m88k-harris
-		os=-sysv3
-		;;
-	hp300-*)
-		basic_machine=m68k-hp
-		;;
-	hp300bsd)
-		basic_machine=m68k-hp
-		os=-bsd
-		;;
-	hp300hpux)
-		basic_machine=m68k-hp
-		os=-hpux
-		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k2[0-9][0-9] | hp9k31[0-9])
-		basic_machine=m68000-hp
-		;;
-	hp9k3[2-9][0-9])
-		basic_machine=m68k-hp
-		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k7[0-79][0-9] | hp7[0-79][0-9])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k78[0-9] | hp78[0-9])
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][13679] | hp8[0-9][13679])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][0-9] | hp8[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hppa-next)
-		os=-nextstep3
-		;;
-	hppaosf)
-		basic_machine=hppa1.1-hp
-		os=-osf
-		;;
-	hppro)
-		basic_machine=hppa1.1-hp
-		os=-proelf
-		;;
-	i370-ibm* | ibm*)
-		basic_machine=i370-ibm
-		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i*86v32)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv32
-		;;
-	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv4
-		;;
-	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv
-		;;
-	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-solaris2
-		;;
-	i386mach)
-		basic_machine=i386-mach
-		os=-mach
-		;;
-	i386-vsta | vsta)
-		basic_machine=i386-unknown
-		os=-vsta
-		;;
-	iris | iris4d)
-		basic_machine=mips-sgi
-		case $os in
-		    -irix*)
-			;;
-		    *)
-			os=-irix4
-			;;
-		esac
-		;;
-	isi68 | isi)
-		basic_machine=m68k-isi
-		os=-sysv
-		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	mingw32)
-		basic_machine=i386-pc
-		os=-mingw32
-		;;
-	miniframe)
-		basic_machine=m68000-convergent
-		;;
-	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-		;;
-	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-		;;
-	monitor)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	morphos)
-		basic_machine=powerpc-unknown
-		os=-morphos
-		;;
-	msdos)
-		basic_machine=i386-pc
-		os=-msdos
-		;;
-	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	ncr3000)
-		basic_machine=i486-ncr
-		os=-sysv4
-		;;
-	netbsd386)
-		basic_machine=i386-unknown
-		os=-netbsd
-		;;
-	netwinder)
-		basic_machine=armv4l-rebel
-		os=-linux
-		;;
-	news | news700 | news800 | news900)
-		basic_machine=m68k-sony
-		os=-newsos
-		;;
-	news1000)
-		basic_machine=m68030-sony
-		os=-newsos
-		;;
-	news-3600 | risc-news)
-		basic_machine=mips-sony
-		os=-newsos
-		;;
-	necv70)
-		basic_machine=v70-nec
-		os=-sysv
-		;;
-	next | m*-next )
-		basic_machine=m68k-next
-		case $os in
-		    -nextstep* )
-			;;
-		    -ns2*)
-		      os=-nextstep2
-			;;
-		    *)
-		      os=-nextstep3
-			;;
-		esac
-		;;
-	nh3000)
-		basic_machine=m68k-harris
-		os=-cxux
-		;;
-	nh[45]000)
-		basic_machine=m88k-harris
-		os=-cxux
-		;;
-	nindy960)
-		basic_machine=i960-intel
-		os=-nindy
-		;;
-	mon960)
-		basic_machine=i960-intel
-		os=-mon960
-		;;
-	nonstopux)
-		basic_machine=mips-compaq
-		os=-nonstopux
-		;;
-	np1)
-		basic_machine=np1-gould
-		;;
-	nsr-tandem)
-		basic_machine=nsr-tandem
-		;;
-	op50n-* | op60c-*)
-		basic_machine=hppa1.1-oki
-		os=-proelf
-		;;
-	openrisc | openrisc-*)
-		basic_machine=or32-unknown
-		;;
-	os400)
-		basic_machine=powerpc-ibm
-		os=-os400
-		;;
-	OSE68000 | ose68000)
-		basic_machine=m68000-ericsson
-		os=-ose
-		;;
-	os68k)
-		basic_machine=m68k-none
-		os=-os68k
-		;;
-	pa-hitachi)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	paragon)
-		basic_machine=i860-intel
-		os=-osf
-		;;
-	pbd)
-		basic_machine=sparc-tti
-		;;
-	pbb)
-		basic_machine=m68k-tti
-		;;
-	pc532 | pc532-*)
-		basic_machine=ns32k-pc532
-		;;
-	pc98)
-		basic_machine=i386-pc
-		;;
-	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium | p5 | k5 | k6 | nexgen | viac3)
-		basic_machine=i586-pc
-		;;
-	pentiumpro | p6 | 6x86 | athlon | athlon_*)
-		basic_machine=i686-pc
-		;;
-	pentiumii | pentium2 | pentiumiii | pentium3)
-		basic_machine=i686-pc
-		;;
-	pentium4)
-		basic_machine=i786-pc
-		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pn)
-		basic_machine=pn-gould
-		;;
-	power)	basic_machine=power-ibm
-		;;
-	ppc)	basic_machine=powerpc-unknown
-		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
-		basic_machine=powerpcle-unknown
-		;;
-	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64)	basic_machine=powerpc64-unknown
-		;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-		basic_machine=powerpc64le-unknown
-		;;
-	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ps2)
-		basic_machine=i386-ibm
-		;;
-	pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
-	rdos)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
-	rom68k)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	rm[46]00)
-		basic_machine=mips-siemens
-		;;
-	rtpc | rtpc-*)
-		basic_machine=romp-ibm
-		;;
-	s390 | s390-*)
-		basic_machine=s390-ibm
-		;;
-	s390x | s390x-*)
-		basic_machine=s390x-ibm
-		;;
-	sa29200)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	sb1)
-		basic_machine=mipsisa64sb1-unknown
-		;;
-	sb1el)
-		basic_machine=mipsisa64sb1el-unknown
-		;;
-	sei)
-		basic_machine=mips-sei
-		os=-seiux
-		;;
-	sequent)
-		basic_machine=i386-sequent
-		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparclite-wrs | simso-wrs)
-		basic_machine=sparclite-wrs
-		os=-vxworks
-		;;
-	sps7)
-		basic_machine=m68k-bull
-		os=-sysv2
-		;;
-	spur)
-		basic_machine=spur-unknown
-		;;
-	st2000)
-		basic_machine=m68k-tandem
-		;;
-	stratus)
-		basic_machine=i860-stratus
-		os=-sysv4
-		;;
-	sun2)
-		basic_machine=m68000-sun
-		;;
-	sun2os3)
-		basic_machine=m68000-sun
-		os=-sunos3
-		;;
-	sun2os4)
-		basic_machine=m68000-sun
-		os=-sunos4
-		;;
-	sun3os3)
-		basic_machine=m68k-sun
-		os=-sunos3
-		;;
-	sun3os4)
-		basic_machine=m68k-sun
-		os=-sunos4
-		;;
-	sun4os3)
-		basic_machine=sparc-sun
-		os=-sunos3
-		;;
-	sun4os4)
-		basic_machine=sparc-sun
-		os=-sunos4
-		;;
-	sun4sol2)
-		basic_machine=sparc-sun
-		os=-solaris2
-		;;
-	sun3 | sun3-*)
-		basic_machine=m68k-sun
-		;;
-	sun4)
-		basic_machine=sparc-sun
-		;;
-	sun386 | sun386i | roadrunner)
-		basic_machine=i386-sun
-		;;
-	sv1)
-		basic_machine=sv1-cray
-		os=-unicos
-		;;
-	symmetry)
-		basic_machine=i386-sequent
-		os=-dynix
-		;;
-	t3e)
-		basic_machine=alphaev5-cray
-		os=-unicos
-		;;
-	t90)
-		basic_machine=t90-cray
-		os=-unicos
-		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
-	tx39)
-		basic_machine=mipstx39-unknown
-		;;
-	tx39el)
-		basic_machine=mipstx39el-unknown
-		;;
-	toad1)
-		basic_machine=pdp10-xkl
-		os=-tops20
-		;;
-	tower | tower-32)
-		basic_machine=m68k-ncr
-		;;
-	tpf)
-		basic_machine=s390x-ibm
-		os=-tpf
-		;;
-	udi29k)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	ultra3)
-		basic_machine=a29k-nyu
-		os=-sym1
-		;;
-	v810 | necv810)
-		basic_machine=v810-nec
-		os=-none
-		;;
-	vaxv)
-		basic_machine=vax-dec
-		os=-sysv
-		;;
-	vms)
-		basic_machine=vax-dec
-		os=-vms
-		;;
-	vpp*|vx|vx-*)
-		basic_machine=f301-fujitsu
-		;;
-	vxworks960)
-		basic_machine=i960-wrs
-		os=-vxworks
-		;;
-	vxworks68)
-		basic_machine=m68k-wrs
-		os=-vxworks
-		;;
-	vxworks29k)
-		basic_machine=a29k-wrs
-		os=-vxworks
-		;;
-	w65*)
-		basic_machine=w65-wdc
-		os=-none
-		;;
-	w89k-*)
-		basic_machine=hppa1.1-winbond
-		os=-proelf
-		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
-	xps | xps100)
-		basic_machine=xps100-honeywell
-		;;
-	ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	none)
-		basic_machine=none-none
-		os=-none
-		;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-	w89k)
-		basic_machine=hppa1.1-winbond
-		;;
-	op50n)
-		basic_machine=hppa1.1-oki
-		;;
-	op60c)
-		basic_machine=hppa1.1-oki
-		;;
-	romp)
-		basic_machine=romp-ibm
-		;;
-	mmix)
-		basic_machine=mmix-knuth
-		;;
-	rs6000)
-		basic_machine=rs6000-ibm
-		;;
-	vax)
-		basic_machine=vax-dec
-		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
-	pdp11)
-		basic_machine=pdp11-dec
-		;;
-	we32k)
-		basic_machine=we32k-att
-		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
-		basic_machine=sh-unknown
-		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
-		basic_machine=sparc-sun
-		;;
-	cydra)
-		basic_machine=cydra-cydrome
-		;;
-	orion)
-		basic_machine=orion-highlevel
-		;;
-	orion105)
-		basic_machine=clipper-highlevel
-		;;
-	mac | mpw | mac-mpw)
-		basic_machine=m68k-apple
-		;;
-	pmac | pmac-mpw)
-		basic_machine=powerpc-apple
-		;;
-	*-unknown)
-		# Make sure to match an already-canonicalized machine name.
-		;;
-	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-		;;
-	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-		;;
-	*)
-		;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-	# -solaris* is a basic system type, with this one exception.
-	-solaris1 | -solaris1.*)
-		os=`echo $os | sed -e 's|solaris1|sunos4|'`
-		;;
-	-solaris)
-		os=-solaris2
-		;;
-	-svr4*)
-		os=-sysv4
-		;;
-	-unixware*)
-		os=-sysv4.2uw
-		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
-	# First accept the basic system types.
-	# The portable systems comes first.
-	# Each alternative MUST END IN A *, to match a version number.
-	# -sysv* is not here because it comes later, after sysvr4.
-	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
-	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
-	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos*)
-	# Remember, each alternative MUST END IN *, to match a version number.
-		;;
-	-qnx*)
-		case $basic_machine in
-		    x86-* | i*86-*)
-			;;
-		    *)
-			os=-nto$os
-			;;
-		esac
-		;;
-	-nto-qnx*)
-		;;
-	-nto*)
-		os=`echo $os | sed -e 's|nto|nto-qnx|'`
-		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-		;;
-	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
-		;;
-	-linux-dietlibc)
-		os=-linux-dietlibc
-		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
-		;;
-	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
-		;;
-	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
-		;;
-	-opened*)
-		os=-openedition
-		;;
-        -os400*)
-		os=-os400
-		;;
-	-wince*)
-		os=-wince
-		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
-	-utek*)
-		os=-bsd
-		;;
-	-dynix*)
-		os=-bsd
-		;;
-	-acis*)
-		os=-aos
-		;;
-	-atheos*)
-		os=-atheos
-		;;
-	-syllable*)
-		os=-syllable
-		;;
-	-386bsd)
-		os=-bsd
-		;;
-	-ctix* | -uts*)
-		os=-sysv
-		;;
-	-nova*)
-		os=-rtmk-nova
-		;;
-	-ns2 )
-		os=-nextstep2
-		;;
-	-nsk*)
-		os=-nsk
-		;;
-	# Preserve the version number of sinix5.
-	-sinix5.*)
-		os=`echo $os | sed -e 's|sinix|sysv|'`
-		;;
-	-sinix*)
-		os=-sysv4
-		;;
-        -tpf*)
-		os=-tpf
-		;;
-	-triton*)
-		os=-sysv3
-		;;
-	-oss*)
-		os=-sysv3
-		;;
-	-svr4)
-		os=-sysv4
-		;;
-	-svr3)
-		os=-sysv3
-		;;
-	-sysvr4)
-		os=-sysv4
-		;;
-	# This must come after -sysvr4.
-	-sysv*)
-		;;
-	-ose*)
-		os=-ose
-		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
-	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-		os=-mint
-		;;
-	-aros*)
-		os=-aros
-		;;
-	-kaos*)
-		os=-kaos
-		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
-	-none)
-		;;
-	*)
-		# Get rid of the `-' at the beginning of $os.
-		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-		exit 1
-		;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-	*-acorn)
-		os=-riscix1.2
-		;;
-	arm*-rebel)
-		os=-linux
-		;;
-	arm*-semi)
-		os=-aout
-		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
-	# This must come before the *-dec entry.
-	pdp10-*)
-		os=-tops20
-		;;
-	pdp11-*)
-		os=-none
-		;;
-	*-dec | vax-*)
-		os=-ultrix4.2
-		;;
-	m68*-apollo)
-		os=-domain
-		;;
-	i386-sun)
-		os=-sunos4.0.2
-		;;
-	m68000-sun)
-		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
-		;;
-	m68*-cisco)
-		os=-aout
-		;;
-	mips*-cisco)
-		os=-elf
-		;;
-	mips*-*)
-		os=-elf
-		;;
-	or32-*)
-		os=-coff
-		;;
-	*-tti)	# must be before sparc entry or we get the wrong os.
-		os=-sysv3
-		;;
-	sparc-* | *-sun)
-		os=-sunos4.1.1
-		;;
-	*-be)
-		os=-beos
-		;;
-	*-haiku)
-		os=-haiku
-		;;
-	*-ibm)
-		os=-aix
-		;;
-    	*-knuth)
-		os=-mmixware
-		;;
-	*-wec)
-		os=-proelf
-		;;
-	*-winbond)
-		os=-proelf
-		;;
-	*-oki)
-		os=-proelf
-		;;
-	*-hp)
-		os=-hpux
-		;;
-	*-hitachi)
-		os=-hiux
-		;;
-	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-		os=-sysv
-		;;
-	*-cbm)
-		os=-amigaos
-		;;
-	*-dg)
-		os=-dgux
-		;;
-	*-dolphin)
-		os=-sysv3
-		;;
-	m68k-ccur)
-		os=-rtu
-		;;
-	m88k-omron*)
-		os=-luna
-		;;
-	*-next )
-		os=-nextstep
-		;;
-	*-sequent)
-		os=-ptx
-		;;
-	*-crds)
-		os=-unos
-		;;
-	*-ns)
-		os=-genix
-		;;
-	i370-*)
-		os=-mvs
-		;;
-	*-next)
-		os=-nextstep3
-		;;
-	*-gould)
-		os=-sysv
-		;;
-	*-highlevel)
-		os=-bsd
-		;;
-	*-encore)
-		os=-bsd
-		;;
-	*-sgi)
-		os=-irix
-		;;
-	*-siemens)
-		os=-sysv4
-		;;
-	*-masscomp)
-		os=-rtu
-		;;
-	f30[01]-fujitsu | f700-fujitsu)
-		os=-uxpv
-		;;
-	*-rom68k)
-		os=-coff
-		;;
-	*-*bug)
-		os=-coff
-		;;
-	*-apple)
-		os=-macos
-		;;
-	*-atari*)
-		os=-mint
-		;;
-	*)
-		os=-none
-		;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-	*-unknown)
-		case $os in
-			-riscix*)
-				vendor=acorn
-				;;
-			-sunos*)
-				vendor=sun
-				;;
-			-aix*)
-				vendor=ibm
-				;;
-			-beos*)
-				vendor=be
-				;;
-			-hpux*)
-				vendor=hp
-				;;
-			-mpeix*)
-				vendor=hp
-				;;
-			-hiux*)
-				vendor=hitachi
-				;;
-			-unos*)
-				vendor=crds
-				;;
-			-dgux*)
-				vendor=dg
-				;;
-			-luna*)
-				vendor=omron
-				;;
-			-genix*)
-				vendor=ns
-				;;
-			-mvs* | -opened*)
-				vendor=ibm
-				;;
-			-os400*)
-				vendor=ibm
-				;;
-			-ptx*)
-				vendor=sequent
-				;;
-			-tpf*)
-				vendor=ibm
-				;;
-			-vxsim* | -vxworks* | -windiss*)
-				vendor=wrs
-				;;
-			-aux*)
-				vendor=apple
-				;;
-			-hms*)
-				vendor=hitachi
-				;;
-			-mpw* | -macos*)
-				vendor=apple
-				;;
-			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-				vendor=atari
-				;;
-			-vos*)
-				vendor=stratus
-				;;
-		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-		;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
--- a/configure.in	Fri Feb 10 07:29:08 2006 +0000
+++ b/configure.in	Thu Feb 16 10:11:48 2006 +0000
@@ -40,6 +40,7 @@
 AC_SUBST(LT_AGE)
 
 dnl Detect the canonical host and target build environment
+AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
 AC_CANONICAL_SYSTEM
 AC_C_BIGENDIAN
 if test x$ac_cv_c_bigendian = xyes; then
@@ -48,101 +49,54 @@
     AC_DEFINE(SDL_BYTEORDER, 1234)
 fi
 
-dnl Setup for automake
-AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
-
-dnl Disable autoheader
-AUTOHEADER=:
-
 dnl Check for tools
-
+#AC_LIBTOOL_DLOPEN
 AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_INSTALL
-ASFLAGS=""
-AC_SUBST(ASFLAGS)
-CCAS="$CC"
-AC_SUBST(CCAS)
-CCASFLAGS=""
-AC_SUBST(CCASFLAGS)
-AM_CONDITIONAL([am__fastdepOBJC], false)
-
-dnl The alpha architecture needs special flags for binary portability
-case "$target" in
-    alpha*-*-linux*)
-        if test x$ac_cv_prog_gcc = xyes; then
-            CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
-        fi
-        ;;
-esac
-
-dnl Add compiler-specific optimization flags
-
-dnl See if the user wants aggressive optimizations of the code
-AC_ARG_ENABLE(debug,
-[  --enable-debug          Disable aggressive optimizations [default=yes]],
-              , enable_debug=yes)
-if test x$enable_debug != xyes; then
-    if test x$ac_cv_prog_gcc = xyes; then
-        CFLAGS="$CFLAGS -fexpensive-optimizations"
-        # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
-        # CFLAGS="$CFLAGS -fomit-frame-pointer"
-    fi
-    case "$target" in
-        i486-*-*)
-            if test x$ac_cv_prog_gcc = xyes; then
-                CFLAGS="$CFLAGS -march=i486"
-            fi
-            ;;
-        i?86-*-*)
-            if test x$ac_cv_prog_gcc = xyes; then
-                CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
-            fi
-            ;;
-        *-*-osf*)
-            if test x$ac_cv_prog_gcc != xyes; then
-                CFLAGS="-g3 -fast -arch host"
-            fi
-            ;;
-    esac
-fi
-
-dnl Add verbose warnings by default, and allow ANSI compliance checking
-AC_ARG_ENABLE(strict-ansi,
-[  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
-              , enable_strict_ansi=no)
-if test x$ac_cv_prog_gcc = xyes; then
-    CFLAGS="$CFLAGS -Wall"
-    if test x$enable_strict_ansi = xyes; then
-        CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
-    fi
-fi
-
-dnl See whether we are allowed to use the system C library
-AC_ARG_ENABLE(libc,
-[  --enable-libc           Use the system C library [default=yes]],
-              , AC_DEFINE(HAVE_LIBC))
 
 dnl Check for compiler characteristics
 AC_C_CONST
 AC_C_INLINE
 AC_C_VOLATILE
 
-dnl Check for header files
-AC_HEADER_STDC
-AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h signal.h)
+dnl See whether we are allowed to use the system C library
+AC_ARG_ENABLE(libc,
+AC_HELP_STRING([--enable-libc], [Use the system C library [default=yes]]),
+              , enable_libc=yes)
+if test x$enable_libc = xyes; then
+    AC_DEFINE(HAVE_LIBC)
+
+    dnl Check for C library headers
+    AC_HEADER_STDC
+    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h signal.h)
 
-dnl Check for typedefs, structures, etc.
-AC_TYPE_SIZE_T
-if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
-    AC_CHECK_TYPE(int64_t)
-    if test x$ac_cv_type_int64_t = xyes; then
-        AC_DEFINE(SDL_HAS_64BIT_TYPE)
+    dnl Check for typedefs, structures, etc.
+    AC_TYPE_SIZE_T
+    if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
+        AC_CHECK_TYPE(int64_t)
+        if test x$ac_cv_type_int64_t = xyes; then
+            AC_DEFINE(SDL_HAS_64BIT_TYPE)
+        fi
+        have_inttypes=yes
     fi
-else
+
+    dnl Checks for library functions.
+    AC_FUNC_ALLOCA
+    AC_FUNC_MEMCMP
+    if test x$ac_cv_func_memcmp_working = xyes; then
+        AC_DEFINE(HAVE_MEMCMP)
+    fi
+    AC_FUNC_STRTOD
+    if test x$ac_cv_func_strtod = xyes; then
+        AC_DEFINE(HAVE_STRTOD)
+    fi
+    AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strcpy strncpy strcat strncat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprint sigaction setjmp nanosleep)
+fi
+
+if test x$have_inttypes != xyes; then
     AC_CHECK_SIZEOF(char, 1)
     AC_CHECK_SIZEOF(short, 2)
     AC_CHECK_SIZEOF(int, 4)
@@ -181,21 +135,32 @@
             AC_DEFINE(SDL_HAS_64BIT_TYPE)
         fi
     fi
-    AC_CHECK_TYPE(uintptr_t, unsigned long)
+    AC_DEFINE(size_t, unsigned int)
+    AC_DEFINE(uintptr_t, unsigned long)
 fi
 
-dnl Checks for library functions.
-AC_FUNC_ALLOCA
-AC_FUNC_MEMCMP
-if test x$ac_cv_func_memcmp_working = xyes; then
-    AC_DEFINE(HAVE_MEMCMP)
+# Set up the build preprocessor flags
+INCLUDE="-I$srcdir/include"
+if test x$srcdir != x.; then
+    INCLUDE="-Iinclude $INCLUDE"
 fi
-AC_FUNC_STRTOD
-if test x$ac_cv_func_strtod = xyes; then
-    AC_DEFINE(HAVE_STRTOD)
-fi
-AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strcpy strncpy strcat strncat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprint)
+BUILD_CFLAGS='-D_GNU_SOURCE=1 $(INCLUDE)'
 
+# Standard C sources
+SOURCES="$SOURCES $srcdir/src/*.c"
+SOURCES="$SOURCES $srcdir/src/audio/*.c"
+SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
+SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
+SOURCES="$SOURCES $srcdir/src/events/*.c"
+SOURCES="$SOURCES $srcdir/src/file/*.c"
+SOURCES="$SOURCES $srcdir/src/joystick/*.c"
+SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
+SOURCES="$SOURCES $srcdir/src/thread/*.c"
+SOURCES="$SOURCES $srcdir/src/timer/*.c"
+SOURCES="$SOURCES $srcdir/src/video/*.c"
+
+# Set up the build libraries needed
+BUILD_LIBS=""
 
 dnl Initialize the compiler and linker flags for SDL applications
 
@@ -218,104 +183,82 @@
         MATHLIB="-lm"
         ;;
 esac
-SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"
+BUILD_LIBS="$BUILD_LIBS $MATHLIB"
 
 dnl Enable/disable various subsystems of the SDL library
 
 AC_ARG_ENABLE(audio,
-[  --enable-audio          Enable the audio subsystem [default=yes]],
+AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [default=yes]]),
               , enable_audio=yes)
-if test x$enable_audio = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_AUDIO"
+if test x$enable_audio != xyes; then
+    AC_DEFINE(SDL_AUDIO_DISABLED)
 fi
 AC_ARG_ENABLE(video,
-[  --enable-video          Enable the video subsystem [default=yes]],
+AC_HELP_STRING([--enable-video], [Enable the video subsystem [default=yes]]),
               , enable_video=yes)
-if test x$enable_video = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS video"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_VIDEO"
+if test x$enable_video != xyes; then
+    AC_DEFINE(SDL_VIDEO_DISABLED)
 fi
 AC_ARG_ENABLE(events,
-[  --enable-events         Enable the events subsystem [default=yes]],
+AC_HELP_STRING([--enable-events], [Enable the events subsystem [default=yes]]),
               , enable_events=yes)
-if test x$enable_video = xyes -a x$enable_events = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS events"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_EVENTS"
+if test x$enable_events != xyes; then
+    AC_DEFINE(SDL_EVENTS_DISABLED)
 fi
 AC_ARG_ENABLE(joystick,
-[  --enable-joystick       Enable the joystick subsystem [default=yes]],
+AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [default=yes]]),
               , enable_joystick=yes)
-if test x$enable_joystick = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
+if test x$enable_joystick != xyes; then
+    AC_DEFINE(SDL_JOYSTICK_DISABLED)
 fi
 AC_ARG_ENABLE(cdrom,
-[  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
+AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [default=yes]]),
               , enable_cdrom=yes)
-if test x$enable_cdrom = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_CDROM"
+if test x$enable_cdrom != xyes; then
+    AC_DEFINE(SDL_CDROM_DISABLED)
 fi
 AC_ARG_ENABLE(threads,
-[  --enable-threads        Enable the threading subsystem [default=yes]],
+AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]]),
               , enable_threads=yes)
-SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
-SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
 if test x$enable_threads != xyes; then
-    CFLAGS="$CFLAGS -DDISABLE_THREADS"
-    COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
-    COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
-    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
-    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
-    COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
-    COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-    COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-    COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
+    AC_DEFINE(SDL_THREADS_DISABLED)
 fi
 AC_ARG_ENABLE(timers,
-[  --enable-timers         Enable the timer subsystem [default=yes]],
+AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]]),
               , enable_timers=yes)
-if test x$enable_timers = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_TIMERS"
+if test x$enable_timers != xyes; then
+    AC_DEFINE(SDL_TIMERS_DISABLED)
 fi
 AC_ARG_ENABLE(file,
-[  --enable-file           Enable the file subsystem [default=yes]],
+AC_HELP_STRING([--enable-file], [Enable the file subsystem [default=yes]]),
               , enable_file=yes)
-if test x$enable_file = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS file"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_FILE"
+if test x$enable_file != xyes; then
+    AC_DEFINE(SDL_FILE_DISABLED)
+fi
+AC_ARG_ENABLE(loadso,
+AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]]),
+              , enable_loadso=yes)
+if test x$enable_loadso != xyes; then
+    AC_DEFINE(SDL_LOADSO_DISABLED)
 fi
 AC_ARG_ENABLE(cpuinfo,
-[  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]],
+AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]]),
               , enable_cpuinfo=yes)
-if test x$enable_cpuinfo = xyes; then
-    SDL_EXTRADIRS="$SDL_EXTRADIRS cpuinfo"
-    SDL_EXTRALIBS="$SDL_EXTRALIBS cpuinfo/libcpuinfo.la"
-else
-    CFLAGS="$CFLAGS -DDISABLE_CPUINFO"
+if test x$enable_cpuinfo != xyes; then
+    AC_DEFINE(SDL_CPUINFO_DISABLED)
+fi
+AC_ARG_ENABLE(assembly-blit,
+AC_HELP_STRING([--enable-asm-blit], [Enable assembly blitters [default=yes]]),
+              , enable_asm_blit=yes)
+if test x$enable_asm_blit = xyes; then
+    AC_DEFINE(SDL_ASSEMBLY_BLITTERS)
 fi
 
 dnl See if the OSS audio interface is supported
 CheckOSS()
 {
     AC_ARG_ENABLE(oss,
-[  --enable-oss            support the OSS audio API [default=yes]],
+AC_HELP_STRING([--enable-oss], [support the OSS audio API [default=yes]]),
                   , enable_oss=yes)
     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
         AC_MSG_CHECKING(for OSS audio support)
@@ -336,16 +279,21 @@
               int arg = SNDCTL_DSP_SETFRAGMENT;
             ],[
             have_oss=yes
-            CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
+            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
             ])
         fi
         AC_MSG_RESULT($have_oss)
         if test x$have_oss = xyes; then
-            CFLAGS="$CFLAGS -DOSS_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
+            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
+            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
+            have_audio=yes
+
+            # OpenBSD needs linking with ossaudio emulation library
+            case "$target" in
+                *-*-openbsd*)
+                    BUILD_LIBS="$BUILD_LIBS -lossaudio";;
+            esac
         fi
     fi
 }
@@ -354,7 +302,7 @@
 CheckALSA()
 {
     AC_ARG_ENABLE(alsa,
-[  --enable-alsa           support the ALSA audio API [default=yes]],
+AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [default=yes]]),
                   , enable_alsa=yes)
     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
@@ -364,6 +312,39 @@
         LIBS="$alsa_save_LIBS"
         if test x$have_alsa = xyes; then
             AC_ARG_ENABLE(alsa-shared,
+AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [default=yes]]),
+                          , enable_alsa_shared=yes)
+            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
+                if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
+                    ALSA_LIBS="-L/lib $ALSA_LIBS"
+                elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
+                    ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
+                elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
+                    ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
+                fi
+            fi
+            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
+            alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
+            echo "-- $alsa_lib_spec -> $alsa_lib"
+
+            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
+            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $ALSA_CFLAGS"
+            if test x$have_loadso != xyes && \
+               test x$enable_alsa_shared = xyes; then
+                AC_MSG_ERROR([You must have SDL_LoadObject() support])
+            fi
+            if test x$have_loadso = xyes && \
+               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
+                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
+            else
+                BUILD_LIBS="$BUILD_LIBS $ALSA_LIBS"
+            fi
+            have_audio=yes
+        fi
+    fi
+        if test x$have_alsa = xyes; then
+            AC_ARG_ENABLE(alsa-shared,
 [  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
                           , enable_alsa_shared=yes)
             if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
@@ -397,10 +378,8 @@
                 CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
                 SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
             fi
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
+            SDL_SRCS="$SDL_SRCS `(cd $srcdir && ls audio/alsa/*.c)`"
         fi
-    fi
 }
 
 dnl Check whether we want to use IRIX 6.5+ native audio or not
@@ -419,10 +398,10 @@
         AC_MSG_RESULT($have_dmedia)
         # Set up files for the audio library
         if test x$have_dmedia = xyes; then
-            CFLAGS="$CFLAGS -DDMEDIA_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
-            SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
+            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
+            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
+            BUILD_LIBS="$BUILD_LIBS -laudio"
+            have_audio=yes
         fi
     fi
 }
@@ -431,13 +410,13 @@
 CheckESD()
 {
     AC_ARG_ENABLE(esd,
-[  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
+AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]]),
                   , enable_esd=yes)
     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
         if test x$have_esd = xyes; then
             AC_ARG_ENABLE(esd-shared,
-[  --enable-esd-shared     dynamically load ESD audio support [default=yes]],
+AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]]),
                           , enable_esd_shared=yes)
             esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
             esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
@@ -448,14 +427,13 @@
             fi
             if test x$have_loadso = xyes && \
                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
-                CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
-                AC_SUBST(esd_lib)
-            else
-                CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
-                SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
+                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
             fi
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
+            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $ESD_CFLAGS"
+            BUILD_LIBS="$BUILD_LIBS $ESD_LIBS"
+            have_audio=yes
         fi
     fi
 }
@@ -463,20 +441,20 @@
 CheckARTSC()
 {
     AC_ARG_ENABLE(arts,
-[  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
+AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]]),
                   , enable_arts=yes)
     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
-        AC_PATH_PROG(ARTSCCONFIG, artsc-config)
-        if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
+        AC_PATH_PROG(ARTSCONFIG, artsc-config)
+        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
             : # arts isn't installed
         else
-            ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
-            ARTSC_LIBS=`$ARTSCCONFIG --libs`
-            ARTSC_PREFIX=`$ARTSCCONFIG --arts-prefix`
+            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
+            ARTS_LIBS=`$ARTSCONFIG --libs`
+            ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
             AC_MSG_CHECKING(for aRts development environment)
             audio_arts=no
             save_CFLAGS="$CFLAGS"
-            CFLAGS="$CFLAGS $ARTSC_CFLAGS"
+            CFLAGS="$CFLAGS $ARTS_CFLAGS"
             AC_TRY_COMPILE([
              #include <artsc.h>
             ],[
@@ -488,9 +466,9 @@
             AC_MSG_RESULT($audio_arts)
             if test x$audio_arts = xyes; then
                 AC_ARG_ENABLE(arts-shared,
-[  --enable-arts-shared    dynamically load aRts audio support [default=yes]],
+AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]]),
                               , enable_arts_shared=yes)
-                arts_lib_spec="$ARTSC_PREFIX/lib/libartsc.so.*"
+                arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
                 arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
                 echo "-- $arts_lib_spec -> $arts_lib"
                 if test x$have_loadso != xyes && \
@@ -499,14 +477,13 @@
                 fi
                 if test x$have_loadso = xyes && \
                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
-                    CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
-                    AC_SUBST(arts_lib)
-                else
-                    CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
-                    SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
+                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
                 fi
-                AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
-                AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
+                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
+                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
+                BUILD_CFLAGS="$BUILD_CFLAGS $ARTS_CFLAGS"
+                BUILD_LIBS="$BUILD_LIBS $ARTS_LIBS"
+                have_audio=yes
             fi
         fi
     fi
@@ -516,29 +493,31 @@
 CheckNAS()
 {
     AC_ARG_ENABLE(nas,
-[  --enable-nas            support the NAS audio API [default=yes]],
+AC_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]]),
                   , enable_nas=yes)
     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
         AC_MSG_CHECKING(for NAS audio support)
         have_nas=no
         if test -r /usr/X11R6/include/audio/audiolib.h; then
             have_nas=yes
-            CFLAGS="$CFLAGS -DNAS_SUPPORT -I/usr/X11R6/include/"
-            SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
+            NAS_CFLAGS="-I/usr/X11R6/include/"
+            NAS_LIBS="-laudio -lXt"
 
         dnl On IRIX, the NAS includes are in a different directory,
         dnl and libnas must be explicitly linked in
 
         elif test -r /usr/freeware/include/nas/audiolib.h; then
             have_nas=yes
-            CFLAGS="$CFLAGS -DNAS_SUPPORT"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lnas -lXt"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
+            NAS_LIBS="-lnas -lXt"
         fi
         AC_MSG_RESULT($have_nas)
+        if test x$have_nas = xyes; then
+            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
+            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $NAS_CFLAGS"
+            BUILD_LIBS="$BUILD_LIBS $NAS_LIBS"
+            have_audio=yes
+        fi
     fi
 }
 
@@ -546,12 +525,11 @@
 CheckDiskAudio()
 {
     AC_ARG_ENABLE(diskaudio,
-[  --enable-diskaudio      support the disk writer audio driver [default=yes]],
+AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [default=yes]]),
                   , enable_diskaudio=yes)
     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
-        CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
-        AUDIO_SUBDIRS="$AUDIO_SUBDIRS disk"
-        AUDIO_DRIVERS="$AUDIO_DRIVERS disk/libaudio_disk.la"
+        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
+        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
     fi
 }
 
@@ -559,22 +537,22 @@
 CheckAtariAudio()
 {
     AC_ARG_ENABLE(mintaudio,
-[  --enable-mintaudio      support Atari audio driver [default=yes]],
+AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [default=yes]]),
                   , enable_mintaudio=yes)
     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
         mintaudio=no
         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
         if test x$have_mint_falcon_hdr = xyes; then
             mintaudio=yes
-            CFLAGS="$CFLAGS -DMINTAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS mint"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS mint/libaudio_mintaudio.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
+            SOURCES="$SOURCES $srcdir/src/audio/ming/*.c"
+            have_audio=yes
         fi
     fi
 }
 
 dnl See if we can use x86 assembly blitters
-# NASM is available from: http://nasm.octium.net/
+# NASM is available from: http://nasm.sourceforge.net
 CheckNASM()
 {
     dnl Make sure we are running on an x86 platform
@@ -588,14 +566,13 @@
     esac
     dnl Check for NASM (for assembly blit routines)
     AC_ARG_ENABLE(nasm,
-[  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
+AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [default=yes]]),
                   , enable_nasm=yes)
-    if test x$enable_video = xyes -a x$enable_nasm = xyes; then
+    if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_nasm = xyes; then
         AC_PATH_PROG(NASM, nasm)
-        if test x$NASM = x -o x$NASM = x'"$NASM"'; then
-            : # nasm isn't installed
-        else
-            CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
+        if test x$NASM != x -a x$NASM != x'"$NASM"'; then
+            AC_DEFINE(SDL_HERMES_BLITTERS)
+            SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
             case $ARCH in
               win32)
                   NASMFLAGS="-f win32"
@@ -607,19 +584,94 @@
                   NASMFLAGS="-f elf"
                   ;;
             esac
+            AC_SUBST(NASM)
             AC_SUBST(NASMFLAGS)
-            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
-            SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
-            SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
-            use_nasm=yes
-            
+
             case "$target" in
                 # this line is needed for QNX, because it's not defined the __ELF__
-                *-*-qnx*) CFLAGS="$CFLAGS -D__ELF__"
-                          ;;
+                *-*-qnx*)
+                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
+                *-*-solaris*)
+                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
+            esac
+        fi
+    fi
+}
+
+dnl Check for altivec instruction support using gas syntax
+CheckAltivec()
+{
+    AC_ARG_ENABLE(altivec,
+AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [default=yes]]),
+                  , enable_altivec=yes)
+    if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_altivec = xyes; then
+        have_altivec_h_hdr=no
+        AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
+
+        save_CFLAGS="$CFLAGS"
+        have_gcc_altivec=no
+        AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
+        altivec_CFLAGS="-maltivec"
+        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
 
-            esac
+        if test x$have_altivec_h_hdr = xyes; then
+          AC_TRY_COMPILE([
+          #include <altivec.h>
+          vector unsigned int vzero() {
+              return vec_splat_u32(0);
+          }
+          ],[
+          ],[
+          have_gcc_altivec=yes
+          ])
+          AC_MSG_RESULT($have_gcc_altivec)
+        else
+          AC_TRY_COMPILE([
+          vector unsigned int vzero() {
+              return vec_splat_u32(0);
+          }
+          ],[
+          ],[
+          have_gcc_altivec=yes
+          ])
+          AC_MSG_RESULT($have_gcc_altivec)
+        fi
 
+        if test x$have_gcc_altivec = xno; then
+            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
+            altivec_CFLAGS="-faltivec"
+            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
+            if test x$have_altivec_h_hdr = xyes; then
+              AC_TRY_COMPILE([
+              #include <altivec.h>
+              vector unsigned int vzero() {
+                  return vec_splat_u32(0);
+              }
+              ],[
+              ],[
+              have_gcc_altivec=yes
+              ])
+              AC_MSG_RESULT($have_gcc_altivec)
+            else
+              AC_TRY_COMPILE([
+              vector unsigned int vzero() {
+                  return vec_splat_u32(0);
+              }
+              ],[
+              ],[
+              have_gcc_altivec=yes
+              ])
+              AC_MSG_RESULT($have_gcc_altivec)
+            fi
+        fi
+        CFLAGS="$save_CFLAGS"
+
+        if test x$have_gcc_altivec = xyes; then
+            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
+            if test x$have_altivec_h_hdr = xyes; then
+              AC_DEFINE(HAVE_ALTIVEC_H)
+            fi
+            BUILD_CFLAGS="$BUILD_CFLAGS $altivec_CFLAGS"
         fi
     fi
 }
@@ -628,49 +680,49 @@
 CheckIPod()
 {
     AC_ARG_ENABLE(ipod,
-[  --enable-ipod          configure SDL to work with iPodLinux [default=yes on arm-elf]],
-	, enable_ipod=yes)
+AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]),
+        , enable_ipod=yes)
 
     if test x$enable_ipod = xyes; then
-	CFLAGS="$CFLAGS -DENABLE_IPOD -DIPOD"
-	VIDEO_SUBDIRS="$VIDEO_SUBDIRS ipod"
-	VIDEO_DRIVERS="$VIDEO_DRIVERS ipod/libvideo_ipod.la"
+        BUILD_CFLAGS="$BUILD_CFLAGS -DIPOD"
+        AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
+        SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
     fi
-}	
+}
 
 dnl Find the nanox include and library directories
 CheckNANOX()
 {
     AC_ARG_ENABLE(video-nanox,
-        [  --enable-video-nanox use nanox video driver [default=no]],
+        AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [default=no]]),
         , enable_video_nanox=no)
-    AC_ARG_ENABLE(nanox-debug,  
-        [  --enable-nanox-debug print debug messages [default=no]],
-        , enable_nanox_debug=no)
-    AC_ARG_ENABLE(nanox-share-memory,  
-        [  --enable-nanox-share-memory use share memory [default=no]],
-        , enable_nanox_share_memory=no)
-    AC_ARG_ENABLE(nanox_direct_fb, 
-        [  --enable-nanox-direct-fb use direct framebuffer access [default=no]],
-        , enable_nanox_direct_fb=no)
 
     if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
+        AC_ARG_ENABLE(nanox-debug,  
+            AC_HELP_STRING([--enable-nanox-debug], [print debug messages [default=no]]),
+            , enable_nanox_debug=no)
         if test x$enable_nanox_debug = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
-        fi
-
-        if test x$enable_nanox_share_memory = xyes; then
-            CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
+            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DEBUG"
         fi
 
-        if test x$enable_nanox_direct_fb = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_NANOX_DIRECT_FB"
+        AC_ARG_ENABLE(nanox-share-memory,  
+            AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [default=no]]),
+            , enable_nanox_share_memory=no)
+        if test x$enable_nanox_share_memory = xyes; then
+            BUILD_CFLAGS="$BUILD_CFLAGS -DNANOX_SHARE_MEMORY"
         fi
 
-        CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
-        SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
-        VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
-        VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
+        AC_ARG_ENABLE(nanox_direct_fb, 
+            AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [default=no]]),
+            , enable_nanox_direct_fb=no)
+        if test x$enable_nanox_direct_fb = xyes; then
+            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DIRECT_FB"
+        fi
+
+        AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
+        SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
+        BUILD_LIBS="$BUILD_LIBS -lnano-X"
+        have_video=yes
     fi
 }
 
@@ -678,17 +730,16 @@
 CheckX11()
 {
     AC_ARG_ENABLE(video-x11,
-[  --enable-video-x11      use X11 video driver [default=yes]],
+AC_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]]),
                   , enable_video_x11=yes)
     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
         AC_PATH_X
         AC_PATH_XTRA
         if test x$have_x = xyes; then
             AC_ARG_ENABLE(x11-shared,
-[  --enable-x11-shared     dynamically load X11 support [default=yes]],
+AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
                           , enable_x11_shared=yes)
 
-            dnl !!! FIXME: if a platform needs more than this, fill it in!
             case "$target" in
                 *-*-darwin* )
                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
@@ -704,6 +755,10 @@
                     ;;
             esac
 
+            X_CFLAGS="$X_CFLAGS -DXTHREADS"
+            if test x$ac_cv_func_shmat != xyes; then
+                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
+            fi
             if test x$have_loadso != xyes && \
                test x$enable_x11_shared = xyes; then
                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
@@ -711,85 +766,77 @@
 
             if test x$have_loadso = xyes && \
                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
-                CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -DX11_DYNAMIC=\$(x11_lib) -DX11EXT_DYNAMIC=\$(x11ext_lib) -I$srcdir/include -I$srcdir/src/video"
-                SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS"
                 echo "-- dynamic libX11 -> $x11_lib"
                 echo "-- dynamic libX11ext -> $x11ext_lib"
-                AC_SUBST(x11_lib)
-                AC_SUBST(x11ext_lib)
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
             else
-                CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
-                SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
-            fi
-
-            if test x$ac_cv_func_shmat != xyes; then
-                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
+                X_LIBS="$X_LIBS -lX11 -lXext"
             fi
 
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
+
+            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
+            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS"
+            BUILD_LIBS="$BUILD_LIBS $X_LIBS"
+            have_video=yes
 
             AC_ARG_ENABLE(dga,
-[  --enable-dga            allow use of X11 DGA code [default=yes]],
+AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [default=yes]]),
                           , enable_dga=yes)
             if test x$enable_dga = xyes; then
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS Xext/Xxf86dga"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS Xext/Xxf86dga/libXext_Xxf86dga.la"
+                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
             fi
             AC_ARG_ENABLE(video-dga,
-[  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
+AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [default=yes]]),
                   , enable_video_dga=yes)
             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
-                CFLAGS="$CFLAGS -DENABLE_DGA"
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
+                AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
+                SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
             fi
             AC_ARG_ENABLE(video-x11-dgamouse,
-[  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
+AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [default=yes]]),
                           , enable_video_x11_dgamouse=yes)
             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
-                CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE -DDEFAULT_DGAMOUSE"
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
             fi
             AC_ARG_ENABLE(video-x11-vm,
-[  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
+AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]]),
                           , enable_video_x11_vm=yes)
             if test x$enable_video_x11_vm = xyes; then
-                CFLAGS="$CFLAGS -DXFREE86_VM -DXFREE86_VMGAMMA"
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS Xext/Xxf86vm"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS Xext/Xxf86vm/libXext_Xxf86vm.la"
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
+                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
             fi
             AC_ARG_ENABLE(video-x11-xv,
-[  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
+AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [default=yes]]),
                           , enable_video_x11_xv=yes)
             if test x$enable_video_x11_xv = xyes; then
-                CFLAGS="$CFLAGS -DXFREE86_XV"
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS Xext/Xv"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS Xext/Xv/libXext_Xv.la"
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
+                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
             fi
             AC_ARG_ENABLE(video-x11-xinerama,
-[  --enable-video-x11-xinerama   enable X11 Xinerama support [default=yes]],
+AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]]),
                             , enable_video_x11_xinerama=yes)
             if test x$enable_video_x11_xinerama = xyes; then
-                CFLAGS="$CFLAGS -DHAVE_XINERAMA"
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS Xext/Xinerama"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS Xext/Xinerama/libXext_Xinerama.la"
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
+                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
             fi
             AC_ARG_ENABLE(video-x11-xme,
-[  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen [default=yes]],
+AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [default=yes]]),
                             , enable_video_x11_xme=yes)
             if test x$enable_video_x11_xme = xyes; then
-                CFLAGS="$CFLAGS -DHAVE_XIGXME"
-                VIDEO_SUBDIRS="$VIDEO_SUBDIRS Xext/XME"
-                VIDEO_DRIVERS="$VIDEO_DRIVERS Xext/XME/libXME.la"
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
+                SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
             fi
         fi
     fi
 }
 
+dnl Check for QNX photon video driver
 CheckPHOTON()
 {
     AC_ARG_ENABLE(video-photon,
-[  --enable-video-photon   use QNX Photon video driver [default=yes]],
+AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [default=yes]]),
                   , enable_video_photon=yes)
     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
         AC_MSG_CHECKING(for QNX Photon support)
@@ -806,20 +853,84 @@
         ])
         AC_MSG_RESULT($video_photon)
         if test x$video_photon = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_PHOTON"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lph"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
+            SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lph"
+            have_video=yes
+
             CheckOpenGLQNX
         fi
     fi
 }
 
+dnl Set up the BWindow video driver if enabled
+CheckBWINDOW()
+{
+    if test x$enable_video = xyes; then
+        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
+        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
+        have_video=yes
+    fi
+}
+
+dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
+CheckCARBON()
+{
+    AC_ARG_ENABLE(video-carbon,
+AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [default=no]]),
+                  , enable_video_carbon=no)
+    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
+        AC_MSG_CHECKING(for Carbon framework)
+        have_carbon=no
+        AC_TRY_COMPILE([
+          #include <Carbon/Carbon.h>
+        ],[
+        ],[
+        have_carbon=yes
+        ])
+        AC_MSG_RESULT($have_carbon)
+        if test x$have_carbon = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
+            SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
+            SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
+            have_video=yes
+        fi
+    fi
+}
+
+dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
+CheckCOCOA()
+{
+    AC_ARG_ENABLE(video-cocoa,
+AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [default=yes]]),
+                  , enable_video_cocoa=yes)
+    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
+        save_CFLAGS="$CFLAGS"
+        dnl work around that we don't have Objective-C support in autoconf
+        CFLAGS="$CFLAGS -x objective-c"
+        AC_MSG_CHECKING(for Cocoa framework)
+        have_cocoa=no
+        AC_TRY_COMPILE([
+          #import <Cocoa/Cocoa.h>
+        ],[
+        ],[
+        have_cocoa=yes
+        ])
+        AC_MSG_RESULT($have_cocoa)
+        CFLAGS="$save_CFLAGS"
+        if test x$have_cocoa = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
+            SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
+            have_video=yes
+        fi
+    fi
+}
+
 dnl Find the framebuffer console includes
 CheckFBCON()
 {
     AC_ARG_ENABLE(video-fbcon,
-[  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
+AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [default=yes]]),
                   , enable_video_fbcon=yes)
     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
         AC_MSG_CHECKING(for framebuffer console support)
@@ -834,9 +945,9 @@
         ])
         AC_MSG_RESULT($video_fbcon)
         if test x$video_fbcon = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_FBCON"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
+            SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
+            have_video=yes
         fi
     fi
 }
@@ -845,7 +956,7 @@
 CheckDirectFB()
 {
     AC_ARG_ENABLE(video-directfb,
-[  --enable-video-directfb use DirectFB video driver [default=no]],
+AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
                   , enable_video_directfb=no)
     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
         video_directfb=no
@@ -871,12 +982,11 @@
 
         AC_MSG_RESULT($video_directfb)
         if test x$video_directfb = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_DIRECTFB"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS directfb"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS directfb/libvideo_directfb.la"
-
-            AC_SUBST(DIRECTFB_CFLAGS)
-            AC_SUBST(DIRECTFB_LIBS)
+            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
+            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $DIRECTFB_CFLAGS"
+            BUILD_LIBS="$BUILD_LIBS $DIRECTFB_LIBS"
+            have_video=yes
         fi
     fi
 }
@@ -885,7 +995,7 @@
 CheckPS2GS()
 {
     AC_ARG_ENABLE(video-ps2gs,
-[  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]],
+AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [default=yes]]),
                   , enable_video_ps2gs=yes)
     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
         AC_MSG_CHECKING(for PlayStation 2 GS support)
@@ -899,9 +1009,9 @@
         ])
         AC_MSG_RESULT($video_ps2gs)
         if test x$video_ps2gs = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_PS2GS"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ps2gs"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS ps2gs/libvideo_ps2gs.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
+            SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
+            have_video=yes
         fi
     fi
 }
@@ -910,7 +1020,7 @@
 CheckGGI()
 {
     AC_ARG_ENABLE(video-ggi,
-[  --enable-video-ggi      use GGI video driver [default=no]],
+AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [default=no]]),
                   , enable_video_ggi=no)
     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
         AC_MSG_CHECKING(for GGI support)
@@ -924,11 +1034,10 @@
         ])
         AC_MSG_RESULT($video_ggi)
         if test x$video_ggi = xyes; then
-            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"
-
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
+            SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lggi -lgii -lgg"
+            have_video=yes
         fi
     fi
 }
@@ -937,7 +1046,7 @@
 CheckSVGA()
 {
     AC_ARG_ENABLE(video-svga,
-[  --enable-video-svga     use SVGAlib video driver [default=no]],
+AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
                   , enable_video_svga=no)
     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
@@ -955,11 +1064,10 @@
         ])
         AC_MSG_RESULT($video_svga)
         if test x$video_svga = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_SVGALIB"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lvga"
-
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
+            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lvga"
+            have_video=yes
         fi
     fi
 }
@@ -968,7 +1076,7 @@
 CheckVGL()
 {
     AC_ARG_ENABLE(video-vgl,
-[  --enable-video-vgl      use VGL video driver [default=no]],
+AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
                   , enable_video_vgl=no)
     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
         AC_MSG_CHECKING(for libVGL support)
@@ -986,20 +1094,45 @@
         ])
         AC_MSG_RESULT($video_vgl)
         if test x$video_vgl = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_VGL"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"
-
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
+            SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lvgl"
+            have_video=yes
         fi
     fi
 }
 
+dnl Set up the wscons video driver if enabled
+CheckWscons()
+{
+    AC_ARG_ENABLE(video-wscons,
+AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [default=yes]]),
+                  , enable_video_wscons=yes)
+    if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
+        AC_MSG_CHECKING(for wscons support)
+        video_wscons=no
+        AC_TRY_COMPILE([
+       #include <sys/time.h>
+       #include <dev/wscons/wsconsio.h>
+        ],[
+        ],[
+        video_wscons=yes
+        ])
+        AC_MSG_RESULT($video_wscons)
+        if test x$video_wscons = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
+            SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
+            have_video=yes
+        fi
+    fi
+}
+
+
 dnl Find the AAlib includes
 CheckAAlib()
 {
     AC_ARG_ENABLE(video-aalib,
-[  --enable-video-aalib    use AAlib video driver [default=no]],
+AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [default=no]]),
                   , enable_video_aalib=no)
     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
         AC_MSG_CHECKING(for AAlib support)
@@ -1012,27 +1145,90 @@
         ])
         AC_MSG_RESULT($video_aalib)
         if test x$video_aalib = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_AALIB"
-            SYSTEM_LIBS="$SYSTEM_LIBS -laa"
-
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
+            SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
+            BUILD_LIBS="$BUILD_LIBS -laa"
+            have_video=yes
         fi
     fi
 }
 
+dnl Set up the QTopia video driver if enabled
+CheckQtopia()
+{
+    AC_ARG_ENABLE(video-qtopia,
+AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [default=no]]),
+                  , enable_video_qtopia=no)
+    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
+        AC_MSG_CHECKING(for Qtopia support)
+        video_qtopia=no
+        QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
+        AC_LANG_CPLUSPLUS
+        OLD_CXX="$CXXFLAGS"
+        CXXFLAGS="$QTOPIA_FLAGS"
+        AC_TRY_COMPILE([
+         #include <qpe/qpeapplication.h>
+        ],[
+        ],[
+        video_qtopia=yes
+        ])
+        CXXFLAGS="$OLD_CXX"
+        AC_MSG_RESULT($video_qtopia)
+        if test x$video_qtopia = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
+            SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
+            BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
+            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
+            SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
+            have_video=yes
+        fi
+        AC_LANG_C
+    fi
+}
+
+dnl Set up the PicoGUI video driver if enabled
+CheckPicoGUI()
+{
+    AC_ARG_ENABLE(video-picogui,
+AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [default=no]]),
+                  , enable_video_picogui=no)
+    if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
+        AC_MSG_CHECKING(for PicoGUI support)
+        video_picogui=no
+        AC_TRY_COMPILE([
+         #include <picogui.h>
+        ],[
+        ],[
+        video_picogui=yes
+        ])
+        AC_MSG_RESULT($video_picogui)
+        if test x$video_picogui = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
+            SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
+            SDL_LIBS="$SDL_LIBS -lpgui"
+            have_video=yes
+        fi
+    fi
+}
+
+dnl Set up the Atari Bios keyboard driver
+CheckAtariBiosEvent()
+{
+    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
+}
+
 dnl Set up the Atari Xbios driver
 CheckAtariXbiosVideo()
 {
     AC_ARG_ENABLE(xbios,
-[  --enable-video-xbios    use Atari Xbios video driver [default=yes]],
+AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [default=yes]]),
                   , enable_video_xbios=yes)
     video_xbios=no
     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
         video_xbios=yes
-        CFLAGS="$CFLAGS -DENABLE_XBIOS"
-        VIDEO_SUBDIRS="$VIDEO_SUBDIRS xbios"
-        VIDEO_DRIVERS="$VIDEO_DRIVERS xbios/libvideo_xbios.la"
+        AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
+        SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
+        have_video=yes
     fi
 }
 
@@ -1040,46 +1236,37 @@
 CheckAtariGemVideo()
 {
     AC_ARG_ENABLE(gem,
-[  --enable-video-gem      use Atari Gem video driver [default=yes]],
+AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [default=yes]]),
                   , enable_video_gem=yes)
     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
         video_gem=no
         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
-            video_gem=yes
-            CFLAGS="$CFLAGS -DENABLE_GEM"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lgem"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS gem"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS gem/libvideo_gem.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
+            SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lgem"
+            have_video=yes
         fi
     fi
 }
 
-dnl Set up the Atari Bios keyboard driver
-CheckAtariBiosEvent()
-{
-    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/ataricommon"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS ataricommon"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS ataricommon/libvideo_ataricommon.la"
-}
-
 dnl rcg04172001 Set up the Null video driver.
 CheckDummyVideo()
 {
     AC_ARG_ENABLE(video-dummy,
-[  --enable-video-dummy    use dummy video driver [default=yes]],
+AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]]),
                   , enable_video_dummy=yes)
     if test x$enable_video_dummy = xyes; then
-      CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
-      VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
-      VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
+        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
+        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
+        have_video=yes
     fi
 }
 
 dnl Check to see if OpenGL support is desired
 AC_ARG_ENABLE(video-opengl,
-[  --enable-video-opengl   include OpenGL context creation [default=yes]],
+AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [default=yes]]),
               , enable_video_opengl=yes)
 
 dnl Find OpenGL
@@ -1091,17 +1278,14 @@
         AC_TRY_COMPILE([
          #include <GL/gl.h>
          #include <GL/glx.h>
-         #include <dlfcn.h> /* For loading extensions */
         ],[
         ],[
         video_opengl=yes
         ])
         AC_MSG_RESULT($video_opengl)
         if test x$video_opengl = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_OPENGL -DHAVE_OPENGL_X11"
-            if test x$have_loadso != xyes; then
-                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
-            fi
+            AC_DEFINE(SDL_VIDEO_OPENGL)
+            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
         fi
     fi
 }
@@ -1120,21 +1304,27 @@
         ])
         AC_MSG_RESULT($video_opengl)
         if test x$video_opengl = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_OPENGL"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
-            if test x$have_loadso != xyes; then
-                AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS", AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl"))
-            fi
+            AC_DEFINE(SDL_VIDEO_OPENGL)
+            BUILD_LIBS="$BUILD_LIBS -lGL"
         fi
     fi
 }
 
+dnl Check for Win32 OpenGL
+CheckWIN32GL()
+{
+    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
+        AC_DEFINE(SDL_VIDEO_OPENGL)
+        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
+    fi
+}
+
 dnl Check for BeOS OpenGL
 CheckBeGL()
 {
     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        CFLAGS="$CFLAGS -DHAVE_OPENGL"
-        SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
+        AC_DEFINE(SDL_VIDEO_OPENGL)
+        BUILD_LIBS="$BUILD_LIBS -lGL"
     fi
 }
 
@@ -1142,12 +1332,12 @@
 CheckMacGL()
 {
     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        CFLAGS="$CFLAGS -DHAVE_OPENGL"
+        AC_DEFINE(SDL_VIDEO_OPENGL)
         case "$target" in
             *-*-darwin*)
-                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL"
+                BUILD_LIBS="$BUILD_LIBS -framework OpenGL"
                 # The following is probably not available in Darwin:
-                SYSTEM_LIBS="$SYSTEM_LIBS -framework AGL"
+                BUILD_LIBS="$BUILD_LIBS -framework AGL"
         esac
     fi
 }
@@ -1164,26 +1354,27 @@
         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
             # -lOSMesa is really the static library
             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
-    	        CFLAGS="$CFLAGS -DHAVE_OPENGL"
-		    	SYSTEM_LIBS="$SYSTEM_LIBS -lOSMesa"
+                OSMESA_LIBS="-lOSMesa"
             fi
         else
             # -lOSMesa is a loader for OSMesa.ldg
             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
-            CFLAGS="$CFLAGS -DHAVE_OPENGL $OSMESA_CFLAGS"
-            SYSTEM_LIBS="$SYSTEM_LIBS $OSMESA_LIBS"
         fi
+        AC_DEFINE(SDL_VIDEO_OPENGL)
+        AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
+        BUILD_CFLAGS="$BUILD_CFLAGS $OSMESA_CFLAGS"
+        BUILD_LIBS="$BUILD_LIBS $OSMESA_LIBS"
 
         AC_ARG_ENABLE(osmesa-shared,
-[  --enable-osmesa-shared  dynamically load OSMesa OpenGL support [default=yes]],
+AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
                               , enable_osmesa_shared=yes)
         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
             # Dynamic linking
             if test "x$have_osmesa_hdr" = "xyes"; then
-                CFLAGS="$CFLAGS -DENABLE_OSMESA_SHARED"
+                AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
             fi
-		fi
+        fi
     fi
 }
 
@@ -1192,7 +1383,7 @@
 {
     dnl Check for Linux 2.4 unified input event interface support
     AC_ARG_ENABLE(input-events,
-[  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
+AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
                   , enable_input_events=yes)
     if test x$enable_input_events = xyes; then
         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
@@ -1208,7 +1399,7 @@
         ])
         AC_MSG_RESULT($use_input_events)
         if test x$use_input_events = xyes; then
-            CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
+            AC_DEFINE(SDL_INPUT_LINUXEV)
         fi
     fi
 }
@@ -1217,7 +1408,7 @@
 CheckTslib()
 {
     AC_ARG_ENABLE(input-tslib,
-[  --enable-input-tslib    use the Touchscreen library for input [default=yes]],
+AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
                   , enable_input_tslib=yes)
     if test x$enable_input_tslib = xyes; then
         AC_MSG_CHECKING(for Touchscreen library support)
@@ -1230,8 +1421,8 @@
         ])
         AC_MSG_RESULT($enable_input_tslib)
         if test x$enable_input_tslib = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_TSLIB"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lts"
+            AC_DEFINE(SDL_INPUT_TSLIB)
+            BUILD_LIBS="$BUILD_LIBS -lts"
         fi
     fi
 }
@@ -1241,25 +1432,24 @@
 {
     dnl Check for pth support
     AC_ARG_ENABLE(pth,
-[  --enable-pth            use GNU pth library for multi-threading [default=yes]],
+AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
                   , enable_pth=yes)
     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
         if test "$PTH_CONFIG" = "no"; then
             use_pth=no
         else
-            PTH_CFLAGS=`$PTH_CONFIG --cflags`
-            PTH_LIBS=`$PTH_CONFIG --libs --all`
-            SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
-            SDL_LIBS="$SDL_LIBS $PTH_LIBS"
-            CFLAGS="$CFLAGS -DENABLE_PTH"
             use_pth=yes
         fi
         AC_MSG_CHECKING(pth)
+        AC_MSG_RESULT($use_pth)
         if test "x$use_pth" = xyes; then
-            AC_MSG_RESULT(yes)
-        else
-            AC_MSG_RESULT(no)
+            AC_DEFINE(SDL_THREAD_PTH)
+            SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
+            SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
+            SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
+            have_threads=yes
         fi
     fi
 }
@@ -1269,15 +1459,15 @@
 {
     dnl Check for pthread support
     AC_ARG_ENABLE(pthreads,
-[  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
+AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
                   , enable_pthreads=yes)
     dnl This is used on Linux for glibc binary compatibility (Doh!)
     AC_ARG_ENABLE(pthread-sem,
-[  --enable-pthread-sem    use pthread semaphores [default=yes]],
+AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
                   , enable_pthread_sem=yes)
     case "$target" in
         *-*-linux*)
-            pthread_cflags="-D_REENTRANT -D_GNU_SOURCE"
+            pthread_cflags="-D_REENTRANT"
             pthread_lib="-lpthread"
             ;;
         *-*-bsdi*)
@@ -1294,7 +1484,7 @@
             pthread_lib="-pthread"
             ;;
         *-*-netbsd*)
-            pthread_cflags="-I/usr/include -D_REENTRANT -D_THREAD_SAFE"
+            pthread_cflags="-I/usr/include -D_REENTRANT -D_THREAD_SAFE -D_POSIX_THREAD_SYSCALL_SOFT=1"
             pthread_lib="-L/usr/lib -lpthread"
             ;;
         *-*-openbsd*)
@@ -1357,10 +1547,12 @@
         AC_MSG_RESULT($use_pthreads)
         # Restore the compiler flags and libraries
         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
+
         # Do futher testing if we have pthread support...
         if test x$use_pthreads = xyes; then
-            CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
-            LIBS="$LIBS $pthread_lib"
+            AC_DEFINE(SDL_THREAD_PTHREAD)
+            BUILD_CFLAGS="$BUILD_CFLAGS $pthread_cflags"
+            BUILD_LIBS="$BUILD_LIBS $pthread_lib"
             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
             SDL_LIBS="$SDL_LIBS $pthread_lib"
 
@@ -1375,7 +1567,7 @@
                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
                 ],[
                 has_recursive_mutexes=yes
-                CFLAGS="$CFLAGS -DPTHREAD_RECURSIVE_MUTEX"
+                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
                 ])
             fi
             if test x$has_recursive_mutexes = xno; then
@@ -1386,13 +1578,10 @@
                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
                 ],[
                 has_recursive_mutexes=yes
-                CFLAGS="$CFLAGS -DPTHREAD_RECURSIVE_MUTEX_NP"
+                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
                 ])
             fi
             AC_MSG_RESULT($has_recursive_mutexes)
-            if test x$has_recursive_mutexes = xno; then
-                CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
-            fi
 
             # Check to see if pthread semaphore support is missing
             if test x$enable_pthread_sem = xyes; then
@@ -1408,139 +1597,28 @@
                 AC_MSG_RESULT($have_pthread_sem)
             fi
 
-            # Check to see if this is broken glibc 2.0 pthreads
-            case "$target" in
-                *-*-linux*)
-                    AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
-                    glibc20_pthreads=no
-                    AC_TRY_COMPILE([
-                      #include <features.h>
-                      #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
-                      #warning Working around a bug in glibc 2.0 pthreads
-                      #else
-                      #error pthread implementation okay
-                      #endif /* glibc 2.0 */
-                    ],[
-                    ],[
-                    glibc20_pthreads=yes
-                    ])
-                    AC_MSG_RESULT($glibc20_pthreads)
-            esac
-        fi
-    fi
+            # Basic thread creation functions
+            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
 
-    AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
-    have_semun=no
-    AC_TRY_COMPILE([
-      #include <sys/types.h>
-      #include <sys/sem.h>
-    ],[
-      union semun t;
-    ],[
-    have_semun=yes
-    ])
-    AC_MSG_RESULT($have_semun)
-    if test x$have_semun = xyes; then
-        CFLAGS="$CFLAGS -DHAVE_SEMUN"
-    fi
-
-    # See if we can use GNU Pth or clone() on Linux directly
-    if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
-        CheckPTH
-        if test x$use_pth != xyes; then
-            case "$target" in
-                *-*-linux*)
-                    use_clone=yes
-                    ;;
-            esac
-        fi
-    fi
-}
-
-# Note that we need to have either semaphores or to have mutexes and
-# condition variables to implement all thread synchronization primitives
-CopyUnixThreadSource()
-{
-    if test x$use_pthreads = xyes -o x$use_clone = xyes; then
-        # Basic thread creation functions
-        COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
-        COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
-
-        # Semaphores
-        # We can fake these with mutexes and condition variables if necessary
-        if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
-            COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
-        else
-            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
-        fi
-        COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
+            # Semaphores
+            # We can fake these with mutexes and condition variables if necessary
+            if test x$have_pthread_sem = xyes; then
+                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
+            else
+                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
+            fi
 
-        # Mutexes
-        # We can fake these with semaphores if necessary
-        case "$target" in
-            *-*-bsdi*)
-                COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
-                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
-                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
-                ;;
-            *)
-                if test x$glibc20_pthreads = xyes; then
-                    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
-                    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
-                else
-                    COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
-                    COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
-                fi
-                ;;
-        esac
-
-        # Condition variables
-        # We can fake these with semaphores and mutexes if necessary
-        if test x$glibc20_pthreads = xyes -o x$has_recursive_mutexes != xyes; then
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-        else
-            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
-        fi
-        COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
+            # Mutexes
+            # We can fake these with semaphores if necessary
+            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
 
-    elif test x$use_pth = xyes; then
-        COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
-        COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
-        COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
-        COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
-        COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
-        COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
-        COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
-        COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-    else
-       AC_MSG_ERROR([
-*** No thread support detected
-       ])
-    fi
-}
+            # Condition variables
+            # We can fake these with semaphores and mutexes if necessary
+            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
 
-dnl See if we can use sigaction() instead of signal()
-CheckSIGACTION()
-{
-    dnl Check for sigaction support
-    AC_ARG_ENABLE(sigaction,
-[  --enable-sigaction      use sigaction instead of signal [default=yes]],
-                  , enable_sigaction=yes)
-    if test x$enable_sigaction = xyes; then
-        AC_MSG_CHECKING(sigaction)
-        have_sigaction=no
-        AC_TRY_COMPILE([
-         #include <signal.h>
-        ],[
-         struct sigaction junk;
-         sigaction(0, &junk, &junk);
-        ],[
-        have_sigaction=yes
-        ])
-        AC_MSG_RESULT($have_sigaction)
-        if test x$have_sigaction = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_SIGACTION"
+            have_threads=yes
+        else
+            CheckPTH
         fi
     fi
 }
@@ -1565,10 +1643,17 @@
 
     dnl See if the user wants to redirect standard output to files
     AC_ARG_ENABLE(stdio-redirect,
-[  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
+AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
                   , enable_stdio_redirect=yes)
     if test x$enable_stdio_redirect != xyes; then
-        CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
+        BUILD_CFLAGS="$BUILD_CFLAGS -DNO_STDIO_REDIRECT"
+    fi
+
+    if test x$enable_video = xyes; then
+        AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
+        SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
+        SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
+        have_video=yes
     fi
 }
 
@@ -1576,249 +1661,52 @@
 CheckDIRECTX()
 {
     AC_ARG_ENABLE(directx,
-[  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
+AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
                   , enable_directx=yes)
     if test x$enable_directx = xyes; then
-        AC_MSG_CHECKING(for DirectX headers and libraries)
-        use_directx=no
-        tmp_cflags=$CFLAGS
-        CFLAGS="$CFLAGS -I$srcdir"
-        AC_TRY_COMPILE([
-         #include "src/video/windx5/directx.h"
-        ],[
-        ],[
-        use_directx=yes
-        ])
-        CFLAGS=$tmp_cflags
-        AC_MSG_RESULT($use_directx)
-    fi
-
-    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
-    SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
-    # Enable the DIB driver
-    CFLAGS="$CFLAGS -DENABLE_WINDIB"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
-    # See if we should enable the DirectX driver
-    if test x$use_directx = xyes; then
-        CFLAGS="$CFLAGS -DENABLE_DIRECTX"
-        SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
-        VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
-        VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
-    fi
-}
-
-dnl Set up the BWindow video driver on BeOS
-CheckBWINDOW()
-{
-    CFLAGS="$CFLAGS -DENABLE_BWINDOW"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
-}
-
-dnl Set up the QTopia video driver if enabled
-CheckQtopia()
-{
-    AC_ARG_ENABLE(video-qtopia,
-[  --enable-video-qtopia   use Qtopia video driver [default=no]],
-                  , enable_video_qtopia=no)
-    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
-        AC_MSG_CHECKING(for Qtopia support)
-        video_qtopia=no
-        AC_LANG_CPLUSPLUS
-        OLD_CXX="$CXXFLAGS"
-        CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
-        AC_TRY_COMPILE([
-         #include <qpe/qpeapplication.h>
-        ],[
-        ],[
-        video_qtopia=yes
-        ])
-        CXXFLAGS="$OLD_CXX"
-        AC_MSG_RESULT($video_qtopia)
-        if test x$video_qtopia = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
-            SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
-            SDL_CFLAGS="$SDL_CFLAGS -DQWS"	  
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
-        else
-	AC_MSG_ERROR([
-*** Failed to find Qtopia includes. Make sure that the QTDIR and QPEDIR
-*** environment variables are set correctly.])
+        have_directx=no
+        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
+        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
+        AC_CHECK_HEADER(dinput.h, use_dinput=yes)
+        if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
+            have_directx=yes
         fi
-        AC_LANG_C
-    fi
-}
-
-dnl Set up the wscons video driver if enabled
-CheckWscons()
-{
-    AC_ARG_ENABLE(video-wscons,
-[  --enable-video-wscons   use wscons video driver [default=no]],
-                  , enable_video_wscons=no)
-    if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
-        AC_MSG_CHECKING(for wscons support)
-        video_wscons=no
-        AC_LANG_C
-        AC_TRY_COMPILE([
-       #include <sys/time.h>
-       #include <dev/wscons/wsconsio.h>
-        ],[
-        ],[
-        video_wscons=yes
-        ])
-        AC_MSG_RESULT($video_wscons)
-        if test x$video_wscons = xyes; then
-            CFLAGS="$CFLAGS -DENABLE_WSCONS"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS wscons"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS wscons/libvideo_wscons.la"
-        else
-      AC_MSG_ERROR([
-*** Failed to find wscons includes.])
+        if test x$enable_video = xyes -a x$have_directx = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
+            SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
+            have_video=yes
         fi
-      AC_LANG_C
     fi
 }
 
-
-dnl Set up the PicoGUI video driver if enabled
-CheckPicoGUI()
-{
-    AC_ARG_ENABLE(video-picogui,
-[  --enable-video-picogui  use PicoGUI video driver [default=no]],
-                  , enable_video_picogui=no)
-    if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
-        AC_MSG_CHECKING(for PicoGUI support)
-        video_picogui=no
-        AC_TRY_COMPILE([
-         #include <picogui.h>
-        ],[
-        ],[
-        video_picogui=yes
-        ])
-        AC_MSG_RESULT($video_picogui)
-        if test x$video_picogui = xyes; then
-	    SDL_LIBS="$SDL_LIBS -lpgui"
-            CFLAGS="$CFLAGS -DENABLE_PICOGUI"
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
-        fi
-        AC_LANG_C
-    fi
-}
-
-dnl Set up the Mac toolbox video driver for Mac OS 7-9
-CheckTOOLBOX()
-{
-    CFLAGS="$CFLAGS -DENABLE_TOOLBOX -DENABLE_DRAWSPROCKET"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
-}
-
-dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
-CheckCARBON()
-{
-    AC_ARG_ENABLE(video-carbon,
-[  --enable-video-carbon   use Carbon/QuickDraw video driver [default=no]],
-                  , enable_video_carbon=no)
-  if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
-    AC_MSG_CHECKING(for Carbon framework)
-    have_carbon=no
-    if test x$have_carbon != xyes; then
-        AC_TRY_COMPILE([
-          #include <Carbon/Carbon.h>
-        ],[
-        ],[
-        have_carbon=yes
-        ])
-    fi
-    AC_MSG_RESULT($have_carbon)
-    if test x$have_carbon = xyes; then
-    # "MACOSX" is not an official definition, but it's commonly
-    # accepted as a way to differentiate between what runs on X
-    # and what runs on older Macs - while in theory "Carbon" defns
-    # are consistent between the two, in practice Carbon is still
-    # changing. -sts Aug 2000
-    mac_autoconf_target_workaround="MAC"
-    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
-      -fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
-    #VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
-    #VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
-    fi
-  fi
-}
-
-dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
-CheckCOCOA()
-{
-    AC_ARG_ENABLE(video-cocoa,
-[  --enable-video-cocoa    use Cocoa/Quartz video driver [default=yes]],
-                  , enable_video_cocoa=yes)
-  if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
-    old_CFLAGS="$CFLAGS"
-    dnl work around that we don't have Objective-C support in autoconf
-    CFLAGS="$CFLAGS -x objective-c"
-    AC_MSG_CHECKING(for Cocoa framework)
-    have_cocoa=no
-    if test x$have_cocoa != xyes; then
-        AC_TRY_COMPILE([
-          #import <Cocoa/Cocoa.h>
-        ],[
-        ],[
-        have_cocoa=yes
-        ])
-    fi
-    AC_MSG_RESULT($have_cocoa)
-    CFLAGS="$old_CFLAGS"
-    if test x$have_cocoa = xyes; then
-    # "MACOSX" is not an official definition, but it's commonly
-    # accepted as a way to differentiate between what runs on X
-    # and what runs on older Macs - while in theory "Carbon" defns
-    # are consistent between the two, in practice Carbon is still
-    # changing. -sts Aug 2000
-    mac_autoconf_target_workaround="MAC"
-    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
-      -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
-      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
-    VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
-    VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
-    fi
-  fi
-}
-
 dnl Check for the dlfcn.h interface for dynamically loading objects
 CheckDLOPEN()
 {
     AC_ARG_ENABLE(sdl-dlopen,
-[  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]],
+AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
                   , enable_sdl_dlopen=yes)
     if test x$enable_sdl_dlopen = xyes; then
         AC_MSG_CHECKING(for dlopen)
-        have_loadso=no
+        have_dlopen=no
         AC_TRY_COMPILE([
          #include <dlfcn.h>
         ],[
         ],[
-        have_loadso=yes
+        have_dlopen=yes
         ])
-        AC_MSG_RESULT($have_loadso)
+        AC_MSG_RESULT($have_dlopen)
 
-        if test x$have_loadso = xyes; then
-            CFLAGS="$CFLAGS -DUSE_DLOPEN"
-            AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS",
-               AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl",
-                  AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")))
+        if test x$have_dlopen = xyes; then
+            AC_CHECK_LIB(c, dlopen, BUILD_LIBS="$BUILD_LIBS",
+               AC_CHECK_LIB(dl, dlopen, BUILD_LIBS="$BUILD_LIBS -ldl",
+                  AC_CHECK_LIB(ltdl, dlopen, BUILD_LIBS="$BUILD_LIBS -lltdl")))
+            AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
+            if test x$have_dlvsym = xyes; then
+                AC_DEFINE(HAVE_DLVSYM)
+            fi
+            AC_DEFINE(SDL_LOADSO_DLOPEN)
+            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
+            have_loadso=yes
         fi
     fi
 }
@@ -1827,15 +1715,16 @@
 CheckAtariLdg()
 {
     AC_ARG_ENABLE(atari-ldg,
-[  --enable-atari-ldg      use Atari LDG for shared object loading [default=yes]],
+AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
                   , enable_atari_ldg=yes)
     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
+            AC_DEFINE(SDL_LOADSO_LDG)
+            SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lldg -lgem"
             have_loadso=yes
-            CFLAGS="$CFLAGS -DENABLE_LDG"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lldg -lgem"
         fi
     fi
 }
@@ -1844,33 +1733,16 @@
 CheckUSBHID()
 {
     if test x$enable_joystick = xyes; then
-        have_libusbhid=no
-        have_libusb=no
-        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
-        AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
-        if test x$have_libusbhid = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
-        fi
-        if test x$have_libusb = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
-        fi
+        AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
+        AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
+        AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
+        AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
+            
+        AC_CHECK_LIB(usbhid, hid_init, [USB_LIBS="$USB_LIBS -lusbhid"])
+        AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
 
-        AC_CHECK_HEADER(usb.h, have_usb_h=yes)
-        AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
-        AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
-        AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
-        if test x$have_usb_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_USB_H"
-        fi
-        if test x$have_usbhid_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_USBHID_H"
-        fi
-        if test x$have_libusb_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
-        fi
-        if test x$have_libusbhid_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
-        fi
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $USB_CFLAGS"
 
         AC_MSG_CHECKING(for usbhid)
         have_usbhid=no
@@ -1921,11 +1793,11 @@
             have_usbhid_ucr_data=yes
             ])
             if test x$have_usbhid_ucr_data = xyes; then
-                CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
+                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
             fi
             AC_MSG_RESULT($have_usbhid_ucr_data)
             
-	    AC_MSG_CHECKING(for new usbhid API)
+            AC_MSG_CHECKING(for new usbhid API)
             have_usbhid_new=no
             AC_TRY_COMPILE([
               #include <sys/types.h>
@@ -1943,87 +1815,36 @@
               #endif
             ],[
               report_desc_t d;
-	      hid_start_parse(d, 1, 1);
+              hid_start_parse(d, 1, 1);
             ],[
             have_usbhid_new=yes
             ])
             if test x$have_usbhid_new = xyes; then
-                CFLAGS="$CFLAGS -DUSBHID_NEW"
+                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
             fi
             AC_MSG_RESULT($have_usbhid_new)
 
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
+            AC_DEFINE(SDL_JOYSTICK_USBHID)
+            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
+            BUILD_CFLAGS="$BUILD_CFLAGS $USB_CFLAGS"
+            BUILD_LIBS="$BUILD_CFLAGS $USB_LIBS"
+            have_joystick=yes
         fi
+        CFLAGS="$save_CFLAGS"
     fi
 }
 
-dnl Check for altivec instruction support using gas syntax
-CheckAltivec()
+dnl Check for clock_gettime()
+CheckClockGettime()
 {
-    have_altivec_h_hdr=no
-    AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
-
-    save_CFLAGS="${CFLAGS}"
-    have_gcc_altivec=no
-    AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
-    CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -maltivec"
-
-    if test x$have_altivec_h_hdr = xyes; then
-      AC_TRY_COMPILE([
-      #include <altivec.h>
-      vector unsigned int vzero() {
-          return vec_splat_u32(0);
-      }
-      ],[
-      ],[
-      have_gcc_altivec=yes
-      ])
-      AC_MSG_RESULT($have_gcc_altivec)
-    else
-      AC_TRY_COMPILE([
-      vector unsigned int vzero() {
-          return vec_splat_u32(0);
-      }
-      ],[
-      ],[
-      have_gcc_altivec=yes
-      ])
-      AC_MSG_RESULT($have_gcc_altivec)
-    fi
-
-    if test x$have_gcc_altivec = xno; then
-        AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
-        CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
-        if test x$have_altivec_h_hdr = xyes; then
-          AC_TRY_COMPILE([
-          #include <altivec.h>
-          vector unsigned int vzero() {
-              return vec_splat_u32(0);
-          }
-          ],[
-          ],[
-          have_gcc_altivec=yes
-          ])
-          AC_MSG_RESULT($have_gcc_altivec)
-        else
-          AC_TRY_COMPILE([
-          vector unsigned int vzero() {
-              return vec_splat_u32(0);
-          }
-          ],[
-          ],[
-          have_gcc_altivec=yes
-          ])
-          AC_MSG_RESULT($have_gcc_altivec)
-        fi
-    fi
-
-    if test x$have_gcc_altivec = xno; then
-        CFLAGS="${save_CFLAGS}"
-    else
-        if test x$have_altivec_h_hdr = xyes; then
-          CFLAGS="${CFLAGS} -DHAVE_ALTIVEC_H"
+    AC_ARG_ENABLE(clock_gettime,
+AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
+                  , enable_clock_gettime=no)
+    if test x$enable_clock_gettime = xyes; then
+        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
+        if test x$have_clock_gettime = xyes; then
+            AC_DEFINE(HAVE_CLOCK_GETTIME)
+            BUILD_LIBS="$BUILD_LIBS -lrt"
         fi
     fi
 }
@@ -2033,7 +1854,7 @@
 {
     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
     if test x$have_linux_version_h = xyes; then
-        CFLAGS="$CFLAGS -DHAVE_LINUX_VERSION_H"
+        BUILD_CFLAGS="$BUILD_CFLAGS -DHAVE_LINUX_VERSION_H"
     fi
 }
 
@@ -2041,34 +1862,48 @@
 CheckRPATH()
 {
     AC_ARG_ENABLE(rpath,
-[  --enable-rpath          use an rpath when linking SDL [default=yes]],
+AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
                   , enable_rpath=yes)
 }
 
-have_loadso=no
+dnl Set up the configuration based on the target platform!
 case "$target" in
-    arm-*-elf*)
-	ARCH=linux
-	CheckDummyVideo
-	CheckIPod
-	# Set up files for the timer library
+    arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
+        ARCH=linux
+        CheckDummyVideo
+        CheckIPod
+        # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_UNIX)
+            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
+            have_timers=yes
         fi
-	;;
-    *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu)
+        ;;
+    *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
         case "$target" in
-          *-*-linux*) ARCH=linux ;;
-          *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
-          *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
-          *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
-          *-*-gnu*) ARCH=gnu ;; # must be last
+            *-*-linux*)         ARCH=linux ;;
+            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
+            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
+            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
+            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
+            *-*-bsdi*)          ARCH=bsdi ;;
+            *-*-freebsd*)       ARCH=freebsd ;;
+            *-*-netbsd*)        ARCH=netbsd ;;
+            *-*-openbsd*)       ARCH=openbsd ;;
+            *-*-sysv5*)         ARCH=sysv5 ;;
+            *-*-solaris*)       ARCH=solaris ;;
+            *-*-hpux*)          ARCH=hpux ;;
+            *-*-irix*)          ARCH=irix ;;
+            *-*-aix*)           ARCH=aix ;;
+            *-*-osf*)           ARCH=osf ;;
         esac
         CheckDummyVideo
         CheckDiskAudio
         CheckDLOPEN
         CheckNASM
+        CheckAltivec
         CheckOSS
+        CheckDMEDIA
         CheckALSA
         CheckARTSC
         CheckESD
@@ -2080,507 +1915,115 @@
         CheckPS2GS
         CheckGGI
         CheckSVGA
+        CheckVGL
+        CheckWscons
         CheckAAlib
         CheckQtopia
         CheckPicoGUI
         CheckOpenGLX11
         CheckInputEvents
         CheckTslib
+        CheckUSBHID
         CheckPTHREAD
-        CheckSIGACTION
-        CheckAltivec
+        CheckClockGettime
         CheckLinuxVersion
         CheckRPATH
-
-        # Set up files for the main() stub
-        if test "x$video_qtopia" = "xyes"; then
-          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
-          SDL_LIBS="-lSDLmain $SDL_LIBS"
+        # Set up files for the audio library
+        if test x$enable_audio = xyes; then
+          case $ARCH in
+            netbsd|sysv5|solaris|hpux)
+                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
+                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
+                have_audio=yes
+            ;;
+            openbsd)
+                AC_DEFINE(SDL_AUDIO_DRIVER_OPENBSD)
+                SOURCES="$SOURCES $srcdir/src/audio/openbsd/*.c"
+                have_audio=yes
+            ;;
+            aix)
+                AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
+                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
+                have_audio=yes
+            ;;
+            osf)
+                AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
+                SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
+                BUILD_LIBS="$BUILD_LIBS -lmme"
+                have_audio=yes
+            ;;
+          esac
         fi
-        # Set up files for the audio library
-        # We use the OSS and ALSA API's, not the Sun audio API
-        #if test x$enable_audio = xyes; then
-        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        #fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-	  case $ARCH in
-	    linux)
-              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
-              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
-	    ;;
-	    gnu)
-              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-	    ;;
-	    k*bsd-gnu)
-              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
-              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
-	    ;;
-	  esac
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-	  case $ARCH in
-	    linux)
-              CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
-              CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
-	    ;;
-	    gnu)
-              CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
-              CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
-	    ;;
-	    kfreebsd-gnu)
-              CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
-              CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
-	    ;;
-	    knetbsd-gnu|kopenbsd-gnu)
-              CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
-              CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
-	    ;;
-	  esac
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-bsdi*)
-        ARCH=bsdi
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckSVGA
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckRPATH
-        # Set up files for the audio library
-        # We use the OSS and ALSA API's, not the Sun audio API
-        #if test x$enable_audio = xyes; then
-        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        #fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
+          case $ARCH in
+            linux)
+                AC_DEFINE(SDL_JOYSTICK_LINUX)
+                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
+                have_joystick=yes
+            ;;
+          esac
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
-            CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-freebsd*)
-        ARCH=freebsd
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckVGL
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckSVGA
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckUSBHID
-        CheckRPATH
-        # Set up files for the audio library
-        # We use the OSS and ALSA API's, not the Sun audio API
-        #if test x$enable_audio = xyes; then
-        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        #fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
-            CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
+          case $ARCH in
+            linux|solaris)
+                AC_DEFINE(SDL_CDROM_LINUX)
+                SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
+                have_cdrom=yes
+            ;;
+            *freebsd*)
+                AC_DEFINE(SDL_CDROM_FREEBSD)
+                SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
+                have_cdrom=yes
+            ;;
+            *netbsd*|*openbsd*)
+                AC_DEFINE(SDL_CDROM_OPENBSD)
+                SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
+                have_cdrom=yes
+            ;;
+            bsdi)
+                AC_DEFINE(SDL_CDROM_BSDI)
+                SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
+                have_cdrom=yes
+            ;;
+            aix)
+                AC_DEFINE(SDL_CDROM_AIX)
+                SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
+                have_cdrom=yes
+            ;;
+            osf)
+                AC_DEFINE(SDL_CDROM_OSF)
+                SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
+                have_cdrom=yes
+            ;;
+          esac
         fi
         # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-netbsd*)
-        ARCH=netbsd
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckAAlib
-	CheckWscons
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckUSBHID
-        CheckRPATH
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
-            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            if test x$use_pthreads = xyes; then
-                CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
-            fi
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        # NetBSD does not define "unix"
-        CFLAGS="$CFLAGS -Dunix"
-        ;;
-    *-*-openbsd*)
-        ARCH=openbsd
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckUSBHID
-        CheckRPATH
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
-        fi
-        # OpenBSD needs linking with ossaudio emulation library
-        if test x$have_oss = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
-            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
+        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
+            AC_DEFINE(SDL_THREAD_SPROC)
+            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
+            have_threads=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        # OpenBSD does not define "unix"
-        CFLAGS="$CFLAGS -Dunix"
-        ;;
-    *-*-sysv5*)
-        ARCH=sysv5
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckRPATH
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
-            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-solaris*)
-        ARCH=solaris
-        CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNASM
-        CheckOSS
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        CheckRPATH
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
-            CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-irix*)
-        ARCH=irix
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckDMEDIA
-        CheckESD
-        CheckNAS
-        CheckX11
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        # We use the dmedia audio API, not the Sun audio API
-        #if test x$enable_audio = xyes; then
-        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        #fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        # (No CD-ROM support yet)
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
-            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
+            AC_DEFINE(SDL_TIMER_UNIX)
+            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
+            have_timers=yes
         fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            if test x$use_pthreads = xyes -o x$use_pth = xyes; then
-                CopyUnixThreadSource
-            else
-                COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
-                COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
-                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
-                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
-                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
-                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-                COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
-            fi
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-hpux*)
-        ARCH=hpux
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckOSS
-        CheckNAS
-        CheckX11
-        CheckGGI
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
-        fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        # (No CD-ROM support yet)
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
-            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-aix*)
-        ARCH=aix
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckOSS
-        CheckNAS
-        CheckX11
-        CheckGGI
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
-        fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
-            CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        ;;
-    *-*-osf*)
-        ARCH=osf
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDLOPEN
-        CheckNAS
-        CheckX11
-        CheckGGI
-        CheckAAlib
-        CheckOpenGLX11
-        CheckPTHREAD
-        CheckSIGACTION
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lmme"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS mme"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS mme/libaudio_mme.la"
-        fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
-        # Set up files for the cdrom library
-        # (No cdrom support yet)
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS osf"
-            CDROM_DRIVERS="$CDROM_DRIVERS osf/libcdrom_osf.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
-        fi
-        # FIXME: If building without -lX11, you get the following messages.
-        # Xlib: connection to ":0.0" refused by server
-        # Xlib: XDM authorization key matches an existing client!
-        # It only has to run xhost +localhost in a such case.
-        #if test x$enable_x11_shared = xyes; then
-        #    SYSTEM_LIBS="$SYSTEM_LIBS -lX11"
-        #fi
+        # Do any final platform setup
+        case $ARCH in
+            netbsd)
+                # NetBSD does not define "unix"
+                BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
+            ;;
+            openbsd)
+                # OpenBSD does not define "unix"
+                BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
+            ;;
+        esac
         ;;
     *-*-qnx*)
         ARCH=qnx
@@ -2593,37 +2036,28 @@
         CheckX11
         CheckOpenGLX11
         CheckPTHREAD
-        CheckSIGACTION
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
-            SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-        # (No joystick support yet)
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
+            SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
+            BUILD_LIBS="$BUILD_LIBS -lasound"
+            have_audio=yes
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
-            CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
+            AC_DEFINE(SDL_CDROM_QNX)
+            SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
+            have_cdrom=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_UNIX)
+            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
+            have_timers=yes
         fi
         ;;
     *-*-cygwin* | *-*-mingw32*)
         ARCH=win32
-        have_loadso=yes
         if test "$build" != "$target"; then # cross-compiling
             # Default cross-compile location
             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
@@ -2636,49 +2070,64 @@
         CheckDummyVideo
         CheckDiskAudio
         CheckWIN32
+        CheckWIN32GL
         CheckDIRECTX
         CheckNASM
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
-            if test x$use_directx = xyes; then
-                AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
-                AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
+            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
+            if test x$have_directx = xyes; then
+                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
+                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
             fi
+            have_audio=yes
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
+            AC_DEFINE(SDL_JOYSTICK_WINMM)
+            SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
+            have_joystick=yes
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
-            CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
+            AC_DEFINE(SDL_CDROM_WIN32)
+            SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
+            have_cdrom=yes
         fi
         # Set up files for the thread library
         if test x$enable_threads = xyes; then
-            COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
-            COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
-            COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
+            AC_DEFINE(SDL_THREAD_WIN32)
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
+            have_threads=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_WIN32)
+            SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
+            have_timers=yes
+        fi
+        # Set up files for the shared object loading library
+        if test x$enable_loadso = xyes; then
+            AC_DEFINE(SDL_LOADSO_WIN32)
+            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
+            have_loadso=yes
+        fi
+        # Set up the system libraries we need
+        BUILD_LIBS="$BUILD_LIBS -luser32 -lgdi32 -lwinmm"
+        if test x$have_directx = xyes; then
+            BUILD_LIBS="$BUILD_LIBS -ldxguid"
         fi
         # The Win32 platform requires special setup
         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
         case "$target" in
             *-*-cygwin*)
-                CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
+                BUILD_CFLAGS="$BUILD_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
-                LIBS="$LIBS -mno-cygwin"
+                BUILD_LIBS="$BUILD_LIBS -mno-cygwin"
                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
                 ;;
             *-*-mingw32*)
@@ -2689,7 +2138,6 @@
     *-*-beos*)
         ARCH=beos
         ac_default_prefix=/boot/develop/tools/gnupro
-        have_loadso=yes
         CheckDummyVideo
         CheckDiskAudio
         CheckNASM
@@ -2697,139 +2145,108 @@
         CheckBeGL
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
+            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
+            have_audio=yes
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
+            AC_DEFINE(SDL_JOYSTICK_BEOS)
+            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
+            have_joystick=yes
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
-            CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
+            AC_DEFINE(SDL_CDROM_BEOS)
+            SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
+            have_cdrom=yes
         fi
         # Set up files for the thread library
         if test x$enable_threads = xyes; then
-            COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
-            COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
-            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
+            AC_DEFINE(SDL_THREAD_BEOS)
+            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
+            have_threads=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_BEOS)
+            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
+            have_timers=yes
+        fi
+        # Set up files for the shared object loading library
+        if test x$enable_loadso = xyes; then
+            AC_DEFINE(SDL_LOADSO_BEOS)
+            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
+            have_loadso=yes
         fi
         # The BeOS platform requires special libraries
-        SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
-        ;;
-    *-*-macos*)
-        # This would be used if cross-compiling to MacOS 9.  No way to
-        # use it at present, but Apple is working on a X-to-9 compiler
-        # for which this case would be handy.
-        ARCH=macos
-        have_loadso=yes
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckTOOLBOX
-        CheckMacGL
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
-            CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
-            COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
-            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
-        fi
-        # The MacOS platform requires special setup
-        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
-        SDL_LIBS="-lSDLmain $SDL_LIBS"
+        BUILD_LIBS="$BUILD_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
         ;;
     *-*-darwin* )
         # This could be either full "Mac OS X", or plain "Darwin" which is
         # just the OS X kernel sans upper layers like Carbon and Cocoa.
         # Next line is broken, and a few files below require Mac OS X (full)
         ARCH=macosx
-        have_loadso=yes
         CheckDummyVideo
         CheckDiskAudio
+        CheckDLOPEN
         CheckCOCOA
         CheckCARBON
         CheckX11
         CheckMacGL
         CheckOpenGLX11
         CheckPTHREAD
-        CheckSIGACTION
         CheckAltivec
-        # If either the audio or CD driver is used, add the AudioUnit framework
-        if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -framework AudioToolbox -framework AudioUnit"
-        fi
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macosx"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS macosx/libaudio_macosx.la"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
+            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
+            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
+            AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
+            SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
+            have_audio=yes
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
-            SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
+            AC_DEFINE(SDL_JOYSTICK_IOKIT)
+            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
+            BUILD_LIBS="$BUILD_LIBS -framework IOKit"
+            have_joystick=yes
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS macosx"
-            CDROM_DRIVERS="$CDROM_DRIVERS macosx/libcdrom_macosx.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
+            AC_DEFINE(SDL_CDROM_MACOSX)
+            SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
+            have_cdrom=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_UNIX)
+            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
+            have_timers=yes
+        fi
+        # Set up files for the shared object loading library
+        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
+            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
+            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
+            have_loadso=yes
         fi
         # The MacOS X platform requires special setup.
+        AC_DEFINE(TARGET_API_MAC_CARBON)
+        BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings -DMACOSX"
         SDL_LIBS="-lSDLmain $SDL_LIBS"
         if test x$enable_video_cocoa = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa"
+            BUILD_LIBS="$BUILD_LIBS -framework Cocoa"
         fi
         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
-            SYSTEM_LIBS="$SYSTEM_LIBS -framework Carbon -framework QuickTime"
+            BUILD_LIBS="$BUILD_LIBS -framework Carbon -framework QuickTime"
         fi
-        #if test x$enable_video_carbon = xyes; then
-        #    SYSTEM_LIBS="$SYSTEM_LIBS -framework DrawSprocket"
-        #fi
+        # If either the audio or CD driver is used, add the AudioUnit framework
+        if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
+            BUILD_LIBS="$BUILD_LIBS -framework AudioToolbox -framework AudioUnit"
+        fi
         ;;
     *-*-mint*)
         ARCH=mint
@@ -2840,123 +2257,110 @@
         CheckAtariGemVideo
         CheckAtariAudio
         CheckAtariLdg
-		CheckAtariOSMesa
+        CheckAtariOSMesa
         CheckPTH
         # Set up files for the audio library
         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
             if test x$enable_audio = xyes; then
-                CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-                AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-                AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
+                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
+                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
+                have_audio=yes
             fi
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
+            AC_DEFINE(SDL_JOYSTICK_MINT)
+            SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
+            have_joystick=yes
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS mint"
-            CDROM_DRIVERS="$CDROM_DRIVERS mint/libcdrom_mint.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            CopyUnixThreadSource
+            AC_DEFINE(SDL_CDROM_MINT)
+            SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
+            have_cdrom=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
-                COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
+                AC_DEFINE(SDL_TIMER_UNIX)
+                SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
             else
-                COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
+                AC_DEFINE(SDL_TIMER_MINT)
+                SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
             fi
+            have_timers=yes
         fi
         # MiNT does not define "unix"
-        CFLAGS="$CFLAGS -Dunix"
+        BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
         ;;
     *-riscos)
         ARCH=riscos
+        CheckOSS
+        CheckPTHREAD
         # Set up files for the video library
         if test x$enable_video = xyes; then
-            VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
-            VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
-        fi
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DOSS_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
+            AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
+            SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
+            have_video=yes
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
-        fi
-        # Set up files for the cdrom library
-        if test x$enable_cdrom = xyes; then
-            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
-            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            COPY_ARCH_SRC(src/thread, riscos, SDL_systhread.c)
-            COPY_ARCH_SRC(src/thread, riscos, SDL_systhread_c.h)
-            COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex.c)
-            COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, riscos, SDL_syssem.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
-            COPY_ARCH_SRC(src/thread, riscos, SDL_syscond.c)
-            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
-        else
-            CFLAGS="$CFLAGS -DDISABLE_THREADS"
+            AC_DEFINE(SDL_JOYSTICK_RISCOS)
+            SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
+            have_joystick=yes
         fi
         # Set up files for the timer library
         if test x$enable_timers = xyes; then
-            COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
+            AC_DEFINE(SDL_TIMER_RISCOS)
+            SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
+            have_timers=yes
         fi
-
-        CFLAGS="$CFLAGS -DENABLE_RISCOS"
-
-        SYSTEM_LIBS="$SYSTEM_LIBS -ljpeg -ltiff -lpng -lz"
+        # The RISC OS platform requires special setup.
+        BUILD_LIBS="$BUILD_LIBS -ljpeg -ltiff -lpng -lz"
         ;;
     *)
-        AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
+        AC_MSG_ERROR([
+*** Unsupported target:  Please add to configure.in
+        ])
         ;;
 esac
-AC_SUBST(ARCH)
 
-# Set the conditional variables for this target
-AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
-AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
-AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
-AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
-AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
-AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
-AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
-AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
-AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
-AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
-AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
-AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
-AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
-AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
-AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
-AM_CONDITIONAL(TARGET_IPOD, test x$enable_ipod = xyes)
+# Verify that we have all the platform specific files we need
+if test x$have_joystick != xyes; then
+    if test x$enable_joystick = xyes; then
+        AC_DEFINE(SDL_JOYSTICK_DISABLED)
+    fi
+    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
+fi
+if test x$have_cdrom != xyes; then
+    if test x$enable_cdrom = xyes; then
+        AC_DEFINE(SDL_CDROM_DISABLED)
+    fi
+    SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
+fi
+if test x$have_threads != xyes; then
+    if test x$enable_threads = xyes; then
+        AC_DEFINE(SDL_THREADS_DISABLED)
+    fi
+    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
+fi
+if test x$have_timers != xyes; then
+    if test x$enable_timers = xyes; then
+        AC_DEFINE(SDL_TIMERS_DISABLED)
+    fi
+    SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
+fi
+if test x$have_loadso != xyes; then
+    if test x$enable_loadso = xyes; then
+        AC_DEFINE(SDL_LOADSO_DISABLED)
+    fi
+    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
+fi
 
-# More automake conditionals
-AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
-AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
-AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
-AM_CONDITIONAL(USE_COCOA, test x$enable_video_cocoa = xyes)
-AM_CONDITIONAL(USE_CARBON, test x$enable_video_carbon = xyes)
-
-# Set conditional variables for shared and static library selection.
-# These are not used in any Makefile.am but in sdl-config.in.
-AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
-AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
+OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
+OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
+OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
+OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
 
 # Set runtime shared library paths as needed
 
@@ -3005,181 +2409,48 @@
     ;;
 esac
 
-
 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
 
-dnl Output the video drivers we use
-if test x$enable_video = xtrue; then
-    if test "$VIDEO_SUBDIRS" = ""; then
-        AC_MSG_ERROR(*** No video drivers are enabled!)
-    fi
-fi
-AC_SUBST(AUDIO_SUBDIRS)
-AC_SUBST(AUDIO_DRIVERS)
-AC_SUBST(VIDEO_SUBDIRS)
-AC_SUBST(VIDEO_DRIVERS)
-AC_SUBST(JOYSTICK_SUBDIRS)
-AC_SUBST(JOYSTICK_DRIVERS)
-AC_SUBST(CDROM_SUBDIRS)
-AC_SUBST(CDROM_DRIVERS)
-AC_SUBST(SDL_EXTRADIRS)
-AC_SUBST(SDL_EXTRALIBS)
-
 dnl Expand the cflags and libraries needed by apps using SDL
 AC_SUBST(SDL_CFLAGS)
 AC_SUBST(SDL_LIBS)
 AC_SUBST(SDL_STATIC_LIBS)
 AC_SUBST(SDL_RLD_FLAGS)
+if test x$enable_shared = xyes; then
+    ENABLE_SHARED_TRUE=
+    ENABLE_SHARED_FALSE="#"
+else
+    ENABLE_SHARED_TRUE="#"
+    ENABLE_SHARED_FALSE=
+fi
+if test x$enable_static = xyes; then
+    ENABLE_STATIC_TRUE=
+    ENABLE_STATIC_FALSE="#"
+else
+    ENABLE_STATIC_TRUE="#"
+    ENABLE_STATIC_FALSE=
+fi
+AC_SUBST(ENABLE_SHARED_TRUE)
+AC_SUBST(ENABLE_SHARED_FALSE)
+AC_SUBST(ENABLE_STATIC_TRUE)
+AC_SUBST(ENABLE_STATIC_FALSE)
 
 dnl Expand the libraries needed for static and dynamic linking
 AC_SUBST(STATIC_SYSTEM_LIBS)
 AC_SUBST(SHARED_SYSTEM_LIBS)
 AC_SUBST(SYSTEM_LIBS)
 
-dnl Expand the include directories for building SDL
-CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/main/$ARCH"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/Xext/extensions"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
-CFLAGS="$CFLAGS -I\$(top_builddir)/src/thread"
-CXXFLAGS="$CFLAGS"
-
+dnl Expand the sources and objects needed to build the library
+AC_SUBST(ac_aux_dir)
+AC_SUBST(INCLUDE)
+AC_SUBST(SOURCES)
+AC_SUBST(OBJECTS)
+AC_SUBST(BUILD_CFLAGS)
+AC_SUBST(BUILD_LIBS)
 
-# Check for darwin at the very end and set up the Objective C compiler
-# We do this here so that we get the full CFLAGS into OBJCFLAGS
-case "$target" in
-    *-*-darwin*)
-        dnl AC_PROG_OBJC doesn't seem to exist, this is the SDL workaround
-        AC_MSG_CHECKING(for an Objective-C compiler)
-        OBJC="$CC"
-        AC_SUBST(OBJC)
-        OBJCFLAGS="$CFLAGS"
-        AC_SUBST(OBJCFLAGS)
-        _AM_DEPENDENCIES(OBJC)
-        ;;
-esac
-
-# Finally create all the generated files
-dnl Important: Any directory that you want to be in the distcheck should
-dnl            have a file listed here, so that configure generates the
-dnl            subdirectories on the build target.
 AC_OUTPUT([
-Makefile
-docs/Makefile
-docs/html/Makefile
-docs/man3/Makefile
-include/Makefile
-src/Makefile
-src/main/Makefile
-src/main/macos/Makefile
-src/main/macosx/Makefile
-src/main/macosx/Info.plist
-src/stdlib/Makefile
-src/audio/Makefile
-src/audio/alsa/Makefile
-src/audio/arts/Makefile
-src/audio/baudio/Makefile
-src/audio/dc/Makefile
-src/audio/disk/Makefile
-src/audio/dma/Makefile
-src/audio/dmedia/Makefile
-src/audio/dsp/Makefile
-src/audio/esd/Makefile
-src/audio/macosx/Makefile
-src/audio/macrom/Makefile
-src/audio/mint/Makefile
-src/audio/mme/Makefile
-src/audio/nas/Makefile
-src/audio/nto/Makefile
-src/audio/openbsd/Makefile
-src/audio/paudio/Makefile
-src/audio/sun/Makefile
-src/audio/ums/Makefile
-src/audio/windib/Makefile
-src/audio/windx5/Makefile
-src/video/Makefile
-src/video/aalib/Makefile
-src/video/ataricommon/Makefile
-src/video/bwindow/Makefile
-src/video/cybergfx/Makefile
-src/video/dc/Makefile
-src/video/dga/Makefile
-src/video/directfb/Makefile
-src/video/dummy/Makefile
-src/video/epoc/Makefile
-src/video/fbcon/Makefile
-src/video/gem/Makefile
-src/video/ggi/Makefile
-src/video/ipod/Makefile
-src/video/os2fslib/Makefile
-src/video/maccommon/Makefile
-src/video/macdsp/Makefile
-src/video/macrom/Makefile
-src/video/nanox/Makefile
-src/video/photon/Makefile
-src/video/picogui/Makefile
-src/video/ps2gs/Makefile
-src/video/qtopia/Makefile
-src/video/wscons/Makefile
-src/video/quartz/Makefile
-src/video/riscos/Makefile
-src/video/svga/Makefile
-src/video/vgl/Makefile
-src/video/wincommon/Makefile
-src/video/windib/Makefile
-src/video/windx5/Makefile
-src/video/gapi/Makefile
-src/video/x11/Makefile
-src/video/xbios/Makefile
-src/video/Xext/Makefile
-src/video/Xext/extensions/Makefile
-src/video/Xext/Xinerama/Makefile
-src/video/Xext/Xv/Makefile
-src/video/Xext/Xxf86dga/Makefile
-src/video/Xext/Xxf86vm/Makefile
-src/video/Xext/XME/Makefile
-src/events/Makefile
-src/joystick/Makefile
-src/joystick/amigaos/Makefile
-src/joystick/beos/Makefile
-src/joystick/bsd/Makefile
-src/joystick/darwin/Makefile
-src/joystick/dc/Makefile
-src/joystick/dummy/Makefile
-src/joystick/linux/Makefile
-src/joystick/macos/Makefile
-src/joystick/mint/Makefile
-src/joystick/riscos/Makefile
-src/joystick/win32/Makefile
-src/cdrom/Makefile
-src/cdrom/aix/Makefile
-src/cdrom/beos/Makefile
-src/cdrom/dc/Makefile
-src/cdrom/dummy/Makefile
-src/cdrom/bsdi/Makefile
-src/cdrom/freebsd/Makefile
-src/cdrom/linux/Makefile
-src/cdrom/macos/Makefile
-src/cdrom/macosx/Makefile
-src/cdrom/mint/Makefile
-src/cdrom/openbsd/Makefile
-src/cdrom/osf/Makefile
-src/cdrom/qnx/Makefile
-src/cdrom/win32/Makefile
-src/thread/Makefile
-src/timer/Makefile
-src/file/Makefile
-src/cpuinfo/Makefile
-src/hermes/Makefile
-sdl-config
-SDL.spec
-SDL.qpg
-], [chmod +x sdl-config])
+    Makefile sdl-config SDL.spec SDL.qpg
+], [
+    : >build-deps
+    make depend
+])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/SDL_config.h	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,295 @@
+/* include/SDL_config.h.  Generated by configure.  */
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#ifndef _SDL_config_h
+#define _SDL_config_h
+
+/* This is a set of defines to configure the SDL features */
+
+/* C language features */
+/* #undef const */
+/* #undef inline */
+/* #undef volatile */
+
+/* C datatypes */
+/* #undef size_t */
+/* #undef int8_t */
+/* #undef uint8_t */
+/* #undef int16_t */
+/* #undef uint16_t */
+/* #undef int32_t */
+/* #undef uint32_t */
+#define SDL_HAS_64BIT_TYPE 1
+/* #undef int64_t */
+/* #undef uint64_t */
+/* #undef uintptr_t */
+
+/* Endianness */
+#define SDL_BYTEORDER 1234
+
+/* Comment this if you want to build without any C library requirements */
+#define HAVE_LIBC 1
+#ifdef HAVE_LIBC
+
+/* Useful headers */
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDIO_H 1
+#define STDC_HEADERS 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+/* #undef HAVE_ALTIVEC_H */
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
+#define HAVE_GETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#endif
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRCPY 1
+#define HAVE_STRNCPY 1
+#define HAVE_STRCAT 1
+#define HAVE_STRNCAT 1
+#define HAVE_STRDUP 1
+/* #undef HAVE__STRREV */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
+/* #undef HAVE_INDEX */
+/* #undef HAVE_RINDEX */
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+/* #undef HAVE_ITOA */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__UITOA */
+/* #undef HAVE__ULTOA */
+#define HAVE_STRTOL 1
+/* #undef HAVE__I64TOA */
+/* #undef HAVE__UI64TOA */
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+/* #undef HAVE_STRICMP */
+#define HAVE_STRCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF 1
+/* #undef HAVE_VSNPRINTF */
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+/* #undef HAVE_CLOCK_GETTIME */
+#define HAVE_DLVSYM 1
+
+#else
+/* We may need some replacement for stdarg.h here */
+#include <stdarg.h>
+#endif /* HAVE_LIBC */
+
+/* General platform specific identifiers */
+/* #undef TARGET_API_MAC_CARBON */
+/* #undef TARGET_API_MAC_OSX */
+
+/* Allow disabling of core subsystems */
+/* #undef SDL_AUDIO_DISABLED */
+/* #undef SDL_CDROM_DISABLED */
+/* #undef SDL_CPUINFO_DISABLED */
+/* #undef SDL_EVENTS_DISABLED */
+/* #undef SDL_FILE_DISABLED */
+/* #undef SDL_JOYSTICK_DISABLED */
+/* #undef SDL_LOADSO_DISABLED */
+/* #undef SDL_THREADS_DISABLED */
+/* #undef SDL_TIMERS_DISABLED */
+/* #undef SDL_VIDEO_DISABLED */
+
+/* Enable various audio drivers */
+/* #undef SDL_AUDIO_DRIVER_AHI */
+#define SDL_AUDIO_DRIVER_ALSA 1
+#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2"
+/* #undef SDL_AUDIO_DRIVER_ARTS */
+/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_BAUDIO */
+/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
+/* #undef SDL_AUDIO_DRIVER_DART */
+/* #undef SDL_AUDIO_DRIVER_DC */
+#define SDL_AUDIO_DRIVER_DISK 1
+/* #undef SDL_AUDIO_DRIVER_DMEDIA */
+/* #undef SDL_AUDIO_DRIVER_DRENDERER */
+/* #undef SDL_AUDIO_DRIVER_DSOUND */
+/* #undef SDL_AUDIO_DRIVER_ESD */
+/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_MINT */
+/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */
+/* #undef SDL_AUDIO_DRIVER_NAS */
+/* #undef SDL_AUDIO_DRIVER_OPENBSD */
+#define SDL_AUDIO_DRIVER_OSS 1
+/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
+/* #undef SDL_AUDIO_DRIVER_PAUD */
+/* #undef SDL_AUDIO_DRIVER_QNXNTO */
+/* #undef SDL_AUDIO_DRIVER_SNDMGR */
+/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
+/* #undef SDL_AUDIO_DRIVER_WAVEOUT */
+
+/* Enable various cdrom drivers */
+/* #undef SDL_CDROM_AIX */
+/* #undef SDL_CDROM_BEOS */
+/* #undef SDL_CDROM_BSDI */
+/* #undef SDL_CDROM_DC */
+/* #undef SDL_CDROM_DUMMY */
+/* #undef SDL_CDROM_FREEBSD */
+#define SDL_CDROM_LINUX 1
+/* #undef SDL_CDROM_MACOS */
+/* #undef SDL_CDROM_MACOSX */
+/* #undef SDL_CDROM_MINT */
+/* #undef SDL_CDROM_OPENBSD */
+/* #undef SDL_CDROM_OS2 */
+/* #undef SDL_CDROM_OSF */
+/* #undef SDL_CDROM_QNX */
+/* #undef SDL_CDROM_WIN32 */
+
+/* Enable various input drivers */
+/* #undef SDL_INPUT_TSLIB */
+/* #undef SDL_JOYSTICK_AMIGA */
+/* #undef SDL_JOYSTICK_BEOS */
+/* #undef SDL_JOYSTICK_DC */
+/* #undef SDL_JOYSTICK_DUMMY */
+/* #undef SDL_JOYSTICK_IOKIT */
+#define SDL_JOYSTICK_LINUX 1
+/* #undef SDL_JOYSTICK_LINUXEV */
+/* #undef SDL_JOYSTICK_MACOS */
+/* #undef SDL_JOYSTICK_MINT */
+/* #undef SDL_JOYSTICK_OS2 */
+/* #undef SDL_JOYSTICK_RISCOS */
+/* #undef SDL_JOYSTICK_WINMM */
+/* #undef SDL_JOYSTICK_USBHID */
+
+/* Enable various shared object loading systems */
+/* #undef SDL_LOADSO_BEOS */
+/* #undef SDL_LOADSO_DLCOMPAT */
+#define SDL_LOADSO_DLOPEN 1
+/* #undef SDL_LOADSO_LDG */
+/* #undef SDL_LOADSO_MACOS */
+/* #undef SDL_LOADSO_OS2 */
+/* #undef SDL_LOADSO_WIN32 */
+
+/* Enable various threading systems */
+/* #undef SDL_THREAD_AMIGA */
+/* #undef SDL_THREAD_BEOS */
+/* #undef SDL_THREAD_DC */
+/* #undef SDL_THREAD_EPOC */
+/* #undef SDL_THREAD_OS2 */
+/* #undef SDL_THREAD_PTH */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
+/* #undef SDL_THREAD_SPROC */
+/* #undef SDL_THREAD_WIN32 */
+
+/* Enable various timer systems */
+/* #undef SDL_TIMER_AMIGA */
+/* #undef SDL_TIMER_BEOS */
+/* #undef SDL_TIMER_DC */
+/* #undef SDL_TIMER_EPOC */
+/* #undef SDL_TIMER_MACOS */
+/* #undef SDL_TIMER_MINT */
+/* #undef SDL_TIMER_OS2 */
+/* #undef SDL_TIMER_RISCOS */
+#define SDL_TIMER_UNIX 1
+/* #undef SDL_TIMER_WIN32 */
+/* #undef SDL_TIMER_WINCE */
+
+/* Enable various video drivers */
+/* #undef SDL_VIDEO_DRIVER_AALIB */
+/* #undef SDL_VIDEO_DRIVER_BWINDOW */
+/* #undef SDL_VIDEO_DRIVER_CYBERGRAPHICS */
+/* #undef SDL_VIDEO_DRIVER_DC */
+/* #undef SDL_VIDEO_DRIVER_DDRAW */
+#define SDL_VIDEO_DRIVER_DGA 1
+/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
+/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+/* #undef SDL_VIDEO_DRIVER_EPOC */
+#define SDL_VIDEO_DRIVER_FBCON 1
+/* #undef SDL_VIDEO_DRIVER_GAPI */
+/* #undef SDL_VIDEO_DRIVER_GEM */
+/* #undef SDL_VIDEO_DRIVER_GGI */
+/* #undef SDL_VIDEO_DRIVER_IPOD */
+/* #undef SDL_VIDEO_DRIVER_NANOX */
+/* #undef SDL_VIDEO_DRIVER_OS2FS */
+/* #undef SDL_VIDEO_DRIVER_PHOTON */
+/* #undef SDL_VIDEO_DRIVER_PICOGUI */
+/* #undef SDL_VIDEO_DRIVER_PS2GS */
+/* #undef SDL_VIDEO_DRIVER_QTOPIA */
+/* #undef SDL_VIDEO_DRIVER_QUARTZ */
+/* #undef SDL_VIDEO_DRIVER_RISCOS */
+/* #undef SDL_VIDEO_DRIVER_SVGALIB */
+/* #undef SDL_VIDEO_DRIVER_TOOLBOX */
+/* #undef SDL_VIDEO_DRIVER_VGL */
+/* #undef SDL_VIDEO_DRIVER_WINDIB */
+/* #undef SDL_VIDEO_DRIVER_WSCONS */
+#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
+#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XME 1
+#define SDL_VIDEO_DRIVER_X11_XV 1
+/* #undef SDL_VIDEO_DRIVER_XBIOS */
+
+/* Enable OpenGL support */
+#define SDL_VIDEO_OPENGL 1
+#define SDL_VIDEO_OPENGL_GLX 1
+/* #undef SDL_VIDEO_OPENGL_WGL */
+/* #undef SDL_VIDEO_OPENGL_OSMESA */
+/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
+
+/* Enable assembly blit routines */
+#define SDL_ASSEMBLY_BLITTERS 1
+#define SDL_HERMES_BLITTERS 1
+/* #undef SDL_ALTIVEC_BLITTERS */
+
+#endif /* _SDL_config_h */
--- a/include/SDL_config.h.in	Fri Feb 10 07:29:08 2006 +0000
+++ b/include/SDL_config.h.in	Thu Feb 16 10:11:48 2006 +0000
@@ -63,7 +63,9 @@
 #undef HAVE_INTTYPES_H
 #undef HAVE_STDINT_H
 #undef HAVE_CTYPE_H
+#undef HAVE_MATH_H
 #undef HAVE_SIGNAL_H
+#undef HAVE_ALTIVEC_H
 
 /* C library functions */
 #undef HAVE_MALLOC
@@ -115,19 +117,178 @@
 #undef HAVE_SSCANF
 #undef HAVE_SNPRINTF
 #undef HAVE_VSNPRINTF
+#undef HAVE_SIGACTION
+#undef HAVE_SETJMP
+#undef HAVE_NANOSLEEP
+#undef HAVE_CLOCK_GETTIME
+#undef HAVE_DLVSYM
 
+#else
+/* We may need some replacement for stdarg.h here */
+#include <stdarg.h>
 #endif /* HAVE_LIBC */
 
+/* General platform specific identifiers */
+#undef TARGET_API_MAC_CARBON
+#undef TARGET_API_MAC_OSX
 
 /* Allow disabling of core subsystems */
-#undef DISABLE_AUDIO
-#undef DISABLE_VIDEO
-#undef DISABLE_EVENTS
-#undef DISABLE_JOYSTICK
-#undef DISABLE_CDROM
-#undef DISABLE_THREADS
-#undef DISABLE_TIMERS
-#undef DISABLE_FILE
-#undef DISABLE_CPUINFO
+#undef SDL_AUDIO_DISABLED
+#undef SDL_CDROM_DISABLED
+#undef SDL_CPUINFO_DISABLED
+#undef SDL_EVENTS_DISABLED
+#undef SDL_FILE_DISABLED
+#undef SDL_JOYSTICK_DISABLED
+#undef SDL_LOADSO_DISABLED
+#undef SDL_THREADS_DISABLED
+#undef SDL_TIMERS_DISABLED
+#undef SDL_VIDEO_DISABLED
+
+/* Enable various audio drivers */
+#undef SDL_AUDIO_DRIVER_AHI
+#undef SDL_AUDIO_DRIVER_ALSA
+#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#undef SDL_AUDIO_DRIVER_ARTS
+#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
+#undef SDL_AUDIO_DRIVER_BAUDIO
+#undef SDL_AUDIO_DRIVER_COREAUDIO
+#undef SDL_AUDIO_DRIVER_DART
+#undef SDL_AUDIO_DRIVER_DC
+#undef SDL_AUDIO_DRIVER_DISK
+#undef SDL_AUDIO_DRIVER_DMEDIA
+#undef SDL_AUDIO_DRIVER_DRENDERER
+#undef SDL_AUDIO_DRIVER_DSOUND
+#undef SDL_AUDIO_DRIVER_ESD
+#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#undef SDL_AUDIO_DRIVER_MINT
+#undef SDL_AUDIO_DRIVER_MMEAUDIO
+#undef SDL_AUDIO_DRIVER_NAS
+#undef SDL_AUDIO_DRIVER_OPENBSD
+#undef SDL_AUDIO_DRIVER_OSS
+#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
+#undef SDL_AUDIO_DRIVER_PAUD
+#undef SDL_AUDIO_DRIVER_QNXNTO
+#undef SDL_AUDIO_DRIVER_SNDMGR
+#undef SDL_AUDIO_DRIVER_SUNAUDIO
+#undef SDL_AUDIO_DRIVER_WAVEOUT
+
+/* Enable various cdrom drivers */
+#undef SDL_CDROM_AIX
+#undef SDL_CDROM_BEOS
+#undef SDL_CDROM_BSDI
+#undef SDL_CDROM_DC
+#undef SDL_CDROM_DUMMY
+#undef SDL_CDROM_FREEBSD
+#undef SDL_CDROM_LINUX
+#undef SDL_CDROM_MACOS
+#undef SDL_CDROM_MACOSX
+#undef SDL_CDROM_MINT
+#undef SDL_CDROM_OPENBSD
+#undef SDL_CDROM_OS2
+#undef SDL_CDROM_OSF
+#undef SDL_CDROM_QNX
+#undef SDL_CDROM_WIN32
+
+/* Enable various input drivers */
+#undef SDL_INPUT_TSLIB
+#undef SDL_JOYSTICK_AMIGA
+#undef SDL_JOYSTICK_BEOS
+#undef SDL_JOYSTICK_DC
+#undef SDL_JOYSTICK_DUMMY
+#undef SDL_JOYSTICK_IOKIT
+#undef SDL_JOYSTICK_LINUX
+#undef SDL_JOYSTICK_LINUXEV
+#undef SDL_JOYSTICK_MACOS
+#undef SDL_JOYSTICK_MINT
+#undef SDL_JOYSTICK_OS2
+#undef SDL_JOYSTICK_RISCOS
+#undef SDL_JOYSTICK_WINMM
+#undef SDL_JOYSTICK_USBHID
+
+/* Enable various shared object loading systems */
+#undef SDL_LOADSO_BEOS
+#undef SDL_LOADSO_DLCOMPAT
+#undef SDL_LOADSO_DLOPEN
+#undef SDL_LOADSO_LDG
+#undef SDL_LOADSO_MACOS
+#undef SDL_LOADSO_OS2
+#undef SDL_LOADSO_WIN32
+
+/* Enable various threading systems */
+#undef SDL_THREAD_AMIGA
+#undef SDL_THREAD_BEOS
+#undef SDL_THREAD_DC
+#undef SDL_THREAD_EPOC
+#undef SDL_THREAD_OS2
+#undef SDL_THREAD_PTH
+#undef SDL_THREAD_PTHREAD
+#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
+#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
+#undef SDL_THREAD_SPROC
+#undef SDL_THREAD_WIN32
+
+/* Enable various timer systems */
+#undef SDL_TIMER_AMIGA
+#undef SDL_TIMER_BEOS
+#undef SDL_TIMER_DC
+#undef SDL_TIMER_EPOC
+#undef SDL_TIMER_MACOS
+#undef SDL_TIMER_MINT
+#undef SDL_TIMER_OS2
+#undef SDL_TIMER_RISCOS
+#undef SDL_TIMER_UNIX
+#undef SDL_TIMER_WIN32
+#undef SDL_TIMER_WINCE
+
+/* Enable various video drivers */
+#undef SDL_VIDEO_DRIVER_AALIB
+#undef SDL_VIDEO_DRIVER_BWINDOW
+#undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
+#undef SDL_VIDEO_DRIVER_DC
+#undef SDL_VIDEO_DRIVER_DDRAW
+#undef SDL_VIDEO_DRIVER_DGA
+#undef SDL_VIDEO_DRIVER_DIRECTFB
+#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
+#undef SDL_VIDEO_DRIVER_DUMMY
+#undef SDL_VIDEO_DRIVER_EPOC
+#undef SDL_VIDEO_DRIVER_FBCON
+#undef SDL_VIDEO_DRIVER_GAPI
+#undef SDL_VIDEO_DRIVER_GEM
+#undef SDL_VIDEO_DRIVER_GGI
+#undef SDL_VIDEO_DRIVER_IPOD
+#undef SDL_VIDEO_DRIVER_NANOX
+#undef SDL_VIDEO_DRIVER_OS2FS
+#undef SDL_VIDEO_DRIVER_PHOTON
+#undef SDL_VIDEO_DRIVER_PICOGUI
+#undef SDL_VIDEO_DRIVER_PS2GS
+#undef SDL_VIDEO_DRIVER_QTOPIA
+#undef SDL_VIDEO_DRIVER_QUARTZ
+#undef SDL_VIDEO_DRIVER_RISCOS
+#undef SDL_VIDEO_DRIVER_SVGALIB
+#undef SDL_VIDEO_DRIVER_TOOLBOX
+#undef SDL_VIDEO_DRIVER_VGL
+#undef SDL_VIDEO_DRIVER_WINDIB
+#undef SDL_VIDEO_DRIVER_WSCONS
+#undef SDL_VIDEO_DRIVER_X11
+#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
+#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
+#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
+#undef SDL_VIDEO_DRIVER_X11_VIDMODE
+#undef SDL_VIDEO_DRIVER_X11_XINERAMA
+#undef SDL_VIDEO_DRIVER_X11_XME
+#undef SDL_VIDEO_DRIVER_X11_XV
+#undef SDL_VIDEO_DRIVER_XBIOS
+
+/* Enable OpenGL support */
+#undef SDL_VIDEO_OPENGL
+#undef SDL_VIDEO_OPENGL_GLX
+#undef SDL_VIDEO_OPENGL_WGL
+#undef SDL_VIDEO_OPENGL_OSMESA
+#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
+
+/* Enable assembly blit routines */
+#undef SDL_ASSEMBLY_BLITTERS
+#undef SDL_HERMES_BLITTERS
+#undef SDL_ALTIVEC_BLITTERS
 
 #endif /* _SDL_config_h */
--- a/include/SDL_error.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/include/SDL_error.h	Thu Feb 16 10:11:48 2006 +0000
@@ -40,11 +40,13 @@
 
 /* Private error message function - used internally */
 #define SDL_OutOfMemory()	SDL_Error(SDL_ENOMEM)
+#define SDL_Unsupported()	SDL_Error(SDL_UNSUPPORTED)
 typedef enum {
 	SDL_ENOMEM,
 	SDL_EFREAD,
 	SDL_EFWRITE,
 	SDL_EFSEEK,
+	SDL_UNSUPPORTED,
 	SDL_LASTERROR
 } SDL_errorcode;
 extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
--- a/include/SDL_stdinc.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/include/SDL_stdinc.h	Thu Feb 16 10:11:48 2006 +0000
@@ -55,14 +55,13 @@
 #else
 # if HAVE_STDLIB_H
 # include <stdlib.h>
+# elif HAVE_MALLOC_H
+# include <malloc.h>
 # endif
 # if HAVE_STDARG_H
 # include <stdarg.h>
 # endif
 #endif
-#if HAVE_MALLOC_H
-# include <malloc.h>
-#endif
 #if HAVE_STRING_H
 # if !STDC_HEADERS && HAVE_MEMORY_H
 # include <memory.h>
--- a/include/SDL_syswm.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/include/SDL_syswm.h	Thu Feb 16 10:11:48 2006 +0000
@@ -45,18 +45,13 @@
 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
 #else
 
+/* This is the structure for custom window manager events */
+#if SDL_VIDEO_DRIVER_X11
 #if defined(__APPLE__) && defined(__MACH__)
 // conflicts with Quickdraw.h
 #define Cursor X11Cursor
 #endif
 
-/* This is the structure for custom window manager events */
-#if (defined(unix) || defined(__unix__) || defined(_AIX) || \
-         defined(__OpenBSD__) || defined(__NetBSD__) || \
-         (defined(__APPLE__) && defined(__MACH__))) && \
-    (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX) && \
-         !defined(__QNXNTO__))
- /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 
@@ -105,7 +100,7 @@
 	} info;
 } SDL_SysWMinfo;
 
-#elif defined(ENABLE_NANOX)
+#elif SDL_VIDEO_DRIVER_NANOX
 #include <microwin/nano-X.h>
 
 /* The generic custom event structure */
@@ -120,7 +115,7 @@
 	GR_WINDOW_ID window ;	/* The display window */
 } SDL_SysWMinfo;
 
-#elif defined(WIN32)
+#elif SDL_VIDEO_DRIVER_WINDIB || SDL_VIDEO_DRIVER_DDRAW
 #include "SDL_windows.h"
 
 /* The windows custom event structure */
@@ -139,7 +134,7 @@
 	HGLRC hglrc;			/* The OpenGL context, if any */
 } SDL_SysWMinfo;
 
-#elif defined(__riscos__)
+#elif SDL_VIDEO_DRIVER_RISCOS
 
 /* RISC OS custom event structure */
 struct SDL_SysWMmsg {
@@ -156,7 +151,7 @@
 	int window;		/* The RISC OS display window */
 } SDL_SysWMinfo;
 
-#elif defined(__QNXNTO__)
+#elif SDL_VIDEO_DRIVER_PHOTON
 #include <sys/neutrino.h>
 #include <Ph.h>
 
@@ -186,7 +181,7 @@
 	int data;
 } SDL_SysWMinfo;
 
-#endif /* OS type */
+#endif /* video driver type */
 
 #endif /* SDL_PROTOTYPES_ONLY */
 
--- a/ltmain.sh	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6457 +0,0 @@
-# Based on libtool-1.5.8
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
-# Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.5.8
-TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
-  setopt NO_GLOB_SUBST
-fi
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell, and then maybe $echo will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
-  SP2NL="tr '\100' '\n'"
-  NL2SP="tr '\r\n' '\100\100'"
-  ;;
- *) # Assume ASCII based system
-  SP2NL="tr '\040' '\012'"
-  NL2SP="tr '\015\012' '\040\040'"
-  ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
-  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
-  save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-# Make sure IFS has a sensible default
-: ${IFS=" 	
-"}
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-  $echo "$modename: not configured to build any kind of library" 1>&2
-  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-  exit $EXIT_FAILURE
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid () {
-  win32_libid_type="unknown"
-  win32_fileres=`file -L $1 2>/dev/null`
-  case $win32_fileres in
-  *ar\ archive\ import\ library*) # definitely import
-    win32_libid_type="x86 archive import"
-    ;;
-  *ar\ archive*) # could be an import, or static
-    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
-      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 | \
-	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
-      if test "X$win32_nmres" = "Ximport" ; then
-        win32_libid_type="x86 archive import"
-      else
-        win32_libid_type="x86 archive static"
-      fi
-    fi
-    ;;
-  *DLL*)
-    win32_libid_type="x86 DLL"
-    ;;
-  *executable*) # but shell scripts are "executable" too...
-    case $win32_fileres in
-    *MS\ Windows\ PE\ Intel*)
-      win32_libid_type="x86 DLL"
-      ;;
-    esac
-    ;;
-  esac
-  $echo $win32_libid_type
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag () {
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-	case $arg in
-	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	CC_quoted="$CC_quoted $arg"
-      done
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-	for z in $available_tags; do
-	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-	    CC_quoted=
-	    for arg in $CC; do
-	    # Double-quote args containing other shell metacharacters.
-	    case $arg in
-	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	      arg="\"$arg\""
-	      ;;
-	    esac
-	    CC_quoted="$CC_quoted $arg"
-	  done
-	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
-	      # The compiler in the base compile command matches
-	      # the one in the tagged configuration.
-	      # Assume this is the tagged configuration we want.
-	      tagname=$z
-	      break
-	      ;;
-	    esac
-	  fi
-	done
-	# If $tagname still isn't set, then no tagged configuration
-	# was found and let the user know that the "--tag" command
-	# line option must be used.
-	if test -z "$tagname"; then
-	  $echo "$modename: unable to infer tagged configuration"
-	  $echo "$modename: specify a tag with \`--tag'" 1>&2
-	  exit $EXIT_FAILURE
-#        else
-#          $echo "$modename: using $tagname tagged configuration"
-	fi
-	;;
-      esac
-    fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives () {
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-    my_status=""
-
-    $show "${rm}r $my_gentop"
-    $run ${rm}r "$my_gentop"
-    $show "$mkdir $my_gentop"
-    $run $mkdir "$my_gentop"
-    my_status=$?
-    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
-      exit $my_status
-    fi
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-	*) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
-
-      $show "${rm}r $my_xdir"
-      $run ${rm}r "$my_xdir"
-      $show "$mkdir $my_xdir"
-      $run $mkdir "$my_xdir"
-      status=$?
-      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
-	exit $status
-      fi
-      case $host in
-      *-darwin*)
-	$show "Extracting $my_xabs"
-	# Do not bother doing anything if just a dry run
-	if test -z "$run"; then
-	  darwin_orig_dir=`pwd`
-	  cd $my_xdir || exit $?
-	  darwin_archive=$my_xabs
-	  darwin_curdir=`pwd`
-	  darwin_base_archive=`basename $darwin_archive`
-	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
-	  if test -n "$darwin_arches"; then 
-	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
-	    darwin_arch=
-	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      # Remove the table of contents from the thin files.
-	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
-	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      $AR -xo "${darwin_base_archive}"
-	      rm "${darwin_base_archive}"
-	      cd "$darwin_curdir"
-	    done # $darwin_arches
-      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
-	    darwin_file=
-	    darwin_files=
-	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
-	      lipo -create -output "$darwin_file" $darwin_files
-	    done # $darwin_filelist
-	    rm -rf unfat-$$
-	    cd "$darwin_orig_dir"
-	  else
-	    cd $darwin_orig_dir
-	    (cd $my_xdir && $AR x $my_xabs) || exit $?
-	  fi # $darwin_arches
-	fi # $run
-      ;;
-      *)
-	# We will extract separately just the conflicting names and we will
-	# no longer touch any unique names. It is faster to leave these
-	# extract automatically by $AR in one run.
-	$show "(cd $my_xdir && $AR x $my_xabs)"
-	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
-	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
-	  :
-	else
-	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
-	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
-	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
-	  do
-	    i=1
-	    while test "$i" -le "$count"
-	    do
-	      # Put our $i before any first dot (extension)
-	      # Never overwrite any file
-	      name_to="$name"
-	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
-	      do
-		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
-	      done
-	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
-	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
-	      i=`expr $i + 1`
-	    done
-	  done
-	fi
-	;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-    done
-
-    func_extract_archives_result="$my_oldobjs"
-}
-# End of Shell function definitions
-#####################################
-
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
-  arg="$1"
-  shift
-
-  case $arg in
-  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
-  esac
-
-  # If the previous option needs an argument, assign it.
-  if test -n "$prev"; then
-    case $prev in
-    execute_dlfiles)
-      execute_dlfiles="$execute_dlfiles $arg"
-      ;;
-    tag)
-      tagname="$arg"
-      preserve_args="${preserve_args}=$arg"
-
-      # Check whether tagname contains only valid characters
-      case $tagname in
-      *[!-_A-Za-z0-9,/]*)
-	$echo "$progname: invalid tag name: $tagname" 1>&2
-	exit $EXIT_FAILURE
-	;;
-      esac
-
-      case $tagname in
-      CC)
-	# Don't test for the "default" C tag, as we know, it's there, but
-	# not specially marked.
-	;;
-      *)
-	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
-	  taglist="$taglist $tagname"
-	  # Evaluate the configuration.
-	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
-	else
-	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
-	fi
-	;;
-      esac
-      ;;
-    *)
-      eval "$prev=\$arg"
-      ;;
-    esac
-
-    prev=
-    prevopt=
-    continue
-  fi
-
-  # Have we seen a non-optional argument yet?
-  case $arg in
-  --help)
-    show_help=yes
-    ;;
-
-  --version)
-    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
-    $echo
-    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
-    $echo "This is free software; see the source for copying conditions.  There is NO"
-    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-    exit $EXIT_SUCCESS
-    ;;
-
-  --config)
-    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
-    # Now print the configurations for the tags.
-    for tagname in $taglist; do
-      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
-    done
-    exit $EXIT_SUCCESS
-    ;;
-
-  --debug)
-    $echo "$progname: enabling shell trace mode"
-    set -x
-    preserve_args="$preserve_args $arg"
-    ;;
-
-  --dry-run | -n)
-    run=:
-    ;;
-
-  --features)
-    $echo "host: $host"
-    if test "$build_libtool_libs" = yes; then
-      $echo "enable shared libraries"
-    else
-      $echo "disable shared libraries"
-    fi
-    if test "$build_old_libs" = yes; then
-      $echo "enable static libraries"
-    else
-      $echo "disable static libraries"
-    fi
-    exit $EXIT_SUCCESS
-    ;;
-
-  --finish) mode="finish" ;;
-
-  --mode) prevopt="--mode" prev=mode ;;
-  --mode=*) mode="$optarg" ;;
-
-  --preserve-dup-deps) duplicate_deps="yes" ;;
-
-  --quiet | --silent)
-    show=:
-    preserve_args="$preserve_args $arg"
-    ;;
-
-  --tag) prevopt="--tag" prev=tag ;;
-  --tag=*)
-    set tag "$optarg" ${1+"$@"}
-    shift
-    prev=tag
-    preserve_args="$preserve_args --tag"
-    ;;
-
-  -dlopen)
-    prevopt="-dlopen"
-    prev=execute_dlfiles
-    ;;
-
-  -*)
-    $echo "$modename: unrecognized option \`$arg'" 1>&2
-    $echo "$help" 1>&2
-    exit $EXIT_FAILURE
-    ;;
-
-  *)
-    nonopt="$arg"
-    break
-    ;;
-  esac
-done
-
-if test -n "$prevopt"; then
-  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
-  $echo "$help" 1>&2
-  exit $EXIT_FAILURE
-fi
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
-  # Infer the operation mode.
-  if test -z "$mode"; then
-    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
-    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
-    case $nonopt in
-    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
-      mode=link
-      for arg
-      do
-	case $arg in
-	-c)
-	   mode=compile
-	   break
-	   ;;
-	esac
-      done
-      ;;
-    *db | *dbx | *strace | *truss)
-      mode=execute
-      ;;
-    *install*|cp|mv)
-      mode=install
-      ;;
-    *rm)
-      mode=uninstall
-      ;;
-    *)
-      # If we have no mode, but dlfiles were specified, then do execute mode.
-      test -n "$execute_dlfiles" && mode=execute
-
-      # Just use the default operation mode.
-      if test -z "$mode"; then
-	if test -n "$nonopt"; then
-	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
-	else
-	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
-	fi
-      fi
-      ;;
-    esac
-  fi
-
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
-    $echo "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$modename --help --mode=$mode' for more information."
-
-  # These modes are in order of execution frequency so that they run quickly.
-  case $mode in
-  # libtool compile mode
-  compile)
-    modename="$modename: compile"
-    # Get the compilation command and the source file.
-    base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
-    suppress_output=
-    arg_mode=normal
-    libobj=
-    later=
-
-    for arg
-    do
-      case "$arg_mode" in
-      arg  )
-	# do not "continue".  Instead, add this to base_compile
-	lastarg="$arg"
-	arg_mode=normal
-	;;
-
-      target )
-	libobj="$arg"
-	arg_mode=normal
-	continue
-	;;
-
-      normal )
-	# Accept any command-line options.
-	case $arg in
-	-o)
-	  if test -n "$libobj" ; then
-	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  arg_mode=target
-	  continue
-	  ;;
-
-	-static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
-	  continue
-	  ;;
-
-	-no-suppress)
-	  suppress_opt=no
-	  continue
-	  ;;
-
-	-Xcompiler)
-	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
-	  continue      #  The current "srcfile" will either be retained or
-	  ;;            #  replaced later.  I would guess that would be a bug.
-
-	-Wc,*)
-	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
-	  lastarg=
-	  save_ifs="$IFS"; IFS=','
- 	  for arg in $args; do
-	    IFS="$save_ifs"
-
-	    # Double-quote args containing other shell metacharacters.
-	    # Many Bourne shells cannot handle close brackets correctly
-	    # in scan sets, so we specify it separately.
-	    case $arg in
-	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	      arg="\"$arg\""
-	      ;;
-	    esac
-	    lastarg="$lastarg $arg"
-	  done
-	  IFS="$save_ifs"
-	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
-	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
-	  continue
-	  ;;
-
-	* )
-	  # Accept the current argument as the source file.
-	  # The previous "srcfile" becomes the current argument.
-	  #
-	  lastarg="$srcfile"
-	  srcfile="$arg"
-	  ;;
-	esac  #  case $arg
-	;;
-      esac    #  case $arg_mode
-
-      # Aesthetically quote the previous argument.
-      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
-      case $lastarg in
-      # Double-quote args containing other shell metacharacters.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	lastarg="\"$lastarg\""
-	;;
-      esac
-
-      base_compile="$base_compile $lastarg"
-    done # for arg
-
-    case $arg_mode in
-    arg)
-      $echo "$modename: you must specify an argument for -Xcompile"
-      exit $EXIT_FAILURE
-      ;;
-    target)
-      $echo "$modename: you must specify a target with \`-o'" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    *)
-      # Get the name of the library object.
-      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
-      ;;
-    esac
-
-    # Recognize several different file suffixes.
-    # If the user specifies -o file.o, it is replaced with file.lo
-    xform='[cCFSifmso]'
-    case $libobj in
-    *.ada) xform=ada ;;
-    *.adb) xform=adb ;;
-    *.ads) xform=ads ;;
-    *.asm) xform=asm ;;
-    *.c++) xform=c++ ;;
-    *.cc) xform=cc ;;
-    *.ii) xform=ii ;;
-    *.class) xform=class ;;
-    *.cpp) xform=cpp ;;
-    *.cxx) xform=cxx ;;
-    *.f90) xform=f90 ;;
-    *.for) xform=for ;;
-    *.java) xform=java ;;
-    esac
-
-    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
-    case $libobj in
-    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
-    *)
-      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    esac
-
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -static)
-	build_old_libs=yes
-	continue
-	;;
-
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
-
-      -prefer-non-pic)
-	pic_mode=no
-	continue
-	;;
-      esac
-    done
-
-    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
-    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-    if test "X$xdir" = "X$obj"; then
-      xdir=
-    else
-      xdir=$xdir/
-    fi
-    lobj=${xdir}$objdir/$objname
-
-    if test -z "$base_compile"; then
-      $echo "$modename: you must specify a compilation command" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
-      removelist="$obj $lobj $libobj ${libobj}T"
-    else
-      removelist="$lobj $libobj ${libobj}T"
-    fi
-
-    $run $rm $removelist
-    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-
-    # On Cygwin there's no "real" PIC flag so we must build both object types
-    case $host_os in
-    cygwin* | mingw* | pw32* | os2*)
-      pic_mode=default
-      ;;
-    esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
-      # non-PIC code in shared libraries is not supported
-      pic_mode=default
-    fi
-
-    # Calculate the filename of the output object if compiler does
-    # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
-      removelist="$removelist $output_obj $lockfile"
-      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-    else
-      output_obj=
-      need_locks=no
-      lockfile=
-    fi
-
-    # Lock this critical section if it is needed
-    # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
-      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
-	$show "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    elif test "$need_locks" = warn; then
-      if test -f "$lockfile"; then
-	$echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-      $echo $srcfile > "$lockfile"
-    fi
-
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
-
-    $run $rm "$libobj" "${libobj}T"
-
-    # Create a libtool object file (analogous to a ".la" file),
-    # but don't create it if we're doing a dry run.
-    test -z "$run" && cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
-    # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
-      # Without this assignment, base_compile gets emptied.
-      fbsd_hideous_sh_bug=$base_compile
-
-      if test "$pic_mode" != no; then
-	command="$base_compile $srcfile $pic_flag"
-      else
-	# Don't build PIC code
-	command="$base_compile $srcfile"
-      fi
-
-      if test ! -d "${xdir}$objdir"; then
-	$show "$mkdir ${xdir}$objdir"
-	$run $mkdir ${xdir}$objdir
-	status=$?
-	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
-	  exit $status
-	fi
-      fi
-
-      if test -z "$output_obj"; then
-	# Place PIC objects in $objdir
-	command="$command -o $lobj"
-      fi
-
-      $run $rm "$lobj" "$output_obj"
-
-      $show "$command"
-      if $run eval "$command"; then :
-      else
-	test -n "$output_obj" && $run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed, then go on to compile the next one
-      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-	$show "$mv $output_obj $lobj"
-	if $run $mv $output_obj $lobj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
-
-      # Append the name of the PIC object to the libtool object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
-      # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-        suppress_output=' >/dev/null 2>&1'
-      fi
-    else
-      # No PIC object so indicate it doesn't exist in the libtool
-      # object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
-    fi
-
-    # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
-	# Don't build PIC code
-	command="$base_compile $srcfile"
-      else
-	command="$base_compile $srcfile $pic_flag"
-      fi
-      if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
-      fi
-
-      # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
-      $run $rm "$obj" "$output_obj"
-      $show "$command"
-      if $run eval "$command"; then :
-      else
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed
-      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-	$show "$mv $output_obj $obj"
-	if $run $mv $output_obj $obj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
-
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
-    else
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
-    fi
-
-    $run $mv "${libobj}T" "${libobj}"
-
-    # Unlock the critical section if it was locked
-    if test "$need_locks" != no; then
-      $run $rm "$lockfile"
-    fi
-
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool link mode
-  link | relink)
-    modename="$modename: link"
-    case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-      # It is impossible to link a dll without this setting, and
-      # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
-      # flag for every libtool invocation.
-      # allow_undefined=no
-
-      # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
-      # even a static library is built.  For now, we need to specify
-      # -no-undefined on the libtool link line when we can be certain
-      # that all symbols are satisfied, otherwise we get a static library.
-      allow_undefined=yes
-      ;;
-    *)
-      allow_undefined=yes
-      ;;
-    esac
-    libtool_args="$nonopt"
-    base_compile="$nonopt $@"
-    compile_command="$nonopt"
-    finalize_command="$nonopt"
-
-    compile_rpath=
-    finalize_rpath=
-    compile_shlibpath=
-    finalize_shlibpath=
-    convenience=
-    old_convenience=
-    deplibs=
-    old_deplibs=
-    compiler_flags=
-    linker_flags=
-    dllsearchpath=
-    lib_search_path=`pwd`
-    inst_prefix_dir=
-
-    avoid_version=no
-    dlfiles=
-    dlprefiles=
-    dlself=no
-    export_dynamic=no
-    export_symbols=
-    export_symbols_regex=
-    generated=
-    libobjs=
-    ltlibs=
-    module=no
-    no_install=no
-    objs=
-    non_pic_objects=
-    precious_files_regex=
-    prefer_static_libs=no
-    preload=no
-    prev=
-    prevarg=
-    release=
-    rpath=
-    xrpath=
-    perm_rpath=
-    temp_rpath=
-    thread_safe=no
-    vinfo=
-    vinfo_number=no
-
-    func_infer_tag $base_compile
-
-    # We need to know -static, to get the right output filenames.
-    for arg
-    do
-      case $arg in
-      -all-static | -static)
-	if test "X$arg" = "X-all-static"; then
-	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
-	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
-	  fi
-	  if test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	else
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	fi
-	build_libtool_libs=no
-	build_old_libs=yes
-	prefer_static_libs=yes
-	break
-	;;
-      esac
-    done
-
-    # See if our shared archives depend on static archives.
-    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
-    # Go through the arguments, transforming them on the way.
-    while test "$#" -gt 0; do
-      arg="$1"
-      shift
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
-	;;
-      *) qarg=$arg ;;
-      esac
-      libtool_args="$libtool_args $qarg"
-
-      # If the previous option needs an argument, assign it.
-      if test -n "$prev"; then
-	case $prev in
-	output)
-	  compile_command="$compile_command @OUTPUT@"
-	  finalize_command="$finalize_command @OUTPUT@"
-	  ;;
-	esac
-
-	case $prev in
-	dlfiles|dlprefiles)
-	  if test "$preload" = no; then
-	    # Add the symbol object into the linking commands.
-	    compile_command="$compile_command @SYMFILE@"
-	    finalize_command="$finalize_command @SYMFILE@"
-	    preload=yes
-	  fi
-	  case $arg in
-	  *.la | *.lo) ;;  # We handle these cases below.
-	  force)
-	    if test "$dlself" = no; then
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  self)
-	    if test "$prev" = dlprefiles; then
-	      dlself=yes
-	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
-	      dlself=yes
-	    else
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  *)
-	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
-	    else
-	      dlprefiles="$dlprefiles $arg"
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  esac
-	  ;;
-	expsyms)
-	  export_symbols="$arg"
-	  if test ! -f "$arg"; then
-	    $echo "$modename: symbol file \`$arg' does not exist"
-	    exit $EXIT_FAILURE
-	  fi
-	  prev=
-	  continue
-	  ;;
-	expsyms_regex)
-	  export_symbols_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	inst_prefix)
-	  inst_prefix_dir="$arg"
-	  prev=
-	  continue
-	  ;;
-	precious_regex)
-	  precious_files_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	release)
-	  release="-$arg"
-	  prev=
-	  continue
-	  ;;
-	objectlist)
-	  if test -f "$arg"; then
-	    save_arg=$arg
-	    moreargs=
-	    for fil in `cat $save_arg`
-	    do
-#	      moreargs="$moreargs $fil"
-	      arg=$fil
-	      # A libtool-controlled object.
-
-	      # Check to see that this really is a libtool object.
-	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-		pic_object=
-		non_pic_object=
-
-		# Read the .lo file
-		# If there is no directory component, then add one.
-		case $arg in
-		*/* | *\\*) . $arg ;;
-		*) . ./$arg ;;
-		esac
-
-		if test -z "$pic_object" || \
-		   test -z "$non_pic_object" ||
-		   test "$pic_object" = none && \
-		   test "$non_pic_object" = none; then
-		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-		  exit $EXIT_FAILURE
-		fi
-
-		# Extract subdirectory from the argument.
-		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-		if test "X$xdir" = "X$arg"; then
-		  xdir=
-		else
-		  xdir="$xdir/"
-		fi
-
-		if test "$pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  pic_object="$xdir$pic_object"
-
-		  if test "$prev" = dlfiles; then
-		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
-		      prev=
-		      continue
-		    else
-		      # If libtool objects are unsupported, then we need to preload.
-		      prev=dlprefiles
-		    fi
-		  fi
-
-		  # CHECK ME:  I think I busted this.  -Ossama
-		  if test "$prev" = dlprefiles; then
-		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
-		    prev=
-		  fi
-
-		  # A PIC object.
-		  libobjs="$libobjs $pic_object"
-		  arg="$pic_object"
-		fi
-
-		# Non-PIC object.
-		if test "$non_pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  non_pic_object="$xdir$non_pic_object"
-
-		  # A standard non-PIC object
-		  non_pic_objects="$non_pic_objects $non_pic_object"
-		  if test -z "$pic_object" || test "$pic_object" = none ; then
-		    arg="$non_pic_object"
-		  fi
-		fi
-	      else
-		# Only an error if not doing a dry-run.
-		if test -z "$run"; then
-		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-		  exit $EXIT_FAILURE
-		else
-		  # Dry-run case.
-
-		  # Extract subdirectory from the argument.
-		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-		  if test "X$xdir" = "X$arg"; then
-		    xdir=
-		  else
-		    xdir="$xdir/"
-		  fi
-
-		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
-		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
-		  libobjs="$libobjs $pic_object"
-		  non_pic_objects="$non_pic_objects $non_pic_object"
-		fi
-	      fi
-	    done
-	  else
-	    $echo "$modename: link input file \`$save_arg' does not exist"
-	    exit $EXIT_FAILURE
-	  fi
-	  arg=$save_arg
-	  prev=
-	  continue
-	  ;;
-	rpath | xrpath)
-	  # We need an absolute path.
-	  case $arg in
-	  [\\/]* | [A-Za-z]:[\\/]*) ;;
-	  *)
-	    $echo "$modename: only absolute run-paths are allowed" 1>&2
-	    exit $EXIT_FAILURE
-	    ;;
-	  esac
-	  if test "$prev" = rpath; then
-	    case "$rpath " in
-	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
-	    esac
-	  else
-	    case "$xrpath " in
-	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
-	    esac
-	  fi
-	  prev=
-	  continue
-	  ;;
-	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  compile_command="$compile_command $qarg"
-	  finalize_command="$finalize_command $qarg"
-	  continue
-	  ;;
-	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
-	  prev=
-	  compile_command="$compile_command $wl$qarg"
-	  finalize_command="$finalize_command $wl$qarg"
-	  continue
-	  ;;
-	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  compile_command="$compile_command $qarg"
-	  finalize_command="$finalize_command $qarg"
-	  continue
-	  ;;
-	framework)
-	  case $host in
-	    *-*-darwin*)
-	      case "$deplibs " in
-	        *" $qarg.framework "*) ;;
-		*) deplibs="$deplibs $qarg.framework" # this is fixed later
-		   ;;
-              esac
-              ;;
-   	  esac
- 	  prev=
- 	  continue
- 	  ;;
-	shrext)
-  	  shrext_cmds="$arg"
-	  prev=
-	  continue
-	  ;;
-	*)
-	  eval "$prev=\"\$arg\""
-	  prev=
-	  continue
-	  ;;
-	esac
-      fi # test -n "$prev"
-
-      prevarg="$arg"
-
-      case $arg in
-      -all-static)
-	if test -n "$link_static_flag"; then
-	  compile_command="$compile_command $link_static_flag"
-	  finalize_command="$finalize_command $link_static_flag"
-	fi
-	continue
-	;;
-
-      -allow-undefined)
-	# FIXME: remove this flag sometime in the future.
-	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
-	continue
-	;;
-
-      -avoid-version)
-	avoid_version=yes
-	continue
-	;;
-
-      -dlopen)
-	prev=dlfiles
-	continue
-	;;
-
-      -dlpreopen)
-	prev=dlprefiles
-	continue
-	;;
-
-      -export-dynamic)
-	export_dynamic=yes
-	continue
-	;;
-
-      -export-symbols | -export-symbols-regex)
-	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	  $echo "$modename: more than one -exported-symbols argument is not allowed"
-	  exit $EXIT_FAILURE
-	fi
-	if test "X$arg" = "X-export-symbols"; then
-	  prev=expsyms
-	else
-	  prev=expsyms_regex
-	fi
-	continue
-	;;
-
-      -inst-prefix-dir)
-	prev=inst_prefix
-	continue
-	;;
-
-      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
-      # so, if we see these flags be careful not to treat them like -L
-      -L[A-Z][A-Z]*:*)
-	case $with_gcc/$host in
-	no/*-*-irix* | /*-*-irix*)
-	  compile_command="$compile_command $arg"
-	  finalize_command="$finalize_command $arg"
-	  ;;
-	esac
-	continue
-	;;
-
-      -L*)
-	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  absdir=`cd "$dir" && pwd`
-	  if test -z "$absdir"; then
-	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  dir="$absdir"
-	  ;;
-	esac
-	case "$deplibs " in
-	*" -L$dir "*) ;;
-	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
-	  ;;
-	esac
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  case :$dllsearchpath: in
-	  *":$dir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
-	  esac
-	  ;;
-	esac
-	continue
-	;;
-
-      -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-	  case $host in
-	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
-	    # These systems don't actually have a C or math library (as such)
-	    continue
-	    ;;
-	  *-*-mingw* | *-*-os2*)
-	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-openbsd* | *-*-freebsd*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs -framework System"
-	    continue
-	  esac
-	elif test "X$arg" = "X-lc_r"; then
-	 case $host in
-	 *-*-openbsd* | *-*-freebsd*)
-	   # Do not include libc_r directly, use -pthread flag.
-	   continue
-	   ;;
-	 esac
-	fi
-	deplibs="$deplibs $arg"
-	continue
-	;;
-
-     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
-	deplibs="$deplibs $arg"
-	continue
-	;;
-
-      -module)
-	module=yes
-	continue
-	;;
-
-      # gcc -m* arguments should be passed to the linker via $compiler_flags
-      # in order to pass architecture information to the linker
-      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
-      # but this is not reliable with gcc because gcc may use -mfoo to
-      # select a different linker, different libraries, etc, while
-      # -Wl,-mfoo simply passes -mfoo to the linker.
-      -m*)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-        compile_command="$compile_command $arg"
-        finalize_command="$finalize_command $arg"
-        if test "$with_gcc" = "yes" ; then
-          compiler_flags="$compiler_flags $arg"
-        fi
-        continue
-        ;;
-
-      -shrext)
-	prev=shrext
-	continue
-	;;
-
-      -no-fast-install)
-	fast_install=no
-	continue
-	;;
-
-      -no-install)
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  # The PATH hackery in wrapper scripts is required on Windows
-	  # in order for the loader to find any dlls it needs.
-	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
-	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
-	  fast_install=no
-	  ;;
-	*) no_install=yes ;;
-	esac
-	continue
-	;;
-
-      -no-undefined)
-	allow_undefined=no
-	continue
-	;;
-
-      -objectlist)
-	prev=objectlist
-	continue
-	;;
-
-      -o) prev=output ;;
-
-      -precious-files-regex)
-	prev=precious_regex
-	continue
-	;;
-
-      -release)
-	prev=release
-	continue
-	;;
-
-      -rpath)
-	prev=rpath
-	continue
-	;;
-
-      -R)
-	prev=xrpath
-	continue
-	;;
-
-      -R*)
-	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  $echo "$modename: only absolute run-paths are allowed" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-	case "$xrpath " in
-	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
-	esac
-	continue
-	;;
-
-      -static)
-	# The effects of -static are defined in a previous loop.
-	# We used to do the same as -all-static on platforms that
-	# didn't have a PIC flag, but the assumption that the effects
-	# would be equivalent was wrong.  It would break on at least
-	# Digital Unix and AIX.
-	continue
-	;;
-
-      -thread-safe)
-	thread_safe=yes
-	continue
-	;;
-
-      -version-info)
-	prev=vinfo
-	continue
-	;;
-      -version-number)
-	prev=vinfo
-	vinfo_number=yes
-	continue
-	;;
-
-      -Wc,*)
-	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-	  case $flag in
-	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	    flag="\"$flag\""
-	    ;;
-	  esac
-	  arg="$arg $wl$flag"
-	  compiler_flags="$compiler_flags $flag"
-	done
-	IFS="$save_ifs"
-	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
-	;;
-
-      -Wl,*)
-	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-	  case $flag in
-	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	    flag="\"$flag\""
-	    ;;
-	  esac
-	  arg="$arg $wl$flag"
-	  compiler_flags="$compiler_flags $wl$flag"
-	  linker_flags="$linker_flags $flag"
-	done
-	IFS="$save_ifs"
-	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
-	;;
-
-      -Xcompiler)
-	prev=xcompiler
-	continue
-	;;
-
-      -Xlinker)
-	prev=xlinker
-	continue
-	;;
-
-      -XCClinker)
-	prev=xcclinker
-	continue
-	;;
-
-      -framework)
-        prev=framework
-	continue
-	;;
-
-      # Some other compiler flag.
-      -* | +*)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	;;
-
-      *.$objext)
-	# A standard object.
-	objs="$objs $arg"
-	;;
-
-      *.lo)
-	# A libtool-controlled object.
-
-	# Check to see that this really is a libtool object.
-	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  pic_object=
-	  non_pic_object=
-
-	  # Read the .lo file
-	  # If there is no directory component, then add one.
-	  case $arg in
-	  */* | *\\*) . $arg ;;
-	  *) . ./$arg ;;
-	  esac
-
-	  if test -z "$pic_object" || \
-	     test -z "$non_pic_object" ||
-	     test "$pic_object" = none && \
-	     test "$non_pic_object" = none; then
-	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  # Extract subdirectory from the argument.
-	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-	  if test "X$xdir" = "X$arg"; then
-	    xdir=
- 	  else
-	    xdir="$xdir/"
-	  fi
-
-	  if test "$pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    pic_object="$xdir$pic_object"
-
-	    if test "$prev" = dlfiles; then
-	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
-		prev=
-		continue
-	      else
-		# If libtool objects are unsupported, then we need to preload.
-		prev=dlprefiles
-	      fi
-	    fi
-
-	    # CHECK ME:  I think I busted this.  -Ossama
-	    if test "$prev" = dlprefiles; then
-	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
-	      prev=
-	    fi
-
-	    # A PIC object.
-	    libobjs="$libobjs $pic_object"
-	    arg="$pic_object"
-	  fi
-
-	  # Non-PIC object.
-	  if test "$non_pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    non_pic_object="$xdir$non_pic_object"
-
-	    # A standard non-PIC object
-	    non_pic_objects="$non_pic_objects $non_pic_object"
-	    if test -z "$pic_object" || test "$pic_object" = none ; then
-	      arg="$non_pic_object"
-	    fi
-	  fi
-	else
-	  # Only an error if not doing a dry-run.
-	  if test -z "$run"; then
-	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-	    exit $EXIT_FAILURE
-	  else
-	    # Dry-run case.
-
-	    # Extract subdirectory from the argument.
-	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-	    if test "X$xdir" = "X$arg"; then
-	      xdir=
-	    else
-	      xdir="$xdir/"
-	    fi
-
-	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
-	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
-	    libobjs="$libobjs $pic_object"
-	    non_pic_objects="$non_pic_objects $non_pic_object"
-	  fi
-	fi
-	;;
-
-      *.$libext)
-	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
-	continue
-	;;
-
-      *.la)
-	# A libtool-controlled library.
-
-	if test "$prev" = dlfiles; then
-	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
-	  prev=
-	elif test "$prev" = dlprefiles; then
-	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
-	  prev=
-	else
-	  deplibs="$deplibs $arg"
-	fi
-	continue
-	;;
-
-      # Some other compiler argument.
-      *)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	;;
-      esac # arg
-
-      # Now actually substitute the argument into the commands.
-      if test -n "$arg"; then
-	compile_command="$compile_command $arg"
-	finalize_command="$finalize_command $arg"
-      fi
-    done # argument parsing loop
-
-    if test -n "$prev"; then
-      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
-      eval arg=\"$export_dynamic_flag_spec\"
-      compile_command="$compile_command $arg"
-      finalize_command="$finalize_command $arg"
-    fi
-
-    oldlibs=
-    # calculate the name of the file, without its directory
-    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
-    libobjs_save="$libobjs"
-
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      shlib_search_path=
-    fi
-    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
-    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
-    if test "X$output_objdir" = "X$output"; then
-      output_objdir="$objdir"
-    else
-      output_objdir="$output_objdir/$objdir"
-    fi
-    # Create the object directory.
-    if test ! -d "$output_objdir"; then
-      $show "$mkdir $output_objdir"
-      $run $mkdir $output_objdir
-      status=$?
-      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
-	exit $status
-      fi
-    fi
-
-    # Determine the type of output
-    case $output in
-    "")
-      $echo "$modename: you must specify an output file" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    *.$libext) linkmode=oldlib ;;
-    *.lo | *.$objext) linkmode=obj ;;
-    *.la) linkmode=lib ;;
-    *) linkmode=prog ;; # Anything else should be a program.
-    esac
-
-    case $host in
-    *cygwin* | *mingw* | *pw32*)
-      # don't eliminate duplications in $postdeps and $predeps
-      duplicate_compiler_generated_deps=yes
-      ;;
-    *)
-      duplicate_compiler_generated_deps=$duplicate_deps
-      ;;
-    esac
-    specialdeplibs=
-
-    libs=
-    # Find all interdependent deplibs by searching for libraries
-    # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
-      if test "X$duplicate_deps" = "Xyes" ; then
-	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	esac
-      fi
-      libs="$libs $deplib"
-    done
-
-    if test "$linkmode" = lib; then
-      libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
-      # Compute libraries that are listed more than once in $predeps
-      # $postdeps and mark them as special (i.e., whose duplicates are
-      # not to be eliminated).
-      pre_post_deps=
-      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
-	for pre_post_dep in $predeps $postdeps; do
-	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
-	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
-	done
-      fi
-      pre_post_deps=
-    fi
-
-    deplibs=
-    newdependency_libs=
-    newlib_search_path=
-    need_relink=no # whether we're linking any uninstalled libtool libraries
-    notinst_deplibs= # not-installed libtool libraries
-    notinst_path= # paths that contain not-installed libtool libraries
-    case $linkmode in
-    lib)
-	passes="conv link"
-	for file in $dlfiles $dlprefiles; do
-	  case $file in
-	  *.la) ;;
-	  *)
-	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
-	    exit $EXIT_FAILURE
-	    ;;
-	  esac
-	done
-	;;
-    prog)
-	compile_deplibs=
-	finalize_deplibs=
-	alldeplibs=no
-	newdlfiles=
-	newdlprefiles=
-	passes="conv scan dlopen dlpreopen link"
-	;;
-    *)  passes="conv"
-	;;
-    esac
-    for pass in $passes; do
-      if test "$linkmode,$pass" = "lib,link" ||
-	 test "$linkmode,$pass" = "prog,scan"; then
-	libs="$deplibs"
-	deplibs=
-      fi
-      if test "$linkmode" = prog; then
-	case $pass in
-	dlopen) libs="$dlfiles" ;;
-	dlpreopen) libs="$dlprefiles" ;;
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
-	esac
-      fi
-      if test "$pass" = dlopen; then
-	# Collect dlpreopened libraries
-	save_deplibs="$deplibs"
-	deplibs=
-      fi
-      for deplib in $libs; do
-	lib=
-	found=no
-	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    deplibs="$deplib $deplibs"
-	  fi
-	  continue
-	  ;;
-	-l*)
-	  if test "$linkmode" != lib && test "$linkmode" != prog; then
-	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
-	    continue
-	  fi
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	    continue
-	  fi
-	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
-	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
-	    for search_ext in .la $std_shrext .so .a; do
-	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
-	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
-		else
-		  found=no
-		fi
-		break 2
-	      fi
-	    done
-	  done
-	  if test "$found" != yes; then
-	    # deplib doesn't seem to be a libtool library
-	    if test "$linkmode,$pass" = "prog,link"; then
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      deplibs="$deplib $deplibs"
-	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    continue
-	  else # deplib is a libtool library
-	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
-	    # We need to do some special things here, and not later.
-	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	      case " $predeps $postdeps " in
-	      *" $deplib "*)
-		if (${SED} -e '2q' $lib |
-                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-		  library_names=
-		  old_library=
-		  case $lib in
-		  */* | *\\*) . $lib ;;
-		  *) . ./$lib ;;
-		  esac
-		  for l in $old_library $library_names; do
-		    ll="$l"
-		  done
-		  if test "X$ll" = "X$old_library" ; then # only static version available
-		    found=no
-		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
-		    test "X$ladir" = "X$lib" && ladir="."
-		    lib=$ladir/$old_library
-		    if test "$linkmode,$pass" = "prog,link"; then
-		      compile_deplibs="$deplib $compile_deplibs"
-		      finalize_deplibs="$deplib $finalize_deplibs"
-		    else
-		      deplibs="$deplib $deplibs"
-		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-		    fi
-		    continue
-		  fi
-		fi
-	        ;;
-	      *) ;;
-	      esac
-	    fi
-	  fi
-	  ;; # -l
-	*.framework)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    deplibs="$deplib $deplibs"
-	    if test "$linkmode" = lib ; then
-	      newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	  fi
-	  continue
-	  ;;
-	-L*)
-	  case $linkmode in
-	  lib)
-	    deplibs="$deplib $deplibs"
-	    test "$pass" = conv && continue
-	    newdependency_libs="$deplib $newdependency_libs"
-	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-	    ;;
-	  prog)
-	    if test "$pass" = conv; then
-	      deplibs="$deplib $deplibs"
-	      continue
-	    fi
-	    if test "$pass" = scan; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-	    ;;
-	  *)
-	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
-	    ;;
-	  esac # linkmode
-	  continue
-	  ;; # -L
-	-R*)
-	  if test "$pass" = link; then
-	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
-	    # Make sure the xrpath contains only unique directories.
-	    case "$xrpath " in
-	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
-	    esac
-	  fi
-	  deplibs="$deplib $deplibs"
-	  continue
-	  ;;
-	*.la) lib="$deplib" ;;
-	*.$libext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	    continue
-	  fi
-	  case $linkmode in
-	  lib)
-	    valid_a_lib=no
-	    case $deplibs_check_method in
-	      match_pattern*)
-		set dummy $deplibs_check_method
-	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-		if eval $echo \"$deplib\" 2>/dev/null \
-		    | $SED 10q \
-		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		  valid_a_lib=yes
-		fi
-		;;
-	      pass_all)
-		valid_a_lib=yes
-		;;
-            esac
-	    if test "$valid_a_lib" != yes; then
-	      $echo
-	      $echo "*** Warning: Trying to link with static lib archive $deplib."
-	      $echo "*** I have the capability to make that library automatically link in when"
-	      $echo "*** you link to this library.  But I can only do this if you have a"
-	      $echo "*** shared version of the library, which you do not appear to have"
-	      $echo "*** because the file extensions .$libext of this argument makes me believe"
-	      $echo "*** that it is just a static archive that I should not used here."
-	    else
-	      $echo
-	      $echo "*** Warning: Linking the shared library $output against the"
-	      $echo "*** static library $deplib is not portable!"
-	      deplibs="$deplib $deplibs"
-	    fi
-	    continue
-	    ;;
-	  prog)
-	    if test "$pass" != link; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    continue
-	    ;;
-	  esac # linkmode
-	  ;; # *.$libext
-	*.lo | *.$objext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	  elif test "$linkmode" = prog; then
-	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
-	      # If there is no dlopen support or we're linking statically,
-	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      newdlfiles="$newdlfiles $deplib"
-	    fi
-	  fi
-	  continue
-	  ;;
-	%DEPLIBS%)
-	  alldeplibs=yes
-	  continue
-	  ;;
-	esac # case $deplib
-	if test "$found" = yes || test -f "$lib"; then :
-	else
-	  $echo "$modename: cannot find the library \`$lib'" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$ladir" = "X$lib" && ladir="."
-
-	dlname=
-	dlopen=
-	dlpreopen=
-	libdir=
-	library_names=
-	old_library=
-	# If the library was installed with an old release of libtool,
-	# it will not redefine variables installed, or shouldnotlink
-	installed=yes
-	shouldnotlink=no
-
-	# Read the .la file
-	case $lib in
-	*/* | *\\*) . $lib ;;
-	*) . ./$lib ;;
-	esac
-
-	case $host in
-	*-*-darwin*)
-	  # Convert "-framework foo" to "foo.framework" in dependency_libs
-	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
-	  ;;
-	esac
-
-	if test "$linkmode,$pass" = "lib,link" ||
-	   test "$linkmode,$pass" = "prog,scan" ||
-	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
-	fi
-
-	if test "$pass" = conv; then
-	  # Only check for convenience libraries
-	  deplibs="$lib $deplibs"
-	  if test -z "$libdir"; then
-	    if test -z "$old_library"; then
-	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	      exit $EXIT_FAILURE
-	    fi
-	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
-	    tmp_libs=
-	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-              if test "X$duplicate_deps" = "Xyes" ; then
-	        case "$tmp_libs " in
-	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	        esac
-              fi
-	      tmp_libs="$tmp_libs $deplib"
-	    done
-	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
-	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  continue
-	fi # $pass = conv
-
-
-	# Get the name of the library we link against.
-	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
-	if test -z "$linklib"; then
-	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# This library was specified with -dlopen.
-	if test "$pass" = dlopen; then
-	  if test -z "$libdir"; then
-	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
-	    # If there is no dlname, no dlopen support or we're linking
-	    # statically, we need to preload.  We also need to preload any
-	    # dependent libraries so libltdl's deplib preloader doesn't
-	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
-	  else
-	    newdlfiles="$newdlfiles $lib"
-	  fi
-	  continue
-	fi # $pass = dlopen
-
-	# We need an absolute path.
-	case $ladir in
-	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
-	*)
-	  abs_ladir=`cd "$ladir" && pwd`
-	  if test -z "$abs_ladir"; then
-	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
-	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
-	    abs_ladir="$ladir"
-	  fi
-	  ;;
-	esac
-	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
-	# Find the relevant object directory and library name.
-	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    libdir="$abs_ladir"
-	  else
-	    dir="$libdir"
-	    absdir="$libdir"
-	  fi
-	else
-	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  fi
-	fi # $installed = yes
-	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
-	# This library was specified with -dlpreopen.
-	if test "$pass" = dlpreopen; then
-	  if test -z "$libdir"; then
-	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
-	fi # $pass = dlpreopen
-
-	if test -z "$libdir"; then
-	  # Link the convenience library
-	  if test "$linkmode" = lib; then
-	    deplibs="$dir/$old_library $deplibs"
-	  elif test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$dir/$old_library $compile_deplibs"
-	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
-	  else
-	    deplibs="$lib $deplibs" # used for prog,scan pass
-	  fi
-	  continue
-	fi
-
-
-	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
-	  deplibs="$lib $deplibs"
-
-	  linkalldeplibs=no
-	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
-	     test "$build_libtool_libs" = no; then
-	    linkalldeplibs=yes
-	  fi
-
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    case $deplib in
-	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
-	    esac
-	    # Need to link against all dependency_libs?
-	    if test "$linkalldeplibs" = yes; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      # Need to hardcode shared library paths
-	      # or/and link against static libraries
-	      newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    if test "X$duplicate_deps" = "Xyes" ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done # for deplib
-	  continue
-	fi # $linkmode = prog...
-
-	if test "$linkmode,$pass" = "prog,link"; then
-	  if test -n "$library_names" &&
-	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
-	    # We need to hardcode the library path
-	    if test -n "$shlibpath_var"; then
-	      # Make sure the rpath contains only unique directories.
-	      case "$temp_rpath " in
-	      *" $dir "*) ;;
-	      *" $absdir "*) ;;
-	      *) temp_rpath="$temp_rpath $dir" ;;
-	      esac
-	    fi
-
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi # $linkmode,$pass = prog,link...
-
-	  if test "$alldeplibs" = yes &&
-	     { test "$deplibs_check_method" = pass_all ||
-	       { test "$build_libtool_libs" = yes &&
-		 test -n "$library_names"; }; }; then
-	    # We only need to search for static libraries
-	    continue
-	  fi
-	fi
-
-	link_static=no # Whether the deplib will be linked statically
-	if test -n "$library_names" &&
-	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
-	  if test "$installed" = no; then
-	    notinst_deplibs="$notinst_deplibs $lib"
-	    need_relink=yes
-	  fi
-	  # This is a shared library
-
-	  # Warn about portability, can't link against -module's on
-	  # some systems (darwin)
-	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
-	    $echo
-	    if test "$linkmode" = prog; then
-	      $echo "*** Warning: Linking the executable $output against the loadable module"
-	    else
-	      $echo "*** Warning: Linking the shared library $output against the loadable module"
-	    fi
-	    $echo "*** $linklib is not portable!"
-	  fi
-	  if test "$linkmode" = lib &&
-	     test "$hardcode_into_libs" = yes; then
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi
-
-	  if test -n "$old_archive_from_expsyms_cmds"; then
-	    # figure out the soname
-	    set dummy $library_names
-	    realname="$2"
-	    shift; shift
-	    libname=`eval \\$echo \"$libname_spec\"`
-	    # use dlname if we got it. it's perfectly good, no?
-	    if test -n "$dlname"; then
-	      soname="$dlname"
-	    elif test -n "$soname_spec"; then
-	      # bleh windows
-	      case $host in
-	      *cygwin* | mingw*)
-		major=`expr $current - $age`
-		versuffix="-$major"
-		;;
-	      esac
-	      eval soname=\"$soname_spec\"
-	    else
-	      soname="$realname"
-	    fi
-
-	    # Make a new name for the extract_expsyms_cmds to use
-	    soroot="$soname"
-	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
-	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
-	    # If the library has no export list, then create one now
-	    if test -f "$output_objdir/$soname-def"; then :
-	    else
-	      $show "extracting exported symbol list from \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$extract_expsyms_cmds
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd" || exit $?
-	      done
-	      IFS="$save_ifs"
-	    fi
-
-	    # Create $newlib
-	    if test -f "$output_objdir/$newlib"; then :; else
-	      $show "generating import library for \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$old_archive_from_expsyms_cmds
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd" || exit $?
-	      done
-	      IFS="$save_ifs"
-	    fi
-	    # make sure the library variables are pointing to the new library
-	    dir=$output_objdir
-	    linklib=$newlib
-	  fi # test -n "$old_archive_from_expsyms_cmds"
-
-	  if test "$linkmode" = prog || test "$mode" != relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    lib_linked=yes
-	    case $hardcode_action in
-	    immediate | unsupported)
-	      if test "$hardcode_direct" = no; then
-		add="$dir/$linklib"
-		case $host in
-		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
-		  *-*-darwin* )
-		    # if the lib is a module then we can not link against
-		    # it, someone is ignoring the new warnings I added
-		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
-		      $echo "** Warning, lib $linklib is a module, not a shared library"
-		      if test -z "$old_library" ; then
-		        $echo
-		        $echo "** And there doesn't seem to be a static archive available"
-		        $echo "** The link will probably fail, sorry"
-		      else
-		        add="$dir/$old_library"
-		      fi
-		    fi
-		esac
-	      elif test "$hardcode_minus_L" = no; then
-		case $host in
-		*-*-sunos*) add_shlibpath="$dir" ;;
-		esac
-		add_dir="-L$dir"
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = no; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    relink)
-	      if test "$hardcode_direct" = yes; then
-		add="$dir/$linklib"
-	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
-		# Try looking first in the location we're being installed to.
-		if test -n "$inst_prefix_dir"; then
-		  case "$libdir" in
-		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		      ;;
-		  esac
-		fi
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = yes; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    *) lib_linked=no ;;
-	    esac
-
-	    if test "$lib_linked" != yes; then
-	      $echo "$modename: configuration error: unsupported hardcode properties"
-	      exit $EXIT_FAILURE
-	    fi
-
-	    if test -n "$add_shlibpath"; then
-	      case :$compile_shlibpath: in
-	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
-	      esac
-	    fi
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	      if test "$hardcode_direct" != yes && \
-		 test "$hardcode_minus_L" != yes && \
-		 test "$hardcode_shlibpath_var" = yes; then
-		case :$finalize_shlibpath: in
-		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-		esac
-	      fi
-	    fi
-	  fi
-
-	  if test "$linkmode" = prog || test "$mode" = relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    # Finalize command for both is simple: just hardcode it.
-	    if test "$hardcode_direct" = yes; then
-	      add="$libdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
-	      add="-l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
-	      case :$finalize_shlibpath: in
-	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-	      esac
-	      add="-l$name"
-	    elif test "$hardcode_automatic" = yes; then
-	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
-	        add="$inst_prefix_dir$libdir/$linklib"
-	      else
-	        add="$libdir/$linklib"
-	      fi
-	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
-	      # Try looking first in the location we're being installed to.
-	      if test -n "$inst_prefix_dir"; then
-		case "$libdir" in
-		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		    ;;
-		esac
-	      fi
-	      add="-l$name"
-	    fi
-
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
-	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	    fi
-	  fi
-	elif test "$linkmode" = prog; then
-	  # Here we assume that one of hardcode_direct or hardcode_minus_L
-	  # is not unsupported.  This is valid on all known static and
-	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
-	    compile_deplibs="$dir/$linklib $compile_deplibs"
-	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
-	  else
-	    compile_deplibs="-l$name -L$dir $compile_deplibs"
-	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
-	  fi
-	elif test "$build_libtool_libs" = yes; then
-	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
-	    # We're trying link a shared library against a static one
-	    # but the system doesn't support it.
-
-	    # Just print a warning and add the library to dependency_libs so
-	    # that the program can be linked against the static library.
-	    $echo
-	    $echo "*** Warning: This system can not link to static lib archive $lib."
-	    $echo "*** I have the capability to make that library automatically link in when"
-	    $echo "*** you link to this library.  But I can only do this if you have a"
-	    $echo "*** shared version of the library, which you do not appear to have."
-	    if test "$module" = yes; then
-	      $echo "*** But as you try to build a module library, libtool will still create "
-	      $echo "*** a static module, that should work as long as the dlopening application"
-	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
-	      if test -z "$global_symbol_pipe"; then
-		$echo
-		$echo "*** However, this would only work if libtool was able to extract symbol"
-		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$echo "*** not find such a program.  So, this module is probably useless."
-		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	      fi
-	      if test "$build_old_libs" = no; then
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  else
-	    convenience="$convenience $dir/$old_library"
-	    old_convenience="$old_convenience $dir/$old_library"
-	    deplibs="$dir/$old_library $deplibs"
-	    link_static=yes
-	  fi
-	fi # link shared/static library?
-
-	if test "$linkmode" = lib; then
-	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
-	       test "$link_static" = yes; }; then
-	    # Extract -R from dependency_libs
-	    temp_deplibs=
-	    for libdir in $dependency_libs; do
-	      case $libdir in
-	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
-		   case " $xrpath " in
-		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
-		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
-	      esac
-	    done
-	    dependency_libs="$temp_deplibs"
-	  fi
-
-	  newlib_search_path="$newlib_search_path $absdir"
-	  # Link against this library
-	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
-	  # ... and its dependency_libs
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    newdependency_libs="$deplib $newdependency_libs"
-	    if test "X$duplicate_deps" = "Xyes" ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done
-
-	  if test "$link_all_deplibs" != no; then
-	    # Add the search paths of all dependency libraries
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      -L*) path="$deplib" ;;
-	      *.la)
-		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
-		test "X$dir" = "X$deplib" && dir="."
-		# We need an absolute path.
-		case $dir in
-		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-		*)
-		  absdir=`cd "$dir" && pwd`
-		  if test -z "$absdir"; then
-		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
-		    absdir="$dir"
-		  fi
-		  ;;
-		esac
-		if grep "^installed=no" $deplib > /dev/null; then
-		  path="$absdir/$objdir"
-		else
-		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		  if test -z "$libdir"; then
-		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		    exit $EXIT_FAILURE
-		  fi
-		  if test "$absdir" != "$libdir"; then
-		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
-		  fi
-		  path="$absdir"
-		fi
-		depdepl=
-		case $host in
-		*-*-darwin*)
-		  # we do not want to link against static libs,
-		  # but need to link against shared
-		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-		  if test -n "$deplibrary_names" ; then
-		    for tmp in $deplibrary_names ; do
-		      depdepl=$tmp
-		    done
-		    if test -f "$path/$depdepl" ; then
-		      depdepl="$path/$depdepl"
-		    fi
-		    # do not add paths which are already there
-		    case " $newlib_search_path " in
-		    *" $path "*) ;;
-		    *) newlib_search_path="$newlib_search_path $path";;
-		    esac
-		  fi
-		  path=""
-		  ;;
-		*)
-		  path="-L$path"
-		  ;;
-		esac
-		;;
-	      -l*)
-		case $host in
-		*-*-darwin*)
-		  # Again, we only want to link against shared libraries
-		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
-		  for tmp in $newlib_search_path ; do
-		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
-		      eval depdepl="$tmp/lib$tmp_libs.dylib"
-		      break
-		    fi
-		  done
-		  path=""
-		  ;;
-	      *.framework)
-		case $host in
-		  *-*-darwin*)
-		    depdepl="$deplib"
-		    ;;
-		esac
-		;;
-		*) continue ;;
-		esac
-		;;
-	      *) continue ;;
-	      esac
-	      case " $deplibs " in
-	      *" $depdepl "*) ;;
-	      *) deplibs="$depdepl $deplibs" ;;
-	      esac
-	      case " $deplibs " in
-	      *" $path "*) ;;
-	      *) deplibs="$deplibs $path" ;;
-	      esac
-	    done
-	  fi # link_all_deplibs != no
-	fi # linkmode = lib
-      done # for deplib in $libs
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
-	# Link the dlpreopened libraries before other libraries
-	for deplib in $save_deplibs; do
-	  deplibs="$deplib $deplibs"
-	done
-      fi
-      if test "$pass" != dlopen; then
-	if test "$pass" != conv; then
-	  # Make sure lib_search_path contains only unique directories.
-	  lib_search_path=
-	  for dir in $newlib_search_path; do
-	    case "$lib_search_path " in
-	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
-	    esac
-	  done
-	  newlib_search_path=
-	fi
-
-	if test "$linkmode,$pass" != "prog,link"; then
-	  vars="deplibs"
-	else
-	  vars="compile_deplibs finalize_deplibs"
-	fi
-	for var in $vars dependency_libs; do
-	  # Add libraries to $var in reverse order
-	  eval tmp_libs=\"\$$var\"
-	  new_libs=
-	  for deplib in $tmp_libs; do
-	    # FIXME: Pedantically, this is the right thing to do, so
-	    #        that some nasty dependency loop isn't accidentally
-	    #        broken:
-	    #new_libs="$deplib $new_libs"
-	    # Pragmatically, this seems to cause very few problems in
-	    # practice:
-	    case $deplib in
-	    -L*) new_libs="$deplib $new_libs" ;;
-	    -R*) ;;
-	    *)
-	      # And here is the reason: when a library appears more
-	      # than once as an explicit dependence of a library, or
-	      # is implicitly linked in more than once by the
-	      # compiler, it is considered special, and multiple
-	      # occurrences thereof are not removed.  Compare this
-	      # with having the same library being listed as a
-	      # dependency of multiple other libraries: in this case,
-	      # we know (pedantically, we assume) the library does not
-	      # need to be listed more than once, so we keep only the
-	      # last copy.  This is not always right, but it is rare
-	      # enough that we require users that really mean to play
-	      # such unportable linking tricks to link the library
-	      # using -Wl,-lname, so that libtool does not consider it
-	      # for duplicate removal.
-	      case " $specialdeplibs " in
-	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
-	      *)
-		case " $new_libs " in
-		*" $deplib "*) ;;
-		*) new_libs="$deplib $new_libs" ;;
-		esac
-		;;
-	      esac
-	      ;;
-	    esac
-	  done
-	  tmp_libs=
-	  for deplib in $new_libs; do
-	    case $deplib in
-	    -L*)
-	      case " $tmp_libs " in
-	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
-	      esac
-	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
-	    esac
-	  done
-	  eval $var=\"$tmp_libs\"
-	done # for var
-      fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
-      tmp_libs=
-      for i in $dependency_libs ; do
-	case " $predeps $postdeps $compiler_lib_search_path " in
-	*" $i "*)
-	  i=""
-	  ;;
-	esac
-	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
-	fi
-      done
-      dependency_libs=$tmp_libs
-    done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
-      dlprefiles="$newdlprefiles"
-    fi
-
-    case $linkmode in
-    oldlib)
-      if test -n "$deplibs"; then
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
-      fi
-
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$rpath"; then
-	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$xrpath"; then
-	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
-      fi
-
-      # Now set the variables for building old libraries.
-      build_libtool_libs=no
-      oldlibs="$output"
-      objs="$objs$old_deplibs"
-      ;;
-
-    lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
-      case $outputname in
-      lib*)
-	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-	eval shared_ext=\"$shrext_cmds\"
-	eval libname=\"$libname_spec\"
-	;;
-      *)
-	if test "$module" = no; then
-	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-	if test "$need_lib_prefix" != no; then
-	  # Add the "lib" prefix for modules if required
-	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
-	  eval shared_ext=\"$shrext_cmds\"
-	  eval libname=\"$libname_spec\"
-	else
-	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
-	fi
-	;;
-      esac
-
-      if test -n "$objs"; then
-	if test "$deplibs_check_method" != pass_all; then
-	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
-	  exit $EXIT_FAILURE
-	else
-	  $echo
-	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
-	  $echo "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
-	fi
-      fi
-
-      if test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
-      fi
-
-      set dummy $rpath
-      if test "$#" -gt 2; then
-	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
-      fi
-      install_libdir="$2"
-
-      oldlibs=
-      if test -z "$rpath"; then
-	if test "$build_libtool_libs" = yes; then
-	  # Building a libtool convenience library.
-	  # Some compilers have problems with a `.al' extension so
-	  # convenience libraries should have the same extension an
-	  # archive normally would.
-	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
-	  build_libtool_libs=convenience
-	  build_old_libs=yes
-	fi
-
-	if test -n "$vinfo"; then
-	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
-	fi
-
-	if test -n "$release"; then
-	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
-	fi
-      else
-
-	# Parse the version information argument.
-	save_ifs="$IFS"; IFS=':'
-	set dummy $vinfo 0 0 0
-	IFS="$save_ifs"
-
-	if test -n "$8"; then
-	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# convert absolute version numbers to libtool ages
-	# this retains compatibility with .la files and attempts
-	# to make the code below a bit more comprehensible
-
-	case $vinfo_number in
-	yes)
-	  number_major="$2"
-	  number_minor="$3"
-	  number_revision="$4"
-	  #
-	  # There are really only two kinds -- those that
-	  # use the current revision as the major version
-	  # and those that subtract age and use age as
-	  # a minor version.  But, then there is irix
-	  # which has an extra 1 added just for fun
-	  #
-	  case $version_type in
-	  darwin|linux|osf|windows)
-	    current=`expr $number_major + $number_minor`
-	    age="$number_minor"
-	    revision="$number_revision"
-	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
-	    current="$number_major"
-	    revision="$number_minor"
-	    age="0"
-	    ;;
-	  irix|nonstopux)
-	    current=`expr $number_major + $number_minor - 1`
-	    age="$number_minor"
-	    revision="$number_minor"
-	    ;;
-	  esac
-	  ;;
-	no)
-	  current="$2"
-	  revision="$3"
-	  age="$4"
-	  ;;
-	esac
-
-	# Check that each of the things are valid numbers.
-	case $current in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	case $revision in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	case $age in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	if test "$age" -gt "$current"; then
-	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Calculate the version variables.
-	major=
-	versuffix=
-	verstring=
-	case $version_type in
-	none) ;;
-
-	darwin)
-	  # Like Linux, but with the current version available in
-	  # verstring for coding it into the library header
-	  major=.`expr $current - $age`
-	  versuffix="$major.$age.$revision"
-	  # Darwin ld doesn't like 0 for these options...
-	  minor_current=`expr $current + 1`
-	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
-	  ;;
-
-	freebsd-aout)
-	  major=".$current"
-	  versuffix=".$current.$revision";
-	  ;;
-
-	freebsd-elf)
-	  major=".$current"
-	  versuffix=".$current";
-	  ;;
-
-	irix | nonstopux)
-	  major=`expr $current - $age + 1`
-
-	  case $version_type in
-	    nonstopux) verstring_prefix=nonstopux ;;
-	    *)         verstring_prefix=sgi ;;
-	  esac
-	  verstring="$verstring_prefix$major.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$revision
-	  while test "$loop" -ne 0; do
-	    iface=`expr $revision - $loop`
-	    loop=`expr $loop - 1`
-	    verstring="$verstring_prefix$major.$iface:$verstring"
-	  done
-
-	  # Before this point, $major must not contain `.'.
-	  major=.$major
-	  versuffix="$major.$revision"
-	  ;;
-
-	linux)
-	  major=.`expr $current - $age`
-	  versuffix="$major.$age.$revision"
-	  ;;
-
-	osf)
-	  major=.`expr $current - $age`
-	  versuffix=".$current.$age.$revision"
-	  verstring="$current.$age.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$age
-	  while test "$loop" -ne 0; do
-	    iface=`expr $current - $loop`
-	    loop=`expr $loop - 1`
-	    verstring="$verstring:${iface}.0"
-	  done
-
-	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
-	  ;;
-
-	sunos)
-	  major=".$current"
-	  versuffix=".$current.$revision"
-	  ;;
-
-	windows)
-	  # Use '-' rather than '.', since we only want one
-	  # extension on DOS 8.3 filesystems.
-	  major=`expr $current - $age`
-	  versuffix="-$major"
-	  ;;
-
-	*)
-	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
-	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	# Clear the version info if we defaulted, and they specified a release.
-	if test -z "$vinfo" && test -n "$release"; then
-	  major=
-	  case $version_type in
-	  darwin)
-	    # we can't check for "0.0" in archive_cmds due to quoting
-	    # problems, so we reset it completely
-	    verstring=
-	    ;;
-	  *)
-	    verstring="0.0"
-	    ;;
-	  esac
-	  if test "$need_version" = no; then
-	    versuffix=
-	  else
-	    versuffix=".0.0"
-	  fi
-	fi
-
-	# Remove version info from name if versioning should be avoided
-	if test "$avoid_version" = yes && test "$need_version" = no; then
-	  major=
-	  versuffix=
-	  verstring=""
-	fi
-
-	# Check to see if the archive will have undefined symbols.
-	if test "$allow_undefined" = yes; then
-	  if test "$allow_undefined_flag" = unsupported; then
-	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
-	    build_libtool_libs=no
-	    build_old_libs=yes
-	  fi
-	else
-	  # Don't allow undefined symbols.
-	  allow_undefined_flag="$no_undefined_flag"
-	fi
-      fi
-
-      if test "$mode" != relink; then
-	# Remove our outputs, but don't remove object files since they
-	# may have been created when compiling PIC objects.
-	removelist=
-	tempremovelist=`$echo "$output_objdir/*"`
-	for p in $tempremovelist; do
-	  case $p in
-	    *.$objext)
-	       ;;
-	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
-	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-	         then
-		   continue
-		 fi
-	       fi
-	       removelist="$removelist $p"
-	       ;;
-	    *) ;;
-	  esac
-	done
-	if test -n "$removelist"; then
-	  $show "${rm}r $removelist"
-	  $run ${rm}r $removelist
-	fi
-      fi
-
-      # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
-	# Transform .lo files to .o files.
-	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
-      fi
-
-      # Eliminate all temporary directories.
-      for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
-	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
-      done
-
-      if test -n "$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	temp_xrpath=
-	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
-	  dependency_libs="$temp_xrpath $dependency_libs"
-	fi
-      fi
-
-      # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
-      dlfiles=
-      for lib in $old_dlfiles; do
-	case " $dlprefiles $dlfiles " in
-	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
-	esac
-      done
-
-      # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
-      dlprefiles=
-      for lib in $old_dlprefiles; do
-	case "$dlprefiles " in
-	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
-	esac
-      done
-
-      if test "$build_libtool_libs" = yes; then
-	if test -n "$rpath"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
-	    # these systems don't actually have a c library (as such)!
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs -framework System"
-	    ;;
-	  *-*-netbsd*)
-	    # Don't link with libc until the a.out ld.so is fixed.
-	    ;;
-	  *-*-openbsd* | *-*-freebsd*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
- 	  *)
-	    # Add libc to deplibs on all other systems if necessary.
-	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
-	    fi
-	    ;;
-	  esac
-	fi
-
-	# Transform deplibs into only deplibs that can be linked in shared.
-	name_save=$name
-	libname_save=$libname
-	release_save=$release
-	versuffix_save=$versuffix
-	major_save=$major
-	# I'm not sure if I'm treating the release correctly.  I think
-	# release should show up in the -l (ie -lgmp5) so we don't want to
-	# add it in twice.  Is that correct?
-	release=""
-	versuffix=""
-	major=""
-	newdeplibs=
-	droppeddeps=no
-	case $deplibs_check_method in
-	pass_all)
-	  # Don't check for shared/static.  Everything works.
-	  # This might be a little naive.  We might want to check
-	  # whether the library exists or not.  But this is on
-	  # osf3 & osf4 and I'm not really sure... Just
-	  # implementing what was already the behavior.
-	  newdeplibs=$deplibs
-	  ;;
-	test_compile)
-	  # This code stresses the "libraries are programs" paradigm to its
-	  # limits. Maybe even breaks it.  We compile a program, linking it
-	  # against the deplibs as a proxy for the library.  Then we can check
-	  # whether they linked in statically or dynamically with ldd.
-	  $rm conftest.c
-	  cat > conftest.c <<EOF
-	  int main() { return 0; }
-EOF
-	  $rm conftest
-	  $LTCC -o conftest conftest.c $deplibs
-	  if test "$?" -eq 0 ; then
-	    ldd_output=`ldd conftest`
-	    for i in $deplibs; do
-	      name="`expr $i : '-l\(.*\)'`"
-	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" -ne "0"; then
-		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		  case " $predeps $postdeps " in
-		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
-		    i=""
-		    ;;
-		  esac
-	        fi
-		if test -n "$i" ; then
-		  libname=`eval \\$echo \"$libname_spec\"`
-		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
-		  set dummy $deplib_matches
-		  deplib_match=$2
-		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
-		  else
-		    droppeddeps=yes
-		    $echo
-		    $echo "*** Warning: dynamic linker does not accept needed library $i."
-		    $echo "*** I have the capability to make that library automatically link in when"
-		    $echo "*** you link to this library.  But I can only do this if you have a"
-		    $echo "*** shared version of the library, which I believe you do not have"
-		    $echo "*** because a test_compile did reveal that the linker did not use it for"
-		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
-		  fi
-		fi
-	      else
-		newdeplibs="$newdeplibs $i"
-	      fi
-	    done
-	  else
-	    # Error occurred in the first compile.  Let's try to salvage
-	    # the situation: Compile a separate program for each library.
-	    for i in $deplibs; do
-	      name="`expr $i : '-l\(.*\)'`"
-	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" != "0"; then
-		$rm conftest
-		$LTCC -o conftest conftest.c $i
-		# Did it work?
-		if test "$?" -eq 0 ; then
-		  ldd_output=`ldd conftest`
-		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		    case " $predeps $postdeps " in
-		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
-		      i=""
-		      ;;
-		    esac
-		  fi
-		  if test -n "$i" ; then
-		    libname=`eval \\$echo \"$libname_spec\"`
-		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
-		    set dummy $deplib_matches
-		    deplib_match=$2
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
-		    else
-		      droppeddeps=yes
-		      $echo
-		      $echo "*** Warning: dynamic linker does not accept needed library $i."
-		      $echo "*** I have the capability to make that library automatically link in when"
-		      $echo "*** you link to this library.  But I can only do this if you have a"
-		      $echo "*** shared version of the library, which you do not appear to have"
-		      $echo "*** because a test_compile did reveal that the linker did not use this one"
-		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
-		    fi
-		  fi
-		else
-		  droppeddeps=yes
-		  $echo
-		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $echo "***  make it link in!  You will probably need to install it or some"
-		  $echo "*** library that it depends on before this library will be fully"
-		  $echo "*** functional.  Installing it before continuing would be even better."
-		fi
-	      else
-		newdeplibs="$newdeplibs $i"
-	      fi
-	    done
-	  fi
-	  ;;
-	file_magic*)
-	  set dummy $deplibs_check_method
-	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    name="`expr $a_deplib : '-l\(.*\)'`"
-	    # If $name is empty we are operating on a -L argument.
-            if test "$name" != "" && test  "$name" != "0"; then
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval \\$echo \"$libname_spec\"`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		      # Follow soft links.
-		      if ls -lLd "$potent_lib" 2>/dev/null \
-			 | grep " -> " >/dev/null; then
-			continue
-		      fi
-		      # The statement above tries to avoid entering an
-		      # endless loop below, in case of cyclic links.
-		      # We might still enter an endless loop, since a link
-		      # loop can be closed while we follow links,
-		      # but so what?
-		      potlib="$potent_lib"
-		      while test -h "$potlib" 2>/dev/null; do
-			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
-			case $potliblink in
-			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
-			esac
-		      done
-		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
-			 | ${SED} 10q \
-			 | $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
-			a_deplib=""
-			break 2
-		      fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$echo
-		$echo "*** Warning: linker path does not have real file for library $a_deplib."
-		$echo "*** I have the capability to make that library automatically link in when"
-		$echo "*** you link to this library.  But I can only do this if you have a"
-		$echo "*** shared version of the library, which you do not appear to have"
-		$echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
-		else
-		  $echo "*** with $libname and none of the candidates passed a file format test"
-		  $echo "*** using a file magic. Last file checked: $potlib"
-		fi
-	      fi
-	    else
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	    fi
-	  done # Gone through all deplibs.
-	  ;;
-	match_pattern*)
-	  set dummy $deplibs_check_method
-	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    name="`expr $a_deplib : '-l\(.*\)'`"
-	    # If $name is empty we are operating on a -L argument.
-	    if test -n "$name" && test "$name" != "0"; then
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval \\$echo \"$libname_spec\"`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval $echo \"$potent_lib\" 2>/dev/null \
-		        | ${SED} 10q \
-		        | $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
-		      a_deplib=""
-		      break 2
-		    fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$echo
-		$echo "*** Warning: linker path does not have real file for library $a_deplib."
-		$echo "*** I have the capability to make that library automatically link in when"
-		$echo "*** you link to this library.  But I can only do this if you have a"
-		$echo "*** shared version of the library, which you do not appear to have"
-		$echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
-		else
-		  $echo "*** with $libname and none of the candidates passed a file format test"
-		  $echo "*** using a regex pattern. Last file checked: $potlib"
-		fi
-	      fi
-	    else
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	    fi
-	  done # Gone through all deplibs.
-	  ;;
-	none | unknown | *)
-	  newdeplibs=""
-	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
-	    -e 's/ -[LR][^ ]*//g'`
-	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	    for i in $predeps $postdeps ; do
-	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
-	    done
-	  fi
-	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
-	    | grep . >/dev/null; then
-	    $echo
-	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
-	    else
-	      $echo "*** Warning: inter-library dependencies are not known to be supported."
-	    fi
-	    $echo "*** All declared inter-library dependencies are being dropped."
-	    droppeddeps=yes
-	  fi
-	  ;;
-	esac
-	versuffix=$versuffix_save
-	major=$major_save
-	release=$release_save
-	libname=$libname_save
-	name=$name_save
-
-	case $host in
-	*-*-rhapsody* | *-*-darwin1.[012])
-	  # On Rhapsody replace the C library is the System framework
-	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	  ;;
-	esac
-
-	if test "$droppeddeps" = yes; then
-	  if test "$module" = yes; then
-	    $echo
-	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
-	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $echo "*** a static module, that should work as long as the dlopening"
-	    $echo "*** application is linked with the -dlopen flag."
-	    if test -z "$global_symbol_pipe"; then
-	      $echo
-	      $echo "*** However, this would only work if libtool was able to extract symbol"
-	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $echo "*** not find such a program.  So, this module is probably useless."
-	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	    fi
-	    if test "$build_old_libs" = no; then
-	      oldlibs="$output_objdir/$libname.$libext"
-	      build_libtool_libs=module
-	      build_old_libs=yes
-	    else
-	      build_libtool_libs=no
-	    fi
-	  else
-	    $echo "*** The inter-library dependencies that have been dropped here will be"
-	    $echo "*** automatically added whenever a program is linked with this library"
-	    $echo "*** or is declared to -dlopen it."
-
-	    if test "$allow_undefined" = no; then
-	      $echo
-	      $echo "*** Since this library must not contain undefined symbols,"
-	      $echo "*** because either the platform does not support them or"
-	      $echo "*** it was explicitly requested with -no-undefined,"
-	      $echo "*** libtool will only create a static version of it."
-	      if test "$build_old_libs" = no; then
-		oldlibs="$output_objdir/$libname.$libext"
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  fi
-	fi
-	# Time to change all our "foo.framework" stuff back to "-framework foo"
-	case $host in
-	  *-*-darwin*)
-	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
-	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
-	    ;;
-	esac
-	# Done checking deplibs!
-	deplibs=$newdeplibs
-      fi
-
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
-      # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-	if test "$hardcode_into_libs" = yes; then
-	  # Hardcode the library paths
-	  hardcode_libdirs=
-	  dep_rpath=
-	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
-	  for libdir in $rpath; do
-	    if test -n "$hardcode_libdir_flag_spec"; then
-	      if test -n "$hardcode_libdir_separator"; then
-		if test -z "$hardcode_libdirs"; then
-		  hardcode_libdirs="$libdir"
-		else
-		  # Just accumulate the unique libdirs.
-		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		    ;;
-		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		    ;;
-		  esac
-		fi
-	      else
-		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
-	      fi
-	    elif test -n "$runpath_var"; then
-	      case "$perm_rpath " in
-	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
-	      esac
-	    fi
-	  done
-	  # Substitute the hardcoded libdirs into the rpath.
-	  if test -n "$hardcode_libdir_separator" &&
-	     test -n "$hardcode_libdirs"; then
-	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
-	  fi
-	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
-	    # We should set the runpath_var.
-	    rpath=
-	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
-	    done
-	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
-	  fi
-	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
-	fi
-
-	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
-	if test -n "$shlibpath"; then
-	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
-	fi
-
-	# Get the real and link names of the library.
-	eval shared_ext=\"$shrext_cmds\"
-	eval library_names=\"$library_names_spec\"
-	set dummy $library_names
-	realname="$2"
-	shift; shift
-
-	if test -n "$soname_spec"; then
-	  eval soname=\"$soname_spec\"
-	else
-	  soname="$realname"
-	fi
-	if test -z "$dlname"; then
-	  dlname=$soname
-	fi
-
-	lib="$output_objdir/$realname"
-	for link
-	do
-	  linknames="$linknames $link"
-	done
-
-	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
-	# Prepare the list of exported symbols
-	if test -z "$export_symbols"; then
-	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-	    $show "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $run $rm $export_symbols
-	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
-	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      if len=`expr "X$cmd" : ".*"` &&
-	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	        $show "$cmd"
-	        $run eval "$cmd" || exit $?
-	        skipped_export=false
-	      else
-	        # The command line is too long to execute in one step.
-	        $show "using reloadable object file for export list..."
-	        skipped_export=:
-	      fi
-	    done
-	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex"; then
-	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
-	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
-	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-	fi
-
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
-	fi
-
-	tmp_deplibs=
-	for test_deplib in $deplibs; do
-		case " $convenience " in
-		*" $test_deplib "*) ;;
-		*)
-			tmp_deplibs="$tmp_deplibs $test_deplib"
-			;;
-		esac
-	done
-	deplibs="$tmp_deplibs"
-
-	if test -n "$convenience"; then
-	  if test -n "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	  else
-	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
-
-	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
-	  fi
-	fi
-	
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
-	fi
-
-	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
-	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
-	fi
-
-	# Do each of the archive commands.
-	if test "$module" = yes && test -n "$module_cmds" ; then
-	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	    eval test_cmds=\"$module_expsym_cmds\"
-	    cmds=$module_expsym_cmds
-	  else
-	    eval test_cmds=\"$module_cmds\"
-	    cmds=$module_cmds
-	  fi
-	else
-	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	  eval test_cmds=\"$archive_expsym_cmds\"
-	  cmds=$archive_expsym_cmds
-	else
-	  eval test_cmds=\"$archive_cmds\"
-	  cmds=$archive_cmds
-	  fi
-	fi
-
-	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
-	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  :
-	else
-	  # The command line is too long to link in one step, link piecewise.
-	  $echo "creating reloadable object files..."
-
-	  # Save the value of $output and $libobjs because we want to
-	  # use them later.  If we have whole_archive_flag_spec, we
-	  # want to use save_libobjs as it was before
-	  # whole_archive_flag_spec was expanded, because we can't
-	  # assume the linker understands whole_archive_flag_spec.
-	  # This may have to be revisited, in case too many
-	  # convenience libraries get linked in and end up exceeding
-	  # the spec.
-	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	  fi
-	  save_output=$output
-
-	  # Clear the reloadable object creation command queue and
-	  # initialize k to one.
-	  test_cmds=
-	  concat_cmds=
-	  objlist=
-	  delfiles=
-	  last_robj=
-	  k=1
-	  output=$output_objdir/$save_output-${k}.$objext
-	  # Loop over the list of objects to be linked.
-	  for obj in $save_libobjs
-	  do
-	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
-	    if test "X$objlist" = X ||
-	       { len=`expr "X$test_cmds" : ".*"` &&
-		 test "$len" -le "$max_cmd_len"; }; then
-	      objlist="$objlist $obj"
-	    else
-	      # The command $test_cmds is almost too long, add a
-	      # command to the queue.
-	      if test "$k" -eq 1 ; then
-		# The first file doesn't have a previous command to add.
-		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
-	      else
-		# All subsequent reloadable object files will link in
-		# the last one created.
-		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
-	      fi
-	      last_robj=$output_objdir/$save_output-${k}.$objext
-	      k=`expr $k + 1`
-	      output=$output_objdir/$save_output-${k}.$objext
-	      objlist=$obj
-	      len=1
-	    fi
-	  done
-	  # Handle the remaining objects by creating one last
-	  # reloadable object file.  All subsequent reloadable object
-	  # files will link in the last one created.
-	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-
-	  if ${skipped_export-false}; then
-	    $show "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $run $rm $export_symbols
-	    libobjs=$output
-	    # Append the command to create the export file.
-	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
-          fi
-
-	  # Set up a command to remove the reloadale object files
-	  # after they are used.
-	  i=0
-	  while test "$i" -lt "$k"
-	  do
-	    i=`expr $i + 1`
-	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
-	  done
-
-	  $echo "creating a temporary reloadable object file: $output"
-
-	  # Loop through the commands generated above and execute them.
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $concat_cmds; do
-	    IFS="$save_ifs"
-	    $show "$cmd"
-	    $run eval "$cmd" || exit $?
-	  done
-	  IFS="$save_ifs"
-
-	  libobjs=$output
-	  # Restore the value of output.
-	  output=$save_output
-
-	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	  fi
-	  # Expand the library linking commands again to reset the
-	  # value of $libobjs for piecewise linking.
-
-	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
-	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	      cmds=$module_expsym_cmds
-	    else
-	      cmds=$module_cmds
-	    fi
-	  else
-	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	    cmds=$archive_expsym_cmds
-	  else
-	    cmds=$archive_cmds
-	    fi
-	  fi
-
-	  # Append the command to remove the reloadable object files
-	  # to the just-reset $cmds.
-	  eval cmds=\"\$cmds~\$rm $delfiles\"
-	fi
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $show "$cmd"
-	  $run eval "$cmd" || exit $?
-	done
-	IFS="$save_ifs"
-
-	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
-	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
-	  exit $EXIT_SUCCESS
-	fi
-
-	# Create links to the real library.
-	for linkname in $linknames; do
-	  if test "$realname" != "$linkname"; then
-	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
-	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
-	  fi
-	done
-
-	# If -module or -export-dynamic was specified, set the dlname.
-	if test "$module" = yes || test "$export_dynamic" = yes; then
-	  # On all known operating systems, these are identical.
-	  dlname="$soname"
-	fi
-      fi
-      ;;
-
-    obj)
-      if test -n "$deplibs"; then
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
-      fi
-
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$rpath"; then
-	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$xrpath"; then
-	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
-      fi
-
-      case $output in
-      *.lo)
-	if test -n "$objs$old_deplibs"; then
-	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-	libobj="$output"
-	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
-	;;
-      *)
-	libobj=
-	obj="$output"
-	;;
-      esac
-
-      # Delete the old objects.
-      $run $rm $obj $libobj
-
-      # Objects from convenience libraries.  This assumes
-      # single-version convenience libraries.  Whenever we create
-      # different ones for PIC/non-PIC, this we'll have to duplicate
-      # the extraction.
-      reload_conv_objs=
-      gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec
-      wl=
-
-      if test -n "$convenience"; then
-	if test -n "$whole_archive_flag_spec"; then
-	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
-	else
-	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
-
-	  func_extract_archives $gentop $convenience
-	  reload_conv_objs="$reload_objs $func_extract_archives_result"
-	fi
-      fi
-
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
-      output="$obj"
-      cmds=$reload_cmds
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-
-      # Exit if we aren't doing a library object file.
-      if test -z "$libobj"; then
-	if test -n "$gentop"; then
-	  $show "${rm}r $gentop"
-	  $run ${rm}r $gentop
-	fi
-
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$build_libtool_libs" != yes; then
-	if test -n "$gentop"; then
-	  $show "${rm}r $gentop"
-	  $run ${rm}r $gentop
-	fi
-
-	# Create an invalid libtool object if no PIC, so that we don't
-	# accidentally link it into a program.
-	# $show "echo timestamp > $libobj"
-	# $run eval "echo timestamp > $libobj" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-	# Only do commands if we really have different PIC objects.
-	reload_objs="$libobjs $reload_conv_objs"
-	output="$libobj"
-	cmds=$reload_cmds
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $show "$cmd"
-	  $run eval "$cmd" || exit $?
-	done
-	IFS="$save_ifs"
-      fi
-
-      if test -n "$gentop"; then
-	$show "${rm}r $gentop"
-	$run ${rm}r $gentop
-      fi
-
-      exit $EXIT_SUCCESS
-      ;;
-
-    prog)
-      case $host in
-	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
-      esac
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
-      fi
-
-      if test "$preload" = yes; then
-	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
-	   test "$dlopen_self_static" = unknown; then
-	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
-	fi
-      fi
-
-      case $host in
-      *-*-rhapsody* | *-*-darwin1.[012])
-	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	;;
-      esac
-
-      case $host in
-      *-*-darwin*)
-        # Don't allow lazy linking, it breaks C++ global constructors
-        if test "$tagname" = CXX ; then
-        compile_command="$compile_command ${wl}-bind_at_load"
-        finalize_command="$finalize_command ${wl}-bind_at_load"
-        fi
-	# Time to change all our "foo.framework" stuff back to "-framework foo"
-	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
-	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
-        ;;
-      esac
-
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
-
-      if test -n "$rpath$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	for libdir in $rpath $xrpath; do
-	  # This is the magic to use -rpath.
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
-	  esac
-	fi
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  case :$dllsearchpath: in
-	  *":$libdir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
-	  esac
-	  ;;
-	esac
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$finalize_perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-	  esac
-	fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-	# Transform all the library objects into standard objects.
-	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-      fi
-
-      dlsyms=
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	if test -n "$NM" && test -n "$global_symbol_pipe"; then
-	  dlsyms="${outputname}S.c"
-	else
-	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
-	fi
-      fi
-
-      if test -n "$dlsyms"; then
-	case $dlsyms in
-	"") ;;
-	*.c)
-	  # Discover the nlist of each of the dlfiles.
-	  nlist="$output_objdir/${outputname}.nm"
-
-	  $show "$rm $nlist ${nlist}S ${nlist}T"
-	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
-	  # Parse the name list into a source file.
-	  $show "creating $output_objdir/$dlsyms"
-
-	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
-	  if test "$dlself" = yes; then
-	    $show "generating symbol list for \`$output'"
-
-	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
-	    # Add our own program objects to the symbol list.
-	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	    for arg in $progfiles; do
-	      $show "extracting global C symbols from \`$arg'"
-	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
-	    done
-
-	    if test -n "$exclude_expsyms"; then
-	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-	      $run eval '$mv "$nlist"T "$nlist"'
-	    fi
-
-	    if test -n "$export_symbols_regex"; then
-	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-	      $run eval '$mv "$nlist"T "$nlist"'
-	    fi
-
-	    # Prepare the list of exported symbols
-	    if test -z "$export_symbols"; then
-	      export_symbols="$output_objdir/$output.exp"
-	      $run $rm $export_symbols
-	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-	    else
-	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
-	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
-	      $run eval 'mv "$nlist"T "$nlist"'
-	    fi
-	  fi
-
-	  for arg in $dlprefiles; do
-	    $show "extracting global C symbols from \`$arg'"
-	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
-	    $run eval '$echo ": $name " >> "$nlist"'
-	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
-	  done
-
-	  if test -z "$run"; then
-	    # Make sure we have at least an empty file.
-	    test -f "$nlist" || : > "$nlist"
-
-	    if test -n "$exclude_expsyms"; then
-	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
-	      $mv "$nlist"T "$nlist"
-	    fi
-
-	    # Try sorting and uniquifying the output.
-	    if grep -v "^: " < "$nlist" |
-		if sort -k 3 </dev/null >/dev/null 2>&1; then
-		  sort -k 3
-		else
-		  sort +2
-		fi |
-		uniq > "$nlist"S; then
-	      :
-	    else
-	      grep -v "^: " < "$nlist" > "$nlist"S
-	    fi
-
-	    if test -f "$nlist"S; then
-	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
-	    else
-	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
-	    fi
-
-	    $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
-	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
-	    $echo >> "$output_objdir/$dlsyms" "\
-  {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
-	  fi
-
-	  pic_flag_for_symtable=
-	  case $host in
-	  # compiling the symbol table file with pic_flag works around
-	  # a FreeBSD bug that causes programs to crash when -lm is
-	  # linked before any other PIC object.  But we must not use
-	  # pic_flag when linking with -static.  The problem exists in
-	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
-	    case "$compile_command " in
-	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
-	    esac;;
-	  *-*-hpux*)
-	    case "$compile_command " in
-	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag";;
-	    esac
-	  esac
-
-	  # Now compile the dynamic symbol file.
-	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
-	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
-	  # Clean up the generated files.
-	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
-	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
-	  # Transform the symbol file into the correct name.
-	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-	  ;;
-	*)
-	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-      else
-	# We keep going just in case the user didn't refer to
-	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
-	# really was required.
-
-	# Nullify the symbol file.
-	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
-      fi
-
-      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-	# Replace the output file specification.
-	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-	link_command="$compile_command$compile_rpath"
-
-	# We have no uninstalled library dependencies, so finalize right now.
-	$show "$link_command"
-	$run eval "$link_command"
-	status=$?
-
-	# Delete the generated files.
-	if test -n "$dlsyms"; then
-	  $show "$rm $output_objdir/${outputname}S.${objext}"
-	  $run $rm "$output_objdir/${outputname}S.${objext}"
-	fi
-
-	exit $status
-      fi
-
-      if test -n "$shlibpath_var"; then
-	# We should set the shlibpath_var
-	rpath=
-	for dir in $temp_rpath; do
-	  case $dir in
-	  [\\/]* | [A-Za-z]:[\\/]*)
-	    # Absolute path.
-	    rpath="$rpath$dir:"
-	    ;;
-	  *)
-	    # Relative path: add a thisdir entry.
-	    rpath="$rpath\$thisdir/$dir:"
-	    ;;
-	  esac
-	done
-	temp_rpath="$rpath"
-      fi
-
-      if test -n "$compile_shlibpath$finalize_shlibpath"; then
-	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
-      fi
-      if test -n "$finalize_shlibpath"; then
-	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
-
-      compile_var=
-      finalize_var=
-      if test -n "$runpath_var"; then
-	if test -n "$perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-	if test -n "$finalize_perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-      fi
-
-      if test "$no_install" = yes; then
-	# We don't need to create a wrapper script.
-	link_command="$compile_var$compile_command$compile_rpath"
-	# Replace the output file specification.
-	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-	# Delete the old output file.
-	$run $rm $output
-	# Link the executable and exit
-	$show "$link_command"
-	$run eval "$link_command" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$hardcode_action" = relink; then
-	# Fast installation is not supported
-	link_command="$compile_var$compile_command$compile_rpath"
-	relink_command="$finalize_var$finalize_command$finalize_rpath"
-
-	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
-	$echo "$modename: \`$output' will be relinked during installation" 1>&2
-      else
-	if test "$fast_install" != no; then
-	  link_command="$finalize_var$compile_command$finalize_rpath"
-	  if test "$fast_install" = yes; then
-	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
-	  else
-	    # fast_install is set to needless
-	    relink_command=
-	  fi
-	else
-	  link_command="$compile_var$compile_command$compile_rpath"
-	  relink_command="$finalize_var$finalize_command$finalize_rpath"
-	fi
-      fi
-
-      # Replace the output file specification.
-      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
-      # Delete the old output files.
-      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
-      $show "$link_command"
-      $run eval "$link_command" || exit $?
-
-      # Now create the wrapper script.
-      $show "creating $output"
-
-      # Quote the relink command for shipping.
-      if test -n "$relink_command"; then
-	# Preserve any variables that may affect compiler behavior
-	for var in $variables_saved_for_relink; do
-	  if eval test -z \"\${$var+set}\"; then
-	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
-	  elif eval var_value=\$$var; test -z "$var_value"; then
-	    relink_command="$var=; export $var; $relink_command"
-	  else
-	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
-	  fi
-	done
-	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $echo for shipping.
-      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Only actually do things if our run command is non-null.
-      if test -z "$run"; then
-	# win32 will think the script is a binary if it has
-	# a .exe suffix, so we strip it off here.
-	case $output in
-	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
-	esac
-	# test for cygwin because mv fails w/o .exe extensions
-	case $host in
-	  *cygwin*)
-	    exeext=.exe
-	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
-	  *) exeext= ;;
-	esac
-	case $host in
-	  *cygwin* | *mingw* )
-	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
-	    cwrapper=`$echo ${output}.exe`
-	    $rm $cwrappersource $cwrapper
-	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
-	    cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
-   The $output program cannot be directly executed until all the libtool
-   libraries that it depends on are installed.
-
-   This wrapper executable should never be moved out of the build directory.
-   If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "/bin/sh $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
-*/
-EOF
-	    cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
-#define HAVE_DOS_BASED_FILE_SYSTEM
-#ifndef DIR_SEPARATOR_2
-#define DIR_SEPARATOR_2 '\\'
-#endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
-        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-const char *program_name = NULL;
-
-void * xmalloc (size_t num);
-char * xstrdup (const char *string);
-char * basename (const char *name);
-char * fnqualify(const char *path);
-char * strendzap(char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-
-int
-main (int argc, char *argv[])
-{
-  char **newargz;
-  int i;
-
-  program_name = (char *) xstrdup ((char *) basename (argv[0]));
-  newargz = XMALLOC(char *, argc+2);
-EOF
-
-	    cat >> $cwrappersource <<EOF
-  newargz[0] = "$SHELL";
-EOF
-
-	    cat >> $cwrappersource <<"EOF"
-  newargz[1] = fnqualify(argv[0]);
-  /* we know the script has the same name, without the .exe */
-  /* so make sure newargz[1] doesn't end in .exe */
-  strendzap(newargz[1],".exe");
-  for (i = 1; i < argc; i++)
-    newargz[i+1] = xstrdup(argv[i]);
-  newargz[argc+1] = NULL;
-EOF
-
-	    cat >> $cwrappersource <<EOF
-  execv("$SHELL",newargz);
-EOF
-
-	    cat >> $cwrappersource <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
-  void * p = (void *) malloc (num);
-  if (!p)
-    lt_fatal ("Memory exhausted");
-
-  return p;
-}
-
-char *
-xstrdup (const char *string)
-{
-  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
-;
-}
-
-char *
-basename (const char *name)
-{
-  const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha (name[0]) && name[1] == ':')
-    name += 2;
-#endif
-
-  for (base = name; *name; name++)
-    if (IS_DIR_SEPARATOR (*name))
-      base = name + 1;
-  return (char *) base;
-}
-
-char *
-fnqualify(const char *path)
-{
-  size_t size;
-  char *p;
-  char tmp[LT_PATHMAX + 1];
-
-  assert(path != NULL);
-
-  /* Is it qualified already? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  if (isalpha (path[0]) && path[1] == ':')
-    return xstrdup (path);
-#endif
-  if (IS_DIR_SEPARATOR (path[0]))
-    return xstrdup (path);
-
-  /* prepend the current directory */
-  /* doesn't handle '~' */
-  if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
-  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
-  p = XMALLOC(char, size);
-  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
-  return p;
-}
-
-char *
-strendzap(char *str, const char *pat)
-{
-  size_t len, patlen;
-
-  assert(str != NULL);
-  assert(pat != NULL);
-
-  len = strlen(str);
-  patlen = strlen(pat);
-
-  if (patlen <= len)
-  {
-    str += len - patlen;
-    if (strcmp(str, pat) == 0)
-      *str = '\0';
-  }
-  return str;
-}
-
-static void
-lt_error_core (int exit_status, const char * mode,
-          const char * message, va_list ap)
-{
-  fprintf (stderr, "%s: %s: ", program_name, mode);
-  vfprintf (stderr, message, ap);
-  fprintf (stderr, ".\n");
-
-  if (exit_status >= 0)
-    exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
-  va_list ap;
-  va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
-  va_end (ap);
-}
-EOF
-	  # we should really use a build-platform specific compiler
-	  # here, but OTOH, the wrappers (shell script and this C one)
-	  # are only useful if you want to execute the "real" binary.
-	  # Since the "real" binary is built for $host, then this
-	  # wrapper might as well be built for $host, too.
-	  $run $LTCC -s -o $cwrapper $cwrappersource
-	  ;;
-	esac
-	$rm $output
-	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
-
-	$echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
-  # install mode needs the following variable:
-  notinst_deplibs='$notinst_deplibs'
-else
-  # When we are sourced in execute mode, \$file and \$echo are already set.
-  if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    echo=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$echo works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$echo will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
-"
-	$echo >> $output "\
-
-  # Find the directory that this script lives in.
-  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
-  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
-  # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
-  while test -n \"\$file\"; do
-    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
-    # If there was a directory component, then change thisdir.
-    if test \"x\$destdir\" != \"x\$file\"; then
-      case \"\$destdir\" in
-      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
-      *) thisdir=\"\$thisdir/\$destdir\" ;;
-      esac
-    fi
-
-    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
-  done
-
-  # Try to get the absolute directory name.
-  absdir=\`cd \"\$thisdir\" && pwd\`
-  test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
-	if test "$fast_install" = yes; then
-	  $echo >> $output "\
-  program=lt-'$outputname'$exeext
-  progdir=\"\$thisdir/$objdir\"
-
-  if test ! -f \"\$progdir/\$program\" || \\
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
-       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
-    file=\"\$\$-\$program\"
-
-    if test ! -d \"\$progdir\"; then
-      $mkdir \"\$progdir\"
-    else
-      $rm \"\$progdir/\$file\"
-    fi"
-
-	  $echo >> $output "\
-
-    # relink executable if necessary
-    if test -n \"\$relink_command\"; then
-      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
-      else
-	$echo \"\$relink_command_output\" >&2
-	$rm \"\$progdir/\$file\"
-	exit $EXIT_FAILURE
-      fi
-    fi
-
-    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
-    { $rm \"\$progdir/\$program\";
-      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
-    $rm \"\$progdir/\$file\"
-  fi"
-	else
-	  $echo >> $output "\
-  program='$outputname'
-  progdir=\"\$thisdir/$objdir\"
-"
-	fi
-
-	$echo >> $output "\
-
-  if test -f \"\$progdir/\$program\"; then"
-
-	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-	  $echo >> $output "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-	fi
-
-	# fixup the dll searchpath if we need to.
-	if test -n "$dllsearchpath"; then
-	  $echo >> $output "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
-	$echo >> $output "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2*)
-	  $echo >> $output "\
-      exec \$progdir\\\\\$program \${1+\"\$@\"}
-"
-	  ;;
-
-	*)
-	  $echo >> $output "\
-      exec \$progdir/\$program \${1+\"\$@\"}
-"
-	  ;;
-	esac
-	$echo >> $output "\
-      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
-      exit $EXIT_FAILURE
-    fi
-  else
-    # The program doesn't exist.
-    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
-    \$echo \"This script is just a wrapper for \$program.\" 1>&2
-    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit $EXIT_FAILURE
-  fi
-fi\
-"
-	chmod +x $output
-      fi
-      exit $EXIT_SUCCESS
-      ;;
-    esac
-
-    # See if we need to build an old-fashioned archive.
-    for oldlib in $oldlibs; do
-
-      if test "$build_libtool_libs" = convenience; then
-	oldobjs="$libobjs_save"
-	addlibs="$convenience"
-	build_libtool_libs=no
-      else
-	if test "$build_libtool_libs" = module; then
-	  oldobjs="$libobjs_save"
-	  build_libtool_libs=no
-	else
-	  oldobjs="$old_deplibs $non_pic_objects"
-	fi
-	addlibs="$old_convenience"
-      fi
-
-      if test -n "$addlibs"; then
-	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
-
-	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
-      fi
-
-      # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-       cmds=$old_archive_from_new_cmds
-      else
-	eval cmds=\"$old_archive_cmds\"
-
-	if len=`expr "X$cmds" : ".*"` &&
-	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  cmds=$old_archive_cmds
-	else
-	  # the command line is too long to link in one step, link in parts
-	  $echo "using piecewise archive linking..."
-	  save_RANLIB=$RANLIB
-	  RANLIB=:
-	  objlist=
-	  concat_cmds=
-	  save_oldobjs=$oldobjs
-	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
-	  # encoded into archives.  This makes 'ar r' malfunction in
-	  # this piecewise linking case whenever conflicting object
-	  # names appear in distinct ar calls; check, warn and compensate.
-	    if (for obj in $save_oldobjs
-	    do
-	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
-	    done | sort | sort -uc >/dev/null 2>&1); then
-	    :
-	  else
-	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
-	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
-	    AR_FLAGS=cq
-	  fi
-	  # Is there a better way of finding the last object in the list?
-	  for obj in $save_oldobjs
-	  do
-	    last_oldobj=$obj
-	  done
-	  for obj in $save_oldobjs
-	  do
-	    oldobjs="$objlist $obj"
-	    objlist="$objlist $obj"
-	    eval test_cmds=\"$old_archive_cmds\"
-	    if len=`expr "X$test_cmds" : ".*"` &&
-	       test "$len" -le "$max_cmd_len"; then
-	      :
-	    else
-	      # the above command should be used before it gets too long
-	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
-	        RANLIB=$save_RANLIB
-	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-	      objlist=
-	    fi
-	  done
-	  RANLIB=$save_RANLIB
-	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
-	    eval cmds=\"\$concat_cmds\"
-	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
-	fi
-      fi
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-        eval cmd=\"$cmd\"
-	IFS="$save_ifs"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-    done
-
-    if test -n "$generated"; then
-      $show "${rm}r$generated"
-      $run ${rm}r$generated
-    fi
-
-    # Now create the libtool archive.
-    case $output in
-    *.la)
-      old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
-      $show "creating $output"
-
-      # Preserve any variables that may affect compiler behavior
-      for var in $variables_saved_for_relink; do
-	if eval test -z \"\${$var+set}\"; then
-	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
-	elif eval var_value=\$$var; test -z "$var_value"; then
-	  relink_command="$var=; export $var; $relink_command"
-	else
-	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
-	fi
-      done
-      # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
-	relink_command=
-      fi
-
-
-      # Only create the output if not a dry run.
-      if test -z "$run"; then
-	for installed in no yes; do
-	  if test "$installed" = yes; then
-	    if test -z "$install_libdir"; then
-	      break
-	    fi
-	    output="$output_objdir/$outputname"i
-	    # Replace all uninstalled libtool libraries with the installed ones
-	    newdependency_libs=
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      *.la)
-		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		if test -z "$libdir"; then
-		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		  exit $EXIT_FAILURE
-		fi
-		newdependency_libs="$newdependency_libs $libdir/$name"
-		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
-	      esac
-	    done
-	    dependency_libs="$newdependency_libs"
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-	      if test -z "$libdir"; then
-		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
-	      fi
-	      newdlfiles="$newdlfiles $libdir/$name"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-	      if test -z "$libdir"; then
-		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
-	      fi
-	      newdlprefiles="$newdlprefiles $libdir/$name"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  else
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlfiles="$newdlfiles $abs"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlprefiles="$newdlprefiles $abs"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  fi
-	  $rm $output
-	  # place dlname in correct position for cygwin
-	  tdlname=$dlname
-	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
-	  esac
-	  $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
-	  if test "$installed" = no && test "$need_relink" = yes; then
-	    $echo >> $output "\
-relink_command=\"$relink_command\""
-	  fi
-	done
-      fi
-
-      # Do a symbolic link so that the libtool archive can be found in
-      # LD_LIBRARY_PATH before the program is installed.
-      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
-      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
-      ;;
-    esac
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool install mode
-  install)
-    modename="$modename: install"
-
-    # There may be an optional sh(1) argument at the beginning of
-    # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
-       # Allow the use of GNU shtool's install command.
-       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
-      # Aesthetically quote it.
-      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
-	arg="\"$arg\""
-	;;
-      esac
-      install_prog="$arg "
-      arg="$1"
-      shift
-    else
-      install_prog=
-      arg="$nonopt"
-    fi
-
-    # The real first argument should be the name of the installation program.
-    # Aesthetically quote it.
-    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-    case $arg in
-    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
-      arg="\"$arg\""
-      ;;
-    esac
-    install_prog="$install_prog$arg"
-
-    # We need to accept at least all the BSD install flags.
-    dest=
-    files=
-    opts=
-    prev=
-    install_type=
-    isdir=no
-    stripme=
-    for arg
-    do
-      if test -n "$dest"; then
-	files="$files $dest"
-	dest="$arg"
-	continue
-      fi
-
-      case $arg in
-      -d) isdir=yes ;;
-      -f) prev="-f" ;;
-      -g) prev="-g" ;;
-      -m) prev="-m" ;;
-      -o) prev="-o" ;;
-      -s)
-	stripme=" -s"
-	continue
-	;;
-      -*) ;;
-
-      *)
-	# If the previous option needed an argument, then skip it.
-	if test -n "$prev"; then
-	  prev=
-	else
-	  dest="$arg"
-	  continue
-	fi
-	;;
-      esac
-
-      # Aesthetically quote the argument.
-      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
-	arg="\"$arg\""
-	;;
-      esac
-      install_prog="$install_prog $arg"
-    done
-
-    if test -z "$install_prog"; then
-      $echo "$modename: you must specify an install program" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test -n "$prev"; then
-      $echo "$modename: the \`$prev' option requires an argument" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test -z "$files"; then
-      if test -z "$dest"; then
-	$echo "$modename: no file or destination specified" 1>&2
-      else
-	$echo "$modename: you must specify a destination" 1>&2
-      fi
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    # Strip any trailing slash from the destination.
-    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
-    # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
-      destname=
-    else
-      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
-      test "X$destdir" = "X$dest" && destdir=.
-      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
-      # Not a directory, so check to see that there is only one file specified.
-      set dummy $files
-      if test "$#" -gt 2; then
-	$echo "$modename: \`$dest' is not a directory" 1>&2
-	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
-      fi
-    fi
-    case $destdir in
-    [\\/]* | [A-Za-z]:[\\/]*) ;;
-    *)
-      for file in $files; do
-	case $file in
-	*.lo) ;;
-	*)
-	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-      done
-      ;;
-    esac
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    staticlibs=
-    future_libdirs=
-    current_libdirs=
-    for file in $files; do
-
-      # Do each installation.
-      case $file in
-      *.$libext)
-	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
-	;;
-
-      *.la)
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	library_names=
-	old_library=
-	relink_command=
-	# If there is no directory component, then add one.
-	case $file in
-	*/* | *\\*) . $file ;;
-	*) . ./$file ;;
-	esac
-
-	# Add the libdir to current_libdirs if it is the destination.
-	if test "X$destdir" = "X$libdir"; then
-	  case "$current_libdirs " in
-	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
-	  esac
-	else
-	  # Note the libdir as a future libdir.
-	  case "$future_libdirs " in
-	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
-	  esac
-	fi
-
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
-	test "X$dir" = "X$file/" && dir=
-	dir="$dir$objdir"
-
-	if test -n "$relink_command"; then
-	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
-
-	  # Don't allow the user to place us outside of our expected
-	  # location b/c this prevents finding dependent libraries that
-	  # are installed to the same prefix.
-	  # At present, this check doesn't affect windows .dll's that
-	  # are installed into $libdir/../bin (currently, that works fine)
-	  # but it's something to keep an eye on.
-	  if test "$inst_prefix_dir" = "$destdir"; then
-	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  if test -n "$inst_prefix_dir"; then
-	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
-	  else
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
-	  fi
-
-	  $echo "$modename: warning: relinking \`$file'" 1>&2
-	  $show "$relink_command"
-	  if $run eval "$relink_command"; then :
-	  else
-	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	fi
-
-	# See the names of the shared library.
-	set dummy $library_names
-	if test -n "$2"; then
-	  realname="$2"
-	  shift
-	  shift
-
-	  srcname="$realname"
-	  test -n "$relink_command" && srcname="$realname"T
-
-	  # Install the shared library and build the symlinks.
-	  $show "$install_prog $dir/$srcname $destdir/$realname"
-	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
-	  if test -n "$stripme" && test -n "$striplib"; then
-	    $show "$striplib $destdir/$realname"
-	    $run eval "$striplib $destdir/$realname" || exit $?
-	  fi
-
-	  if test "$#" -gt 0; then
-	    # Delete the old symlinks, and create new ones.
-	    for linkname
-	    do
-	      if test "$linkname" != "$realname"; then
-		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
-		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
-	      fi
-	    done
-	  fi
-
-	  # Do each command in the postinstall commands.
-	  lib="$destdir/$realname"
-	  cmds=$postinstall_cmds
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $cmds; do
-	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
-	    $show "$cmd"
-	    $run eval "$cmd" || exit $?
-	  done
-	  IFS="$save_ifs"
-	fi
-
-	# Install the pseudo-library for information purposes.
-	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	instname="$dir/$name"i
-	$show "$install_prog $instname $destdir/$name"
-	$run eval "$install_prog $instname $destdir/$name" || exit $?
-
-	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
-	;;
-
-      *.lo)
-	# Install (i.e. copy) a libtool object.
-
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	  destfile="$destdir/$destfile"
-	fi
-
-	# Deduce the name of the destination old-style object file.
-	case $destfile in
-	*.lo)
-	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
-	  ;;
-	*.$objext)
-	  staticdest="$destfile"
-	  destfile=
-	  ;;
-	*)
-	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	# Install the libtool object if requested.
-	if test -n "$destfile"; then
-	  $show "$install_prog $file $destfile"
-	  $run eval "$install_prog $file $destfile" || exit $?
-	fi
-
-	# Install the old object if enabled.
-	if test "$build_old_libs" = yes; then
-	  # Deduce the name of the old-style object file.
-	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
-	  $show "$install_prog $staticobj $staticdest"
-	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
-	fi
-	exit $EXIT_SUCCESS
-	;;
-
-      *)
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	  destfile="$destdir/$destfile"
-	fi
-
-	# If the file is missing, and there is a .exe on the end, strip it
-	# because it is most likely a libtool script we actually want to
-	# install
-	stripped_ext=""
-	case $file in
-	  *.exe)
-	    if test ! -f "$file"; then
-	      file=`$echo $file|${SED} 's,.exe$,,'`
-	      stripped_ext=".exe"
-	    fi
-	    ;;
-	esac
-
-	# Do a test to see if this is really a libtool program.
-	case $host in
-	*cygwin*|*mingw*)
-	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
-	    ;;
-	*)
-	    wrapper=$file
-	    ;;
-	esac
-	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
-	  notinst_deplibs=
-	  relink_command=
-
-	  # To insure that "foo" is sourced, and not "foo.exe",
-	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
-	  # which disallows the automatic-append-.exe behavior.
-	  case $build in
-	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
-	  *) wrapperdot=${wrapper} ;;
-	  esac
-	  # If there is no directory component, then add one.
-	  case $file in
-	  */* | *\\*) . ${wrapperdot} ;;
-	  *) . ./${wrapperdot} ;;
-	  esac
-
-	  # Check the variables that should have been set.
-	  if test -z "$notinst_deplibs"; then
-	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  finalize=yes
-	  for lib in $notinst_deplibs; do
-	    # Check to see that each library is installed.
-	    libdir=
-	    if test -f "$lib"; then
-	      # If there is no directory component, then add one.
-	      case $lib in
-	      */* | *\\*) . $lib ;;
-	      *) . ./$lib ;;
-	      esac
-	    fi
-	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
-	    if test -n "$libdir" && test ! -f "$libfile"; then
-	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
-	      finalize=no
-	    fi
-	  done
-
-	  relink_command=
-	  # To insure that "foo" is sourced, and not "foo.exe",
-	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
-	  # which disallows the automatic-append-.exe behavior.
-	  case $build in
-	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
-	  *) wrapperdot=${wrapper} ;;
-	  esac
-	  # If there is no directory component, then add one.
-	  case $file in
-	  */* | *\\*) . ${wrapperdot} ;;
-	  *) . ./${wrapperdot} ;;
-	  esac
-
-	  outputname=
-	  if test "$fast_install" = no && test -n "$relink_command"; then
-	    if test "$finalize" = yes && test -z "$run"; then
-	      tmpdir="/tmp"
-	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
-	      tmpdir="$tmpdir/libtool-$$"
-	      save_umask=`umask`
-	      umask 0077
-	      if $mkdir "$tmpdir"; then
-	        umask $save_umask
-	      else
-	        umask $save_umask
-		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
-		continue
-	      fi
-	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
-	      outputname="$tmpdir/$file"
-	      # Replace the output file specification.
-	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
-	      $show "$relink_command"
-	      if $run eval "$relink_command"; then :
-	      else
-		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
-		${rm}r "$tmpdir"
-		continue
-	      fi
-	      file="$outputname"
-	    else
-	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
-	    fi
-	  else
-	    # Install the binary that we compiled earlier.
-	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
-	  fi
-	fi
-
-	# remove .exe since cygwin /usr/bin/install will append another
-	# one anyways
-	case $install_prog,$host in
-	*/usr/bin/install*,*cygwin*)
-	  case $file:$destfile in
-	  *.exe:*.exe)
-	    # this is ok
-	    ;;
-	  *.exe:*)
-	    destfile=$destfile.exe
-	    ;;
-	  *:*.exe)
-	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
-	    ;;
-	  esac
-	  ;;
-	esac
-	$show "$install_prog$stripme $file $destfile"
-	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
-	test -n "$outputname" && ${rm}r "$tmpdir"
-	;;
-      esac
-    done
-
-    for file in $staticlibs; do
-      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
-      # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
-
-      $show "$install_prog $file $oldlib"
-      $run eval "$install_prog \$file \$oldlib" || exit $?
-
-      if test -n "$stripme" && test -n "$old_striplib"; then
-	$show "$old_striplib $oldlib"
-	$run eval "$old_striplib $oldlib" || exit $?
-      fi
-
-      # Do each command in the postinstall commands.
-      cmds=$old_postinstall_cmds
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-    done
-
-    if test -n "$future_libdirs"; then
-      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
-    fi
-
-    if test -n "$current_libdirs"; then
-      # Maybe just do a dry run.
-      test -n "$run" && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
-    else
-      exit $EXIT_SUCCESS
-    fi
-    ;;
-
-  # libtool finish mode
-  finish)
-    modename="$modename: finish"
-    libdirs="$nonopt"
-    admincmds=
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
-
-      for libdir in $libdirs; do
-	if test -n "$finish_cmds"; then
-	  # Do each command in the finish commands.
-	  cmds=$finish_cmds
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $cmds; do
-	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
-	    $show "$cmd"
-	    $run eval "$cmd" || admincmds="$admincmds
-       $cmd"
-	  done
-	  IFS="$save_ifs"
-	fi
-	if test -n "$finish_eval"; then
-	  # Do the single finish_eval.
-	  eval cmds=\"$finish_eval\"
-	  $run eval "$cmds" || admincmds="$admincmds
-       $cmds"
-	fi
-      done
-    fi
-
-    # Exit here if they wanted silent mode.
-    test "$show" = : && exit $EXIT_SUCCESS
-
-    $echo "----------------------------------------------------------------------"
-    $echo "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $echo "   $libdir"
-    done
-    $echo
-    $echo "If you ever happen to want to link against installed libraries"
-    $echo "in a given directory, LIBDIR, you must either use libtool, and"
-    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $echo "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $echo "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $echo "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
-
-      $echo "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $echo "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $echo
-    $echo "See any operating system documentation about shared libraries for"
-    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
-    $echo "----------------------------------------------------------------------"
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool execute mode
-  execute)
-    modename="$modename: execute"
-
-    # The first argument is the command name.
-    cmd="$nonopt"
-    if test -z "$cmd"; then
-      $echo "$modename: you must specify a COMMAND" 1>&2
-      $echo "$help"
-      exit $EXIT_FAILURE
-    fi
-
-    # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
-      if test ! -f "$file"; then
-	$echo "$modename: \`$file' is not a file" 1>&2
-	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
-      fi
-
-      dir=
-      case $file in
-      *.la)
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Read the libtool library.
-	dlname=
-	library_names=
-
-	# If there is no directory component, then add one.
-	case $file in
-	*/* | *\\*) . $file ;;
-	*) . ./$file ;;
-	esac
-
-	# Skip this library if it cannot be dlopened.
-	if test -z "$dlname"; then
-	  # Warn if it was a shared library.
-	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
-	  continue
-	fi
-
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$dir" = "X$file" && dir=.
-
-	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
-	else
-	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-	;;
-
-      *.lo)
-	# Just add the directory containing the .lo file.
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$dir" = "X$file" && dir=.
-	;;
-
-      *)
-	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
-	continue
-	;;
-      esac
-
-      # Get the absolute pathname.
-      absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
-
-      # Now add the directory to shlibpath_var.
-      if eval "test -z \"\$$shlibpath_var\""; then
-	eval "$shlibpath_var=\"\$dir\""
-      else
-	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
-      fi
-    done
-
-    # This variable tells wrapper scripts just to set shlibpath_var
-    # rather than running their programs.
-    libtool_execute_magic="$magic"
-
-    # Check if any of the arguments is a wrapper script.
-    args=
-    for file
-    do
-      case $file in
-      -*) ;;
-      *)
-	# Do a test to see if this is really a libtool program.
-	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  # If there is no directory component, then add one.
-	  case $file in
-	  */* | *\\*) . $file ;;
-	  *) . ./$file ;;
-	  esac
-
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	fi
-	;;
-      esac
-      # Quote arguments (to preserve shell metacharacters).
-      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
-      args="$args \"$file\""
-    done
-
-    if test -z "$run"; then
-      if test -n "$shlibpath_var"; then
-	# Export the shlibpath_var.
-	eval "export $shlibpath_var"
-      fi
-
-      # Restore saved environment variables
-      if test "${save_LC_ALL+set}" = set; then
-	LC_ALL="$save_LC_ALL"; export LC_ALL
-      fi
-      if test "${save_LANG+set}" = set; then
-	LANG="$save_LANG"; export LANG
-      fi
-
-      # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
-	$echo "export $shlibpath_var"
-      fi
-      $echo "$cmd$args"
-      exit $EXIT_SUCCESS
-    fi
-    ;;
-
-  # libtool clean and uninstall mode
-  clean | uninstall)
-    modename="$modename: $mode"
-    rm="$nonopt"
-    files=
-    rmforce=
-    exit_status=0
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case $arg in
-      -f) rm="$rm $arg"; rmforce=yes ;;
-      -*) rm="$rm $arg" ;;
-      *) files="$files $arg" ;;
-      esac
-    done
-
-    if test -z "$rm"; then
-      $echo "$modename: you must specify an RM program" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    rmdirs=
-
-    origobjdir="$objdir"
-    for file in $files; do
-      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-      if test "X$dir" = "X$file"; then
-	dir=.
-	objdir="$origobjdir"
-      else
-	objdir="$dir/$origobjdir"
-      fi
-      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-      test "$mode" = uninstall && objdir="$dir"
-
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
-	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
-	esac
-      fi
-
-      # Don't error if the file doesn't exist and rm -f was used.
-      if (test -L "$file") >/dev/null 2>&1 \
-	|| (test -h "$file") >/dev/null 2>&1 \
-	|| test -f "$file"; then
-	:
-      elif test -d "$file"; then
-	exit_status=1
-	continue
-      elif test "$rmforce" = yes; then
-	continue
-      fi
-
-      rmfiles="$file"
-
-      case $name in
-      *.la)
-	# Possibly a libtool archive, so verify it.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  . $dir/$name
-
-	  # Delete the libtool libraries and symlinks.
-	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
-	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-
-	  if test "$mode" = uninstall; then
-	    if test -n "$library_names"; then
-	      # Do each command in the postuninstall commands.
-	      cmds=$postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd"
-		if test "$?" -ne 0 && test "$rmforce" != yes; then
-		  exit_status=1
-		fi
-	      done
-	      IFS="$save_ifs"
-	    fi
-
-	    if test -n "$old_library"; then
-	      # Do each command in the old_postuninstall commands.
-	      cmds=$old_postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd"
-		if test "$?" -ne 0 && test "$rmforce" != yes; then
-		  exit_status=1
-		fi
-	      done
-	      IFS="$save_ifs"
-	    fi
-	    # FIXME: should reinstall the best remaining shared library.
-	  fi
-	fi
-	;;
-
-      *.lo)
-	# Possibly a libtool object, so verify it.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-
-	  # Read the .lo file
-	  . $dir/$name
-
-	  # Add PIC object to the list of files to remove.
-	  if test -n "$pic_object" \
-	     && test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
-	  fi
-
-	  # Add non-PIC object to the list of files to remove.
-	  if test -n "$non_pic_object" \
-	     && test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
-	  fi
-	fi
-	;;
-
-      *)
-	if test "$mode" = clean ; then
-	  noexename=$name
-	  case $file in
-	  *.exe)
-	    file=`$echo $file|${SED} 's,.exe$,,'`
-	    noexename=`$echo $name|${SED} 's,.exe$,,'`
-	    # $file with .exe has already been added to rmfiles,
-	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
-	    ;;
-	  esac
-	  # Do a test to see if this is a libtool program.
-	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	    relink_command=
-	    . $dir/$noexename
-
-	    # note $name still contains .exe if it was in $file originally
-	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
-	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
-	    fi
-	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
-	    fi
-	  fi
-	fi
-	;;
-      esac
-      $show "$rm $rmfiles"
-      $run $rm $rmfiles || exit_status=1
-    done
-    objdir="$origobjdir"
-
-    # Try to remove the ${objdir}s in the directories where we deleted files
-    for dir in $rmdirs; do
-      if test -d "$dir"; then
-	$show "rmdir $dir"
-	$run rmdir $dir >/dev/null 2>&1
-      fi
-    done
-
-    exit $exit_status
-    ;;
-
-  "")
-    $echo "$modename: you must specify a MODE" 1>&2
-    $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
-    ;;
-  esac
-
-  if test -z "$exec_cmd"; then
-    $echo "$modename: invalid operation mode \`$mode'" 1>&2
-    $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
-  eval exec $exec_cmd
-  exit $EXIT_FAILURE
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
-    --config          show all configuration variables
-    --debug           enable verbose shell tracing
--n, --dry-run         display commands without modifying any files
-    --features        display basic configuration information and exit
-    --finish          same as \`--mode=finish'
-    --help            display this help message and exit
-    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
-    --quiet           same as \`--silent'
-    --silent          don't print informational messages
-    --tag=TAG         use configuration variables from tag TAG
-    --version         print version information
-
-MODE must be one of the following:
-
-      clean           remove files from the build directory
-      compile         compile a source file into a libtool object
-      execute         automatically set library path, then run a program
-      finish          complete the installation of libtool libraries
-      install         install libraries or executables
-      link            create a library or an executable
-      uninstall       remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE.
-
-Report bugs to <bug-libtool@gnu.org>."
-  exit $EXIT_SUCCESS
-  ;;
-
-clean)
-  $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
-  ;;
-
-compile)
-  $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
-  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
-  -static           always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
-  ;;
-
-execute)
-  $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
-  -dlopen FILE      add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
-  ;;
-
-finish)
-  $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
-  ;;
-
-install)
-  $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
-  ;;
-
-link)
-  $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
-  -all-static       do not do any dynamic linking at all
-  -avoid-version    do not add a version suffix if possible
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
-  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
-  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-  -export-symbols SYMFILE
-		    try to export only the symbols listed in SYMFILE
-  -export-symbols-regex REGEX
-		    try to export only the symbols matching REGEX
-  -LLIBDIR          search LIBDIR for required installed libraries
-  -lNAME            OUTPUT-FILE requires the installed library libNAME
-  -module           build a library that can dlopened
-  -no-fast-install  disable the fast-install mode
-  -no-install       link a not-installable executable
-  -no-undefined     declare that a library does not refer to external symbols
-  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
-  -release RELEASE  specify package release information
-  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
-  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of libtool libraries
-  -version-info CURRENT[:REVISION[:AGE]]
-		    specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename.  Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
-  ;;
-
-uninstall)
-  $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
-  ;;
-
-*)
-  $echo "$modename: invalid operation mode \`$mode'" 1>&2
-  $echo "$help" 1>&2
-  exit $EXIT_FAILURE
-  ;;
-esac
-
-$echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit $EXIT_SUCCESS
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them.  This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration.  But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
--- a/sdl-config.in	Fri Feb 10 07:29:08 2006 +0000
+++ b/sdl-config.in	Thu Feb 16 10:11:48 2006 +0000
@@ -40,15 +40,6 @@
       ;;
     --cflags)
       echo -I@includedir@/SDL @SDL_CFLAGS@
-
-      # The portable way of including SDL is #include "SDL.h"
-      #if test @includedir@ != /usr/include ; then
-      #    # Handle oddities in Win32 path handling (assumes prefix)
-      #    prefix=`echo ${prefix} | sed 's,^//\([A-Z]\),\1:,'`
-      #
-      #    includes=-I@includedir@
-      #fi
-      #echo $includes -I@includedir@/SDL @SDL_CFLAGS@
       ;;
 @ENABLE_SHARED_TRUE@    --libs)
 @ENABLE_SHARED_TRUE@      libdirs="-L@libdir@ @SDL_RLD_FLAGS@"
--- a/src/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-
-## Makefile.am for the main SDL library
-
-# These are the subdirectories that are always built
-CORE_SUBDIRS =			\
-	main stdlib
-
-# These are the subdirectories which may be built
-EXTRA_SUBDIRS =			\
-	 audio video events joystick cdrom thread timer file cpuinfo hermes
-
-# These are the subdirectories which will be built now
-SUBDIRS = $(CORE_SUBDIRS) @SDL_EXTRADIRS@
-
-# These are the subdirectories which will be distributed with "make dist"
-DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS)
-
-# The SDL library target
-lib_LTLIBRARIES = libSDL.la
-
-libSDL_la_SOURCES = $(GENERAL_SRCS)
-libSDL_la_LDFLAGS = 		\
-	-no-undefined		\
-        -release $(LT_RELEASE)	\
-	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libSDL_la_LIBADD =		\
-	main/libarch.la		\
-	stdlib/libstdlib.la	\
-	@SDL_EXTRALIBS@		\
-	@SYSTEM_LIBS@
-libSDL_la_DEPENDENCIES =	\
-	main/libarch.la		\
-	stdlib/libstdlib.la	\
-	@SDL_EXTRALIBS@
-
-# The SDL library sources
-GENERAL_SRCS = 		\
-	SDL.c			\
-	SDL_error.c		\
-	SDL_error_c.h		\
-	SDL_fatal.c		\
-	SDL_fatal.h		\
-	SDL_loadso.c
-
--- a/src/SDL.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/SDL.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,26 +22,26 @@
 
 /* Initialization code for SDL */
 
-#ifdef ENABLE_PTH
+#include "SDL.h"
+#include "SDL_fatal.h"
+#if !SDL_VIDEO_DISABLED
+#include "video/SDL_leaks.h"
+#endif
+
+#if SDL_THREAD_PTH
 #include <pth.h>
 #endif
 
-#include "SDL.h"
-#include "SDL_fatal.h"
-#ifndef DISABLE_VIDEO
-#include "SDL_leaks.h"
-#endif
-
 /* Initialization/Cleanup routines */
-#ifndef DISABLE_JOYSTICK
+#if !SDL_JOYSTICK_DISABLED
 extern int  SDL_JoystickInit(void);
 extern void SDL_JoystickQuit(void);
 #endif
-#ifndef DISABLE_CDROM
+#if !SDL_CDROM_DISABLED
 extern int  SDL_CDROMInit(void);
 extern void SDL_CDROMQuit(void);
 #endif
-#ifndef DISABLE_TIMERS
+#if !SDL_TIMERS_DISABLED
 extern void SDL_StartTicks(void);
 extern int  SDL_TimerInit(void);
 extern void SDL_TimerQuit(void);
@@ -61,7 +61,7 @@
 
 int SDL_InitSubSystem(Uint32 flags)
 {
-#ifndef DISABLE_VIDEO
+#if !SDL_VIDEO_DISABLED
 	/* Initialize the video/event subsystem */
 	if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) {
 		if ( SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"),
@@ -77,7 +77,7 @@
 	}
 #endif
 
-#ifndef DISABLE_AUDIO
+#if !SDL_AUDIO_DISABLED
 	/* Initialize the audio subsystem */
 	if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) {
 		if ( SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0 ) {
@@ -92,7 +92,7 @@
 	}
 #endif
 
-#ifndef DISABLE_TIMERS
+#if !SDL_TIMERS_DISABLED
 	/* Initialize the timer subsystem */
 	if ( ! ticks_started ) {
 		SDL_StartTicks();
@@ -111,7 +111,7 @@
 	}
 #endif
 
-#ifndef DISABLE_JOYSTICK
+#if !SDL_JOYSTICK_DISABLED
 	/* Initialize the joystick subsystem */
 	if ( (flags & SDL_INIT_JOYSTICK) &&
 	     !(SDL_initialized & SDL_INIT_JOYSTICK) ) {
@@ -127,7 +127,7 @@
 	}
 #endif
 
-#ifndef DISABLE_CDROM
+#if !SDL_CDROM_DISABLED
 	/* Initialize the CD-ROM subsystem */
 	if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) {
 		if ( SDL_CDROMInit() < 0 ) {
@@ -146,7 +146,7 @@
 
 int SDL_Init(Uint32 flags)
 {
-#if !defined(DISABLE_THREADS) && defined(ENABLE_PTH)
+#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
 	if (!pth_init()) {
 		return -1;
 	}
@@ -170,31 +170,31 @@
 void SDL_QuitSubSystem(Uint32 flags)
 {
 	/* Shut down requested initialized subsystems */
-#ifndef DISABLE_CDROM
+#if !SDL_CDROM_DISABLED
 	if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) {
 		SDL_CDROMQuit();
 		SDL_initialized &= ~SDL_INIT_CDROM;
 	}
 #endif
-#ifndef DISABLE_JOYSTICK
+#if !SDL_JOYSTICK_DISABLED
 	if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) {
 		SDL_JoystickQuit();
 		SDL_initialized &= ~SDL_INIT_JOYSTICK;
 	}
 #endif
-#ifndef DISABLE_TIMERS
+#if !SDL_TIMERS_DISABLED
 	if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) {
 		SDL_TimerQuit();
 		SDL_initialized &= ~SDL_INIT_TIMER;
 	}
 #endif
-#ifndef DISABLE_AUDIO
+#if !SDL_AUDIO_DISABLED
 	if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) {
 		SDL_AudioQuit();
 		SDL_initialized &= ~SDL_INIT_AUDIO;
 	}
 #endif
-#ifndef DISABLE_VIDEO
+#if !SDL_VIDEO_DISABLED
 	if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) {
 		SDL_VideoQuit();
 		SDL_initialized &= ~SDL_INIT_VIDEO;
@@ -236,7 +236,7 @@
 	/* Uninstall any parachute signal handlers */
 	SDL_UninstallParachute();
 
-#if !defined(DISABLE_THREADS) && defined(ENABLE_PTH)
+#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
 	pth_kill();
 #endif
 #ifdef DEBUG_BUILD
--- a/src/SDL_error.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/SDL_error.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,16 +24,15 @@
 
 #include "SDL_error.h"
 #include "SDL_error_c.h"
-#ifndef DISABLE_THREADS
-#include "SDL_thread_c.h"
-#endif
 
-#ifdef DISABLE_THREADS
-/* The default (non-thread-safe) global error variable */
+/* Routine to get the thread-specific error variable */
+#if SDL_THREADS_DISABLED
+/* The  SDL_arraysize(The ),default (non-thread-safe) global error variable */
 static SDL_error SDL_global_error;
-
 #define SDL_GetErrBuf()	(&SDL_global_error)
-#endif /* DISABLE_THREADS */
+#else
+extern SDL_error *SDL_GetErrBuf(void);
+#endif /* SDL_THREADS_DISABLED */
 
 #define SDL_ERRBUFIZE	1024
 
--- a/src/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-/*
- * Mac OS X >= 10.3 are guaranteed to have dlopen support in a system
- *  framework, which means we don't have to roll our own on non-PowerPC
- *  systems to guarantee compatibility (x86 Macs started at 10.4).   --ryan.
- */
-#if ( (defined(MACOSX)) && (!defined(__POWERPC__)) )
-#  define USE_DLOPEN 1
-#endif
-
-/* !!! FIXME: includes so I don't have to update all the project files... */
-#define SDL_INTERNAL_BUILDING_LOADSO 1
-#if defined(USE_DUMMY_LOADSO)
-# include "loadso/dummy/SDL_loadso.c"
-#elif defined(USE_DLOPEN)
-# include "loadso/dlopen/SDL_loadso.c"
-#elif defined(MACOSX)
-# include "loadso/macosx/SDL_loadso.c"
-#elif defined(macintosh)
-# include "loadso/macos/SDL_loadso.c"
-#elif defined(WIN32) || defined(_WIN32_WCE)
-# include "loadso/windows/SDL_loadso.c"
-#elif defined(__BEOS__)
-# include "loadso/beos/SDL_loadso.c"
-#elif defined(__MINT__) && defined(ENABLE_LDG)
-# include "loadso/mint/SDL_loadso.c"
-#elif defined(__OS2__)
-# include "loadso/os2/SDL_loadso.c"
-#else
-# include "loadso/dummy/SDL_loadso.c"
-#endif /* system type */
-
--- a/src/audio/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-
-## Makefile.am for the SDL audio library
-
-noinst_LTLIBRARIES = libaudio.la
-
-# Define which subdirectories need to be built
-SUBDIRS = @AUDIO_SUBDIRS@
-DIST_SUBDIRS =	\
-	alsa	\
-	arts	\
-	baudio	\
-	dc	\
-	disk	\
-	dma	\
-	dmedia	\
-	dsp	\
-	esd	\
-	macosx	\
-	macrom	\
-	mint	\
-	mme	\
-	nas	\
-	nto	\
-	openbsd	\
-	paudio	\
-	sun	\
-	ums	\
-	windib	\
-	windx5
-
-DRIVERS = @AUDIO_DRIVERS@
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_audio.c		\
-	SDL_audio_c.h		\
-	SDL_audiocvt.c		\
-	SDL_audiodev.c		\
-	SDL_audiodev_c.h	\
-	SDL_audiomem.c		\
-	SDL_audiomem.h		\
-	SDL_mixer.c		\
-	SDL_sysaudio.h		\
-	SDL_wave.c		\
-	SDL_wave.h              \
-	SDL_mixer_MMX.c         \
-	SDL_mixer_MMX.h		\
-	SDL_mixer_MMX_VC.c	\
-	SDL_mixer_MMX_VC.h	\
-	SDL_mixer_m68k.c	\
-	SDL_mixer_m68k.h
-
-libaudio_la_SOURCES = $(COMMON_SRCS)
-libaudio_la_LIBADD = $(DRIVERS)
-libaudio_la_DEPENDENCIES = $(DRIVERS)
--- a/src/audio/SDL_audio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/SDL_audio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -35,76 +35,76 @@
 
 /* Available audio drivers */
 static AudioBootStrap *bootstrap[] = {
-#ifdef OPENBSD_AUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_OPENBSD
 	&OPENBSD_AUDIO_bootstrap,
 #endif
-#ifdef OSS_SUPPORT
+#if SDL_AUDIO_DRIVER_OSS
 	&DSP_bootstrap,
 	&DMA_bootstrap,
 #endif
-#ifdef ALSA_SUPPORT
+#if SDL_AUDIO_DRIVER_ALSA
 	&ALSA_bootstrap,
 #endif
-#ifdef QNXNTOAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_QNXNTO
 	&QNXNTOAUDIO_bootstrap,
 #endif
-#ifdef SUNAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_SUNAUDIO
 	&SUNAUDIO_bootstrap,
 #endif
-#ifdef DMEDIA_SUPPORT
+#if SDL_AUDIO_DRIVER_DMEDIA
 	&DMEDIA_bootstrap,
 #endif
-#ifdef ARTSC_SUPPORT
-	&ARTSC_bootstrap,
+#if SDL_AUDIO_DRIVER_ARTS
+	&ARTS_bootstrap,
 #endif
-#ifdef ESD_SUPPORT
+#if SDL_AUDIO_DRIVER_ESD
 	&ESD_bootstrap,
 #endif
-#ifdef NAS_SUPPORT
+#if SDL_AUDIO_DRIVER_NAS
 	&NAS_bootstrap,
 #endif
-#ifdef ENABLE_DIRECTX
+#if SDL_AUDIO_DRIVER_DSOUND
 	&DSOUND_bootstrap,
 #endif
-#ifdef ENABLE_WINDIB
+#if SDL_AUDIO_DRIVER_WAVEOUT
 	&WAVEOUT_bootstrap,
 #endif
-#ifdef __BEOS__
+#if SDL_AUDIO_DRIVER_PAUD
+	&Paud_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_BAUDIO
 	&BAUDIO_bootstrap,
 #endif
-#ifdef MACOSX
+#if SDL_AUDIO_DRIVER_COREAUDIO
 	&COREAUDIO_bootstrap,
 #endif
-#if defined(macintosh) || TARGET_API_MAC_CARBON
+#if SDL_AUDIO_DRIVER_SNDMGR
 	&SNDMGR_bootstrap,
 #endif
-#ifdef _AIX
-	&Paud_bootstrap,
-#endif
-#ifdef ENABLE_AHI
+#if SDL_AUDIO_DRIVER_AHI
 	&AHI_bootstrap,
 #endif
-#ifdef MMEAUDIO_SUPPORT
-	&MMEAUDIO_bootstrap,
-#endif
-#ifdef MINTAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_MINT
 	&MINTAUDIO_GSXB_bootstrap,
 	&MINTAUDIO_MCSN_bootstrap,
 	&MINTAUDIO_STFA_bootstrap,
 	&MINTAUDIO_XBIOS_bootstrap,
 	&MINTAUDIO_DMA8_bootstrap,
 #endif
-#ifdef DISKAUD_SUPPORT
+#if SDL_AUDIO_DRIVER_DISK
 	&DISKAUD_bootstrap,
 #endif
-#ifdef ENABLE_DC
+#if SDL_AUDIO_DRIVER_DC
 	&DCAUD_bootstrap,
 #endif
-#ifdef DRENDERER_SUPPORT
+#if SDL_AUDIO_DRIVER_DRENDERER
 	&DRENDERER_bootstrap,
 #endif
-#ifdef __OS2__
-        &DART_bootstrap,
+#if SDL_AUDIO_DRIVER_MMEAUDIO
+	&MMEAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_DART
+	&DART_bootstrap,
 #endif
 	NULL
 };
@@ -294,7 +294,7 @@
 	/* Select the proper audio driver */
 	audio = NULL;
 	idx = 0;
-#ifdef unix
+#if SDL_AUDIO_DRIVER_ESD
 	if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) {
 		/* Ahem, we know that if ESPEAKER is set, user probably wants
 		   to use ESD, but don't start it if it's not already running.
@@ -323,7 +323,7 @@
 			}
 		}
 	}
-#endif /* unix */
+#endif /* SDL_AUDIO_DRIVER_ESD */
 	if ( audio == NULL ) {
 		if ( driver_name != NULL ) {
 #if 0	/* This will be replaced with a better driver selection API */
@@ -414,10 +414,10 @@
 		return(-1);
 	}
 
-#if defined(macintosh) || (defined(__riscos__) && defined(DISABLE_THREADS))
+#if defined(macintosh) || (defined(__riscos__) && SDL_THREADS_DISABLED)
 	/* FIXME: Need to implement PPC interrupt asm for SDL_LockAudio() */
 #else
-#if defined(__MINT__) && !defined(ENABLE_THREADS)
+#if defined(__MINT__) && SDL_THREADS_DISABLED
 	/* Uses interrupt driven audio, without thread */
 #else
 	/* Create a semaphore for locking the sound buffers */
--- a/src/audio/SDL_audiomem.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* Functions to allocate audio buffer memory, shareable across threads
-	(necessary because SDL audio emulates threads with fork()
- */
-
-#ifdef FORK_HACK
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <stddef.h>
-#endif
-
-#include "SDL_stdinc.h"
-#include "SDL_audiomem.h"
-
-/* Allocate memory that will be shared between threads (freed on exit) */
-void *SDL_AllocAudioMem(int size)
-{
-	void *chunk;
-
-#ifdef FORK_HACK
-	int   semid;
-	
-	/* Create and get the address of a shared memory segment */
-	semid = shmget(IPC_PRIVATE, size, (IPC_CREAT|0600));
-	if ( semid < 0 ) {
-		return(NULL);
-	}
-	chunk = shmat(semid, NULL, 0);
-	
-	/* Set the segment for deletion when it is detatched */
-	shmctl(semid, IPC_RMID, NULL);	/* Delets semid if shmat() fails */
-#else
-	chunk = SDL_malloc(size);
-#endif
-	return((void *)chunk);
-}
-
-void SDL_FreeAudioMem(void *chunk)
-{
-#ifdef FORK_HACK
-	shmdt(chunk);
-#else
-	SDL_free(chunk);
-#endif
-}
--- a/src/audio/SDL_audiomem.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/SDL_audiomem.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,10 +20,5 @@
     slouken@libsdl.org
 */
 
-/* Functions to allocate audio buffer memory, shareable across threads
-	(necessary because SDL audio emulates threads with fork()
- */
-
-extern void *SDL_AllocAudioMem(int size);
-extern void SDL_FreeAudioMem(void *mem);
-
+#define SDL_AllocAudioMem	SDL_malloc
+#define SDL_FreeAudioMem	SDL_free
--- a/src/audio/SDL_sysaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/SDL_sysaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -99,75 +99,75 @@
 	SDL_AudioDevice *(*create)(int devindex);
 } AudioBootStrap;
 
-#ifdef OPENBSD_AUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_OPENBSD
 extern AudioBootStrap OPENBSD_AUDIO_bootstrap;
 #endif
-#ifdef OSS_SUPPORT
+#if SDL_AUDIO_DRIVER_OSS
 extern AudioBootStrap DSP_bootstrap;
 extern AudioBootStrap DMA_bootstrap;
 #endif
-#ifdef ALSA_SUPPORT
+#if SDL_AUDIO_DRIVER_ALSA
 extern AudioBootStrap ALSA_bootstrap;
 #endif
-#ifdef QNXNTOAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_QNXNTO
 extern AudioBootStrap QNXNTOAUDIO_bootstrap;
 #endif
-#ifdef SUNAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_SUNAUDIO
 extern AudioBootStrap SUNAUDIO_bootstrap;
 #endif
-#ifdef DMEDIA_SUPPORT
+#if SDL_AUDIO_DRIVER_DMEDIA
 extern AudioBootStrap DMEDIA_bootstrap;
 #endif
-#ifdef ARTSC_SUPPORT
-extern AudioBootStrap ARTSC_bootstrap;
+#if SDL_AUDIO_DRIVER_ARTS
+extern AudioBootStrap ARTS_bootstrap;
 #endif
-#ifdef ESD_SUPPORT
+#if SDL_AUDIO_DRIVER_ESD
 extern AudioBootStrap ESD_bootstrap;
 #endif
-#ifdef NAS_SUPPORT
+#if SDL_AUDIO_DRIVER_NAS
 extern AudioBootStrap NAS_bootstrap;
 #endif
-#ifdef ENABLE_DIRECTX
+#if SDL_AUDIO_DRIVER_DSOUND
 extern AudioBootStrap DSOUND_bootstrap;
 #endif
-#ifdef ENABLE_WINDIB
+#if SDL_AUDIO_DRIVER_WAVEOUT
 extern AudioBootStrap WAVEOUT_bootstrap;
 #endif
-#ifdef _AIX
+#if SDL_AUDIO_DRIVER_PAUD
 extern AudioBootStrap Paud_bootstrap;
 #endif
-#ifdef __BEOS__
+#if SDL_AUDIO_DRIVER_BAUDIO
 extern AudioBootStrap BAUDIO_bootstrap;
 #endif
-#ifdef MACOSX
+#if SDL_AUDIO_DRIVER_COREAUDIO
 extern AudioBootStrap COREAUDIO_bootstrap;
 #endif
-#if defined(macintosh) || TARGET_API_MAC_CARBON
+#if SDL_AUDIO_DRIVER_SNDMGR
 extern AudioBootStrap SNDMGR_bootstrap;
 #endif
-#ifdef ENABLE_AHI
+#if SDL_AUDIO_DRIVER_AHI
 extern AudioBootStrap AHI_bootstrap;
 #endif
-#ifdef MINTAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_MINT
 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
 extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
 #endif
-#ifdef DISKAUD_SUPPORT
+#if SDL_AUDIO_DRIVER_DISK
 extern AudioBootStrap DISKAUD_bootstrap;
 #endif
-#ifdef ENABLE_DC
+#if SDL_AUDIO_DRIVER_DC
 extern AudioBootStrap DCAUD_bootstrap;
 #endif
-#ifdef DRENDERER_SUPPORT
+#if SDL_AUDIO_DRIVER_DRENDERER
 extern AudioBootStrap DRENDERER_bootstrap;
 #endif
-#ifdef MMEAUDIO_SUPPORT
+#if SDL_AUDIO_DRIVER_MMEAUDIO
 extern AudioBootStrap MMEAUDIO_bootstrap;
 #endif
-#ifdef __OS2__
+#if SDL_AUDIO_DRIVER_DART
 extern AudioBootStrap DART_bootstrap;
 #endif
 
--- a/src/audio/SDL_wave.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/SDL_wave.c	Thu Feb 16 10:11:48 2006 +0000
@@ -20,8 +20,6 @@
     slouken@libsdl.org
 */
 
-#ifndef DISABLE_FILE
-
 /* Microsoft WAVE file loading routines */
 
 #include "SDL_audio.h"
@@ -590,5 +588,3 @@
 	}
 	return(chunk->length);
 }
-
-#endif /* ENABLE_FILE */
--- a/src/audio/alsa/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for SDL using the ALSA PCM audio API
-
-noinst_LTLIBRARIES = libaudio_alsa.la
-libaudio_alsa_la_SOURCES = $(SRCS)
-
-alsa_lib = \"@alsa_lib@\"
-
-# The SDL audio driver sources
-SRCS =	SDL_alsa_audio.c	\
-	SDL_alsa_audio.h
--- a/src/audio/alsa/SDL_alsa_audio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/alsa/SDL_alsa_audio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,18 +27,13 @@
 #include <sys/types.h>
 #include <signal.h>	/* For kill() */
 
+#include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_timer.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
 #include "SDL_alsa_audio.h"
 
-#ifdef ALSA_DYNAMIC
-#ifdef USE_DLVSYM
-#ifndef __USE_GNU
-#define __USE_GNU
-#endif
-#endif
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 #include <dlfcn.h>
 #include "SDL_name.h"
 #include "SDL_loadso.h"
@@ -60,9 +55,9 @@
 static Uint8 *ALSA_GetAudioBuf(_THIS);
 static void ALSA_CloseAudio(_THIS);
 
-#ifdef ALSA_DYNAMIC
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 
-static const char *alsa_library = ALSA_DYNAMIC;
+static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
 static void *alsa_handle = NULL;
 static int alsa_loaded = 0;
 
@@ -131,7 +126,7 @@
 		retval = 0;
 		for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) {
 /*			*alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/
-#ifdef USE_DLVSYM
+#if HAVE_DLVSYM
 			*alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9");
 			if (!*alsa_functions[i].func)
 #endif
@@ -156,7 +151,7 @@
 	return 0;
 }
 
-#endif /* ALSA_DYNAMIC */
+#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
 
 static const char *get_audio_device(int channels)
 {
--- a/src/audio/alsa/SDL_alsa_audio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/alsa/SDL_alsa_audio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,11 +23,12 @@
 #ifndef _ALSA_PCM_audio_h
 #define _ALSA_PCM_audio_h
 
-#include "SDL_sysaudio.h"
 #define ALSA_PCM_OLD_HW_PARAMS_API
 #define ALSA_PCM_OLD_SW_PARAMS_API
 #include <alsa/asoundlib.h>
 
+#include "../SDL_sysaudio.h"
+
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
 
--- a/src/audio/amigaos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the SDL AmigaOS audio subsystem
-
-noinst_LTLIBRARIES = libaudio_arch.la
-
-ARCH_SRCS = SDL_ahiaudio.c SDL_ahiaudio.h
-
-libaudio_arch_la_SOURCES = $(ARCH_SRCS)
--- a/src/audio/amigaos/SDL_ahiaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/amigaos/SDL_ahiaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,7 @@
 /* Allow access to a raw mixing buffer (for AmigaOS) */
 
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audio_c.h"
 #include "SDL_ahiaudio.h"
 
 /* Audio driver functions */
--- a/src/audio/amigaos/SDL_ahiaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/amigaos/SDL_ahiaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,8 @@
 
 #include <devices/ahi.h>
 #include "mydebug.h"
-#include "SDL_sysaudio.h"
+
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the audio functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/arts/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for SDL using the Analog Realtime Synthesizer sound driver
-
-noinst_LTLIBRARIES = libaudio_arts.la
-libaudio_arts_la_SOURCES = $(SRCS)
-
-arts_lib = \"@arts_lib@\"
-
-# The SDL audio driver sources
-SRCS =	SDL_artsaudio.c	\
-	SDL_artsaudio.h
--- a/src/audio/arts/SDL_artsaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/arts/SDL_artsaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,12 +24,12 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_artsaudio.h"
 
-#ifdef ARTSC_DYNAMIC
+#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
@@ -37,18 +37,18 @@
 #endif
 
 /* The tag name used by artsc audio */
-#define ARTSC_DRIVER_NAME         "arts"
+#define ARTS_DRIVER_NAME         "arts"
 
 /* Audio driver functions */
-static int ARTSC_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void ARTSC_WaitAudio(_THIS);
-static void ARTSC_PlayAudio(_THIS);
-static Uint8 *ARTSC_GetAudioBuf(_THIS);
-static void ARTSC_CloseAudio(_THIS);
+static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec);
+static void ARTS_WaitAudio(_THIS);
+static void ARTS_PlayAudio(_THIS);
+static Uint8 *ARTS_GetAudioBuf(_THIS);
+static void ARTS_CloseAudio(_THIS);
 
-#ifdef ARTSC_DYNAMIC
+#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
 
-static const char *arts_library = ARTSC_DYNAMIC;
+static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
 static void *arts_handle = NULL;
 static int arts_loaded = 0;
 
@@ -114,7 +114,7 @@
 	return 0;
 }
 
-#endif /* ARTSC_DYNAMIC */
+#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
 
 /* Audio driver bootstrap functions */
 
@@ -171,24 +171,24 @@
 	stream = 0;
 
 	/* Set the function pointers */
-	this->OpenAudio = ARTSC_OpenAudio;
-	this->WaitAudio = ARTSC_WaitAudio;
-	this->PlayAudio = ARTSC_PlayAudio;
-	this->GetAudioBuf = ARTSC_GetAudioBuf;
-	this->CloseAudio = ARTSC_CloseAudio;
+	this->OpenAudio = ARTS_OpenAudio;
+	this->WaitAudio = ARTS_WaitAudio;
+	this->PlayAudio = ARTS_PlayAudio;
+	this->GetAudioBuf = ARTS_GetAudioBuf;
+	this->CloseAudio = ARTS_CloseAudio;
 
 	this->free = Audio_DeleteDevice;
 
 	return this;
 }
 
-AudioBootStrap ARTSC_bootstrap = {
-	ARTSC_DRIVER_NAME, "Analog Realtime Synthesizer",
+AudioBootStrap ARTS_bootstrap = {
+	ARTS_DRIVER_NAME, "Analog Realtime Synthesizer",
 	Audio_Available, Audio_CreateDevice
 };
 
 /* This function waits until it is possible to write a full sound buffer */
-static void ARTSC_WaitAudio(_THIS)
+static void ARTS_WaitAudio(_THIS)
 {
 	Sint32 ticks;
 
@@ -211,7 +211,7 @@
 	}
 }
 
-static void ARTSC_PlayAudio(_THIS)
+static void ARTS_PlayAudio(_THIS)
 {
 	int written;
 
@@ -232,12 +232,12 @@
 #endif
 }
 
-static Uint8 *ARTSC_GetAudioBuf(_THIS)
+static Uint8 *ARTS_GetAudioBuf(_THIS)
 {
 	return(mixbuf);
 }
 
-static void ARTSC_CloseAudio(_THIS)
+static void ARTS_CloseAudio(_THIS)
 {
 	if ( mixbuf != NULL ) {
 		SDL_FreeAudioMem(mixbuf);
@@ -250,7 +250,7 @@
 	SDL_NAME(arts_free)();
 }
 
-static int ARTSC_OpenAudio(_THIS, SDL_AudioSpec *spec)
+static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec)
 {
 	int bits, frag_spec;
 	Uint16 test_format, format;
--- a/src/audio/arts/SDL_artsaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/arts/SDL_artsaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,8 @@
 #define _SDL_artscaudio_h
 
 #include <artsc.h>
-#include "SDL_sysaudio.h"
+
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/baudio/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the BeOS BSoundPlayer sound driver
-
-noinst_LTLIBRARIES = libaudio_baudio.la
-libaudio_baudio_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_beaudio.cc	\
-	SDL_beaudio.h
--- a/src/audio/baudio/SDL_beaudio.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/baudio/SDL_beaudio.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -29,9 +29,9 @@
 extern "C" {
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_sysaudio.h"
-#include "SDL_systhread_c.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "../../thread/SDL_systhread_c.h"
 #include "SDL_beaudio.h"
 
 
--- a/src/audio/baudio/SDL_beaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/baudio/SDL_beaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_lowaudio_h
 #define _SDL_lowaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *_this
--- a/src/audio/dart/SDL_dart.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dart/SDL_dart.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audio_c.h"
 #include "SDL_dart.h"
 
 // Buffer states:
--- a/src/audio/dart/SDL_dart.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dart/SDL_dart.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,6 @@
 #ifndef _SDL_lowaudio_h
 #define _SDL_lowaudio_h
 
-#include "SDL_sysaudio.h"
-
 #define INCL_TYPES
 #define INCL_DOSSEMAPHORES
 #define INCL_DOSRESOURCES
@@ -37,6 +35,8 @@
 #include <os2.h>
 #include <os2me.h>     // DART stuff and MMIO stuff
 
+#include "../SDL_sysaudio.h"
+
 /* Hidden "this" pointer for the audio functions */
 #define _THIS	SDL_AudioDevice *_this
 
--- a/src/audio/dc/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for SDL on the Dreamcast console
-
-noinst_LTLIBRARIES = libaudio_dc.la
-libaudio_dc_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_dcaudio.c	\
-	SDL_dcaudio.h	\
-	aica.c		\
-	aica.h
--- a/src/audio/dc/SDL_dcaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dc/SDL_dcaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -32,9 +32,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_dcaudio.h"
 
 #include "aica.h"
--- a/src/audio/dc/SDL_dcaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dc/SDL_dcaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_diskaudio_h
 #define _SDL_diskaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/disk/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL audio "driver" that writes to a file.
-
-noinst_LTLIBRARIES = libaudio_disk.la
-libaudio_disk_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_diskaudio.c	\
-	SDL_diskaudio.h
--- a/src/audio/disk/SDL_diskaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/disk/SDL_diskaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,9 +37,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_diskaudio.h"
 
 /* The tag name used by DISK audio */
--- a/src/audio/disk/SDL_diskaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/disk/SDL_diskaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_diskaudio_h
 #define _SDL_diskaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/dma/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the OSS /dev/dsp DMA sound driver
-
-noinst_LTLIBRARIES = libaudio_dma.la
-libaudio_dma_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_dmaaudio.c	\
-	SDL_dmaaudio.h
--- a/src/audio/dma/SDL_dmaaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dma/SDL_dmaaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,10 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
-#ifdef OSS_USE_SOUNDCARD_H
+
+#include "SDL_config.h"
+
+#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 /* This is installed on some systems */
 #include <soundcard.h>
 #else
@@ -47,9 +50,8 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_dmaaudio.h"
 
 /* The tag name used by DMA audio */
--- a/src/audio/dma/SDL_dmaaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dma/SDL_dmaaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_dspaudio_h
 #define _SDL_dspaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/dmedia/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the IRIX DMedia sound driver
-
-noinst_LTLIBRARIES = libaudio_dmedia.la
-libaudio_dmedia_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_irixaudio.c	\
-	SDL_irixaudio.h
--- a/src/audio/dmedia/SDL_irixaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dmedia/SDL_irixaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,8 +25,8 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
 #include "SDL_irixaudio.h"
 
 
--- a/src/audio/dmedia/SDL_irixaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dmedia/SDL_irixaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 
 #include <dmedia/audio.h>
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the audio functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/dsp/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the OSS /dev/dsp standard sound driver
-
-noinst_LTLIBRARIES = libaudio_dsp.la
-libaudio_dsp_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_dspaudio.c	\
-	SDL_dspaudio.h
--- a/src/audio/dsp/SDL_dspaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dsp/SDL_dspaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -34,7 +34,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#ifdef OSS_USE_SOUNDCARD_H
+
+#include "SDL_config.h"
+
+#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 /* This is installed on some systems */
 #include <soundcard.h>
 #else
@@ -44,9 +47,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_dspaudio.h"
 
 /* The tag name used by DSP audio */
--- a/src/audio/dsp/SDL_dspaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/dsp/SDL_dspaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_dspaudio_h
 #define _SDL_dspaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/esd/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for SDL using the Enlightened Sound Daemon sound driver
-
-noinst_LTLIBRARIES = libaudio_esd.la
-libaudio_esd_la_SOURCES = $(SRCS)
-
-esd_lib = \"@esd_lib@\"
-
-# The SDL audio driver sources
-SRCS =	SDL_esdaudio.c	\
-	SDL_esdaudio.h
--- a/src/audio/esd/SDL_esdaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/esd/SDL_esdaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,12 +30,12 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_esdaudio.h"
 
-#ifdef ESD_DYNAMIC
+#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
@@ -52,9 +52,9 @@
 static Uint8 *ESD_GetAudioBuf(_THIS);
 static void ESD_CloseAudio(_THIS);
 
-#ifdef ESD_DYNAMIC
+#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
 
-static const char *esd_library = ESD_DYNAMIC;
+static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC;
 static void *esd_handle = NULL;
 static int esd_loaded = 0;
 
@@ -112,7 +112,7 @@
 	return 0;
 }
 
-#endif /* ESD_DYNAMIC */
+#endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */
 
 /* Audio driver bootstrap functions */
 
--- a/src/audio/esd/SDL_esdaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/esd/SDL_esdaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_esdaudio_h
 #define _SDL_esdaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/macosx/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the Mac OS X CoreAudio driver
-
-noinst_LTLIBRARIES = libaudio_macosx.la
-libaudio_macosx_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_coreaudio.c	\
-	SDL_coreaudio.h
--- a/src/audio/macosx/SDL_coreaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/macosx/SDL_coreaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,9 +23,8 @@
 #include <AudioUnit/AudioUnit.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 #include "SDL_coreaudio.h"
 
 
--- a/src/audio/macosx/SDL_coreaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/macosx/SDL_coreaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_coreaudio_h
 #define _SDL_coreaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/macrom/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the MacOS SoundManager audio driver
-
-noinst_LTLIBRARIES = libaudio_macrom.la
-libaudio_macrom_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_romaudio.c	\
-	SDL_romaudio.h
--- a/src/audio/macrom/SDL_romaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/macrom/SDL_romaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -40,9 +40,8 @@
 #endif
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 #include "SDL_romaudio.h"
 
 /* Audio driver functions */
--- a/src/audio/macrom/SDL_romaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/macrom/SDL_romaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_romaudio_h
 #define _SDL_romaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* This is Ryan's improved MacOS sound code, with locking support */
 #define USE_RYANS_SOUNDCODE
--- a/src/audio/mint/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-## Makefile.am for SDL using Xbios/Dma/whatever available audio functions
-
-noinst_LTLIBRARIES = libaudio_mintaudio.la
-libaudio_mintaudio_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS = \
-	SDL_mintaudio.c	\
-	SDL_mintaudio.h	\
-	SDL_mintaudio_dma8.c	\
-	SDL_mintaudio_dma8.h	\
-	SDL_mintaudio_gsxb.c	\
-	SDL_mintaudio_gsxb.h	\
-	SDL_mintaudio_it.S	\
-	SDL_mintaudio_mcsn.c	\
-	SDL_mintaudio_mcsn.h	\
-	SDL_mintaudio_stfa.c	\
-	SDL_mintaudio_stfa.h	\
-	SDL_mintaudio_xbios.c
--- a/src/audio/mint/SDL_mintaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_mintaudio_h
 #define _SDL_mintaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 #include "SDL_mintaudio_stfa.h"
 
 /* Hidden "this" pointer for the audio functions */
--- a/src/audio/mint/SDL_mintaudio_dma8.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_dma8.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,8 @@
 #include <mint/cookie.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 
 #include "SDL_atarimxalloc_c.h"
 
--- a/src/audio/mint/SDL_mintaudio_gsxb.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,8 @@
 #include <mint/cookie.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 
 #include "SDL_atarimxalloc_c.h"
 
--- a/src/audio/mint/SDL_mintaudio_mcsn.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_mcsn.c	Thu Feb 16 10:11:48 2006 +0000
@@ -35,9 +35,8 @@
 #include <mint/cookie.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 
 #include "SDL_atarimxalloc_c.h"
 
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,8 @@
 #include <mint/cookie.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 
 #include "SDL_atarimxalloc_c.h"
 
@@ -161,8 +160,8 @@
 
 	/* Stop replay */
 	oldpile=(void *)Super(0);
-	cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
-	Super(oldpile);
+	cookie_stfa->sound_enable=STFA_PLAY_SDL_DISABLE;
+	Super( SDL_arraysize(Super),oldpile);
 }
 
 static void Mint_UnlockAudio(_THIS)
--- a/src/audio/mint/SDL_mintaudio_xbios.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_xbios.c	Thu Feb 16 10:11:48 2006 +0000
@@ -36,9 +36,8 @@
 #include <mint/cookie.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiomem.h"
-#include "SDL_sysaudio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
 
 #include "SDL_atarimxalloc_c.h"
 
--- a/src/audio/mme/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the Tru64 MME sound driver
-
-noinst_LTLIBRARIES = libaudio_mme.la
-libaudio_mme_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_mmeaudio.c	\
-	SDL_mmeaudio.h
--- a/src/audio/mme/SDL_mmeaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mme/SDL_mmeaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,8 +25,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-
+#include "../SDL_audio_c.h"
 #include "SDL_mmeaudio.h"
 
 static BOOL inUse[NUM_BUFFERS];
--- a/src/audio/mme/SDL_mmeaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/mme/SDL_mmeaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,8 @@
 
 #ifndef _SDL_lowaudio_h
 #define _SDL_lowaudio_h
-#include "SDL_sysaudio.h"
+
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/nas/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the Network Audio System sound driver
-
-noinst_LTLIBRARIES = libaudio_nas.la
-libaudio_nas_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_nasaudio.c	\
-	SDL_nasaudio.h
--- a/src/audio/nas/SDL_nasaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/nas/SDL_nasaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,9 +31,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_nasaudio.h"
 
 /* The tag name used by artsc audio */
--- a/src/audio/nas/SDL_nasaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/nas/SDL_nasaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,8 @@
 #include <audio/audiolib.h>
 #endif
 #include <sys/time.h>
-#include "SDL_sysaudio.h"
+
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/nto/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the QNX Neutrino PCM audio API
-
-noinst_LTLIBRARIES = libaudio_nto.la
-libaudio_nto_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_nto_audio.c	\
-	SDL_nto_audio.h
--- a/src/audio/nto/SDL_nto_audio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/nto/SDL_nto_audio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,8 +33,8 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
 #include "SDL_nto_audio.h"
 
 /* The tag name used by NTO audio */
--- a/src/audio/nto/SDL_nto_audio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/nto/SDL_nto_audio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,9 +23,10 @@
 #ifndef __SDL_NTO_AUDIO_H__
 #define __SDL_NTO_AUDIO_H__
 
-#include "SDL_sysaudio.h"
 #include <sys/asoundlib.h>
 
+#include "../SDL_sysaudio.h"
+
 /* Hidden "this" pointer for the audio functions */
 #define _THIS	SDL_AudioDevice *this
 
--- a/src/audio/openbsd/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the native OpenBSD sound driver
-
-noinst_LTLIBRARIES = libaudio_openbsd.la
-libaudio_openbsd_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_openbsdaudio.c	\
-	SDL_openbsdaudio.h
--- a/src/audio/openbsd/SDL_openbsdaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/openbsd/SDL_openbsdaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -36,9 +36,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_openbsdaudio.h"
 
 /* The tag name used by OpenBSD audio */
--- a/src/audio/openbsd/SDL_openbsdaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/openbsd/SDL_openbsdaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_openbsdaudio_h
 #define _SDL_openbsdaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 #define _THIS	SDL_AudioDevice *this
 
--- a/src/audio/paudio/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the AIX PAudio sound driver
-
-noinst_LTLIBRARIES = libaudio_paudio.la
-libaudio_paudio_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_paudio.c	\
-	SDL_paudio.h
--- a/src/audio/paudio/SDL_paudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/paudio/SDL_paudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_paudio.h"
 
 #define DEBUG_AUDIO 1
--- a/src/audio/paudio/SDL_paudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/paudio/SDL_paudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_paudaudio_h
 #define _SDL_paudaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/sun/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the UNIX /dev/audio sound driver
-
-noinst_LTLIBRARIES = libaudio_sun.la
-libaudio_sun_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_sunaudio.c	\
-	SDL_sunaudio.h
--- a/src/audio/sun/SDL_sunaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/sun/SDL_sunaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -38,10 +38,10 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audiomem.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_sunaudio.h"
-#include "SDL_audio_c.h"
 
 /* Open the audio device for playback, and don't block if busy */
 #define OPEN_FLAGS	(O_WRONLY|O_NONBLOCK)
--- a/src/audio/sun/SDL_sunaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/sun/SDL_sunaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_lowaudio_h
 #define _SDL_lowaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/ums/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the AIX UMS sound driver
-
-noinst_LTLIBRARIES = libaudio_ums.la
-libaudio_ums_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_umsaudio.c	\
-	SDL_umsaudio.h
--- a/src/audio/ums/SDL_umsaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/ums/SDL_umsaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -34,8 +34,8 @@
 #include <sys/mman.h>
 
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
-#include "SDL_audiodev_c.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
 #include "SDL_umsaudio.h"
 
 /* The tag name used by UMS audio */
--- a/src/audio/ums/SDL_umsaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/ums/SDL_umsaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,9 +25,9 @@
 #ifndef _SDL_UMSaudio_h
 #define _SDL_UMSaudio_h
 
-#include "SDL_sysaudio.h"
+#include <UMS/UMSAudioDevice.h>
 
-#include <UMS/UMSAudioDevice.h>
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/windib/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-
-## Makefile.am for SDL using the Win32 WaveOut audio driver
-
-noinst_LTLIBRARIES = libaudio_windib.la
-libaudio_windib_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_dibaudio.c	\
-	SDL_dibaudio.h
--- a/src/audio/windib/SDL_dibaudio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/windib/SDL_dibaudio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audio_c.h"
 #include "SDL_dibaudio.h"
 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
 #include "win_ce_semaphore.h"
--- a/src/audio/windib/SDL_dibaudio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/windib/SDL_dibaudio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_lowaudio_h
 #define _SDL_lowaudio_h
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/audio/windx5/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-## Makefile.am for SDL using the Win32 DirectX audio driver
-
-noinst_LTLIBRARIES = libaudio_windx5.la
-libaudio_windx5_la_SOURCES = $(SRCS)
-
-# The SDL audio driver sources
-SRCS =	SDL_dx5audio.c	\
-	SDL_dx5audio.h	\
-	directx.h
--- a/src/audio/windx5/SDL_dx5audio.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/windx5/SDL_dx5audio.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_audio.h"
-#include "SDL_audio_c.h"
+#include "../SDL_audio_c.h"
 #include "SDL_dx5audio.h"
 
 /* Define this if you want to use DirectX 6 DirectSoundNotify interface */
--- a/src/audio/windx5/SDL_dx5audio.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/audio/windx5/SDL_dx5audio.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 
 #include "directx.h"
 
-#include "SDL_sysaudio.h"
+#include "../SDL_sysaudio.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_AudioDevice *this
--- a/src/cdrom/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-
-## Makefile.am for the SDL cdrom library
-
-noinst_LTLIBRARIES = libcdrom.la
-
-# Define which subdirectories need to be built
-SUBDIRS = @CDROM_SUBDIRS@
-DIST_SUBDIRS =	\
-	aix	\
-	beos	\
-	bsdi	\
-	dc	\
-	dummy	\
-	freebsd	\
-	linux	\
-	macos	\
-	macosx	\
-	mint	\
-	openbsd	\
-	osf	\
-	qnx	\
-	win32
-
-DRIVERS = @CDROM_DRIVERS@
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_cdrom.c		\
-	SDL_syscdrom.h
-
-libcdrom_la_SOURCES = $(COMMON_SRCS)
-libcdrom_la_LIBADD = $(DRIVERS)
-libcdrom_la_DEPENDENCIES = $(DRIVERS)
--- a/src/cdrom/aix/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the AIX cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_aix.la
-libcdrom_aix_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/aix/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/aix/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 /* Functions for system-level CD-ROM audio control */
 
-#define DEBUG_CDROM 1
+/*#define DEBUG_CDROM 1*/
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -41,7 +41,7 @@
 #include <sys/scdisk.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* The maximum number of CD-ROM drives we'll detect */
 #define MAX_DRIVES	16	
--- a/src/cdrom/beos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the BeOS cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_beos.la
-libcdrom_beos_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.cc
--- a/src/cdrom/beos/SDL_syscdrom.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/beos/SDL_syscdrom.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -35,7 +35,7 @@
 
 #include "SDL_cdrom.h"
 extern "C" {
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 }
 
 /* Constants to help us get at the SCSI table-of-contents info */
--- a/src/cdrom/bsdi/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the BSDi cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_bsdi.la
-libcdrom_bsdi_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/bsdi/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/bsdi/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -38,7 +38,7 @@
 #include </sys/dev/scsi/scsi_ioctl.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /*
  * The msf_to_frame and frame_to_msf were yanked from libcdrom and inlined
--- a/src/cdrom/dc/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Dreamcast cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_dc.la
-libcdrom_dc_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS = SDL_syscdrom.c
--- a/src/cdrom/dc/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/dc/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 #include <dc/spu.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* The system-dependent CD control functions */
 static const char *SDL_SYS_CDName(int drive);
--- a/src/cdrom/dummy/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the dummy cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_dummy.la
-libcdrom_dummy_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/dummy/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/dummy/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 /* Stub functions for system-level CD-ROM audio control */
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 int  SDL_SYS_CDInit(void)
 {
--- a/src/cdrom/freebsd/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the FreeBSD cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_freebsd.la
-libcdrom_freebsd_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/freebsd/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/freebsd/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,7 +30,7 @@
 #include <sys/cdio.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 
 /* The maximum number of CD-ROM drives we'll detect */
--- a/src/cdrom/linux/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Linux cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_linux.la
-libcdrom_linux_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/linux/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/linux/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -82,7 +82,7 @@
 #endif /* USE_MNTENT */
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 
 /* The maximum number of CD-ROM drives we'll detect */
--- a/src/cdrom/macos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the MacOS Classic cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_macos.la
-libcdrom_macos_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS = SDL_syscdrom.c SDL_syscdrom_c.h
--- a/src/cdrom/macos/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/macos/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include <LowMem.h> /* Use entry table macros, not functions in InterfaceLib  */
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 #include "SDL_syscdrom_c.h"
 
 /* Added by Matt Slot */
--- a/src/cdrom/macosx/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-## Makefile.am for the Mac OS X cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_macosx.la
-libcdrom_macosx_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS = \
-	SDL_syscdrom_c.h \
-	SDL_syscdrom.c \
-	AudioFilePlayer.h \
-	AudioFilePlayer.c \
-	AudioFileReaderThread.c \
-	SDLOSXCAGuard.c \
-	CDPlayer.h \
-	CDPlayer.c
--- a/src/cdrom/macosx/SDL_syscdrom_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/macosx/SDL_syscdrom_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -127,7 +127,7 @@
 
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 #include "CDPlayer.h"
 
--- a/src/cdrom/mint/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the MiNT+MetaDOS cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_mint.la
-libcdrom_mint_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/mint/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/mint/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -32,7 +32,7 @@
 #include <metados.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* Some ioctl() errno values which occur when the tray is empty */
 #ifndef ENOMEDIUM
--- a/src/cdrom/openbsd/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the OpenBSD cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_openbsd.la
-libcdrom_openbsd_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/openbsd/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/openbsd/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -32,7 +32,7 @@
 #include <sys/cdio.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 
 /* The maximum number of CD-ROM drives we'll detect */
--- a/src/cdrom/os2/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/os2/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include <os2me.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* Size of MCI result buffer (in bytes) */
 #define MCI_CMDRETBUFSIZE	128
--- a/src/cdrom/osf/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the osf cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_osf.la
-libcdrom_osf_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/osf/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/osf/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,7 @@
 #include <io/common/devgetinfo.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* The maximum number of CD-ROM drives we'll detect */
 #define MAX_DRIVES 16
--- a/src/cdrom/qnx/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the QNX cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_qnx.la
-libcdrom_qnx_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/qnx/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/qnx/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* The maximum number of CD-ROM drives we'll detect */
 #define MAX_DRIVES 16
--- a/src/cdrom/win32/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Windows cdrom driver for SDL
-
-noinst_LTLIBRARIES = libcdrom_win32.la
-libcdrom_win32_la_SOURCES = $(SRCS)
-
-# The SDL cdrom driver sources
-SRCS =  SDL_syscdrom.c
--- a/src/cdrom/win32/SDL_syscdrom.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cdrom/win32/SDL_syscdrom.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 #include <mmsystem.h>
 
 #include "SDL_cdrom.h"
-#include "SDL_syscdrom.h"
+#include "../SDL_syscdrom.h"
 
 /* This really broken?? */
 #define BROKEN_MCI_PAUSE	/* Pausing actually stops play -- Doh! */
--- a/src/cpuinfo/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-# The cpuinfo library target
-noinst_LTLIBRARIES = libcpuinfo.la
-
-COMMON_SRCS = 			\
-	SDL_cpuinfo.c
-
-libcpuinfo_la_SOURCES = $(COMMON_SRCS)
--- a/src/cpuinfo/SDL_cpuinfo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,16 +22,15 @@
 
 /* CPU feature detection for SDL */
 
-#ifdef unix /* FIXME: Better setjmp detection? */
-#define USE_SETJMP
+#include "SDL.h"
+#include "SDL_cpuinfo.h"
+
+#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
 #include <signal.h>
 #include <setjmp.h>
 #endif
 
-#include "SDL.h"
-#include "SDL_cpuinfo.h"
-
-#ifdef MACOSX
+#if MACOSX
 #include <sys/sysctl.h> /* For AltiVec check */
 #endif
 
@@ -44,7 +43,7 @@
 #define CPU_HAS_SSE2	0x00000080
 #define CPU_HAS_ALTIVEC	0x00000100
 
-#if defined(USE_SETJMP) && defined(GCC_ALTIVEC)
+#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
 /* This is the brute force way of detecting instruction sets...
    the idea is borrowed from the libmpeg2 library - thanks!
  */
@@ -53,7 +52,7 @@
 {
 	longjmp(jmpbuf, 1);
 }
-#endif // USE_SETJMP
+#endif /* HAVE_SETJMP */
 
 static __inline__ int CPU_haveCPUID()
 {
@@ -112,18 +111,18 @@
 done:
 	}
 #elif defined(__sun) && defined(__x86)
-	    __asm (
+	__asm (
 "       pushfl                 \n"
-"	    popl    %eax           \n"
-"	    movl    %eax,%ecx      \n"
-"	    xorl    $0x200000,%eax \n"
-"	    pushl   %eax           \n"
-"	    popfl                  \n"
-"	    pushfl                 \n"
-"	    popl    %eax           \n"
-"	    xorl    %ecx,%eax      \n"
-"	    jz      1f             \n"
-"	    movl    $1,-8(%ebp)    \n"
+"	popl    %eax           \n"
+"	movl    %eax,%ecx      \n"
+"	xorl    $0x200000,%eax \n"
+"	pushl   %eax           \n"
+"	popfl                  \n"
+"	pushfl                 \n"
+"	popl    %eax           \n"
+"	xorl    %ecx,%eax      \n"
+"	jz      1f             \n"
+"	movl    $1,-8(%ebp)    \n"
 "1:                            \n"
 	);
 #elif defined(__sun) && defined(__amd64)
@@ -308,14 +307,14 @@
 static __inline__ int CPU_haveAltiVec()
 {
 	volatile int altivec = 0;
-#ifdef MACOSX
+#if MACOSX
 	int selectors[2] = { CTL_HW, HW_VECTORUNIT }; 
 	int hasVectorUnit = 0; 
 	size_t length = sizeof(hasVectorUnit); 
 	int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); 
 	if( 0 == error )
 		altivec = (hasVectorUnit != 0); 
-#elif defined(USE_SETJMP) && defined(GCC_ALTIVEC)
+#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
 	void (*handler)(int sig);
 	handler = signal(SIGILL, illegal_instruction);
 	if ( setjmp(jmpbuf) == 0 ) {
--- a/src/events/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-
-## Makefile.am for the SDL event handling library
-
-noinst_LTLIBRARIES = libevents.la
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_events.c		\
-	SDL_events_c.h		\
-	SDL_expose.c		\
-	SDL_sysevents.h		\
-	SDL_quit.c		\
-	SDL_active.c		\
-	SDL_keyboard.c		\
-	SDL_mouse.c		\
-	SDL_resize.c
-
-libevents_la_SOURCES = $(COMMON_SRCS)
-
--- a/src/events/SDL_events.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/events/SDL_events.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,16 +23,13 @@
 /* General event handling code for SDL */
 
 #include "SDL.h"
-#include "SDL_events_c.h"
-#include "SDL_timer_c.h"
-#ifndef DISABLE_JOYSTICK
-#include "SDL_joystick_c.h"
-#endif
-#ifndef ENABLE_X11
-#define DISABLE_X11
-#endif
 #include "SDL_syswm.h"
 #include "SDL_sysevents.h"
+#include "SDL_events_c.h"
+#include "../timer/SDL_timer_c.h"
+#if !SDL_JOYSTICK_DISABLED
+#include "../joystick/SDL_joystick_c.h"
+#endif
 
 /* Public data -- the event filter */
 SDL_EventFilter SDL_EventOK = NULL;
@@ -112,7 +109,7 @@
 		/* Queue pending key-repeat events */
 		SDL_CheckKeyRepeat();
 
-#ifndef DISABLE_JOYSTICK
+#if !SDL_JOYSTICK_DISABLED
 		/* Check for joystick state change */
 		if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) {
 			SDL_JoystickUpdate();
@@ -150,16 +147,16 @@
 	SDL_memset(&SDL_EventLock, 0, sizeof(SDL_EventLock));
 
 	/* Create the lock and set ourselves active */
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 	SDL_EventQ.lock = SDL_CreateMutex();
 	if ( SDL_EventQ.lock == NULL ) {
-#ifdef macintosh /* On MacOS 7/8, you can't multithread, so no lock needed */
+#ifdef macintosh /* MacOS classic you can't multithread, so no lock needed */
 		;
 #else
 		return(-1);
 #endif
 	}
-#endif /* !DISABLE_THREADS */
+#endif /* !SDL_THREADS_DISABLED */
 	SDL_EventQ.active = 1;
 
 	if ( (flags&SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD ) {
@@ -379,7 +376,7 @@
 		/* Queue pending key-repeat events */
 		SDL_CheckKeyRepeat();
 
-#ifndef DISABLE_JOYSTICK
+#if !SDL_JOYSTICK_DISABLED
 		/* Check for joystick state change */
 		if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) {
 			SDL_JoystickUpdate();
--- a/src/events/SDL_mouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/events/SDL_mouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 
 #include "SDL_events.h"
 #include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
-#include "SDL_sysvideo.h"
+#include "../video/SDL_cursor_c.h"
+#include "../video/SDL_sysvideo.h"
 
 
 /* These are static for our mouse handling code */
--- a/src/events/SDL_resize.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/events/SDL_resize.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_events.h"
 #include "SDL_events_c.h"
-#include "SDL_sysvideo.h"
+#include "../video/SDL_sysvideo.h"
 
 
 /* Keep the last resize event so we don't post duplicates */
--- a/src/events/SDL_sysevents.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/events/SDL_sysevents.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,7 +20,7 @@
     slouken@libsdl.org
 */
 
-#include "SDL_sysvideo.h"
+#include "../video/SDL_sysvideo.h"
 
 /* Useful functions and variables from SDL_sysevents.c */
 
--- a/src/file/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for the SDL file library
-
-noinst_LTLIBRARIES = libfile.la
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_rwops.c
-
-libfile_la_SOURCES = $(COMMON_SRCS)
-
--- a/src/hermes/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-###########################################################################
-#
-# Some consistent rules for building asm files:
-
-STRIP_FPIC = sh $(top_srcdir)/strip_fPIC.sh
-
-SUFFIXES = .asm
-
-.asm.lo:
-	$(LIBTOOL) --tag=CC --mode=compile $(STRIP_FPIC) $(NASM) @NASMFLAGS@ $< -o $*.o
-
-###########################################################################
-
-# The hermes library target
-noinst_LTLIBRARIES = libhermes.la
-
-libhermes_la_SOURCES = $(PORTABLE_SRCS)
-am_libhermes_la_OBJECTS =	\
-	mmx_main.lo		\
-	mmxp2_32.lo		\
-	x86_main.lo		\
-	x86p_16.lo		\
-	x86p_32.lo
-
-# The hermes library sources
-PORTABLE_SRCS = 		\
-	mmx_main.asm		\
-	mmxp2_32.asm		\
-	x86_main.asm		\
-	x86p_16.asm		\
-	x86p_32.asm		\
-	\
-	HeadMMX.h		\
-	HeadX86.h
-
-EXTRA_DIST =			\
-	COPYING.LIB		\
-	README
-
--- a/src/joystick/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-
-## Makefile.am for the SDL joystick library
-
-noinst_LTLIBRARIES = libjoystick.la
-
-# Define which subdirectories need to be built
-SUBDIRS = @JOYSTICK_SUBDIRS@
-DIST_SUBDIRS = dummy amigaos beos bsd darwin dc linux macos mint riscos win32
-
-DRIVERS = @JOYSTICK_DRIVERS@
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_joystick.c		\
-	SDL_joystick_c.h	\
-	SDL_sysjoystick.h
-
-libjoystick_la_SOURCES = $(COMMON_SRCS)
-libjoystick_la_LIBADD = $(DRIVERS)
-libjoystick_la_DEPENDENCIES = $(DRIVERS)
--- a/src/joystick/SDL_joystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/SDL_joystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,14 +23,14 @@
 /* This is the joystick API for Simple DirectMedia Layer */
 
 #include "SDL_events.h"
-#ifndef DISABLE_EVENTS
-#include "SDL_events_c.h"
+#include "SDL_sysjoystick.h"
+#include "SDL_joystick_c.h"
+#if !SDL_EVENTS_DISABLED
+#include "../events/SDL_events_c.h"
 #endif
-#include "SDL_joystick_c.h"
-#include "SDL_sysjoystick.h"
 
 /* This is used for Quake III Arena */
-#ifdef DISABLE_EVENTS
+#if SDL_EVENTS_DISABLED
 #define SDL_Lock_EventThread()
 #define SDL_Unlock_EventThread()
 #endif
@@ -424,7 +424,7 @@
 
 	/* Post the event, if desired */
 	posted = 0;
-#ifndef DISABLE_EVENTS
+#if !SDL_EVENTS_DISABLED
 	if ( SDL_ProcessEvents[SDL_JOYAXISMOTION] == SDL_ENABLE ) {
 		SDL_Event event;
 		event.type = SDL_JOYAXISMOTION;
@@ -436,7 +436,7 @@
 			SDL_PushEvent(&event);
 		}
 	}
-#endif /* !DISABLE_EVENTS */
+#endif /* !SDL_EVENTS_DISABLED */
 	return(posted);
 }
 
@@ -449,7 +449,7 @@
 
 	/* Post the event, if desired */
 	posted = 0;
-#ifndef DISABLE_EVENTS
+#if !SDL_EVENTS_DISABLED
 	if ( SDL_ProcessEvents[SDL_JOYHATMOTION] == SDL_ENABLE ) {
 		SDL_Event event;
 		event.jhat.type = SDL_JOYHATMOTION;
@@ -461,7 +461,7 @@
 			SDL_PushEvent(&event);
 		}
 	}
-#endif /* !DISABLE_EVENTS */
+#endif /* !SDL_EVENTS_DISABLED */
 	return(posted);
 }
 
@@ -476,7 +476,7 @@
 
 	/* Post the event, if desired */
 	posted = 0;
-#ifndef DISABLE_EVENTS
+#if !SDL_EVENTS_DISABLED
 	if ( SDL_ProcessEvents[SDL_JOYBALLMOTION] == SDL_ENABLE ) {
 		SDL_Event event;
 		event.jball.type = SDL_JOYBALLMOTION;
@@ -489,14 +489,14 @@
 			SDL_PushEvent(&event);
 		}
 	}
-#endif /* !DISABLE_EVENTS */
+#endif /* !SDL_EVENTS_DISABLED */
 	return(posted);
 }
 
 int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
 {
 	int posted;
-#ifndef DISABLE_EVENTS
+#if !SDL_EVENTS_DISABLED
 	SDL_Event event;
 
 	switch ( state ) {
@@ -510,14 +510,14 @@
 			/* Invalid state -- bail */
 			return(0);
 	}
-#endif /* !DISABLE_EVENTS */
+#endif /* !SDL_EVENTS_DISABLED */
 
 	/* Update internal joystick state */
 	joystick->buttons[button] = state;
 
 	/* Post the event, if desired */
 	posted = 0;
-#ifndef DISABLE_EVENTS
+#if !SDL_EVENTS_DISABLED
 	if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
 		event.jbutton.which = joystick->index;
 		event.jbutton.button = button;
@@ -527,7 +527,7 @@
 			SDL_PushEvent(&event);
 		}
 	}
-#endif /* !DISABLE_EVENTS */
+#endif /* !SDL_EVENTS_DISABLED */
 	return(posted);
 }
 
@@ -542,7 +542,7 @@
 
 int SDL_JoystickEventState(int state)
 {
-#ifdef DISABLE_EVENTS
+#if SDL_EVENTS_DISABLED
 	return SDL_IGNORE;
 #else
 	const Uint8 event_list[] = {
@@ -568,5 +568,5 @@
 			break;
 	}
 	return(state);
-#endif /* DISABLE_EVENTS */
+#endif /* SDL_EVENTS_DISABLED */
 }
--- a/src/joystick/amigaos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the AmigaOS joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_amiga.la
-libjoystick_amiga_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/amigaos/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/amigaos/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -39,8 +39,8 @@
 extern struct GfxBase *GfxBase;
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 /* Function to scan the system for joysticks.
  * This function should set SDL_numjoysticks to the number of available
--- a/src/joystick/beos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the BeOS joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_beos.la
-libjoystick_beos_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_bejoystick.cc
--- a/src/joystick/beos/SDL_bejoystick.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/beos/SDL_bejoystick.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -28,8 +28,8 @@
 extern "C" {
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 
 /* The maximum number of joysticks we'll detect */
--- a/src/joystick/bsd/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the BSD joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_bsd.la
-libjoystick_bsd_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/bsd/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -57,8 +57,8 @@
 #endif
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 #define MAX_UHID_JOYS	4
 #define MAX_JOY_JOYS	2
--- a/src/joystick/darwin/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-## Makefile.am for the darwin/MacOS X joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_darwin.la
-libjoystick_darwin_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
-
-AM_CPPFLAGS = -no-cpp-precomp -I/System/Library/Frameworks/Kernel.framework/Headers/
--- a/src/joystick/darwin/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -42,8 +42,8 @@
 #include <Carbon/Carbon.h> /* for NewPtrClear, DisposePtr */
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 struct recElement
 {
--- a/src/joystick/dc/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Dreamcast joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_dc.la
-libjoystick_dc_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/dc/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/dc/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,8 @@
 /* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 #include <dc/maple.h>
 #include <dc/maple/controller.h>
--- a/src/joystick/dummy/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the dummy joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_dummy.la
-libjoystick_dummy_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/dummy/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/dummy/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,8 @@
 /* This is the system specific header for the SDL joystick API */
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 /* Function to scan the system for joysticks.
  * This function should set SDL_numjoysticks to the number of available
--- a/src/joystick/linux/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Linux joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_linux.la
-libjoystick_linux_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/linux/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/linux/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,13 +31,13 @@
 #include <linux/limits.h> /* Arm cross-compiler needs this */
 #endif
 #include <linux/joystick.h>
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 #include <linux/input.h>
 #endif
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 /* Special joystick configurations */
 static struct {
@@ -168,7 +168,7 @@
 	} *balls;
 
 	/* Support for the Linux 2.4 unified input interface */
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 	SDL_bool is_hid;
 	Uint8 key_map[KEY_MAX-BTN_MISC];
 	Uint8 abs_map[ABS_MAX];
@@ -257,7 +257,7 @@
 
 #endif /* USE_LOGICAL_JOYSTICKS */
 
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 #define test_bit(nr, addr) \
 	(((1UL << ((nr) & 31)) & (((const unsigned int *) addr)[(nr) >> 5])) != 0)
 
@@ -278,14 +278,14 @@
 	return(1);
 }
 
-#endif /* USE_INPUT_EVENTS */
+#endif /* SDL_INPUT_LINUXEV */
 
 /* Function to scan the system for joysticks */
 int SDL_SYS_JoystickInit(void)
 {
 	/* The base path of the joystick devices */
 	const char *joydev_pattern[] = {
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 		"/dev/input/event%d",
 #endif
 		"/dev/input/js%d",
@@ -345,7 +345,7 @@
 				if ( fd < 0 ) {
 					continue;
 				}
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 #ifdef DEBUG_INPUT_EVENTS
 				printf("Checking %s\n", path);
 #endif
@@ -366,7 +366,7 @@
 				break;
 		}
 
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 		/* This is a special case...
 		   If the event devices are valid then the joystick devices
 		   will be duplicates but without extra information about their
@@ -400,7 +400,7 @@
 	fd = open(SDL_joylist[index].fname, O_RDONLY, 0);
 	if ( fd >= 0 ) {
 		if ( 
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 		     (ioctl(fd, EVIOCGNAME(sizeof(namebuf)), namebuf) <= 0) &&
 #endif
 		     (ioctl(fd, JSIOCGNAME(sizeof(namebuf)), namebuf) <= 0) ) {
@@ -540,7 +540,7 @@
 	return(handled);
 }
 
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 
 static SDL_bool EV_ConfigJoystick(SDL_Joystick *joystick, int fd)
 {
@@ -639,7 +639,7 @@
 	return(joystick->hwdata->is_hid);
 }
 
-#endif /* USE_INPUT_EVENTS */
+#endif /* SDL_INPUT_LINUXEV */
 
 #ifndef NO_LOGICAL_JOYSTICKS
 static void ConfigLogicalJoystick(SDL_Joystick *joystick)
@@ -711,7 +711,7 @@
 		ConfigLogicalJoystick(joystick);
 	else
 #endif
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 	if ( ! EV_ConfigJoystick(joystick, fd) )
 #endif
 		JS_ConfigJoystick(joystick, fd);
@@ -914,7 +914,7 @@
 		}
 	}
 }
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 static __inline__ int EV_AxisCorrect(SDL_Joystick *joystick, int which, int value)
 {
 	struct axis_correct *correct;
@@ -1016,13 +1016,13 @@
 		}
 	}
 }
-#endif /* USE_INPUT_EVENTS */
+#endif /* SDL_INPUT_LINUXEV */
 
 void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
 {
 	int i;
 	
-#ifdef USE_INPUT_EVENTS
+#if SDL_INPUT_LINUXEV
 	if ( joystick->hwdata->is_hid )
 		EV_HandleEvents(joystick);
 	else
--- a/src/joystick/macos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the MacOS joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_macos.la
-libjoystick_macos_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/macos/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/macos/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,8 +29,8 @@
 #include <InputSprocket.h>
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 
 /*  The max number of joysticks we will detect  */
--- a/src/joystick/mint/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the MiNT joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_mint.la
-libjoystick_mint_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/mint/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/mint/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 #include <mint/osbind.h>
 
 #include "SDL_events.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 #include "SDL_ikbdinterrupt_s.h"
 #include "SDL_xbiosevents_c.h"
--- a/src/joystick/os2/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/os2/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,8 +31,8 @@
 #include "joyos2.h"
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 HFILE hJoyPort = NULL;		/* Joystick GAME$ Port Address */
 #define MAX_JOYSTICKS	2	/* Maximum of two joysticks */
--- a/src/joystick/riscos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the RISC OS joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_riscos.la
-libjoystick_riscos_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_sysjoystick.c
--- a/src/joystick/riscos/SDL_sysjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/riscos/SDL_sysjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 /* This is the system specific header for the SDL joystick API */
 
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 #include "kernel.h"
 
--- a/src/joystick/win32/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-## Makefile.am for the Windows MultiMedia joystick driver for SDL
-
-noinst_LTLIBRARIES = libjoystick_winmm.la
-libjoystick_winmm_la_SOURCES = $(SRCS)
-
-# The SDL joystick driver sources
-SRCS =  SDL_mmjoystick.c
--- a/src/joystick/win32/SDL_mmjoystick.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/joystick/win32/SDL_mmjoystick.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,8 +28,8 @@
 
 #include "SDL_events.h"
 #include "SDL_joystick.h"
-#include "SDL_sysjoystick.h"
-#include "SDL_joystick_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
 
 #define MAX_JOYSTICKS	16
 #define MAX_AXES	6	/* each joystick can have up to 6 axes */
--- a/src/loadso/beos/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(__BEOS__)
-#error Compiling for the wrong platform?
-#endif
-
-#include <stdio.h>
-#include <be/kernel/image.h>
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	void *handle = NULL;
-	const char *loaderror = "Unknown error";
-	image_id library_id = load_add_on(sofile);
-	if ( library_id == B_ERROR ) {
-		loaderror = "BeOS error";
-	} else {
-		handle = (void *)(library_id);
-	}
-
-	if ( handle == NULL ) {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	void *symbol = NULL;
-	const char *loaderror = "Unknown error";
-	image_id library_id = (image_id)handle;
-	if ( get_image_symbol(library_id,
-		name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR ) {
-		loaderror = "Symbol not found";
-	}
-
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, loaderror);
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	image_id library_id;
-	if ( handle != NULL ) {
-		library_id = (image_id)handle;
-		unload_add_on(library_id);
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/beos/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,72 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include <stdio.h>
+#include <be/kernel/image.h>
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	void *handle = NULL;
+	const char *loaderror = "Unknown error";
+	image_id library_id = load_add_on(sofile);
+	if ( library_id == B_ERROR ) {
+		loaderror = "BeOS error";
+	} else {
+		handle = (void *)(library_id);
+	}
+
+	if ( handle == NULL ) {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	void *symbol = NULL;
+	const char *loaderror = "Unknown error";
+	image_id library_id = (image_id)handle;
+	if ( get_image_symbol(library_id,
+		name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR ) {
+		loaderror = "Symbol not found";
+	}
+
+	if ( symbol == NULL ) {
+		SDL_SetError("Failed loading %s: %s", name, loaderror);
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	image_id library_id;
+	if ( handle != NULL ) {
+		library_id = (image_id)handle;
+		unload_add_on(library_id);
+	}
+}
+
--- a/src/loadso/dlopen/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(USE_DLOPEN)
-#error Compiling for the wrong platform?
-#endif
-
-#include <stdio.h>
-#include <dlfcn.h>
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	void *handle = dlopen(sofile, RTLD_NOW);
-	const char *loaderror = (char *)dlerror();
-	if ( handle == NULL ) {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	void *symbol = dlsym(handle, name);
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	if ( handle != NULL ) {
-		dlclose(handle);
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/dlopen/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,63 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include <stdio.h>
+#include <dlfcn.h>
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	void *handle = dlopen(sofile, RTLD_NOW);
+	const char *loaderror = (char *)dlerror();
+	if ( handle == NULL ) {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	void *symbol = dlsym(handle, name);
+	if ( symbol == NULL ) {
+		char *_name = SDL_stack_alloc(char, 1+SDL_strlen(name)+1);
+		_name[0] = '_';
+		SDL_strcpy(&_name[1], name);
+		symbol = dlsym(handle, name);
+		SDL_stack_free(_name);
+		if ( symbol == NULL ) {
+			SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());
+		}
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	if ( handle != NULL ) {
+		dlclose(handle);
+	}
+}
+
--- a/src/loadso/dummy/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	const char *loaderror = "SDL_LoadObject() not implemented";
-	SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	return(NULL);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	const char *loaderror = "SDL_LoadFunction not implemented";
-	SDL_SetError("Failed loading %s: %s", name, loaderror);
-	return(NULL);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-    /* no-op. */
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/dummy/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,46 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	const char *loaderror = "SDL_LoadObject() not implemented";
+	SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	return(NULL);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	const char *loaderror = "SDL_LoadFunction not implemented";
+	SDL_SetError("Failed loading %s: %s", name, loaderror);
+	return(NULL);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+    /* no-op. */
+}
+
--- a/src/loadso/macos/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(macintosh)
-#error Compiling for the wrong platform?
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#define OLDP2C 1
-#include <Strings.h>
-#include <CodeFragments.h>
-#include <Errors.h>
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	void *handle = NULL;
-	const char *loaderror = NULL;
-	CFragConnectionID library_id;
-	Ptr mainAddr;
-	Str255 errName;
-	OSErr error;
-	char psofile[512];
-
-	SDL_strncpy(psofile, sofile, SDL_TABLESIZE(psofile));
-	psofile[SDL_TABLESIZE(psofile)-1] = '\0';
-	error = GetSharedLibrary(C2PStr(psofile), kCompiledCFragArch,
-			kLoadCFrag, &library_id, &mainAddr, errName);
-	switch (error) {
-		case noErr:
-			loaderror = NULL;
-			break;
-		case cfragNoLibraryErr:
-			loaderror = "Library not found";
-			break;
-		case cfragUnresolvedErr:
-			loaderror = "Unabled to resolve symbols";
-			break;
-		case cfragNoPrivateMemErr:
-		case cfragNoClientMemErr:
-			loaderror = "Out of memory";
-			break;
-		default:
-			loaderror = "Unknown Code Fragment Manager error";
-			break;
-	}
-	if ( loaderror == NULL ) {
-		handle = (void *)(library_id);
-	} else {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	void *symbol = NULL;
-	const char *loaderror = NULL;
-	CFragSymbolClass class;
-	CFragConnectionID library_id = (CFragConnectionID)handle;
-	char pname[512];
-
-	SDL_strncpy(pname, name, SDL_TABLESIZE(pname));
-	pname[SDL_TABLESIZE(pname)-1] = '\0';
-	if ( FindSymbol(library_id, C2PStr(pname),
-	                (char **)&symbol, &class) != noErr ) {
-		loaderror = "Symbol not found";
-	}
-
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, loaderror);
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	CFragConnectionID library_id;
-	if ( handle != NULL ) {
-		library_id = (CFragConnectionID)handle;
-		CloseConnection(&library_id);
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/macos/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,104 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include <stdio.h>
+#include <string.h>
+#define OLDP2C 1
+#include <Strings.h>
+#include <CodeFragments.h>
+#include <Errors.h>
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	void *handle = NULL;
+	const char *loaderror = NULL;
+	CFragConnectionID library_id;
+	Ptr mainAddr;
+	Str255 errName;
+	OSErr error;
+	char psofile[512];
+
+	SDL_strncpy(psofile, sofile, SDL_TABLESIZE(psofile));
+	psofile[SDL_TABLESIZE(psofile)-1] = '\0';
+	error = GetSharedLibrary(C2PStr(psofile), kCompiledCFragArch,
+			kLoadCFrag, &library_id, &mainAddr, errName);
+	switch (error) {
+		case noErr:
+			loaderror = NULL;
+			break;
+		case cfragNoLibraryErr:
+			loaderror = "Library not found";
+			break;
+		case cfragUnresolvedErr:
+			loaderror = "Unabled to resolve symbols";
+			break;
+		case cfragNoPrivateMemErr:
+		case cfragNoClientMemErr:
+			loaderror = "Out of memory";
+			break;
+		default:
+			loaderror = "Unknown Code Fragment Manager error";
+			break;
+	}
+	if ( loaderror == NULL ) {
+		handle = (void *)(library_id);
+	} else {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	void *symbol = NULL;
+	const char *loaderror = NULL;
+	CFragSymbolClass class;
+	CFragConnectionID library_id = (CFragConnectionID)handle;
+	char pname[512];
+
+	SDL_strncpy(pname, name, SDL_TABLESIZE(pname));
+	pname[SDL_TABLESIZE(pname)-1] = '\0';
+	if ( FindSymbol(library_id, C2PStr(pname),
+	                (char **)&symbol, &class) != noErr ) {
+		loaderror = "Symbol not found";
+	}
+
+	if ( symbol == NULL ) {
+		SDL_SetError("Failed loading %s: %s", name, loaderror);
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	CFragConnectionID library_id;
+	if ( handle != NULL ) {
+		library_id = (CFragConnectionID)handle;
+		CloseConnection(&library_id);
+	}
+}
+
--- a/src/loadso/macosx/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1412 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* Please note that dlcompat apparently ships in current Mac OS X versions
- *  as a system library that provides compatibility with the Unix "dlopen"
- *  interface. In order to allow SDL to work on older OS X releases and also
- *  not conflict with the system lib on newer versions, we include dlcompat
- *  in SDL and change the symbols to prevent symbol clash with any existing
- *  system libraries.  --ryan.
- */
-
-/* here is the dlcompat license: */
-
-/*
-Copyright (c) 2002 Jorge Acereda  <jacereda@users.sourceforge.net> &
-                   Peter O'Gorman <ogorman@users.sourceforge.net>
-                   
-Portions may be copyright others, see the AUTHORS file included with this
-distribution.
-
-Maintained by Peter O'Gorman <ogorman@users.sourceforge.net>
-
-Bug Reports and other queries should go to <ogorman@users.sourceforge.net>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <mach-o/dyld.h>
-#include <mach-o/nlist.h>
-#include <mach-o/getsect.h>
-
-#include "SDL_stdinc.h"
-
-/* Just playing to see if it would compile with the freebsd headers, it does,
- * but because of the different values for RTLD_LOCAL etc, it would break binary
- * compat... oh well
- */
-#ifndef __BSD_VISIBLE
-#define __BSD_VISIBLE 1
-#endif
-
-/*include "dlfcn.h"*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined (__GNUC__) && __GNUC__ > 3
-#define dl_restrict __restrict
-#else
-#define dl_restrict
-#endif
-
-#ifndef _POSIX_SOURCE
-/*
- * Structure filled in by dladdr().
- */
-typedef struct SDL_OSX_dl_info {
-        const char      *dli_fname;     /* Pathname of shared object */
-        void            *dli_fbase;     /* Base address of shared object */
-        const char      *dli_sname;     /* Name of nearest symbol */
-        void            *dli_saddr;     /* Address of nearest symbol */
-} SDL_OSX_Dl_info;
-
-static int SDL_OSX_dladdr(const void * dl_restrict, SDL_OSX_Dl_info * dl_restrict);
-#endif /* ! _POSIX_SOURCE */
-
-static int SDL_OSX_dlclose(void * handle);
-static char * SDL_OSX_dlerror(void);
-static void * SDL_OSX_dlopen(const char *path, int mode);
-static void * SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol);
-
-#define RTLD_LAZY	0x1
-#define RTLD_NOW	0x2
-#define RTLD_LOCAL	0x4
-#define RTLD_GLOBAL	0x8
-
-#ifndef _POSIX_SOURCE
-#define RTLD_NOLOAD	0x10
-#define RTLD_NODELETE	0x80
-
-/*
- * Special handle arguments for SDL_OSX_dlsym().
- */
-#define	RTLD_NEXT		((void *) -1)	/* Search subsequent objects. */
-#define	RTLD_DEFAULT	((void *) -2)	/* Use default search algorithm. */
-#endif /* ! _POSIX_SOURCE */
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifndef dl_restrict
-#define dl_restrict __restrict
-#endif
-/* This is not available on 10.1 */
-#ifndef LC_LOAD_WEAK_DYLIB
-#define	LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
-#endif
-
-/* With this stuff here, this thing may actually compile/run on 10.0 systems
- * Not that I have a 10.0 system to test it on anylonger
- */
-#ifndef LC_REQ_DYLD
-#define LC_REQ_DYLD 0x80000000
-#endif
-#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
-#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
-#endif
-#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
-#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
-#endif
-/* These symbols will be looked for in dyld */
-static const struct mach_header *(*dyld_NSAddImage) (const char *, unsigned long) = 0;
-static int (*dyld_NSIsSymbolNameDefinedInImage) (const struct mach_header *, const char *) = 0;
-static NSSymbol(*dyld_NSLookupSymbolInImage)
-	(const struct mach_header *, const char *, unsigned long) = 0;
-
-/* Define this to make dlcompat reuse data block. This way in theory we save
- * a little bit of overhead. However we then couldn't correctly catch excess
- * calls to SDL_OSX_dlclose(). Hence we don't use this feature
- */
-#undef REUSE_STATUS
-
-/* Size of the internal error message buffer (used by dlerror()) */
-#define ERR_STR_LEN			251
-
-/* Maximum number of search paths supported by getSearchPath */
-#define MAX_SEARCH_PATHS	32
-
-
-#define MAGIC_DYLIB_OFI ((NSObjectFileImage) 'DYOF')
-#define MAGIC_DYLIB_MOD ((NSModule) 'DYMO')
-
-/* internal flags */
-#define DL_IN_LIST 0x01
-
-/* our mutex */
-static pthread_mutex_t dlcompat_mutex;
-/* Our thread specific storage
- */
-static pthread_key_t dlerror_key;
-
-struct dlthread
-{
-	int lockcnt;
-	unsigned char errset;
-	char errstr[ERR_STR_LEN];
-};
-
-/* This is our central data structure. Whenever a module is loaded via
- * SDL_OSX_dlopen(), we create such a struct.
- */
-struct dlstatus
-{
-	struct dlstatus *next;		/* pointer to next element in the linked list */
-	NSModule module;
-	const struct mach_header *lib;
-	int refs;					/* reference count */
-	int mode;					/* mode in which this module was loaded */
-	dev_t device;
-	ino_t inode;
-	int flags;					/* Any internal flags we may need */
-};
-
-/* Head node of the dlstatus list */
-static struct dlstatus mainStatus = { 0, MAGIC_DYLIB_MOD, NULL, -1, RTLD_GLOBAL, 0, 0, 0 };
-static struct dlstatus *stqueue = &mainStatus;
-
-
-/* Storage for the last error message (used by dlerror()) */
-/* static char err_str[ERR_STR_LEN]; */
-/* static int err_filled = 0; */
-
-/* Prototypes to internal functions */
-static void debug(const char *fmt, ...);
-static void error(const char *str, ...);
-static const char *safegetenv(const char *s);
-static const char *searchList(void);
-static const char *getSearchPath(int i);
-static const char *getFullPath(int i, const char *file);
-static const struct stat *findFile(const char *file, const char **fullPath);
-static int isValidStatus(struct dlstatus *status);
-static inline int isFlagSet(int mode, int flag);
-static struct dlstatus *lookupStatus(const struct stat *sbuf);
-static void insertStatus(struct dlstatus *dls, const struct stat *sbuf);
-static int promoteLocalToGlobal(struct dlstatus *dls);
-static void *reference(struct dlstatus *dls, int mode);
-static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError);
-static struct dlstatus *allocStatus(void);
-static struct dlstatus *loadModule(const char *path, const struct stat *sbuf, int mode);
-static NSSymbol *search_linked_libs(const struct mach_header *mh, const char *symbol);
-static const char *get_lib_name(const struct mach_header *mh);
-static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod);
-static void dlcompat_init_func(void);
-static inline void dlcompat_init_check(void);
-static inline void dolock(void);
-static inline void dounlock(void);
-static void dlerrorfree(void *data);
-static void resetdlerror(void);
-static const struct mach_header *my_find_image(const char *name);
-static const struct mach_header *image_for_address(const void *address);
-static inline const char *dyld_error_str(void);
-
-#if FINK_BUILD
-/* Two Global Functions */
-static void *dlsym_prepend_underscore(void *handle, const char *symbol);
-static void *dlsym_auto_underscore(void *handle, const char *symbol);
-
-/* And their _intern counterparts */
-static void *dlsym_prepend_underscore_intern(void *handle, const char *symbol);
-static void *dlsym_auto_underscore_intern(void *handle, const char *symbol);
-#endif
-
-/* Functions */
-
-static void debug(const char *fmt, ...)
-{
-#if DEBUG > 1
-	va_list arg;
-	va_start(arg, fmt);
-	fprintf(stderr, "DLDEBUG: ");
-	vfprintf(stderr, fmt, arg);
-	fprintf(stderr, "\n");
-	fflush(stderr);
-	va_end(arg);
-#endif
-}
-
-static void error(const char *str, ...)
-{
-	va_list arg;
-	struct dlthread  *tss;
-	char * err_str;
-	va_start(arg, str);
-	tss = pthread_getspecific(dlerror_key);
-	err_str = tss->errstr;
-	SDL_strncpy(err_str, "dlcompat: ", ERR_STR_LEN);
-	vsnprintf(err_str + 10, ERR_STR_LEN - 10, str, arg);
-	va_end(arg);
-	debug("ERROR: %s\n", err_str);
-	tss->errset = 1;
-}
-
-static void warning(const char *str)
-{
-#if DEBUG > 0
-	fprintf(stderr, "WARNING: dlcompat: %s\n", str);
-#endif
-}
-
-static const char *safegetenv(const char *s)
-{
-	const char *ss = SDL_getenv(s);
-	return ss ? ss : "";
-}
-
-/* because this is only used for debugging and error reporting functions, we
- * don't really care about how elegant it is... it could use the load
- * commands to find the install name of the library, but...
- */
-static const char *get_lib_name(const struct mach_header *mh)
-{
-	unsigned long count = _dyld_image_count();
-	unsigned long i;
-	const char *val = NULL;
-	if (mh)
-	{
-		for (i = 0; i < count; i++)
-		{
-			if (mh == _dyld_get_image_header(i))
-			{
-				val = _dyld_get_image_name(i);
-				break;
-			}
-		}
-	}
-	return val;
-}
-
-/* Returns the mach_header for the module bu going through all the loaded images
- * and finding the one with the same name as the module. There really ought to be
- * an api for doing this, would be faster, but there isn't one right now
- */
-static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod)
-{
-	const char *mod_name = NSNameOfModule(mod);
-	struct mach_header *mh = NULL;
-	unsigned long count = _dyld_image_count();
-	unsigned long i;
-	debug("Module name: %s", mod_name);
-	for (i = 0; i < count; i++)
-	{
-		if (!SDL_strcmp(mod_name, _dyld_get_image_name(i)))
-		{
-			mh = _dyld_get_image_header(i);
-			break;
-		}
-	}
-	return mh;
-}
-
-
-/* Compute and return a list of all directories that we should search when
- * trying to locate a module. We first look at the values of LD_LIBRARY_PATH
- * and DYLD_LIBRARY_PATH, and then finally fall back to looking into
- * /usr/lib and /lib. Since both of the environments variables can contain a
- * list of colon seperated paths, we simply concat them and the two other paths
- * into one big string, which we then can easily parse.
- * Splitting this string into the actual path list is done by getSearchPath()
- */
-static const char *searchList()
-{
-	size_t buf_size;
-	static char *buf=NULL;
-	const char *ldlp = safegetenv("LD_LIBRARY_PATH");
-	const char *dyldlp = safegetenv("DYLD_LIBRARY_PATH");
-	const char *stdpath = SDL_getenv("DYLD_FALLBACK_LIBRARY_PATH");
-	if (!stdpath)
-		stdpath = "/usr/local/lib:/lib:/usr/lib";
-	if (!buf)
-	{	
-		buf_size = SDL_strlen(ldlp) + SDL_strlen(dyldlp) + SDL_strlen(stdpath) + 4;
-		buf = SDL_malloc(buf_size);
-		SDL_snprintf(buf, buf_size, "%s%s%s%s%s%c", dyldlp, (dyldlp[0] ? ":" : ""), ldlp, (ldlp[0] ? ":" : ""),
-				 stdpath, '\0');
-	}
-	return buf;
-}
-
-/* Returns the ith search path from the list as computed by searchList() */
-static const char *getSearchPath(int i)
-{
-	static const char *list = 0;
-	static char **path = (char **)0;
-	static int end = 0;
-	static int numsize = MAX_SEARCH_PATHS;
-	static char **tmp;
-	/* So we can call SDL_free() in the "destructor" we use i=-1 to return the alloc'd array */
-	if (i == -1)
-	{
-		return (const char*)path;
-	}
-	if (!path)
-	{
-		path = (char **)SDL_calloc(MAX_SEARCH_PATHS, sizeof(char **));
-	}
-	if (!list && !end)
-		list = searchList();
-	if (i >= (numsize))
-	{
-		debug("Increasing size for long PATH");
-		tmp = (char **)SDL_calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **));
-		if (tmp)
-		{
-			SDL_memcpy(tmp, path, sizeof(char **) * numsize);
-			SDL_free(path);
-			path = tmp;
-			numsize += MAX_SEARCH_PATHS;
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	while (!path[i] && !end)
-	{
-		path[i] = strsep((char **)&list, ":");
-
-		if (path[i][0] == 0)
-			path[i] = 0;
-		end = (list == 0);
-	}
-	return path[i];
-}
-
-static const char *getFullPath(int i, const char *file)
-{
-	static char buf[PATH_MAX];
-	const char *path = getSearchPath(i);
-	if (path)
-	{
-		SDL_snprintf(buf, PATH_MAX, "%s/%s", path, file);
-	}
-	return path ? buf : 0;
-}
-
-/* Given a file name, try to determine the full path for that file. Starts
- * its search in the current directory, and then tries all paths in the 
- * search list in the order they are specified there.
- */
-static const struct stat *findFile(const char *file, const char **fullPath)
-{
-	int i = 0;
-	static struct stat sbuf;
-	char *fileName;
-	debug("finding file %s", file);
-	*fullPath = file;
-	if (0 == stat(file, &sbuf))
-		return &sbuf;
-	if (SDL_strchr(file, '/'))
-		return 0;				/* If the path had a / we don't look in env var places */
-	fileName = NULL;
-	if (!fileName)
-		fileName = (char *)file;
-	while ((*fullPath = getFullPath(i++, fileName)))
-	{
-		if (0 == stat(*fullPath, &sbuf))
-			return &sbuf;
-	}
-	;
-	return 0;
-}
-
-/* Determine whether a given dlstatus is valid or not */
-static int isValidStatus(struct dlstatus *status)
-{
-	/* Walk the list to verify status is contained in it */
-	struct dlstatus *dls = stqueue;
-	while (dls && status != dls)
-		dls = dls->next;
-	if (dls == 0)
-		error("invalid handle");
-	else if ((dls->module == 0) || (dls->refs == 0))
-		error("handle to closed library");
-	else
-		return TRUE;
-	return FALSE;
-}
-
-static inline int isFlagSet(int mode, int flag)
-{
-	return (mode & flag) == flag;
-}
-
-static struct dlstatus *lookupStatus(const struct stat *sbuf)
-{
-	struct dlstatus *dls = stqueue;
-	debug("looking for status");
-	while (dls && ( /* isFlagSet(dls->mode, RTLD_UNSHARED) */ 0
-				   || sbuf->st_dev != dls->device || sbuf->st_ino != dls->inode))
-		dls = dls->next;
-	return dls;
-}
-
-static void insertStatus(struct dlstatus *dls, const struct stat *sbuf)
-{
-	debug("inserting status");
-	dls->inode = sbuf->st_ino;
-	dls->device = sbuf->st_dev;
-	dls->refs = 0;
-	dls->mode = 0;
-	if ((dls->flags & DL_IN_LIST) == 0)
-	{
-		dls->next = stqueue;
-		stqueue = dls;
-		dls->flags |= DL_IN_LIST;
-	}
-}
-
-static struct dlstatus *allocStatus()
-{
-	struct dlstatus *dls;
-#ifdef REUSE_STATUS
-	dls = stqueue;
-	while (dls && dls->module)
-		dls = dls->next;
-	if (!dls)
-#endif
-		dls = SDL_calloc(sizeof(*dls),1);
-	return dls;
-}
-
-static int promoteLocalToGlobal(struct dlstatus *dls)
-{
-	static int (*p) (NSModule module) = 0;
-	debug("promoting");
-	if (!p)
-		_dyld_func_lookup("__dyld_NSMakePrivateModulePublic", (unsigned long *)&p);
-	return (dls->module == MAGIC_DYLIB_MOD) || (p && p(dls->module));
-}
-
-static void *reference(struct dlstatus *dls, int mode)
-{
-	if (dls)
-	{
-		if (dls->module == MAGIC_DYLIB_MOD && isFlagSet(mode, RTLD_LOCAL))
-		{
-			warning("trying to open a .dylib with RTLD_LOCAL");
-			error("unable to open a .dylib with RTLD_LOCAL");
-			return NULL;
-		}
-		if (isFlagSet(mode, RTLD_GLOBAL) &&
-			!isFlagSet(dls->mode, RTLD_GLOBAL) && !promoteLocalToGlobal(dls))
-		{
-			error("unable to promote local module to global");
-			return NULL;
-		}
-		dls->mode |= mode;
-		dls->refs++;
-	}
-	else
-		debug("reference called with NULL argument");
-
-	return dls;
-}
-
-static const struct mach_header *my_find_image(const char *name)
-{
-	const struct mach_header *mh = 0;
-	const char *id = NULL;
-	int i = _dyld_image_count();
-	int j;
-	mh = (struct mach_header *)
-		dyld_NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED |
-						NSADDIMAGE_OPTION_RETURN_ON_ERROR);
-	if (!mh)
-	{
-		for (j = 0; j < i; j++)
-		{
-			id = _dyld_get_image_name(j);
-			if (!SDL_strcmp(id, name))
-			{
-				mh = _dyld_get_image_header(j);
-				break;
-			}
-		}
-	}
-	return mh;
-}
-
-/*
- * dyld adds libraries by first adding the directly dependant libraries in link order, and
- * then adding the dependencies for those libraries, so we should do the same... but we don't
- * bother adding the extra dependencies, if the symbols are neither in the loaded image nor
- * any of it's direct dependencies, then it probably isn't there.
- */
-static NSSymbol *search_linked_libs(const struct mach_header * mh, const char *symbol)
-{
-	unsigned int n;
-	struct load_command *lc = 0;
-	struct mach_header *wh;
-	NSSymbol *nssym = 0;
-	if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
-	{
-		lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
-		for (n = 0; n < mh->ncmds; n++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
-		{
-			if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd))
-			{
-				if ((wh = (struct mach_header *)
-					 my_find_image((char *)(((struct dylib_command *)lc)->dylib.name.offset +
-											(char *)lc))))
-				{
-					if (dyld_NSIsSymbolNameDefinedInImage(wh, symbol))
-					{
-						nssym = dyld_NSLookupSymbolInImage(wh,
-														   symbol,
-														   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
-														   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
-						break;
-					}
-				}
-			}
-		}
-		if ((!nssym) && NSIsSymbolNameDefined(symbol))
-		{
-			/* I've never seen this debug message...*/
-			debug("Symbol \"%s\" is defined but was not found", symbol);
-		}
-	}
-	return nssym;
-}
-
-/* Up to the caller to SDL_free() returned string */
-static inline const char *dyld_error_str()
-{
-	NSLinkEditErrors dylder;
-	int dylderno;
-	const char *dylderrstr;
-	const char *dyldfile;
-	const char* retStr = NULL;
-	NSLinkEditError(&dylder, &dylderno, &dyldfile, &dylderrstr);
-	if (dylderrstr && SDL_strlen(dylderrstr))
-	{
-		retStr = SDL_malloc(SDL_strlen(dylderrstr) +1);
-		SDL_strcpy((char*)retStr,dylderrstr);
-	}
-	return retStr;
-}
-
-static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError)
-{
-  NSSymbol *nssym = 0;
-#ifdef __GCC__  
-	void *caller = __builtin_return_address(1);	/* Be *very* careful about inlining */
-#else
-	void *caller = NULL;
-#endif
-	const struct mach_header *caller_mh = 0;
-	const char* savedErrorStr = NULL;
-	resetdlerror();
-#ifndef RTLD_SELF
-#define	RTLD_SELF		((void *) -3)
-#endif
-	if (NULL == dls)
-		dls = RTLD_SELF;
-	if ((RTLD_NEXT == dls) || (RTLD_SELF == dls))
-	{
-		if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage && caller)
-		  {
-			caller_mh = image_for_address(caller);
-			if (RTLD_SELF == dls)
-			{
-				/* FIXME: We should be using the NSModule api, if SELF is an MH_BUNDLE
-				 * But it appears to work anyway, and looking at the code in dyld_libfuncs.c
-				 * this is acceptable.
-				 */
-				if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol))
-				{
-					nssym = dyld_NSLookupSymbolInImage(caller_mh,
-													   symbol,
-													   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
-													   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
-				}
-			}
-			if (!nssym)
-			{
-				if (RTLD_SELF == dls)
-					savedErrorStr = dyld_error_str();
-				nssym = search_linked_libs(caller_mh, symbol);
-			}
-		}
-		else
-		{
-			if (canSetError)
-				error("RTLD_SELF and RTLD_NEXT are not supported");
-			return NULL;
-		}
-	}
-	if (!nssym)
-	{
-
-		if (RTLD_DEFAULT == dls)
-		{
-			dls = &mainStatus;
-		}
-		if (!isValidStatus(dls))
-			return NULL;
-
-		if (dls->module != MAGIC_DYLIB_MOD)
-		{
-			nssym = NSLookupSymbolInModule(dls->module, symbol);
-			if (!nssym && NSIsSymbolNameDefined(symbol))
-			{
-				debug("Searching dependencies");
-				savedErrorStr = dyld_error_str();
-				nssym = search_linked_libs(get_mach_header_from_NSModule(dls->module), symbol);
-			}
-		}
-		else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
-		{
-			if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol))
-			{
-				nssym = dyld_NSLookupSymbolInImage(dls->lib,
-												   symbol,
-												   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
-												   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
-			}
-			else if (NSIsSymbolNameDefined(symbol))
-			{
-				debug("Searching dependencies");
-				savedErrorStr = dyld_error_str();
-				nssym = search_linked_libs(dls->lib, symbol);
-			}
-		}
-		else if (dls->module == MAGIC_DYLIB_MOD)
-		{
-			/* Global context, use NSLookupAndBindSymbol */
-			if (NSIsSymbolNameDefined(symbol))
-			{
-				/* There doesn't seem to be a return on error option for this call???
-				   this is potentially broken, if binding fails, it will improperly
-				   exit the application. */
-				nssym = NSLookupAndBindSymbol(symbol);
-			}
-			else
-			{
-				if (savedErrorStr)
-					SDL_free((char*)savedErrorStr);			
-				savedErrorStr = SDL_malloc(256);
-				SDL_snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context",symbol);	
-			}
-		}
-	}
-	/* Error reporting */
-	if (!nssym)
-	{
-		if (!savedErrorStr || !SDL_strlen(savedErrorStr))
-		{
-			if (savedErrorStr)
-				SDL_free((char*)savedErrorStr);
-			savedErrorStr = SDL_malloc(256);
-			SDL_snprintf((char*)savedErrorStr, 256,"Symbol \"%s\" not found",symbol);
-		}
-		if (canSetError)
-		{
-			error(savedErrorStr);
-		}
-		else
-		{
-			debug(savedErrorStr);
-		}
-		if (savedErrorStr)
-			SDL_free((char*)savedErrorStr);
-		return NULL;
-	}
-	return NSAddressOfSymbol(nssym);
-}
-
-static struct dlstatus *loadModule(const char *path, const struct stat *sbuf, int mode)
-{
-	NSObjectFileImage ofi = 0;
-	NSObjectFileImageReturnCode ofirc;
-	struct dlstatus *dls;
-	NSLinkEditErrors ler;
-	int lerno;
-	const char *errstr;
-	const char *file;
-	void (*init) (void);
-
-	ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
-	switch (ofirc)
-	{
-		case NSObjectFileImageSuccess:
-			break;
-		case NSObjectFileImageInappropriateFile:
-			if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
-			{	
-				if (isFlagSet(mode, RTLD_LOCAL))
-				{
-					warning("trying to open a .dylib with RTLD_LOCAL");
-					error("unable to open this file with RTLD_LOCAL");
-					return NULL;
-				}
-			}
-			else
-			{
-				error("opening this file is unsupported on this system");
-				return NULL;
-			}
-			break;
-		case NSObjectFileImageFailure:
-			error("object file setup failure");
-			return NULL;
-		case NSObjectFileImageArch:
-			error("no object for this architecture");
-			return NULL;
-		case NSObjectFileImageFormat:
-			error("bad object file format");
-			return NULL;
-		case NSObjectFileImageAccess:
-			error("can't read object file");
-			return NULL;
-		default:
-			error("unknown error from NSCreateObjectFileImageFromFile()");
-			return NULL;
-	}
-	dls = lookupStatus(sbuf);
-	if (!dls)
-	{
-		dls = allocStatus();
-	}
-	if (!dls)
-	{
-		error("unable to allocate memory");
-		return NULL;
-	}
-	//	dls->lib = 0;
-	if (ofirc == NSObjectFileImageInappropriateFile)
-	{
-		if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR)))
-		{
-			debug("Dynamic lib loaded at %ld", dls->lib);
-			ofi = MAGIC_DYLIB_OFI;
-			dls->module = MAGIC_DYLIB_MOD;
-			ofirc = NSObjectFileImageSuccess;
-			/* Although it is possible with a bit of work to modify this so it works and
-			   functions with RTLD_NOW, I don't deem it necessary at the moment */
-		}
-		if (!(dls->module))
-		{
-			NSLinkEditError(&ler, &lerno, &file, &errstr);
-			if (!errstr || (!SDL_strlen(errstr)))
-				error("Can't open this file type");
-			else
-				error(errstr);
-			if ((dls->flags & DL_IN_LIST) == 0)
-			{
-				SDL_free(dls);
-			}
-			return NULL;
-		}
-	}
-	else
-	{
-		dls->module = NSLinkModule(ofi, path,
-								   NSLINKMODULE_OPTION_RETURN_ON_ERROR |
-								   NSLINKMODULE_OPTION_PRIVATE |
-								   (isFlagSet(mode, RTLD_NOW) ? NSLINKMODULE_OPTION_BINDNOW : 0));
-		NSDestroyObjectFileImage(ofi);
-		if (dls->module)
-		{
-			dls->lib = get_mach_header_from_NSModule(dls->module);
-		}
-	}
-	if (!dls->module)
-	{
-		NSLinkEditError(&ler, &lerno, &file, &errstr);
-		if ((dls->flags & DL_IN_LIST) == 0)
-		{
-			SDL_free(dls);
-		}
-		error(errstr);
-		return NULL;
-	}
-
-	insertStatus(dls, sbuf);
-	dls = reference(dls, mode);
-	if ((init = dlsymIntern(dls, "__init", 0)))
-	{
-		debug("calling _init()");
-		init();
-	}
-	return dls;
-}
-
-inline static void dlcompat_init_check(void)
-{
-	static pthread_mutex_t l = PTHREAD_MUTEX_INITIALIZER;
-	static int init_done = 0;
-
-	pthread_mutex_lock(&l);
-	if (!init_done) {
-		dlcompat_init_func();
-		init_done = 1;
-	}
-	pthread_mutex_unlock(&l);
-}
-
-static void dlcompat_init_func(void)
-{
-        _dyld_func_lookup("__dyld_NSAddImage", (unsigned long *)&dyld_NSAddImage);
-	_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
-			  (unsigned long *)&dyld_NSIsSymbolNameDefinedInImage);
-	_dyld_func_lookup("__dyld_NSLookupSymbolInImage", (unsigned long *)&dyld_NSLookupSymbolInImage);
-	if (pthread_mutex_init(&dlcompat_mutex, NULL))
-	    exit(1);
-	if (pthread_key_create(&dlerror_key, &dlerrorfree))
-	    exit(1);
-}
-
-static void resetdlerror()
-{
-	struct dlthread *tss;
-	tss = pthread_getspecific(dlerror_key);
-	tss->errset = 0;
-}
-
-static void dlerrorfree(void *data)
-{
-	SDL_free(data);
-}
-
-/* We kind of want a recursive lock here, but meet a little trouble
- * because they are not available pre OS X 10.2, so we fake it
- * using thread specific storage to keep a lock count
- */ 
-static inline void dolock(void)
-{
-	int err = 0;
-	struct dlthread *tss;
-	dlcompat_init_check();
-	tss = pthread_getspecific(dlerror_key);
-	if (!tss)
-	{
-		tss = SDL_malloc(sizeof(struct dlthread));
-		tss->lockcnt = 0;
-		tss->errset = 0;
-		if (pthread_setspecific(dlerror_key, tss))
-		{
-			fprintf(stderr,"dlcompat: pthread_setspecific failed\n");
-			exit(1);
-		}
-	}
-	if (!tss->lockcnt)
-		err = pthread_mutex_lock(&dlcompat_mutex);
-	tss->lockcnt = tss->lockcnt +1;	
-	if (err)
-		exit(err);
-}
-
-static inline void dounlock(void)
-{
-	int err = 0;
-	struct dlthread *tss;
-	tss = pthread_getspecific(dlerror_key);
-	tss->lockcnt = tss->lockcnt -1;
-	if (!tss->lockcnt)
-		err = pthread_mutex_unlock(&dlcompat_mutex);
-	if (err)
-		exit(err);
-}
-
-static void *SDL_OSX_dlopen(const char *path, int mode)
-{
-	const struct stat *sbuf;
-	struct dlstatus *dls;
-	const char *fullPath;
-
-	dolock();
-	resetdlerror();
-	if (!path)
-	{
-		dls = &mainStatus;
-		goto dlopenok;
-	}
-	if (!(sbuf = findFile(path, &fullPath)))
-	{
-		error("file \"%s\" not found", path);
-		goto dlopenerror;
-	}
-	/* Now checks that it hasn't been closed already */
-	if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
-	{
-		/* debug("status found"); */
-		dls = reference(dls, mode);
-		goto dlopenok;
-	}
-#ifdef 	RTLD_NOLOAD
-	if (isFlagSet(mode, RTLD_NOLOAD))
-	{
-		error("no existing handle and RTLD_NOLOAD specified");
-		goto dlopenerror;
-	}
-#endif
-	if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
-	{
-		error("how can I load something both RTLD_LAZY and RTLD_NOW?");
-		goto dlopenerror;
-	}
-	dls = loadModule(fullPath, sbuf, mode);
-	
-  dlopenok:
-	dounlock();
-	return (void *)dls;
-  dlopenerror:
-	dounlock();
-	return NULL;
-}
-
-#if !FINK_BUILD
-static void *SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol)
-{
-	int sym_len = SDL_strlen(symbol);
-	void *value = NULL;
-	char *malloc_sym = NULL;
-	dolock();
-	malloc_sym = SDL_malloc(sym_len + 2);
-	if (malloc_sym)
-	{
-		SDL_sprintf(malloc_sym, sym_len+2, "_%s", symbol);
-		value = dlsymIntern(handle, malloc_sym, 1);
-		SDL_free(malloc_sym);
-	}
-	else
-	{
-		error("Unable to allocate memory");
-		goto dlsymerror;
-	}
-	dounlock();
-	return value;
-  dlsymerror:
-	dounlock();
-	return NULL;
-}
-#endif
-
-#if FINK_BUILD
-
-static void *dlsym_prepend_underscore(void *handle, const char *symbol)
-{
-	void *answer;
-	dolock();
-	answer = dlsym_prepend_underscore_intern(handle, symbol);
-	dounlock();
-	return answer;
-}
-
-static void *dlsym_prepend_underscore_intern(void *handle, const char *symbol)
-{
-/*
- *	A quick and easy way for porting packages which call dlsym(handle,"sym")
- *	If the porter adds -Ddlsym=dlsym_prepend_underscore to the CFLAGS then
- *	this function will be called, and will add the required underscore.
- *	
- *	Note that I haven't figured out yet which should be "standard", prepend
- *	the underscore always, or not at all. These global functions need to go away
- *	for opendarwin.
- */
-	int sym_len = SDL_strlen(symbol);
-	void *value = NULL;
-	char *malloc_sym = NULL;
-	malloc_sym = SDL_malloc(sym_len + 2);
-	if (malloc_sym)
-	{
-		SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol);
-		value = dlsymIntern(handle, malloc_sym, 1);
-		SDL_free(malloc_sym);
-	}
-	else
-	{
-		error("Unable to allocate memory");
-	}
-	return value;
-}
-
-static void *dlsym_auto_underscore(void *handle, const char *symbol)
-{
-	void *answer;
-	dolock();
-	answer = dlsym_auto_underscore_intern(handle, symbol);
-	dounlock();
-	return answer;
-
-}
-static void *dlsym_auto_underscore_intern(void *handle, const char *symbol)
-{
-	struct dlstatus *dls = handle;
-	void *addr = 0;
-	addr = dlsymIntern(dls, symbol, 0);
-	if (!addr)
-		addr = dlsym_prepend_underscore_intern(handle, symbol);
-	return addr;
-}
-
-
-static void *SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol)
-{
-	struct dlstatus *dls = handle;
-	void *addr = 0;
-	dolock();
-	addr = dlsymIntern(dls, symbol, 1);
-	dounlock();
-	return addr;
-}
-#endif
-
-static int SDL_OSX_dlclose(void *handle)
-{
-	struct dlstatus *dls = handle;
-	dolock();
-	resetdlerror();
-	if (!isValidStatus(dls))
-	{
-		goto dlcloseerror;
-	}
-	if (dls->module == MAGIC_DYLIB_MOD)
-	{
-		const char *name;
-		if (!dls->lib)
-		{
-			name = "global context";
-		}
-		else
-		{
-			name = get_lib_name(dls->lib);
-		}
-		warning("trying to close a .dylib!");
-		error("Not closing \"%s\" - dynamic libraries cannot be closed", name);
-		goto dlcloseerror;
-	}
-	if (!dls->module)
-	{
-		error("module already closed");
-		goto dlcloseerror;
-	}
-	
-	if (dls->refs == 1)
-	{
-		unsigned long options = 0;
-		void (*fini) (void);
-		if ((fini = dlsymIntern(dls, "__fini", 0)))
-		{
-			debug("calling _fini()");
-			fini();
-		}
-		options |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
-#ifdef RTLD_NODELETE
-		if (isFlagSet(dls->mode, RTLD_NODELETE))
-			options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
-#endif
-		if (!NSUnLinkModule(dls->module, options))
-		{
-			error("unable to unlink module");
-			goto dlcloseerror;
-		}
-		dls->refs--;
-		dls->module = 0;
-		/* Note: the dlstatus struct dls is neither removed from the list
-		 * nor is the memory it occupies freed. This shouldn't pose a 
-		 * problem in mostly all cases, though.
-		 */
-	}
-	dounlock();
-	return 0;
-  dlcloseerror:
-	dounlock();
-	return 1;
-}
-
-static char *SDL_OSX_dlerror(void)
-{
-	struct dlthread  *tss;
-	const char * err_str = NULL;
-	dlcompat_init_check();
-	tss = pthread_getspecific(dlerror_key);
-	if (tss != NULL && tss->errset != 0) {
-		tss->errset = 0;	
-		err_str = tss->errstr;
-	}
-	return (err_str);
-}
-
-/* Given an address, return the mach_header for the image containing it
- * or zero if the given address is not contained in any loaded images.
- */
-static const struct mach_header *image_for_address(const void *address)
-{
-	unsigned long i;
-	unsigned long j;
-	unsigned long count = _dyld_image_count();
-	struct mach_header *mh = 0;
-	struct load_command *lc = 0;
-	unsigned long addr = NULL;
-	for (i = 0; i < count; i++)
-	{
-		addr = (unsigned long)address - _dyld_get_image_vmaddr_slide(i);
-		mh = _dyld_get_image_header(i);
-		if (mh)
-		{
-			lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
-			for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
-			{
-				if (LC_SEGMENT == lc->cmd &&
-					addr >= ((struct segment_command *)lc)->vmaddr &&
-					addr <
-					((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
-				{
-					goto image_found;
-				}
-			}
-		}
-		mh = 0;
-	}
-  image_found:
-	return mh;
-}
-
-static int SDL_OSX_dladdr(const void * dl_restrict p, SDL_OSX_Dl_info * dl_restrict info)
-{
-/*
-	FIXME: USe the routine image_for_address.
-*/
-	unsigned long i;
-	unsigned long j;
-	unsigned long count = _dyld_image_count();
-	struct mach_header *mh = 0;
-	struct load_command *lc = 0;
-	unsigned long addr = NULL;
-	unsigned long table_off = (unsigned long)0;
-	int found = 0;
-	if (!info)
-		return 0;
-	dolock();
-	resetdlerror();
-	info->dli_fname = 0;
-	info->dli_fbase = 0;
-	info->dli_sname = 0;
-	info->dli_saddr = 0;
-/* Some of this was swiped from code posted by Douglas Davidson <ddavidso AT apple DOT com>
- * to darwin-development AT lists DOT apple DOT com and slightly modified
- */
-	for (i = 0; i < count; i++)
-	{
-		addr = (unsigned long)p - _dyld_get_image_vmaddr_slide(i);
-		mh = _dyld_get_image_header(i);
-		if (mh)
-		{
-			lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
-			for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
-			{
-				if (LC_SEGMENT == lc->cmd &&
-					addr >= ((struct segment_command *)lc)->vmaddr &&
-					addr <
-					((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
-				{
-					info->dli_fname = _dyld_get_image_name(i);
-					info->dli_fbase = (void *)mh;
-					found = 1;
-					break;
-				}
-			}
-			if (found)
-				break;
-		}
-	}
-	if (!found)
-	{
-		dounlock();
-		return 0;
-	}
-	lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
-	for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
-	{
-		if (LC_SEGMENT == lc->cmd)
-		{
-			if (!SDL_strcmp(((struct segment_command *)lc)->segname, "__LINKEDIT"))
-				break;
-		}
-	}
-	table_off =
-		((unsigned long)((struct segment_command *)lc)->vmaddr) -
-		((unsigned long)((struct segment_command *)lc)->fileoff) + _dyld_get_image_vmaddr_slide(i);
-	debug("table off %x", table_off);
-
-	lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
-	for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
-	{
-		if (LC_SYMTAB == lc->cmd)
-		{
-
-			struct nlist *symtable = (struct nlist *)(((struct symtab_command *)lc)->symoff + table_off);
-			unsigned long numsyms = ((struct symtab_command *)lc)->nsyms;
-			struct nlist *nearest = NULL;
-			unsigned long diff = 0xffffffff;
-			unsigned long strtable = (unsigned long)(((struct symtab_command *)lc)->stroff + table_off);
-			debug("symtable %x", symtable);
-			for (i = 0; i < numsyms; i++)
-			{
-				/* Ignore the following kinds of Symbols */
-				if ((!symtable->n_value)	/* Undefined */
-					|| (symtable->n_type >= N_PEXT)	/* Debug symbol */
-					|| (!(symtable->n_type & N_EXT))	/* Local Symbol */
-					)
-				{
-					symtable++;
-					continue;
-				}
-				if ((addr >= symtable->n_value) && (diff >= (symtable->n_value - addr)))
-				{
-					diff = (unsigned long)symtable->n_value - addr;
-					nearest = symtable;
-				}
-				symtable++;
-			}
-			if (nearest)
-			{
-				info->dli_saddr = nearest->n_value + ((void *)p - addr);
-				info->dli_sname = (char *)(strtable + nearest->n_un.n_strx);
-			}
-		}
-	}
-	dounlock();
-	return 1;
-}
-
-
-/*
- * Implement the dlfunc() interface, which behaves exactly the same as
- * dlsym() except that it returns a function pointer instead of a data
- * pointer.  This can be used by applications to avoid compiler warnings
- * about undefined behavior, and is intended as prior art for future
- * POSIX standardization.  This function requires that all pointer types
- * have the same representation, which is true on all platforms FreeBSD
- * runs on, but is not guaranteed by the C standard.
- */
-#if 0 
-static dlfunc_t SDL_OSX_dlfunc(void * dl_restrict handle, const char * dl_restrict symbol)
-{
-	union
-	{
-		void *d;
-		dlfunc_t f;
-	} rv;
-	int sym_len = SDL_strlen(symbol);
-	char *malloc_sym = NULL;
-	dolock();
-	malloc_sym = SDL_malloc(sym_len + 2);
-	if (malloc_sym)
-	{
-		SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol);
-		rv.d = dlsymIntern(handle, malloc_sym, 1);
-		SDL_free(malloc_sym);
-	}
-	else
-	{
-		error("Unable to allocate memory");
-		goto dlfuncerror;
-	}
-	dounlock();
-	return rv.f;
-  dlfuncerror:
-	dounlock();
-	return NULL;
-}
-#endif
-
-
-
-/* dlcompat ends, here's the SDL interface...  --ryan.  */
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(MACOSX)
-#error Compiling for the wrong platform?
-#elif defined(USE_DLOPEN)
-#error Do not use USE_DLOPEN on Mac OS X.
-#endif
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	void *handle = SDL_OSX_dlopen(sofile, RTLD_NOW);
-	const char *loaderror = (char *)SDL_OSX_dlerror();
-	if ( handle == NULL ) {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	void *symbol = SDL_OSX_dlsym(handle, name);
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, (const char *)SDL_OSX_dlerror());
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	if ( handle != NULL ) {
-		SDL_OSX_dlclose(handle);
-	}
-}
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/macosx/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,1401 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* Please note that dlcompat apparently ships in current Mac OS X versions
+ *  as a system library that provides compatibility with the Unix "dlopen"
+ *  interface. In order to allow SDL to work on older OS X releases and also
+ *  not conflict with the system lib on newer versions, we include dlcompat
+ *  in SDL and change the symbols to prevent symbol clash with any existing
+ *  system libraries.  --ryan.
+ */
+
+/* here is the dlcompat license: */
+
+/*
+Copyright (c) 2002 Jorge Acereda  <jacereda@users.sourceforge.net> &
+                   Peter O'Gorman <ogorman@users.sourceforge.net>
+                   
+Portions may be copyright others, see the AUTHORS file included with this
+distribution.
+
+Maintained by Peter O'Gorman <ogorman@users.sourceforge.net>
+
+Bug Reports and other queries should go to <ogorman@users.sourceforge.net>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <pthread.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <mach-o/dyld.h>
+#include <mach-o/nlist.h>
+#include <mach-o/getsect.h>
+
+#include "SDL_stdinc.h"
+
+/* Just playing to see if it would compile with the freebsd headers, it does,
+ * but because of the different values for RTLD_LOCAL etc, it would break binary
+ * compat... oh well
+ */
+#ifndef __BSD_VISIBLE
+#define __BSD_VISIBLE 1
+#endif
+
+/*include "dlfcn.h"*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined (__GNUC__) && __GNUC__ > 3
+#define dl_restrict __restrict
+#else
+#define dl_restrict
+#endif
+
+#ifndef _POSIX_SOURCE
+/*
+ * Structure filled in by dladdr().
+ */
+typedef struct SDL_OSX_dl_info {
+        const char      *dli_fname;     /* Pathname of shared object */
+        void            *dli_fbase;     /* Base address of shared object */
+        const char      *dli_sname;     /* Name of nearest symbol */
+        void            *dli_saddr;     /* Address of nearest symbol */
+} SDL_OSX_Dl_info;
+
+static int SDL_OSX_dladdr(const void * dl_restrict, SDL_OSX_Dl_info * dl_restrict);
+#endif /* ! _POSIX_SOURCE */
+
+static int SDL_OSX_dlclose(void * handle);
+static char * SDL_OSX_dlerror(void);
+static void * SDL_OSX_dlopen(const char *path, int mode);
+static void * SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol);
+
+#define RTLD_LAZY	0x1
+#define RTLD_NOW	0x2
+#define RTLD_LOCAL	0x4
+#define RTLD_GLOBAL	0x8
+
+#ifndef _POSIX_SOURCE
+#define RTLD_NOLOAD	0x10
+#define RTLD_NODELETE	0x80
+
+/*
+ * Special handle arguments for SDL_OSX_dlsym().
+ */
+#define	RTLD_NEXT		((void *) -1)	/* Search subsequent objects. */
+#define	RTLD_DEFAULT	((void *) -2)	/* Use default search algorithm. */
+#endif /* ! _POSIX_SOURCE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef dl_restrict
+#define dl_restrict __restrict
+#endif
+/* This is not available on 10.1 */
+#ifndef LC_LOAD_WEAK_DYLIB
+#define	LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
+#endif
+
+/* With this stuff here, this thing may actually compile/run on 10.0 systems
+ * Not that I have a 10.0 system to test it on anylonger
+ */
+#ifndef LC_REQ_DYLD
+#define LC_REQ_DYLD 0x80000000
+#endif
+#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
+#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
+#endif
+#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
+#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
+#endif
+/* These symbols will be looked for in dyld */
+static const struct mach_header *(*dyld_NSAddImage) (const char *, unsigned long) = 0;
+static int (*dyld_NSIsSymbolNameDefinedInImage) (const struct mach_header *, const char *) = 0;
+static NSSymbol(*dyld_NSLookupSymbolInImage)
+	(const struct mach_header *, const char *, unsigned long) = 0;
+
+/* Define this to make dlcompat reuse data block. This way in theory we save
+ * a little bit of overhead. However we then couldn't correctly catch excess
+ * calls to SDL_OSX_dlclose(). Hence we don't use this feature
+ */
+#undef REUSE_STATUS
+
+/* Size of the internal error message buffer (used by dlerror()) */
+#define ERR_STR_LEN			251
+
+/* Maximum number of search paths supported by getSearchPath */
+#define MAX_SEARCH_PATHS	32
+
+
+#define MAGIC_DYLIB_OFI ((NSObjectFileImage) 'DYOF')
+#define MAGIC_DYLIB_MOD ((NSModule) 'DYMO')
+
+/* internal flags */
+#define DL_IN_LIST 0x01
+
+/* our mutex */
+static pthread_mutex_t dlcompat_mutex;
+/* Our thread specific storage
+ */
+static pthread_key_t dlerror_key;
+
+struct dlthread
+{
+	int lockcnt;
+	unsigned char errset;
+	char errstr[ERR_STR_LEN];
+};
+
+/* This is our central data structure. Whenever a module is loaded via
+ * SDL_OSX_dlopen(), we create such a struct.
+ */
+struct dlstatus
+{
+	struct dlstatus *next;		/* pointer to next element in the linked list */
+	NSModule module;
+	const struct mach_header *lib;
+	int refs;					/* reference count */
+	int mode;					/* mode in which this module was loaded */
+	dev_t device;
+	ino_t inode;
+	int flags;					/* Any internal flags we may need */
+};
+
+/* Head node of the dlstatus list */
+static struct dlstatus mainStatus = { 0, MAGIC_DYLIB_MOD, NULL, -1, RTLD_GLOBAL, 0, 0, 0 };
+static struct dlstatus *stqueue = &mainStatus;
+
+
+/* Storage for the last error message (used by dlerror()) */
+/* static char err_str[ERR_STR_LEN]; */
+/* static int err_filled = 0; */
+
+/* Prototypes to internal functions */
+static void debug(const char *fmt, ...);
+static void error(const char *str, ...);
+static const char *safegetenv(const char *s);
+static const char *searchList(void);
+static const char *getSearchPath(int i);
+static const char *getFullPath(int i, const char *file);
+static const struct stat *findFile(const char *file, const char **fullPath);
+static int isValidStatus(struct dlstatus *status);
+static inline int isFlagSet(int mode, int flag);
+static struct dlstatus *lookupStatus(const struct stat *sbuf);
+static void insertStatus(struct dlstatus *dls, const struct stat *sbuf);
+static int promoteLocalToGlobal(struct dlstatus *dls);
+static void *reference(struct dlstatus *dls, int mode);
+static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError);
+static struct dlstatus *allocStatus(void);
+static struct dlstatus *loadModule(const char *path, const struct stat *sbuf, int mode);
+static NSSymbol *search_linked_libs(const struct mach_header *mh, const char *symbol);
+static const char *get_lib_name(const struct mach_header *mh);
+static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod);
+static void dlcompat_init_func(void);
+static inline void dlcompat_init_check(void);
+static inline void dolock(void);
+static inline void dounlock(void);
+static void dlerrorfree(void *data);
+static void resetdlerror(void);
+static const struct mach_header *my_find_image(const char *name);
+static const struct mach_header *image_for_address(const void *address);
+static inline const char *dyld_error_str(void);
+
+#if FINK_BUILD
+/* Two Global Functions */
+static void *dlsym_prepend_underscore(void *handle, const char *symbol);
+static void *dlsym_auto_underscore(void *handle, const char *symbol);
+
+/* And their _intern counterparts */
+static void *dlsym_prepend_underscore_intern(void *handle, const char *symbol);
+static void *dlsym_auto_underscore_intern(void *handle, const char *symbol);
+#endif
+
+/* Functions */
+
+static void debug(const char *fmt, ...)
+{
+#if DEBUG > 1
+	va_list arg;
+	va_start(arg, fmt);
+	fprintf(stderr, "DLDEBUG: ");
+	vfprintf(stderr, fmt, arg);
+	fprintf(stderr, "\n");
+	fflush(stderr);
+	va_end(arg);
+#endif
+}
+
+static void error(const char *str, ...)
+{
+	va_list arg;
+	struct dlthread  *tss;
+	char * err_str;
+	va_start(arg, str);
+	tss = pthread_getspecific(dlerror_key);
+	err_str = tss->errstr;
+	SDL_strncpy(err_str, "dlcompat: ", ERR_STR_LEN);
+	vsnprintf(err_str + 10, ERR_STR_LEN - 10, str, arg);
+	va_end(arg);
+	debug("ERROR: %s\n", err_str);
+	tss->errset = 1;
+}
+
+static void warning(const char *str)
+{
+#if DEBUG > 0
+	fprintf(stderr, "WARNING: dlcompat: %s\n", str);
+#endif
+}
+
+static const char *safegetenv(const char *s)
+{
+	const char *ss = SDL_getenv(s);
+	return ss ? ss : "";
+}
+
+/* because this is only used for debugging and error reporting functions, we
+ * don't really care about how elegant it is... it could use the load
+ * commands to find the install name of the library, but...
+ */
+static const char *get_lib_name(const struct mach_header *mh)
+{
+	unsigned long count = _dyld_image_count();
+	unsigned long i;
+	const char *val = NULL;
+	if (mh)
+	{
+		for (i = 0; i < count; i++)
+		{
+			if (mh == _dyld_get_image_header(i))
+			{
+				val = _dyld_get_image_name(i);
+				break;
+			}
+		}
+	}
+	return val;
+}
+
+/* Returns the mach_header for the module bu going through all the loaded images
+ * and finding the one with the same name as the module. There really ought to be
+ * an api for doing this, would be faster, but there isn't one right now
+ */
+static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod)
+{
+	const char *mod_name = NSNameOfModule(mod);
+	struct mach_header *mh = NULL;
+	unsigned long count = _dyld_image_count();
+	unsigned long i;
+	debug("Module name: %s", mod_name);
+	for (i = 0; i < count; i++)
+	{
+		if (!SDL_strcmp(mod_name, _dyld_get_image_name(i)))
+		{
+			mh = _dyld_get_image_header(i);
+			break;
+		}
+	}
+	return mh;
+}
+
+
+/* Compute and return a list of all directories that we should search when
+ * trying to locate a module. We first look at the values of LD_LIBRARY_PATH
+ * and DYLD_LIBRARY_PATH, and then finally fall back to looking into
+ * /usr/lib and /lib. Since both of the environments variables can contain a
+ * list of colon seperated paths, we simply concat them and the two other paths
+ * into one big string, which we then can easily parse.
+ * Splitting this string into the actual path list is done by getSearchPath()
+ */
+static const char *searchList()
+{
+	size_t buf_size;
+	static char *buf=NULL;
+	const char *ldlp = safegetenv("LD_LIBRARY_PATH");
+	const char *dyldlp = safegetenv("DYLD_LIBRARY_PATH");
+	const char *stdpath = SDL_getenv("DYLD_FALLBACK_LIBRARY_PATH");
+	if (!stdpath)
+		stdpath = "/usr/local/lib:/lib:/usr/lib";
+	if (!buf)
+	{	
+		buf_size = SDL_strlen(ldlp) + SDL_strlen(dyldlp) + SDL_strlen(stdpath) + 4;
+		buf = SDL_malloc(buf_size);
+		SDL_snprintf(buf, buf_size, "%s%s%s%s%s%c", dyldlp, (dyldlp[0] ? ":" : ""), ldlp, (ldlp[0] ? ":" : ""),
+				 stdpath, '\0');
+	}
+	return buf;
+}
+
+/* Returns the ith search path from the list as computed by searchList() */
+static const char *getSearchPath(int i)
+{
+	static const char *list = 0;
+	static char **path = (char **)0;
+	static int end = 0;
+	static int numsize = MAX_SEARCH_PATHS;
+	static char **tmp;
+	/* So we can call SDL_free() in the "destructor" we use i=-1 to return the alloc'd array */
+	if (i == -1)
+	{
+		return (const char*)path;
+	}
+	if (!path)
+	{
+		path = (char **)SDL_calloc(MAX_SEARCH_PATHS, sizeof(char **));
+	}
+	if (!list && !end)
+		list = searchList();
+	if (i >= (numsize))
+	{
+		debug("Increasing size for long PATH");
+		tmp = (char **)SDL_calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **));
+		if (tmp)
+		{
+			SDL_memcpy(tmp, path, sizeof(char **) * numsize);
+			SDL_free(path);
+			path = tmp;
+			numsize += MAX_SEARCH_PATHS;
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	while (!path[i] && !end)
+	{
+		path[i] = strsep((char **)&list, ":");
+
+		if (path[i][0] == 0)
+			path[i] = 0;
+		end = (list == 0);
+	}
+	return path[i];
+}
+
+static const char *getFullPath(int i, const char *file)
+{
+	static char buf[PATH_MAX];
+	const char *path = getSearchPath(i);
+	if (path)
+	{
+		SDL_snprintf(buf, PATH_MAX, "%s/%s", path, file);
+	}
+	return path ? buf : 0;
+}
+
+/* Given a file name, try to determine the full path for that file. Starts
+ * its search in the current directory, and then tries all paths in the 
+ * search list in the order they are specified there.
+ */
+static const struct stat *findFile(const char *file, const char **fullPath)
+{
+	int i = 0;
+	static struct stat sbuf;
+	char *fileName;
+	debug("finding file %s", file);
+	*fullPath = file;
+	if (0 == stat(file, &sbuf))
+		return &sbuf;
+	if (SDL_strchr(file, '/'))
+		return 0;				/* If the path had a / we don't look in env var places */
+	fileName = NULL;
+	if (!fileName)
+		fileName = (char *)file;
+	while ((*fullPath = getFullPath(i++, fileName)))
+	{
+		if (0 == stat(*fullPath, &sbuf))
+			return &sbuf;
+	}
+	;
+	return 0;
+}
+
+/* Determine whether a given dlstatus is valid or not */
+static int isValidStatus(struct dlstatus *status)
+{
+	/* Walk the list to verify status is contained in it */
+	struct dlstatus *dls = stqueue;
+	while (dls && status != dls)
+		dls = dls->next;
+	if (dls == 0)
+		error("invalid handle");
+	else if ((dls->module == 0) || (dls->refs == 0))
+		error("handle to closed library");
+	else
+		return TRUE;
+	return FALSE;
+}
+
+static inline int isFlagSet(int mode, int flag)
+{
+	return (mode & flag) == flag;
+}
+
+static struct dlstatus *lookupStatus(const struct stat *sbuf)
+{
+	struct dlstatus *dls = stqueue;
+	debug("looking for status");
+	while (dls && ( /* isFlagSet(dls->mode, RTLD_UNSHARED) */ 0
+				   || sbuf->st_dev != dls->device || sbuf->st_ino != dls->inode))
+		dls = dls->next;
+	return dls;
+}
+
+static void insertStatus(struct dlstatus *dls, const struct stat *sbuf)
+{
+	debug("inserting status");
+	dls->inode = sbuf->st_ino;
+	dls->device = sbuf->st_dev;
+	dls->refs = 0;
+	dls->mode = 0;
+	if ((dls->flags & DL_IN_LIST) == 0)
+	{
+		dls->next = stqueue;
+		stqueue = dls;
+		dls->flags |= DL_IN_LIST;
+	}
+}
+
+static struct dlstatus *allocStatus()
+{
+	struct dlstatus *dls;
+#ifdef REUSE_STATUS
+	dls = stqueue;
+	while (dls && dls->module)
+		dls = dls->next;
+	if (!dls)
+#endif
+		dls = SDL_calloc(sizeof(*dls),1);
+	return dls;
+}
+
+static int promoteLocalToGlobal(struct dlstatus *dls)
+{
+	static int (*p) (NSModule module) = 0;
+	debug("promoting");
+	if (!p)
+		_dyld_func_lookup("__dyld_NSMakePrivateModulePublic", (unsigned long *)&p);
+	return (dls->module == MAGIC_DYLIB_MOD) || (p && p(dls->module));
+}
+
+static void *reference(struct dlstatus *dls, int mode)
+{
+	if (dls)
+	{
+		if (dls->module == MAGIC_DYLIB_MOD && isFlagSet(mode, RTLD_LOCAL))
+		{
+			warning("trying to open a .dylib with RTLD_LOCAL");
+			error("unable to open a .dylib with RTLD_LOCAL");
+			return NULL;
+		}
+		if (isFlagSet(mode, RTLD_GLOBAL) &&
+			!isFlagSet(dls->mode, RTLD_GLOBAL) && !promoteLocalToGlobal(dls))
+		{
+			error("unable to promote local module to global");
+			return NULL;
+		}
+		dls->mode |= mode;
+		dls->refs++;
+	}
+	else
+		debug("reference called with NULL argument");
+
+	return dls;
+}
+
+static const struct mach_header *my_find_image(const char *name)
+{
+	const struct mach_header *mh = 0;
+	const char *id = NULL;
+	int i = _dyld_image_count();
+	int j;
+	mh = (struct mach_header *)
+		dyld_NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED |
+						NSADDIMAGE_OPTION_RETURN_ON_ERROR);
+	if (!mh)
+	{
+		for (j = 0; j < i; j++)
+		{
+			id = _dyld_get_image_name(j);
+			if (!SDL_strcmp(id, name))
+			{
+				mh = _dyld_get_image_header(j);
+				break;
+			}
+		}
+	}
+	return mh;
+}
+
+/*
+ * dyld adds libraries by first adding the directly dependant libraries in link order, and
+ * then adding the dependencies for those libraries, so we should do the same... but we don't
+ * bother adding the extra dependencies, if the symbols are neither in the loaded image nor
+ * any of it's direct dependencies, then it probably isn't there.
+ */
+static NSSymbol *search_linked_libs(const struct mach_header * mh, const char *symbol)
+{
+	unsigned int n;
+	struct load_command *lc = 0;
+	struct mach_header *wh;
+	NSSymbol *nssym = 0;
+	if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
+	{
+		lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
+		for (n = 0; n < mh->ncmds; n++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
+		{
+			if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd))
+			{
+				if ((wh = (struct mach_header *)
+					 my_find_image((char *)(((struct dylib_command *)lc)->dylib.name.offset +
+											(char *)lc))))
+				{
+					if (dyld_NSIsSymbolNameDefinedInImage(wh, symbol))
+					{
+						nssym = dyld_NSLookupSymbolInImage(wh,
+														   symbol,
+														   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
+														   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
+						break;
+					}
+				}
+			}
+		}
+		if ((!nssym) && NSIsSymbolNameDefined(symbol))
+		{
+			/* I've never seen this debug message...*/
+			debug("Symbol \"%s\" is defined but was not found", symbol);
+		}
+	}
+	return nssym;
+}
+
+/* Up to the caller to SDL_free() returned string */
+static inline const char *dyld_error_str()
+{
+	NSLinkEditErrors dylder;
+	int dylderno;
+	const char *dylderrstr;
+	const char *dyldfile;
+	const char* retStr = NULL;
+	NSLinkEditError(&dylder, &dylderno, &dyldfile, &dylderrstr);
+	if (dylderrstr && SDL_strlen(dylderrstr))
+	{
+		retStr = SDL_malloc(SDL_strlen(dylderrstr) +1);
+		SDL_strcpy((char*)retStr,dylderrstr);
+	}
+	return retStr;
+}
+
+static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError)
+{
+  NSSymbol *nssym = 0;
+#ifdef __GCC__  
+	void *caller = __builtin_return_address(1);	/* Be *very* careful about inlining */
+#else
+	void *caller = NULL;
+#endif
+	const struct mach_header *caller_mh = 0;
+	const char* savedErrorStr = NULL;
+	resetdlerror();
+#ifndef RTLD_SELF
+#define	RTLD_SELF		((void *) -3)
+#endif
+	if (NULL == dls)
+		dls = RTLD_SELF;
+	if ((RTLD_NEXT == dls) || (RTLD_SELF == dls))
+	{
+		if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage && caller)
+		  {
+			caller_mh = image_for_address(caller);
+			if (RTLD_SELF == dls)
+			{
+				/* FIXME: We should be using the NSModule api, if SELF is an MH_BUNDLE
+				 * But it appears to work anyway, and looking at the code in dyld_libfuncs.c
+				 * this is acceptable.
+				 */
+				if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol))
+				{
+					nssym = dyld_NSLookupSymbolInImage(caller_mh,
+													   symbol,
+													   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
+													   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
+				}
+			}
+			if (!nssym)
+			{
+				if (RTLD_SELF == dls)
+					savedErrorStr = dyld_error_str();
+				nssym = search_linked_libs(caller_mh, symbol);
+			}
+		}
+		else
+		{
+			if (canSetError)
+				error("RTLD_SELF and RTLD_NEXT are not supported");
+			return NULL;
+		}
+	}
+	if (!nssym)
+	{
+
+		if (RTLD_DEFAULT == dls)
+		{
+			dls = &mainStatus;
+		}
+		if (!isValidStatus(dls))
+			return NULL;
+
+		if (dls->module != MAGIC_DYLIB_MOD)
+		{
+			nssym = NSLookupSymbolInModule(dls->module, symbol);
+			if (!nssym && NSIsSymbolNameDefined(symbol))
+			{
+				debug("Searching dependencies");
+				savedErrorStr = dyld_error_str();
+				nssym = search_linked_libs(get_mach_header_from_NSModule(dls->module), symbol);
+			}
+		}
+		else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
+		{
+			if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol))
+			{
+				nssym = dyld_NSLookupSymbolInImage(dls->lib,
+												   symbol,
+												   NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
+												   NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
+			}
+			else if (NSIsSymbolNameDefined(symbol))
+			{
+				debug("Searching dependencies");
+				savedErrorStr = dyld_error_str();
+				nssym = search_linked_libs(dls->lib, symbol);
+			}
+		}
+		else if (dls->module == MAGIC_DYLIB_MOD)
+		{
+			/* Global context, use NSLookupAndBindSymbol */
+			if (NSIsSymbolNameDefined(symbol))
+			{
+				/* There doesn't seem to be a return on error option for this call???
+				   this is potentially broken, if binding fails, it will improperly
+				   exit the application. */
+				nssym = NSLookupAndBindSymbol(symbol);
+			}
+			else
+			{
+				if (savedErrorStr)
+					SDL_free((char*)savedErrorStr);			
+				savedErrorStr = SDL_malloc(256);
+				SDL_snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context",symbol);	
+			}
+		}
+	}
+	/* Error reporting */
+	if (!nssym)
+	{
+		if (!savedErrorStr || !SDL_strlen(savedErrorStr))
+		{
+			if (savedErrorStr)
+				SDL_free((char*)savedErrorStr);
+			savedErrorStr = SDL_malloc(256);
+			SDL_snprintf((char*)savedErrorStr, 256,"Symbol \"%s\" not found",symbol);
+		}
+		if (canSetError)
+		{
+			error(savedErrorStr);
+		}
+		else
+		{
+			debug(savedErrorStr);
+		}
+		if (savedErrorStr)
+			SDL_free((char*)savedErrorStr);
+		return NULL;
+	}
+	return NSAddressOfSymbol(nssym);
+}
+
+static struct dlstatus *loadModule(const char *path, const struct stat *sbuf, int mode)
+{
+	NSObjectFileImage ofi = 0;
+	NSObjectFileImageReturnCode ofirc;
+	struct dlstatus *dls;
+	NSLinkEditErrors ler;
+	int lerno;
+	const char *errstr;
+	const char *file;
+	void (*init) (void);
+
+	ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
+	switch (ofirc)
+	{
+		case NSObjectFileImageSuccess:
+			break;
+		case NSObjectFileImageInappropriateFile:
+			if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
+			{	
+				if (isFlagSet(mode, RTLD_LOCAL))
+				{
+					warning("trying to open a .dylib with RTLD_LOCAL");
+					error("unable to open this file with RTLD_LOCAL");
+					return NULL;
+				}
+			}
+			else
+			{
+				error("opening this file is unsupported on this system");
+				return NULL;
+			}
+			break;
+		case NSObjectFileImageFailure:
+			error("object file setup failure");
+			return NULL;
+		case NSObjectFileImageArch:
+			error("no object for this architecture");
+			return NULL;
+		case NSObjectFileImageFormat:
+			error("bad object file format");
+			return NULL;
+		case NSObjectFileImageAccess:
+			error("can't read object file");
+			return NULL;
+		default:
+			error("unknown error from NSCreateObjectFileImageFromFile()");
+			return NULL;
+	}
+	dls = lookupStatus(sbuf);
+	if (!dls)
+	{
+		dls = allocStatus();
+	}
+	if (!dls)
+	{
+		error("unable to allocate memory");
+		return NULL;
+	}
+	//	dls->lib = 0;
+	if (ofirc == NSObjectFileImageInappropriateFile)
+	{
+		if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR)))
+		{
+			debug("Dynamic lib loaded at %ld", dls->lib);
+			ofi = MAGIC_DYLIB_OFI;
+			dls->module = MAGIC_DYLIB_MOD;
+			ofirc = NSObjectFileImageSuccess;
+			/* Although it is possible with a bit of work to modify this so it works and
+			   functions with RTLD_NOW, I don't deem it necessary at the moment */
+		}
+		if (!(dls->module))
+		{
+			NSLinkEditError(&ler, &lerno, &file, &errstr);
+			if (!errstr || (!SDL_strlen(errstr)))
+				error("Can't open this file type");
+			else
+				error(errstr);
+			if ((dls->flags & DL_IN_LIST) == 0)
+			{
+				SDL_free(dls);
+			}
+			return NULL;
+		}
+	}
+	else
+	{
+		dls->module = NSLinkModule(ofi, path,
+								   NSLINKMODULE_OPTION_RETURN_ON_ERROR |
+								   NSLINKMODULE_OPTION_PRIVATE |
+								   (isFlagSet(mode, RTLD_NOW) ? NSLINKMODULE_OPTION_BINDNOW : 0));
+		NSDestroyObjectFileImage(ofi);
+		if (dls->module)
+		{
+			dls->lib = get_mach_header_from_NSModule(dls->module);
+		}
+	}
+	if (!dls->module)
+	{
+		NSLinkEditError(&ler, &lerno, &file, &errstr);
+		if ((dls->flags & DL_IN_LIST) == 0)
+		{
+			SDL_free(dls);
+		}
+		error(errstr);
+		return NULL;
+	}
+
+	insertStatus(dls, sbuf);
+	dls = reference(dls, mode);
+	if ((init = dlsymIntern(dls, "__init", 0)))
+	{
+		debug("calling _init()");
+		init();
+	}
+	return dls;
+}
+
+inline static void dlcompat_init_check(void)
+{
+	static pthread_mutex_t l = PTHREAD_MUTEX_INITIALIZER;
+	static int init_done = 0;
+
+	pthread_mutex_lock(&l);
+	if (!init_done) {
+		dlcompat_init_func();
+		init_done = 1;
+	}
+	pthread_mutex_unlock(&l);
+}
+
+static void dlcompat_init_func(void)
+{
+        _dyld_func_lookup("__dyld_NSAddImage", (unsigned long *)&dyld_NSAddImage);
+	_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
+			  (unsigned long *)&dyld_NSIsSymbolNameDefinedInImage);
+	_dyld_func_lookup("__dyld_NSLookupSymbolInImage", (unsigned long *)&dyld_NSLookupSymbolInImage);
+	if (pthread_mutex_init(&dlcompat_mutex, NULL))
+	    exit(1);
+	if (pthread_key_create(&dlerror_key, &dlerrorfree))
+	    exit(1);
+}
+
+static void resetdlerror()
+{
+	struct dlthread *tss;
+	tss = pthread_getspecific(dlerror_key);
+	tss->errset = 0;
+}
+
+static void dlerrorfree(void *data)
+{
+	SDL_free(data);
+}
+
+/* We kind of want a recursive lock here, but meet a little trouble
+ * because they are not available pre OS X 10.2, so we fake it
+ * using thread specific storage to keep a lock count
+ */ 
+static inline void dolock(void)
+{
+	int err = 0;
+	struct dlthread *tss;
+	dlcompat_init_check();
+	tss = pthread_getspecific(dlerror_key);
+	if (!tss)
+	{
+		tss = SDL_malloc(sizeof(struct dlthread));
+		tss->lockcnt = 0;
+		tss->errset = 0;
+		if (pthread_setspecific(dlerror_key, tss))
+		{
+			fprintf(stderr,"dlcompat: pthread_setspecific failed\n");
+			exit(1);
+		}
+	}
+	if (!tss->lockcnt)
+		err = pthread_mutex_lock(&dlcompat_mutex);
+	tss->lockcnt = tss->lockcnt +1;	
+	if (err)
+		exit(err);
+}
+
+static inline void dounlock(void)
+{
+	int err = 0;
+	struct dlthread *tss;
+	tss = pthread_getspecific(dlerror_key);
+	tss->lockcnt = tss->lockcnt -1;
+	if (!tss->lockcnt)
+		err = pthread_mutex_unlock(&dlcompat_mutex);
+	if (err)
+		exit(err);
+}
+
+static void *SDL_OSX_dlopen(const char *path, int mode)
+{
+	const struct stat *sbuf;
+	struct dlstatus *dls;
+	const char *fullPath;
+
+	dolock();
+	resetdlerror();
+	if (!path)
+	{
+		dls = &mainStatus;
+		goto dlopenok;
+	}
+	if (!(sbuf = findFile(path, &fullPath)))
+	{
+		error("file \"%s\" not found", path);
+		goto dlopenerror;
+	}
+	/* Now checks that it hasn't been closed already */
+	if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
+	{
+		/* debug("status found"); */
+		dls = reference(dls, mode);
+		goto dlopenok;
+	}
+#ifdef 	RTLD_NOLOAD
+	if (isFlagSet(mode, RTLD_NOLOAD))
+	{
+		error("no existing handle and RTLD_NOLOAD specified");
+		goto dlopenerror;
+	}
+#endif
+	if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
+	{
+		error("how can I load something both RTLD_LAZY and RTLD_NOW?");
+		goto dlopenerror;
+	}
+	dls = loadModule(fullPath, sbuf, mode);
+	
+  dlopenok:
+	dounlock();
+	return (void *)dls;
+  dlopenerror:
+	dounlock();
+	return NULL;
+}
+
+#if !FINK_BUILD
+static void *SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol)
+{
+	int sym_len = SDL_strlen(symbol);
+	void *value = NULL;
+	char *malloc_sym = NULL;
+	dolock();
+	malloc_sym = SDL_malloc(sym_len + 2);
+	if (malloc_sym)
+	{
+		SDL_sprintf(malloc_sym, sym_len+2, "_%s", symbol);
+		value = dlsymIntern(handle, malloc_sym, 1);
+		SDL_free(malloc_sym);
+	}
+	else
+	{
+		error("Unable to allocate memory");
+		goto dlsymerror;
+	}
+	dounlock();
+	return value;
+  dlsymerror:
+	dounlock();
+	return NULL;
+}
+#endif
+
+#if FINK_BUILD
+
+static void *dlsym_prepend_underscore(void *handle, const char *symbol)
+{
+	void *answer;
+	dolock();
+	answer = dlsym_prepend_underscore_intern(handle, symbol);
+	dounlock();
+	return answer;
+}
+
+static void *dlsym_prepend_underscore_intern(void *handle, const char *symbol)
+{
+/*
+ *	A quick and easy way for porting packages which call dlsym(handle,"sym")
+ *	If the porter adds -Ddlsym=dlsym_prepend_underscore to the CFLAGS then
+ *	this function will be called, and will add the required underscore.
+ *	
+ *	Note that I haven't figured out yet which should be "standard", prepend
+ *	the underscore always, or not at all. These global functions need to go away
+ *	for opendarwin.
+ */
+	int sym_len = SDL_strlen(symbol);
+	void *value = NULL;
+	char *malloc_sym = NULL;
+	malloc_sym = SDL_malloc(sym_len + 2);
+	if (malloc_sym)
+	{
+		SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol);
+		value = dlsymIntern(handle, malloc_sym, 1);
+		SDL_free(malloc_sym);
+	}
+	else
+	{
+		error("Unable to allocate memory");
+	}
+	return value;
+}
+
+static void *dlsym_auto_underscore(void *handle, const char *symbol)
+{
+	void *answer;
+	dolock();
+	answer = dlsym_auto_underscore_intern(handle, symbol);
+	dounlock();
+	return answer;
+
+}
+static void *dlsym_auto_underscore_intern(void *handle, const char *symbol)
+{
+	struct dlstatus *dls = handle;
+	void *addr = 0;
+	addr = dlsymIntern(dls, symbol, 0);
+	if (!addr)
+		addr = dlsym_prepend_underscore_intern(handle, symbol);
+	return addr;
+}
+
+
+static void *SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol)
+{
+	struct dlstatus *dls = handle;
+	void *addr = 0;
+	dolock();
+	addr = dlsymIntern(dls, symbol, 1);
+	dounlock();
+	return addr;
+}
+#endif
+
+static int SDL_OSX_dlclose(void *handle)
+{
+	struct dlstatus *dls = handle;
+	dolock();
+	resetdlerror();
+	if (!isValidStatus(dls))
+	{
+		goto dlcloseerror;
+	}
+	if (dls->module == MAGIC_DYLIB_MOD)
+	{
+		const char *name;
+		if (!dls->lib)
+		{
+			name = "global context";
+		}
+		else
+		{
+			name = get_lib_name(dls->lib);
+		}
+		warning("trying to close a .dylib!");
+		error("Not closing \"%s\" - dynamic libraries cannot be closed", name);
+		goto dlcloseerror;
+	}
+	if (!dls->module)
+	{
+		error("module already closed");
+		goto dlcloseerror;
+	}
+	
+	if (dls->refs == 1)
+	{
+		unsigned long options = 0;
+		void (*fini) (void);
+		if ((fini = dlsymIntern(dls, "__fini", 0)))
+		{
+			debug("calling _fini()");
+			fini();
+		}
+		options |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
+#ifdef RTLD_NODELETE
+		if (isFlagSet(dls->mode, RTLD_NODELETE))
+			options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
+#endif
+		if (!NSUnLinkModule(dls->module, options))
+		{
+			error("unable to unlink module");
+			goto dlcloseerror;
+		}
+		dls->refs--;
+		dls->module = 0;
+		/* Note: the dlstatus struct dls is neither removed from the list
+		 * nor is the memory it occupies freed. This shouldn't pose a 
+		 * problem in mostly all cases, though.
+		 */
+	}
+	dounlock();
+	return 0;
+  dlcloseerror:
+	dounlock();
+	return 1;
+}
+
+static char *SDL_OSX_dlerror(void)
+{
+	struct dlthread  *tss;
+	const char * err_str = NULL;
+	dlcompat_init_check();
+	tss = pthread_getspecific(dlerror_key);
+	if (tss != NULL && tss->errset != 0) {
+		tss->errset = 0;	
+		err_str = tss->errstr;
+	}
+	return (err_str);
+}
+
+/* Given an address, return the mach_header for the image containing it
+ * or zero if the given address is not contained in any loaded images.
+ */
+static const struct mach_header *image_for_address(const void *address)
+{
+	unsigned long i;
+	unsigned long j;
+	unsigned long count = _dyld_image_count();
+	struct mach_header *mh = 0;
+	struct load_command *lc = 0;
+	unsigned long addr = NULL;
+	for (i = 0; i < count; i++)
+	{
+		addr = (unsigned long)address - _dyld_get_image_vmaddr_slide(i);
+		mh = _dyld_get_image_header(i);
+		if (mh)
+		{
+			lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
+			for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
+			{
+				if (LC_SEGMENT == lc->cmd &&
+					addr >= ((struct segment_command *)lc)->vmaddr &&
+					addr <
+					((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
+				{
+					goto image_found;
+				}
+			}
+		}
+		mh = 0;
+	}
+  image_found:
+	return mh;
+}
+
+static int SDL_OSX_dladdr(const void * dl_restrict p, SDL_OSX_Dl_info * dl_restrict info)
+{
+/*
+	FIXME: USe the routine image_for_address.
+*/
+	unsigned long i;
+	unsigned long j;
+	unsigned long count = _dyld_image_count();
+	struct mach_header *mh = 0;
+	struct load_command *lc = 0;
+	unsigned long addr = NULL;
+	unsigned long table_off = (unsigned long)0;
+	int found = 0;
+	if (!info)
+		return 0;
+	dolock();
+	resetdlerror();
+	info->dli_fname = 0;
+	info->dli_fbase = 0;
+	info->dli_sname = 0;
+	info->dli_saddr = 0;
+/* Some of this was swiped from code posted by Douglas Davidson <ddavidso AT apple DOT com>
+ * to darwin-development AT lists DOT apple DOT com and slightly modified
+ */
+	for (i = 0; i < count; i++)
+	{
+		addr = (unsigned long)p - _dyld_get_image_vmaddr_slide(i);
+		mh = _dyld_get_image_header(i);
+		if (mh)
+		{
+			lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
+			for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
+			{
+				if (LC_SEGMENT == lc->cmd &&
+					addr >= ((struct segment_command *)lc)->vmaddr &&
+					addr <
+					((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
+				{
+					info->dli_fname = _dyld_get_image_name(i);
+					info->dli_fbase = (void *)mh;
+					found = 1;
+					break;
+				}
+			}
+			if (found)
+				break;
+		}
+	}
+	if (!found)
+	{
+		dounlock();
+		return 0;
+	}
+	lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
+	for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
+	{
+		if (LC_SEGMENT == lc->cmd)
+		{
+			if (!SDL_strcmp(((struct segment_command *)lc)->segname, "__LINKEDIT"))
+				break;
+		}
+	}
+	table_off =
+		((unsigned long)((struct segment_command *)lc)->vmaddr) -
+		((unsigned long)((struct segment_command *)lc)->fileoff) + _dyld_get_image_vmaddr_slide(i);
+	debug("table off %x", table_off);
+
+	lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
+	for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
+	{
+		if (LC_SYMTAB == lc->cmd)
+		{
+
+			struct nlist *symtable = (struct nlist *)(((struct symtab_command *)lc)->symoff + table_off);
+			unsigned long numsyms = ((struct symtab_command *)lc)->nsyms;
+			struct nlist *nearest = NULL;
+			unsigned long diff = 0xffffffff;
+			unsigned long strtable = (unsigned long)(((struct symtab_command *)lc)->stroff + table_off);
+			debug("symtable %x", symtable);
+			for (i = 0; i < numsyms; i++)
+			{
+				/* Ignore the following kinds of Symbols */
+				if ((!symtable->n_value)	/* Undefined */
+					|| (symtable->n_type >= N_PEXT)	/* Debug symbol */
+					|| (!(symtable->n_type & N_EXT))	/* Local Symbol */
+					)
+				{
+					symtable++;
+					continue;
+				}
+				if ((addr >= symtable->n_value) && (diff >= (symtable->n_value - addr)))
+				{
+					diff = (unsigned long)symtable->n_value - addr;
+					nearest = symtable;
+				}
+				symtable++;
+			}
+			if (nearest)
+			{
+				info->dli_saddr = nearest->n_value + ((void *)p - addr);
+				info->dli_sname = (char *)(strtable + nearest->n_un.n_strx);
+			}
+		}
+	}
+	dounlock();
+	return 1;
+}
+
+
+/*
+ * Implement the dlfunc() interface, which behaves exactly the same as
+ * dlsym() except that it returns a function pointer instead of a data
+ * pointer.  This can be used by applications to avoid compiler warnings
+ * about undefined behavior, and is intended as prior art for future
+ * POSIX standardization.  This function requires that all pointer types
+ * have the same representation, which is true on all platforms FreeBSD
+ * runs on, but is not guaranteed by the C standard.
+ */
+#if 0 
+static dlfunc_t SDL_OSX_dlfunc(void * dl_restrict handle, const char * dl_restrict symbol)
+{
+	union
+	{
+		void *d;
+		dlfunc_t f;
+	} rv;
+	int sym_len = SDL_strlen(symbol);
+	char *malloc_sym = NULL;
+	dolock();
+	malloc_sym = SDL_malloc(sym_len + 2);
+	if (malloc_sym)
+	{
+		SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol);
+		rv.d = dlsymIntern(handle, malloc_sym, 1);
+		SDL_free(malloc_sym);
+	}
+	else
+	{
+		error("Unable to allocate memory");
+		goto dlfuncerror;
+	}
+	dounlock();
+	return rv.f;
+  dlfuncerror:
+	dounlock();
+	return NULL;
+}
+#endif
+
+
+
+/* dlcompat ends, here's the SDL interface...  --ryan.  */
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	void *handle = SDL_OSX_dlopen(sofile, RTLD_NOW);
+	const char *loaderror = (char *)SDL_OSX_dlerror();
+	if ( handle == NULL ) {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	void *symbol = SDL_OSX_dlsym(handle, name);
+	if ( symbol == NULL ) {
+		SDL_SetError("Failed loading %s: %s", name, (const char *)SDL_OSX_dlerror());
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	if ( handle != NULL ) {
+		SDL_OSX_dlclose(handle);
+	}
+}
+
--- a/src/loadso/mint/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-/* please use the "dummy" driver if you don't have LDG support enabled. */
-#if !defined(__MINT__) || !defined(ENABLE_LDG)
-#error Compiling for the wrong platform?
-#endif
-
-#include <stdio.h>
-#include <gem.h>
-#include <ldg.h>
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	const char *loaderror = "Unknown error";
-	void *handle = (void *)ldg_open((char *)sofile, ldg_global);
-	if ( handle == NULL ) {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	const char *loaderror = "Unknown error";
-	void *symbol = (void *)ldg_find((char *)name, (LDG *)handle);
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, loaderror);
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	if ( handle != NULL ) {
-		ldg_close((LDG *)handle, ldg_global);
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/mint/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,58 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include <stdio.h>
+#include <gem.h>
+#include <ldg.h>
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	const char *loaderror = "Unknown error";
+	void *handle = (void *)ldg_open((char *)sofile, ldg_global);
+	if ( handle == NULL ) {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	const char *loaderror = "Unknown error";
+	void *symbol = (void *)ldg_find((char *)name, (LDG *)handle);
+	if ( symbol == NULL ) {
+		SDL_SetError("Failed loading %s: %s", name, loaderror);
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	if ( handle != NULL ) {
+		ldg_close((LDG *)handle, ldg_global);
+	}
+}
+
--- a/src/loadso/os2/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(__OS2__)
-#error Compiling for the wrong platform?
-#endif
-
-#include <stdio.h>
-#define INCL_DOSERRORS
-#define INCL_DOSMODULEMGR
-#include <os2.h>
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-    HMODULE handle = NULL;
-    char buf[512];
-    APIRET ulrc = DosLoadModule(buf, sizeof (buf), (char *) sofile, &handle);
-
-    /* Generate an error message if all loads failed */
-    if ((ulrc != NO_ERROR) || (handle == NULL))
-        SDL_SetError("Failed loading %s: %s", sofile, buf);
-
-    return((void *) handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-    const char *loaderror = "Unknown error";
-    void *symbol = NULL;
-    APIRET ulrc = DosQueryProcAddr((HMODULE)handle, 0, (char *)name, &symbol);
-    if (ulrc == ERROR_INVALID_HANDLE)
-        loaderror = "Invalid module handle";
-    else if (ulrc == ERROR_INVALID_NAME)
-        loaderror = "Symbol not found";
-
-    if (symbol == NULL)
-        SDL_SetError("Failed loading %s: %s", name, loaderror);
-
-    return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-    if ( handle != NULL )
-        DosFreeModule((HMODULE) handle);
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/os2/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,67 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include <stdio.h>
+#define INCL_DOSERRORS
+#define INCL_DOSMODULEMGR
+#include <os2.h>
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+    HMODULE handle = NULL;
+    char buf[512];
+    APIRET ulrc = DosLoadModule(buf, sizeof (buf), (char *) sofile, &handle);
+
+    /* Generate an error message if all loads failed */
+    if ((ulrc != NO_ERROR) || (handle == NULL))
+        SDL_SetError("Failed loading %s: %s", sofile, buf);
+
+    return((void *) handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+    const char *loaderror = "Unknown error";
+    void *symbol = NULL;
+    APIRET ulrc = DosQueryProcAddr((HMODULE)handle, 0, (char *)name, &symbol);
+    if (ulrc == ERROR_INVALID_HANDLE)
+        loaderror = "Invalid module handle";
+    else if (ulrc == ERROR_INVALID_NAME)
+        loaderror = "Symbol not found";
+
+    if (symbol == NULL)
+        SDL_SetError("Failed loading %s: %s", name, loaderror);
+
+    return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+    if ( handle != NULL )
+        DosFreeModule((HMODULE) handle);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/loadso/win32/SDL_sysloadso.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,134 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines                           */
+
+#include "SDL_windows.h"
+
+#include "SDL_loadso.h"
+
+void *SDL_LoadObject(const char *sofile)
+{
+	void *handle = NULL;
+	const char *loaderror = "Unknown error";
+
+#if defined(_WIN32_WCE)
+	char errbuf[512];
+
+	wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
+	wchar_t *sofile_t = SDL_malloc((MAX_PATH+1) * sizeof(wchar_t));
+
+	MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH);
+	handle = (void *)LoadLibrary(sofile_t);
+
+	/* Generate an error message if all loads failed */
+	if ( handle == NULL ) {
+		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
+					FORMAT_MESSAGE_FROM_SYSTEM),
+				NULL, GetLastError(), 
+				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+				errbuf_t, SDL_TABLESIZE(errbuf), NULL);
+		WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
+		loaderror = errbuf;
+	}
+
+	SDL_free(sofile_t);
+	SDL_free(errbuf_t);
+
+#else /*if defined(WIN32)*/
+	char errbuf[512];
+
+	handle = (void *)LoadLibrary(sofile);
+
+	/* Generate an error message if all loads failed */
+	if ( handle == NULL ) {
+		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
+					FORMAT_MESSAGE_FROM_SYSTEM),
+				NULL, GetLastError(), 
+				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+				errbuf, SDL_TABLESIZE(errbuf), NULL);
+		loaderror = errbuf;
+	}
+#endif
+
+	if ( handle == NULL ) {
+		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+	}
+	return(handle);
+}
+
+void *SDL_LoadFunction(void *handle, const char *name)
+{
+	void *symbol = NULL;
+	const char *loaderror = "Unknown error";
+
+#if defined(_WIN32_WCE)
+	char errbuf[512];
+	int length = SDL_strlen(name);
+
+	wchar_t *name_t = SDL_malloc((length + 1) * sizeof(wchar_t));
+	wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
+
+	MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length);
+
+	symbol = (void *)GetProcAddress((HMODULE)handle, name_t);
+	if ( symbol == NULL ) {
+		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
+					FORMAT_MESSAGE_FROM_SYSTEM),
+				NULL, GetLastError(), 
+				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+				errbuf_t, SDL_TABLESIZE(errbuf), NULL);
+		WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
+		loaderror = errbuf;
+	}
+
+	SDL_free(name_t);
+	SDL_free(errbuf_t);
+
+#else /*if defined(WIN32)*/
+	char errbuf[512];
+
+	symbol = (void *)GetProcAddress((HMODULE)handle, name);
+	if ( symbol == NULL ) {
+		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
+					FORMAT_MESSAGE_FROM_SYSTEM),
+				NULL, GetLastError(), 
+				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+				errbuf, SDL_TABLESIZE(errbuf), NULL);
+		loaderror = errbuf;
+	}
+#endif
+
+	if ( symbol == NULL ) {
+		SDL_SetError("Failed loading %s: %s", name, loaderror);
+	}
+	return(symbol);
+}
+
+void SDL_UnloadObject(void *handle)
+{
+	if ( handle != NULL ) {
+		FreeLibrary((HMODULE)handle);
+	}
+}
+
--- a/src/loadso/windows/SDL_loadso.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#if !SDL_INTERNAL_BUILDING_LOADSO
-#error Do not compile directly...compile src/SDL_loadso.c instead!
-#endif
-
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-#error Compiling for the wrong platform?
-#endif
-
-#include "SDL_windows.h"
-
-#include "SDL_loadso.h"
-
-void *SDL_LoadObject(const char *sofile)
-{
-	void *handle = NULL;
-	const char *loaderror = "Unknown error";
-
-#if defined(_WIN32_WCE)
-	char errbuf[512];
-
-	wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
-	wchar_t *sofile_t = SDL_malloc((MAX_PATH+1) * sizeof(wchar_t));
-
-	MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH);
-	handle = (void *)LoadLibrary(sofile_t);
-
-	/* Generate an error message if all loads failed */
-	if ( handle == NULL ) {
-		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
-					FORMAT_MESSAGE_FROM_SYSTEM),
-				NULL, GetLastError(), 
-				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-				errbuf_t, SDL_TABLESIZE(errbuf), NULL);
-		WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
-		loaderror = errbuf;
-	}
-
-	SDL_free(sofile_t);
-	SDL_free(errbuf_t);
-
-#else /*if defined(WIN32)*/
-	char errbuf[512];
-
-	handle = (void *)LoadLibrary(sofile);
-
-	/* Generate an error message if all loads failed */
-	if ( handle == NULL ) {
-		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
-					FORMAT_MESSAGE_FROM_SYSTEM),
-				NULL, GetLastError(), 
-				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-				errbuf, SDL_TABLESIZE(errbuf), NULL);
-		loaderror = errbuf;
-	}
-#endif
-
-	if ( handle == NULL ) {
-		SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-	}
-	return(handle);
-}
-
-void *SDL_LoadFunction(void *handle, const char *name)
-{
-	void *symbol = NULL;
-	const char *loaderror = "Unknown error";
-
-#if defined(_WIN32_WCE)
-	char errbuf[512];
-	int length = SDL_strlen(name);
-
-	wchar_t *name_t = SDL_malloc((length + 1) * sizeof(wchar_t));
-	wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
-
-	MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length);
-
-	symbol = (void *)GetProcAddress((HMODULE)handle, name_t);
-	if ( symbol == NULL ) {
-		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
-					FORMAT_MESSAGE_FROM_SYSTEM),
-				NULL, GetLastError(), 
-				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-				errbuf_t, SDL_TABLESIZE(errbuf), NULL);
-		WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
-		loaderror = errbuf;
-	}
-
-	SDL_free(name_t);
-	SDL_free(errbuf_t);
-
-#else /*if defined(WIN32)*/
-	char errbuf[512];
-
-	symbol = (void *)GetProcAddress((HMODULE)handle, name);
-	if ( symbol == NULL ) {
-		FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
-					FORMAT_MESSAGE_FROM_SYSTEM),
-				NULL, GetLastError(), 
-				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-				errbuf, SDL_TABLESIZE(errbuf), NULL);
-		loaderror = errbuf;
-	}
-#endif
-
-	if ( symbol == NULL ) {
-		SDL_SetError("Failed loading %s: %s", name, loaderror);
-	}
-	return(symbol);
-}
-
-void SDL_UnloadObject(void *handle)
-{
-	if ( handle != NULL ) {
-		FreeLibrary((HMODULE)handle);
-	}
-}
-
--- a/src/main/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/main/Makefile.am	Thu Feb 16 10:11:48 2006 +0000
@@ -4,14 +4,6 @@
 # This is necessary because some platforms have special program
 # entry points, which require special application initialization.
 
-ARCH_SUBDIRS = $(srcdir)/beos \
-               $(srcdir)/epoc \
-               $(srcdir)/dummy \
-               $(srcdir)/macos \
-               $(srcdir)/macosx \
-               $(srcdir)/qtopia \
-               $(srcdir)/win32
-
 # Build a separate library containing the main() entry point.
 lib_LIBRARIES = libSDLmain.a
 
@@ -48,11 +40,6 @@
 libarch_la_SOURCES = $(ARCH_SRCS)
 
 exports:
-	for i in $(ARCH_SUBDIRS); do if [ -d $$i/exports ]; then (cd $$i/exports; make); fi; done
+	for i in $(srcdir)/*; do if [ -d $$i/exports ]; then (cd $$i/exports; make); fi; done
 
-# The architecture specific directories need to be copied into place
-# when building a distribution.
-dist-hook:
-	(cd $(distdir) && rm -f $(BUILT_SOURCES))
-	cp -rp $(ARCH_SUBDIRS) $(distdir)
-	(cd $(distdir) && rm -rf `find . -name CVS`)
+EXTRA_DIST = beos dummy epoc linux macos macosx qtopia win32
--- a/src/main/win32/SDL_win32_main.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/main/win32/SDL_win32_main.c	Thu Feb 16 10:11:48 2006 +0000
@@ -220,27 +220,12 @@
 	atexit(cleanup_output);
 	atexit(SDL_Quit);
 
-#ifndef DISABLE_VIDEO
-#if 0
-	/* Create and register our class *
-	   DJM: If we do this here, the user nevers gets a chance to
-	   putenv(SDL_WINDOWID).  This is already called later by
-	   the (DIB|DX5)_CreateWindow function, so it should be
-	   safe to comment it out here.
-	if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT, 
-	                     GetModuleHandle(NULL)) < 0 ) {
-		ShowError("WinMain() error", SDL_GetError());
-		exit(1);
-	}*/
-#else
 	/* Sam:
 	   We still need to pass in the application handle so that
 	   DirectInput will initialize properly when SDL_RegisterApp()
 	   is called later in the video initialization.
 	 */
 	SDL_SetModuleHandle(GetModuleHandle(NULL));
-#endif /* 0 */
-#endif /* !DISABLE_VIDEO */
 
 	/* Run the application main() code */
 	SDL_main(argc, argv);
--- a/src/stdlib/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for the SDL file library
-
-noinst_LTLIBRARIES = libstdlib.la
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_getenv.c		\
-	SDL_malloc.c		\
-	SDL_qsort.c		\
-	SDL_stdlib.c		\
-	SDL_string.c
-
-libstdlib_la_SOURCES = $(COMMON_SRCS)
-
--- a/src/thread/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-
-## Makefile.am for the SDL thread library
-
-noinst_LTLIBRARIES = libthread.la
-
-ARCH_SUBDIRS = $(srcdir)/generic	\
-               $(srcdir)/amigaos	\
-               $(srcdir)/beos		\
-               $(srcdir)/bsdi		\
-               $(srcdir)/dc		\
-               $(srcdir)/epoc		\
-               $(srcdir)/irix		\
-               $(srcdir)/linux		\
-               $(srcdir)/pth		\
-               $(srcdir)/win32
-
-# Older versions of Linux require an asm clone() implementation
-if USE_CLONE
-THREAD_ASM_SRC = linux/clone.S
-else
-THREAD_ASM_SRC =
-endif
-
-COMMON_SRCS =			\
-	SDL_systhread.h		\
-	SDL_thread.c		\
-	SDL_thread_c.h
-ARCH_SRCS = 			\
-	SDL_systhread.c		\
-	SDL_systhread_c.h	\
-	SDL_sysmutex.c		\
-	SDL_sysmutex_c.h	\
-	SDL_syssem.c		\
-	SDL_syssem_c.h		\
-	SDL_syscond.c		\
-	SDL_syscond_c.h		\
-	$(THREAD_ASM_SRC)
-
-libthread_la_SOURCES = $(COMMON_SRCS) $(ARCH_SRCS)
-
-## Let automake know that it shouldn't distribute linked sources
-BUILT_SOURCES = $(ARCH_SRCS)
-
-## Let automake know that it should remove these for distribution
-DISTCLEANFILES = $(ARCH_SRCS)
-
-# The architecture specific directories need to be copied into place
-# when building a distribution.
-dist-hook:
-	(cd $(distdir) && rm -f $(BUILT_SOURCES))
-	cp -rp $(ARCH_SUBDIRS) $(distdir)
-	(cd $(distdir) && rm -rf `find . -name CVS`)
--- a/src/thread/SDL_systhread.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/SDL_systhread.h	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,10 @@
 
 /* These are functions that need to be implemented by a port of SDL */
 
-#include "SDL_thread_c.h"
+#ifndef _SDL_systhread_h
+#define _SDL_systhread_h
+
+#include "SDL_thread.h"
 
 /* This function creates a thread, passing args to SDL_RunThread(),
    saves a system-dependent thread id in thread->id, and returns 0
@@ -45,3 +48,4 @@
 /* This function kills the thread and returns */
 extern void SDL_SYS_KillThread(SDL_Thread *thread);
 
+#endif /* _SDL_systhread_h */
--- a/src/thread/SDL_thread_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/SDL_thread_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,32 @@
 #ifndef _SDL_thread_c_h
 #define _SDL_thread_c_h
 
-#include "SDL_error_c.h"
-#include "SDL_systhread_c.h"
+/* Need the definitions of SYS_ThreadHandle */
+#if SDL_THREADS_DISABLED
+#include "generic/SDL_systhread_c.h"
+#elif SDL_THREAD_AMIGA
+#include "amigaos/SDL_systhread_c.h"
+#elif SDL_THREAD_BEOS
+#include "beos/SDL_systhread_c.h"
+#elif SDL_THREAD_DC
+#include "dc/SDL_systhread_c.h"
+#elif SDL_THREAD_EPOC
+#include "epoc/SDL_systhread_c.h"
+#elif SDL_THREAD_OS2
+#include "os2/SDL_systhread_c.h"
+#elif SDL_THREAD_PTH
+#include "pth/SDL_systhread_c.h"
+#elif SDL_THREAD_PTHREAD
+#include "pthread/SDL_systhread_c.h"
+#elif SDL_THREAD_SPROC
+#include "irix/SDL_systhread_c.h"
+#elif SDL_THREAD_WIN32
+#include "win32/SDL_systhread_c.h"
+#else
+#error Need thread implementation for this platform
+#include "generic/SDL_systhread_c.h"
+#endif
+#include "../SDL_error_c.h"
 
 /* This is the system-independent thread info structure */
 struct SDL_Thread {
@@ -38,7 +62,4 @@
 /* This is the function called to run a thread */
 extern void SDL_RunThread(void *data);
 
-/* Routine to get the thread-specific error variable */
-extern SDL_error *SDL_GetErrBuf(void);
-
 #endif /* _SDL_thread_c_h */
--- a/src/thread/amigaos/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/amigaos/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,10 +29,6 @@
 struct SDL_semaphore
 {
 	struct SignalSemaphore Sem;
-	Uint32 count;
-	Uint32 waiters_count;
-	SDL_mutex *count_lock;
-	SDL_cond *count_nonzero;
 };
 
 #undef D
@@ -98,20 +94,9 @@
 
 	/* A timeout of 0 is an easy case */
 	if ( timeout == 0 ) {
-		return SDL_SemTryWait(sem);
+		ObtainSemaphore(&sem->Sem);
+		return 1;
 	}
-/*
-	SDL_LockMutex(sem->count_lock);
-	++sem->waiters_count;
-	retval = 0;
-	while ( (sem->count == 0) && (retval != SDL_MUTEX_TIMEDOUT) ) {
-		retval = SDL_CondWaitTimeout(sem->count_nonzero,
-		                             sem->count_lock, timeout);
-	}
-	--sem->waiters_count;
-	--sem->count;
-	SDL_UnlockMutex(sem->count_lock);
-*/
 	if(!(retval=AttemptSemaphore(&sem->Sem)))
 	{
 		SDL_Delay(timeout);
@@ -131,7 +116,6 @@
 {
 	ObtainSemaphore(&sem->Sem);
 	return 0;
-//	return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
 }
 
 Uint32 SDL_SemValue(SDL_sem *sem)
@@ -145,7 +129,6 @@
 		#else
 		value = sem->Sem.ss_NestCount;
 		#endif
-//		SDL_UnlockMutex(sem->count_lock);
 	}
 	return value;
 }
@@ -159,14 +142,6 @@
 	D(bug("SemPost semaphore...%lx\n",sem));
 
 	ReleaseSemaphore(&sem->Sem);
-#if 0
-	SDL_LockMutex(sem->count_lock);
-	if ( sem->waiters_count > 0 ) {
-		SDL_CondSignal(sem->count_nonzero);
-	}
-	++sem->count;
-	SDL_UnlockMutex(sem->count_lock);
-#endif
 	return 0;
 }
 
--- a/src/thread/amigaos/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/amigaos/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 
 #include "SDL_mutex.h"
 #include "SDL_thread.h"
-#include "SDL_thread_c.h"
-#include "SDL_systhread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
 #include "mydebug.h"
 
 typedef struct {
--- a/src/thread/amigaos/SDL_thread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/amigaos/SDL_thread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 
 #include "SDL_mutex.h"
 #include "SDL_thread.h"
-#include "SDL_thread_c.h"
-#include "SDL_systhread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
 
 #define ARRAY_CHUNKSIZE	32
 /* The array of threads currently active in the application
--- a/src/thread/beos/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/beos/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,8 +28,8 @@
 
 #include "SDL_mutex.h"
 #include "SDL_thread.h"
-#include "SDL_thread_c.h"
-#include "SDL_systhread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
 
 
 static int sig_list[] = {
--- a/src/thread/bsdi/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,498 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#include "SDL_thread.h"
-#include "SDL_timer.h"
-
-#ifdef SDL_USE_PTHREADS
-
-#include <unistd.h>			/* For getpid() */
-#include <pthread.h>
-
-
-/*
- * This is semaphore.h inlined here so that BSD/OS POSIX semaphore are
- * completely selfcontained without requiring any additional include files
- * or libraries not present in the stock system
-*/
-
-/* semaphore.h: POSIX 1003.1b semaphores */
-
-/*-
- * Copyright (c) 1996, 1997
- *	HD Associates, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/posix4/semaphore.h,v 1.6 2000/01/20 07:55:42 jasone Exp $
- */
-
-#include <machine/limits.h>
-
-#include <sys/types.h>
-#include <fcntl.h>
-
-/* Opaque type definition. */
-struct sem;
-typedef struct sem *sem_t;
-
-#define SEM_FAILED	((sem_t *)0)
-#define SEM_VALUE_MAX	UINT_MAX
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int	 sem_init __P((sem_t *, int, unsigned int));
-int	 sem_destroy __P((sem_t *));
-sem_t	*sem_open __P((const char *, int, ...));
-int	 sem_close __P((sem_t *));
-int	 sem_unlink __P((const char *));
-int	 sem_wait __P((sem_t *));
-int	 sem_trywait __P((sem_t *));
-int	 sem_post __P((sem_t *));
-int	 sem_getvalue __P((sem_t *, int *));
-__END_DECLS
-
-/* END of inlined semaphore.h */
-
-/* Wrapper around POSIX 1003.1b semaphores */
-
-struct SDL_semaphore {
-	sem_t *sem;
-	sem_t sem_data;
-};
-
-/* Create a semaphore, initialized with value */
-SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
-{
-	SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
-	if ( sem ) {
-		if ( sem_init(&sem->sem_data, 0, initial_value) < 0 ) {
-			SDL_SetError("sem_init() failed");
-			SDL_free(sem);
-			sem = NULL;
-		} else {
-			sem->sem = &sem->sem_data;
-		}
-	} else {
-		SDL_OutOfMemory();
-	}
-	return sem;
-}
-
-void SDL_DestroySemaphore(SDL_sem *sem)
-{
-	if ( sem ) {
-		sem_destroy(sem->sem);
-		SDL_free(sem);
-	}
-}
-
-int SDL_SemTryWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-	retval = SDL_MUTEX_TIMEDOUT;
-	if ( sem_trywait(sem->sem) == 0 )
-		retval = 0;
-	return retval;
-}
-
-int SDL_SemWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = sem_wait(sem->sem);
-	if ( retval < 0 ) {
-		SDL_SetError("sem_wait() failed");
-	}
-	return retval;
-}
-
-int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	/* Try the easy cases first */
-	if ( timeout == 0 ) {
-		return SDL_SemTryWait(sem);
-	}
-	if ( timeout == SDL_MUTEX_MAXWAIT ) {
-		return SDL_SemWait(sem);
-	}
-
-	/* Ack!  We have to busy wait... */
-	timeout += SDL_GetTicks();
-	do {
-		retval = SDL_SemTryWait(sem);
-		if ( retval == 0 ) {
-			break;
-		}
-		SDL_Delay(1);
-	} while ( SDL_GetTicks() < timeout );
-
-	return retval;
-}
-
-Uint32 SDL_SemValue(SDL_sem *sem)
-{
-	int ret = 0;
-	if ( sem ) {
-		sem_getvalue(sem->sem, &ret);
-		if ( ret < 0 ) {
-			ret = 0;
-		}
-	}
-	return (Uint32)ret;
-}
-
-int SDL_SemPost(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = sem_post(sem->sem);
-	if ( retval < 0 ) {
-		SDL_SetError("sem_post() failed");
-	}
-	return retval;
-}
-
-/* 
- * BEGIN inlined uthread_sem.c.  This is done here so that no extra libraries
- * or include files not present in BSD/OS are required
-*/
-
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice(s), this list of conditions and the following disclaimer as
- *    the first lines of this file unmodified other than the possible
- *    addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice(s), this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc_r/uthread/uthread_sem.c,v 1.3.2.1 2000/07/18 02:05:57 jasone Exp $
- */
-
-#include <errno.h>
-#include <pthread.h>
-
-/* Begin thread_private.h kluge */
-/*
- * These come out of (or should go into) thread_private.h - rather than have 
- * to copy (or symlink) the files from the source tree these definitions are 
- * inlined here.  Obviously these go away when this module is part of libc.
-*/
-struct sem {
-#define SEM_MAGIC       ((u_int32_t) 0x09fa4012)
-        u_int32_t       magic;
-        pthread_mutex_t lock;
-        pthread_cond_t  gtzero;
-        u_int32_t       count;
-        u_int32_t       nwaiters;
-};
-
-extern pthread_once_t _thread_init_once;
-extern int _threads_initialized;
-extern void  _thread_init __P((void));
-#define THREAD_INIT() \
-	(void) pthread_once(&_thread_init_once, _thread_init)
-#define THREAD_SAFE() \
-	(_threads_initialized != 0)
-
-#define _SEM_CHECK_VALIDITY(sem)		\
-	if ((*(sem))->magic != SEM_MAGIC) {	\
-		errno = EINVAL;			\
-		retval = -1;			\
-		goto RETURN;			\
-	}
-/* End thread_private.h kluge */
-
-int
-sem_init(sem_t *sem, int pshared, unsigned int value)
-{
-	int	retval;
-
-	if (!THREAD_SAFE())
-		THREAD_INIT();
-
-	/*
-	 * Range check the arguments.
-	 */
-	if (pshared != 0) {
-		/*
-		 * The user wants a semaphore that can be shared among
-		 * processes, which this implementation can't do.  Sounds like a
-		 * permissions problem to me (yeah right).
-		 */
-		errno = EPERM;
-		retval = -1;
-		goto RETURN;
-	}
-
-	if (value > SEM_VALUE_MAX) {
-		errno = EINVAL;
-		retval = -1;
-		goto RETURN;
-	}
-
-	*sem = (sem_t)SDL_malloc(sizeof(struct sem));
-	if (*sem == NULL) {
-		errno = ENOSPC;
-		retval = -1;
-		goto RETURN;
-	}
-
-	/*
-	 * Initialize the semaphore.
-	 */
-	if (pthread_mutex_init(&(*sem)->lock, NULL) != 0) {
-		SDL_free(*sem);
-		errno = ENOSPC;
-		retval = -1;
-		goto RETURN;
-	}
-
-	if (pthread_cond_init(&(*sem)->gtzero, NULL) != 0) {
-		pthread_mutex_destroy(&(*sem)->lock);
-		SDL_free(*sem);
-		errno = ENOSPC;
-		retval = -1;
-		goto RETURN;
-	}
-	
-	(*sem)->count = (u_int32_t)value;
-	(*sem)->nwaiters = 0;
-	(*sem)->magic = SEM_MAGIC;
-
-	retval = 0;
-  RETURN:
-	return retval;
-}
-
-int
-sem_destroy(sem_t *sem)
-{
-	int	retval;
-	
-	_SEM_CHECK_VALIDITY(sem);
-
-	/* Make sure there are no waiters. */
-	pthread_mutex_lock(&(*sem)->lock);
-	if ((*sem)->nwaiters > 0) {
-		pthread_mutex_unlock(&(*sem)->lock);
-		errno = EBUSY;
-		retval = -1;
-		goto RETURN;
-	}
-	pthread_mutex_unlock(&(*sem)->lock);
-	
-	pthread_mutex_destroy(&(*sem)->lock);
-	pthread_cond_destroy(&(*sem)->gtzero);
-	(*sem)->magic = 0;
-
-	SDL_free(*sem);
-
-	retval = 0;
-  RETURN:
-	return retval;
-}
-
-sem_t *
-sem_open(const char *name, int oflag, ...)
-{
-	errno = ENOSYS;
-	return SEM_FAILED;
-}
-
-int
-sem_close(sem_t *sem)
-{
-	errno = ENOSYS;
-	return -1;
-}
-
-int
-sem_unlink(const char *name)
-{
-	errno = ENOSYS;
-	return -1;
-}
-
-int
-sem_wait(sem_t *sem)
-{
-	int	retval;
-
-	pthread_testcancel();
-	
-	_SEM_CHECK_VALIDITY(sem);
-
-	pthread_mutex_lock(&(*sem)->lock);
-
-	while ((*sem)->count == 0) {
-		(*sem)->nwaiters++;
-		pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock);
-		(*sem)->nwaiters--;
-	}
-	(*sem)->count--;
-
-	pthread_mutex_unlock(&(*sem)->lock);
-
-	retval = 0;
-  RETURN:
-
-	pthread_testcancel();
-	return retval;
-}
-
-int
-sem_trywait(sem_t *sem)
-{
-	int	retval;
-
-	_SEM_CHECK_VALIDITY(sem);
-
-	pthread_mutex_lock(&(*sem)->lock);
-
-	if ((*sem)->count > 0) {
-		(*sem)->count--;
-		retval = 0;
-	} else {
-		errno = EAGAIN;
-		retval = -1;
-	}
-	
-	pthread_mutex_unlock(&(*sem)->lock);
-
-  RETURN:
-	return retval;
-}
-
-int
-sem_post(sem_t *sem)
-{
-	int	retval;
-
-	_SEM_CHECK_VALIDITY(sem);
-
-	pthread_mutex_lock(&(*sem)->lock);
-
-	(*sem)->count++;
-	if ((*sem)->nwaiters > 0) {
-		/*
-		 * We must use pthread_cond_broadcast() rather than
-		 * pthread_cond_signal() in order to assure that the highest
-		 * priority thread is run by the scheduler, since
-		 * pthread_cond_signal() signals waiting threads in FIFO order.
-		 */
-		pthread_cond_broadcast(&(*sem)->gtzero);
-	}
-
-	pthread_mutex_unlock(&(*sem)->lock);
-
-	retval = 0;
-  RETURN:
-	return retval;
-}
-
-int
-sem_getvalue(sem_t *sem, int *sval)
-{
-	int	retval;
-
-	_SEM_CHECK_VALIDITY(sem);
-
-	pthread_mutex_lock(&(*sem)->lock);
-	*sval = (int)(*sem)->count;
-	pthread_mutex_unlock(&(*sem)->lock);
-
-	retval = 0;
-  RETURN:
-	return retval;
-}
-
-/* END of inlined uthread_sem.c */
-#endif /* SDL_USE_PTHREADS */
--- a/src/thread/dc/SDL_sysmutex.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/dc/SDL_sysmutex.c	Thu Feb 16 10:11:48 2006 +0000
@@ -61,8 +61,8 @@
 /* Lock the semaphore */
 int SDL_mutexP(SDL_mutex *mutex)
 {
-#ifdef DISABLE_THREADS
-	return 0;
+#if SDL_THREADS_DISABLED
+	return  SDL_arraysize(return ),0;
 #else
 	Uint32 this_thread;
 
@@ -85,13 +85,13 @@
 	}
 
 	return 0;
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
 }
 
 /* Unlock the mutex */
 int SDL_mutexV(SDL_mutex *mutex)
 {
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 	return 0;
 #else
 	if ( mutex == NULL ) {
@@ -117,5 +117,5 @@
 		spinlock_unlock(&mutex->mutex);
 	}
 	return 0;
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
 }
--- a/src/thread/dc/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/dc/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include "SDL_systhread_c.h"
 
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 
 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
@@ -164,4 +164,4 @@
 	return 0;
 }
 
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
--- a/src/thread/dc/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/dc/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,11 +23,11 @@
 /* Thread management routines for SDL */
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
 #include <kos/thread.h>
 
-#ifdef	DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
 {
 	SDL_SetError("Threads are not supported on this platform");
--- a/src/thread/dc/SDL_systhread_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/dc/SDL_systhread_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,10 +20,4 @@
     slouken@libsdl.org
 */
 
-/* Stub until we implement threads on this platform */
 typedef struct kthread* SYS_ThreadHandle;
-/*
-#ifndef DISABLE_THREADS
-#define DISABLE_THREADS
-#endif
-*/
--- a/src/thread/epoc/SDL_systhread.cpp	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/epoc/SDL_systhread.cpp	Thu Feb 16 10:11:48 2006 +0000
@@ -32,7 +32,7 @@
 #undef NULL
 #include "SDL_error.h"
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
     };
 
 #include <e32std.h>
--- a/src/thread/generic/SDL_syscond_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
--- a/src/thread/generic/SDL_sysmutex.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/generic/SDL_sysmutex.c	Thu Feb 16 10:11:48 2006 +0000
@@ -68,7 +68,7 @@
 /* Lock the semaphore */
 int SDL_mutexP(SDL_mutex *mutex)
 {
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 	return 0;
 #else
 	Uint32 this_thread;
@@ -92,13 +92,13 @@
 	}
 
 	return 0;
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
 }
 
 /* Unlock the mutex */
 int SDL_mutexV(SDL_mutex *mutex)
 {
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 	return 0;
 #else
 	if ( mutex == NULL ) {
@@ -124,5 +124,5 @@
 		SDL_SemPost(mutex->sem);
 	}
 	return 0;
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
 }
--- a/src/thread/generic/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/generic/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include "SDL_systhread_c.h"
 
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 
 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
@@ -203,4 +203,4 @@
 	return 0;
 }
 
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
--- a/src/thread/generic/SDL_syssem_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
--- a/src/thread/generic/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/generic/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 /* Thread management routines for SDL */
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
 {
--- a/src/thread/generic/SDL_systhread_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/generic/SDL_systhread_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,3 @@
 
 /* Stub until we implement threads on this platform */
 typedef int SYS_ThreadHandle;
-
-#ifndef DISABLE_THREADS
-#define DISABLE_THREADS
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/irix/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,235 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <errno.h>
+
+#include "SDL_error.h"
+#include "SDL_thread.h"
+
+
+struct SDL_semaphore {
+	int id;
+};
+
+/* Not defined by many operating systems, use configure to detect */
+/*
+#if !defined(HAVE_SEMUN)
+union semun {
+	int val;
+	struct semid_ds *buf;
+	ushort *array;
+};
+#endif
+*/
+
+static struct sembuf op_trywait[2] = {
+	{ 0, -1, (IPC_NOWAIT|SEM_UNDO) } /* Decrement semaphore, no block */
+};
+static struct sembuf op_wait[2] = {
+	{ 0, -1, SEM_UNDO }		/* Decrement semaphore */
+};
+static struct sembuf op_post[1] = {
+	{ 0, 1, (IPC_NOWAIT|SEM_UNDO) }	/* Increment semaphore */
+};
+
+/* Create a blockable semaphore */
+SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
+{
+	extern int _creating_thread_lock;	/* SDL_threads.c */
+	SDL_sem *sem;
+	union semun init;
+	key_t key;
+
+	sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
+	if ( sem == NULL ) {
+		SDL_OutOfMemory();
+		return(NULL);
+	}
+	/* This flag is true if we are creating the thread manager sem,
+	   which is never freed.  This allows us to reuse the same sem.
+	*/
+	if ( _creating_thread_lock ) {
+		key = 'S'+'D'+'L';
+	} else {
+		key = IPC_PRIVATE;
+	}
+	/* Keep trying to create sem while we don't own the requested key */
+	do {
+		if ( key != IPC_PRIVATE ) {
+			++key;
+		}
+		sem->id = semget(key, 1, (0600|IPC_CREAT));
+	} while ((sem->id < 0) && (key != IPC_PRIVATE) && (errno == EACCES));
+
+	/* Report the error if we eventually failed */
+	if ( sem->id < 0 ) {
+		SDL_SetError("Couldn't create semaphore");
+		SDL_free(sem);
+		return(NULL);
+	}
+	init.val = initial_value;	/* Initialize semaphore */
+	semctl(sem->id, 0, SETVAL, init);
+	return(sem);
+}
+
+void SDL_DestroySemaphore(SDL_sem *sem)
+{
+	if ( sem ) {
+#ifdef _SGI_SOURCE
+		semctl(sem->id, 0, IPC_RMID);
+#else
+		union semun dummy;
+		dummy.val = 0;
+		semctl(sem->id, 0, IPC_RMID, dummy);
+#endif
+		SDL_free(sem);
+	}
+}
+
+int SDL_SemTryWait(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	retval = 0;
+  tryagain:
+	if ( semop(sem->id, op_trywait, 1) < 0 ) {
+		if ( errno == EINTR ) {
+			goto tryagain;
+		}
+		retval = SDL_MUTEX_TIMEDOUT;
+	}
+	return retval;
+}
+
+int SDL_SemWait(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	retval = 0;
+  tryagain:
+	if ( semop(sem->id, op_wait, 1) < 0 ) {
+		if ( errno == EINTR ) {
+			goto tryagain;
+		}
+		SDL_SetError("Semaphore operation error");
+		retval = -1;
+	}
+	return retval;
+}
+
+int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	/* Try the easy cases first */
+	if ( timeout == 0 ) {
+		return SDL_SemTryWait(sem);
+	}
+	if ( timeout == SDL_MUTEX_MAXWAIT ) {
+		return SDL_SemWait(sem);
+	}
+
+	/* Ack!  We have to busy wait... */
+	timeout += SDL_GetTicks();
+	do {
+		retval = SDL_SemTryWait(sem);
+		if ( retval == 0 ) {
+			break;
+		}
+		SDL_Delay(1);
+	} while ( SDL_GetTicks() < timeout );
+
+	return retval;
+}
+
+Uint32 SDL_SemValue(SDL_sem *sem)
+{
+	int semval;
+	Uint32 value;
+	
+	value = 0;
+	if ( sem ) {
+	  tryagain:
+#ifdef _SGI_SOURCE
+		semval = semctl(sem->id, 0, GETVAL);
+#else
+		{
+		union semun arg;
+		arg.val = 0;
+		semval = semctl(sem->id, 0, GETVAL, arg);
+		}
+#endif
+		if ( semval < 0 ) {
+			if ( errno == EINTR ) {
+				goto tryagain;
+			}
+		} else {
+			value = (Uint32)semval;
+		}
+	}
+	return value;
+}
+
+int SDL_SemPost(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	retval = 0;
+  tryagain:
+	if ( semop(sem->id, op_post, 1) < 0 ) {
+		if ( errno == EINTR ) {
+			goto tryagain;
+		}
+		SDL_SetError("Semaphore operation error");
+		retval = -1;
+	}
+	return retval;
+}
--- a/src/thread/irix/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/irix/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #include <sys/prctl.h>
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
 
 static int sig_list[] = {
--- a/src/thread/linux/SDL_syscond.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#ifdef linux
-/* Look to see if glibc is available, and if so, what version */
-#include <features.h>
-
-#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
-#warning Working around a bug in glibc 2.0 pthreads
-#undef SDL_USE_PTHREADS
-/* The bug is actually a problem where threads are suspended, but don't
-   wake up when the thread manager sends them a signal.  This is a problem
-   with thread creation too, but it happens less often. :-/
-   We avoid this by using System V IPC for mutexes.
- */
-#endif /* glibc 2.0 */
-#endif /* linux */
-
-#ifdef SDL_USE_PTHREADS
-
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <pthread.h>
-
-#include "SDL_thread.h"
-#include "SDL_sysmutex_c.h"
-
-
-#if defined(PTHREAD_NO_RECURSIVE_MUTEX) && !defined(__bsdi__)
-#error You need to use the generic condition variable implementation
-#endif
-
-struct SDL_cond
-{
-	pthread_cond_t cond;
-};
-
-/* Create a condition variable */
-SDL_cond * SDL_CreateCond(void)
-{
-	SDL_cond *cond;
-
-	cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
-	if ( cond ) {
-		if ( pthread_cond_init(&cond->cond, NULL) < 0 ) {
-			SDL_SetError("pthread_cond_init() failed");
-			SDL_free(cond);
-			cond = NULL;
-		}
-	}
-	return(cond);
-}
-
-/* Destroy a condition variable */
-void SDL_DestroyCond(SDL_cond *cond)
-{
-	if ( cond ) {
-		pthread_cond_destroy(&cond->cond);
-		SDL_free(cond);
-	}
-}
-
-/* Restart one of the threads that are waiting on the condition variable */
-int SDL_CondSignal(SDL_cond *cond)
-{
-	int retval;
-
-	if ( ! cond ) {
-		SDL_SetError("Passed a NULL condition variable");
-		return -1;
-	}
-
-	retval = 0;
-	if ( pthread_cond_signal(&cond->cond) != 0 ) {
-		SDL_SetError("pthread_cond_signal() failed");
-		retval = -1;
-	}
-	return retval;
-}
-
-/* Restart all threads that are waiting on the condition variable */
-int SDL_CondBroadcast(SDL_cond *cond)
-{
-	int retval;
-
-	if ( ! cond ) {
-		SDL_SetError("Passed a NULL condition variable");
-		return -1;
-	}
-
-	retval = 0;
-	if ( pthread_cond_broadcast(&cond->cond) != 0 ) {
-		SDL_SetError("pthread_cond_broadcast() failed");
-		retval = -1;
-	}
-	return retval;
-}
-
-int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
-{
-	int retval;
-	struct timeval delta;
-	struct timespec abstime;
-
-	if ( ! cond ) {
-		SDL_SetError("Passed a NULL condition variable");
-		return -1;
-	}
-
-	gettimeofday(&delta, NULL);
-
-	abstime.tv_sec = delta.tv_sec + (ms/1000);
-	abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000;
-        if ( abstime.tv_nsec > 1000000000 ) {
-          abstime.tv_sec += 1;
-          abstime.tv_nsec -= 1000000000;
-        }
-
-  tryagain:
-	retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime);
-	switch (retval) {
-	    case EINTR:
-		goto tryagain;
-		break;
-	    case ETIMEDOUT:
-		retval = SDL_MUTEX_TIMEDOUT;
-		break;
-	    case 0:
-		break;
-	    default:
-		SDL_SetError("pthread_cond_timedwait() failed");
-		retval = -1;
-		break;
-	}
-	return retval;
-}
-
-/* Wait on the condition variable, unlocking the provided mutex.
-   The mutex must be locked before entering this function!
- */
-int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)
-{
-	int retval;
-
-	if ( ! cond ) {
-		SDL_SetError("Passed a NULL condition variable");
-		return -1;
-	}
-
-	retval = 0;
-	if ( pthread_cond_wait(&cond->cond, &mutex->id) != 0 ) {
-		SDL_SetError("pthread_cond_wait() failed");
-		retval = -1;
-	}
-	return retval;
-}
-
-#else /* Use semaphore implementation */
-
-#include "generic/SDL_syscond.c"
-
-#endif /* SDL_USE_PTHREADS */
--- a/src/thread/linux/SDL_sysmutex.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#ifdef linux
-/* Look to see if glibc is available, and if so, what version */
-#include <features.h>
-
-#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
-#warning Working around a bug in glibc 2.0 pthreads
-#undef SDL_USE_PTHREADS
-/* The bug is actually a problem where threads are suspended, but don't
-   wake up when the thread manager sends them a signal.  This is a problem
-   with thread creation too, but it happens less often. :-/
-   We avoid this by using System V IPC for mutexes.
- */
-#endif /* glibc 2.0 */
-#endif /* linux */
-
-#ifdef SDL_USE_PTHREADS
-
-#include <pthread.h>
-
-#include "SDL_thread.h"
-
-
-struct SDL_mutex {
-	pthread_mutex_t id;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
-	int recursive;
-	pthread_t owner;
-#endif
-};
-
-SDL_mutex *SDL_CreateMutex (void)
-{
-	SDL_mutex *mutex;
-	pthread_mutexattr_t attr;
-
-	/* Allocate the structure */
-	mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
-	if ( mutex ) {
-		pthread_mutexattr_init(&attr);
-#if defined(PTHREAD_RECURSIVE_MUTEX)
-		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-#elif defined(PTHREAD_RECURSIVE_MUTEX_NP)
-		pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
-#else
-		/* No extra attributes necessary */
-#endif /* PTHREAD_RECURSIVE_MUTEX */
-		if ( pthread_mutex_init(&mutex->id, &attr) != 0 ) {
-			SDL_SetError("pthread_mutex_init() failed");
-			SDL_free(mutex);
-			mutex = NULL;
-		}
-	} else {
-		SDL_OutOfMemory();
-	}
-	return(mutex);
-}
-
-void SDL_DestroyMutex(SDL_mutex *mutex)
-{
-	if ( mutex ) {
-		pthread_mutex_destroy(&mutex->id);
-		SDL_free(mutex);
-	}
-}
-
-/* Lock the mutex */
-int SDL_mutexP(SDL_mutex *mutex)
-{
-	int retval;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
-	pthread_t this_thread;
-#endif
-
-	if ( mutex == NULL ) {
-		SDL_SetError("Passed a NULL mutex");
-		return -1;
-	}
-
-	retval = 0;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
-	this_thread = pthread_self();
-	if ( mutex->owner == this_thread ) {
-		++mutex->recursive;
-	} else {
-		/* The order of operations is important.
-		   We set the locking thread id after we obtain the lock
-		   so unlocks from other threads will fail.
-		*/
-		if ( pthread_mutex_lock(&mutex->id) == 0 ) {
-			mutex->owner = this_thread;
-			mutex->recursive = 0;
-		} else {
-			SDL_SetError("pthread_mutex_lock() failed");
-			retval = -1;
-		}
-	}
-#else
-	if ( pthread_mutex_lock(&mutex->id) < 0 ) {
-		SDL_SetError("pthread_mutex_lock() failed");
-		retval = -1;
-	}
-#endif
-	return retval;
-}
-
-int SDL_mutexV(SDL_mutex *mutex)
-{
-	int retval;
-
-	if ( mutex == NULL ) {
-		SDL_SetError("Passed a NULL mutex");
-		return -1;
-	}
-
-	retval = 0;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
-	/* We can only unlock the mutex if we own it */
-	if ( pthread_self() == mutex->owner ) {
-		if ( mutex->recursive ) {
-			--mutex->recursive;
-		} else {
-			/* The order of operations is important.
-			   First reset the owner so another thread doesn't lock
-			   the mutex and set the ownership before we reset it,
-			   then release the lock semaphore.
-			 */
-			mutex->owner = 0;
-			pthread_mutex_unlock(&mutex->id);
-		}
-	} else {
-		SDL_SetError("mutex not owned by this thread");
-		retval = -1;
-	}
-
-#else
-	if ( pthread_mutex_unlock(&mutex->id) < 0 ) {
-		SDL_SetError("pthread_mutex_unlock() failed");
-		retval = -1;
-	}
-#endif /* PTHREAD_NO_RECURSIVE_MUTEX */
-
-	return retval;
-}
-
-#else /* Use semaphore implementation */
-
-#include "generic/SDL_sysmutex.c"
-
-#endif /* SDL_USE_PTHREADS */
--- a/src/thread/linux/SDL_sysmutex_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#ifndef _SDL_mutex_c_h
-#define _SDL_mutex_c_h
-
-#ifdef SDL_USE_PTHREADS
-/* Recursive mutexes aren't widespread among pthread implementations yet */
-#if 0
-#define PTHREAD_NO_RECURSIVE_MUTEX
-#endif
-
-struct SDL_mutex {
-	pthread_mutex_t id;
-};
-#endif /* SDL_USE_PTHREADS */
-
-
-#endif /* _SDL_mutex_c_h */
--- a/src/thread/linux/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,409 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#include "SDL_thread.h"
-#include "SDL_timer.h"
-
-#ifdef linux
-/* Look to see if glibc is available, and if so, what version */
-#include <features.h>
-
-#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
-#warning Working around a bug in glibc 2.0 pthreads
-#undef SDL_USE_PTHREADS
-/* The bug is actually a problem where threads are suspended, but don't
-   wake up when the thread manager sends them a signal.  This is a problem
-   with thread creation too, but it happens less often. :-/
-   We avoid this by using System V IPC for semaphores.
- */
-#endif /* glibc 2.0 */
-#endif /* linux */
-
-#ifdef SDL_USE_PTHREADS
-
-#ifdef SDL_NO_PTHREAD_SEMAPHORES
-#include "generic/SDL_syssem.c"
-#else
-
-#include <pthread.h>
-#include <semaphore.h>
-
-/* Wrapper around POSIX 1003.1b semaphores */
-
-#ifdef MACOSX
-#define USE_NAMED_SEMAPHORES
-#endif /* MACOSX */
-
-struct SDL_semaphore {
-	sem_t *sem;
-#ifndef USE_NAMED_SEMAPHORES
-	sem_t sem_data;
-#endif
-};
-
-/* Create a semaphore, initialized with value */
-SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
-{
-	SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
-	if ( sem ) {
-#ifdef USE_NAMED_SEMAPHORES
-		static int semnum = 0;
-		char name[32];
-
-		SDL_snprintf(name, SDL_arraysize(name), "/SDL_sem-%d-%4.4d", getpid(), semnum++);
-		sem->sem = sem_open(name, O_CREAT, 0600, initial_value);
-		if ( sem->sem == (sem_t *)SEM_FAILED ) {
-			SDL_SetError("sem_open(%s) failed", name);
-			SDL_free(sem);
-			sem = NULL;
-		} else {
-			sem_unlink(name);
-		}
-#else
-		if ( sem_init(&sem->sem_data, 0, initial_value) < 0 ) {
-			SDL_SetError("sem_init() failed");
-			SDL_free(sem);
-			sem = NULL;
-		} else {
-			sem->sem = &sem->sem_data;
-		}
-#endif /* USE_NAMED_SEMAPHORES */
-	} else {
-		SDL_OutOfMemory();
-	}
-	return sem;
-}
-
-void SDL_DestroySemaphore(SDL_sem *sem)
-{
-	if ( sem ) {
-#ifdef USE_NAMED_SEMAPHORES
-		sem_close(sem->sem);
-#else
-		sem_destroy(sem->sem);
-#endif
-		SDL_free(sem);
-	}
-}
-
-int SDL_SemTryWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-	retval = SDL_MUTEX_TIMEDOUT;
-	if ( sem_trywait(sem->sem) == 0 ) {
-		retval = 0;
-	}
-	return retval;
-}
-
-int SDL_SemWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = sem_wait(sem->sem);
-	if ( retval < 0 ) {
-		SDL_SetError("sem_wait() failed");
-	}
-	return retval;
-}
-
-int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	/* Try the easy cases first */
-	if ( timeout == 0 ) {
-		return SDL_SemTryWait(sem);
-	}
-	if ( timeout == SDL_MUTEX_MAXWAIT ) {
-		return SDL_SemWait(sem);
-	}
-
-	/* Ack!  We have to busy wait... */
-	timeout += SDL_GetTicks();
-	do {
-		retval = SDL_SemTryWait(sem);
-		if ( retval == 0 ) {
-			break;
-		}
-		SDL_Delay(1);
-	} while ( SDL_GetTicks() < timeout );
-
-	return retval;
-}
-
-Uint32 SDL_SemValue(SDL_sem *sem)
-{
-	int ret = 0;
-	if ( sem ) {
-		sem_getvalue(sem->sem, &ret);
-		if ( ret < 0 ) {
-			ret = 0;
-		}
-	}
-	return (Uint32)ret;
-}
-
-int SDL_SemPost(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = sem_post(sem->sem);
-	if ( retval < 0 ) {
-		SDL_SetError("sem_post() failed");
-	}
-	return retval;
-}
-
-#endif /* NO_PTHREAD_SEMAPHORES */
-
-#else /* System V IPC implementation */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <errno.h>
-
-#include "SDL_error.h"
-#include "SDL_thread.h"
-
-
-struct SDL_semaphore {
-	int id;
-};
-
-/* Not defined by many operating systems, use configure to detect */
-#if !defined(HAVE_SEMUN)
-union semun {
-	int val;
-	struct semid_ds *buf;
-	ushort *array;
-};
-#endif
-
-static struct sembuf op_trywait[2] = {
-	{ 0, -1, (IPC_NOWAIT|SEM_UNDO) } /* Decrement semaphore, no block */
-};
-static struct sembuf op_wait[2] = {
-	{ 0, -1, SEM_UNDO }		/* Decrement semaphore */
-};
-static struct sembuf op_post[1] = {
-	{ 0, 1, (IPC_NOWAIT|SEM_UNDO) }	/* Increment semaphore */
-};
-
-/* Create a blockable semaphore */
-SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
-{
-	extern int _creating_thread_lock;	/* SDL_threads.c */
-	SDL_sem *sem;
-	union semun init;
-	key_t key;
-
-	sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
-	if ( sem == NULL ) {
-		SDL_OutOfMemory();
-		return(NULL);
-	}
-	/* This flag is true if we are creating the thread manager sem,
-	   which is never freed.  This allows us to reuse the same sem.
-	*/
-	if ( _creating_thread_lock ) {
-		key = 'S'+'D'+'L';
-	} else {
-		key = IPC_PRIVATE;
-	}
-	/* Keep trying to create sem while we don't own the requested key */
-	do {
-		if ( key != IPC_PRIVATE ) {
-			++key;
-		}
-		sem->id = semget(key, 1, (0600|IPC_CREAT));
-	} while ((sem->id < 0) && (key != IPC_PRIVATE) && (errno == EACCES));
-
-	/* Report the error if we eventually failed */
-	if ( sem->id < 0 ) {
-		SDL_SetError("Couldn't create semaphore");
-		SDL_free(sem);
-		return(NULL);
-	}
-	init.val = initial_value;	/* Initialize semaphore */
-	semctl(sem->id, 0, SETVAL, init);
-	return(sem);
-}
-
-void SDL_DestroySemaphore(SDL_sem *sem)
-{
-	if ( sem ) {
-#ifdef _SGI_SOURCE
-		semctl(sem->id, 0, IPC_RMID);
-#else
-		union semun dummy;
-		dummy.val = 0;
-		semctl(sem->id, 0, IPC_RMID, dummy);
-#endif
-		SDL_free(sem);
-	}
-}
-
-int SDL_SemTryWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = 0;
-  tryagain:
-	if ( semop(sem->id, op_trywait, 1) < 0 ) {
-		if ( errno == EINTR ) {
-			goto tryagain;
-		}
-		retval = SDL_MUTEX_TIMEDOUT;
-	}
-	return retval;
-}
-
-int SDL_SemWait(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = 0;
-  tryagain:
-	if ( semop(sem->id, op_wait, 1) < 0 ) {
-		if ( errno == EINTR ) {
-			goto tryagain;
-		}
-		SDL_SetError("Semaphore operation error");
-		retval = -1;
-	}
-	return retval;
-}
-
-int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	/* Try the easy cases first */
-	if ( timeout == 0 ) {
-		return SDL_SemTryWait(sem);
-	}
-	if ( timeout == SDL_MUTEX_MAXWAIT ) {
-		return SDL_SemWait(sem);
-	}
-
-	/* Ack!  We have to busy wait... */
-	timeout += SDL_GetTicks();
-	do {
-		retval = SDL_SemTryWait(sem);
-		if ( retval == 0 ) {
-			break;
-		}
-		SDL_Delay(1);
-	} while ( SDL_GetTicks() < timeout );
-
-	return retval;
-}
-
-Uint32 SDL_SemValue(SDL_sem *sem)
-{
-	int semval;
-	Uint32 value;
-	
-	value = 0;
-	if ( sem ) {
-	  tryagain:
-#ifdef _SGI_SOURCE
-		semval = semctl(sem->id, 0, GETVAL);
-#else
-		{
-		union semun arg;
-		arg.val = 0;
-		semval = semctl(sem->id, 0, GETVAL, arg);
-		}
-#endif
-		if ( semval < 0 ) {
-			if ( errno == EINTR ) {
-				goto tryagain;
-			}
-		} else {
-			value = (Uint32)semval;
-		}
-	}
-	return value;
-}
-
-int SDL_SemPost(SDL_sem *sem)
-{
-	int retval;
-
-	if ( ! sem ) {
-		SDL_SetError("Passed a NULL semaphore");
-		return -1;
-	}
-
-	retval = 0;
-  tryagain:
-	if ( semop(sem->id, op_post, 1) < 0 ) {
-		if ( errno == EINTR ) {
-			goto tryagain;
-		}
-		SDL_SetError("Semaphore operation error");
-		retval = -1;
-	}
-	return retval;
-}
-
-#endif /* SDL_USE_PTHREADS */
--- a/src/thread/linux/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* Linux thread management routines for SDL */
-
-#include "SDL_thread.h"
-#include "SDL_systhread.h"
-
-#ifdef FORK_HACK
-
-#include <unistd.h>
-
-int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
-{
-	SDL_SetError("Threads are not supported on this platform");
-	return(-1);
-}
-void SDL_SYS_SetupThread(void)
-{
-	return;
-}
-Uint32 SDL_ThreadID(void)
-{
-	return((Uint32)getpid());
-}
-void SDL_SYS_WaitThread(SDL_Thread *thread)
-{
-	return;
-}
-void SDL_SYS_KillThread(SDL_Thread *thread)
-{
-	return;
-}
-
-#else
-
-#include <signal.h>
-
-/* List of signals to mask in the subthreads */
-static int sig_list[] = {
-	SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
-	SIGVTALRM, SIGPROF, 0
-};
-
-#ifdef SDL_USE_PTHREADS
-
-#include <pthread.h>
-
-
-static void *RunThread(void *data)
-{
-	SDL_RunThread(data);
-	pthread_exit((void*)0);
-	return((void *)0);		/* Prevent compiler warning */
-}
-
-int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
-{
-	pthread_attr_t type;
-
-	/* Set the thread attributes */
-	if ( pthread_attr_init(&type) != 0 ) {
-		SDL_SetError("Couldn't initialize pthread attributes");
-		return(-1);
-	}
-	pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
-
-	/* Create the thread and go! */
-	if ( pthread_create(&thread->handle, &type, RunThread, args) != 0 ) {
-		SDL_SetError("Not enough resources to create thread");
-		return(-1);
-	}
-	return(0);
-}
-
-void SDL_SYS_SetupThread(void)
-{
-	int i;
-	sigset_t mask;
-
-	/* Mask asynchronous signals for this thread */
-	sigemptyset(&mask);
-	for ( i=0; sig_list[i]; ++i ) {
-		sigaddset(&mask, sig_list[i]);
-	}
-	pthread_sigmask(SIG_BLOCK, &mask, 0);
-
-#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
-	/* Allow ourselves to be asynchronously cancelled */
-	{ int oldstate;
-		pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate);
-	}
-#endif
-}
-
-/* WARNING:  This may not work for systems with 64-bit pid_t */
-Uint32 SDL_ThreadID(void)
-{
-	return((Uint32)pthread_self());
-}
-
-void SDL_SYS_WaitThread(SDL_Thread *thread)
-{
-	pthread_join(thread->handle, 0);
-}
-
-void SDL_SYS_KillThread(SDL_Thread *thread)
-{
-#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
-	pthread_cancel(thread->handle);
-#else
-#ifdef __FreeBSD__
-#warning For some reason, this doesnt actually kill a thread - FreeBSD 3.2
-#endif
-	pthread_kill(thread->handle, SIGKILL);
-#endif
-}
-
-#else /* Linux-specific clone() based implementation */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/wait.h>
-
-
-/* Stack size for child thread */
-#define STACKSIZE 16384*4		/* 16384 is too small */
-
-#ifdef __GLIBC__
-#include <sched.h>
-#else
-/* From <linux/sched.h> */
-#define CLONE_VM      0x00000100   /* set if VM shared */
-#define CLONE_FS      0x00000200   /* set if fs info shared */
-#define CLONE_FILES   0x00000400   /* set if open files shared */
-#define CLONE_SIGHAND 0x00000800   /* set if signal handlers shared */
-#define CLONE_PID     0x00001000   /* set if pid shared */
-
-/* The infamous "start_thread" function, courtesy Linus Torvalds */
-extern int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg);
-#endif
-
-static int RunThread(void *data)
-{
-	SDL_RunThread(data);
-	return(0);
-}
-
-int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
-{
-	void *stack;
-
-	/* Allocate memory for thread stack */
-	stack = SDL_malloc(STACKSIZE);
-	if ( stack == (void *)0 ) {
-		SDL_OutOfMemory();
-		return(-1);
-	}
-	thread->data = stack;
-
-	/* Adjust the stack since it actually grows down */
-        stack = (void *) ((char *)stack + STACKSIZE);
-
-	/* Create the thread and go! */
-	thread->handle = clone(RunThread, stack,
-			(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND), args);
-	if ( thread->handle < 0 ) {
-		SDL_free(thread->data);
-		SDL_SetError("Not enough resources to create thread");
-		return(-1);
-	}
-	return(0);
-}
-
-void SDL_SYS_SetupThread(void)
-{
-	int i;
-	sigset_t mask;
-
-	/* Mask asynchronous signals for this thread */
-	sigemptyset(&mask);
-	for ( i=0; sig_list[i]; ++i ) {
-		sigaddset(&mask, sig_list[i]);
-	}
-	sigprocmask(SIG_BLOCK, &mask, 0);
-}
-
-/* WARNING:  This may not work for systems with 64-bit pid_t */
-Uint32 SDL_ThreadID(void)
-{
-	return((Uint32)getpid());
-}
-
-void SDL_SYS_WaitThread(SDL_Thread *thread)
-{
-#ifdef __WCLONE
-	errno = 0;
-	while ( errno != ECHILD ) {
-		waitpid(thread->handle, 0, __WCLONE);
-	}
-#else
-	/* Ack, ugly ugly hack --
-	   wait() doesn't work, waitpid() doesn't work, and ignoring SIG_CHLD
-	   doesn't work .. and the child thread is still a zombie, so kill()
-	   doesn't work.
-	*/
-	char command[1024];
-
-	SDL_snprintf(command, SDL_arraysize(command),
-		"ps ax|fgrep -v fgrep|fgrep -v '<zombie>'|fgrep %d >/dev/null",
-								thread->handle);
-	while ( system(command) == 0 )
-		sleep(1);
-#endif
-	SDL_free(thread->data);
-}
-
-void SDL_SYS_KillThread(SDL_Thread *thread)
-{
-	kill(thread->handle, SIGKILL);
-}
-
-#endif /* SDL_USE_PTHREADS */
-
-#endif /* FORK_HACK */
--- a/src/thread/linux/SDL_systhread_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2004 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#ifdef SDL_USE_PTHREADS
-
-#include <pthread.h>
-
-typedef pthread_t SYS_ThreadHandle;
-
-#else
-
-#include <sys/types.h>
-
-typedef pid_t SYS_ThreadHandle;
-
-#endif /* SDL_USE_PTHREADS */
--- a/src/thread/linux/clone.S	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-
-/* Taken with thanks from LinuxThreads 0.6 */
-
-/* This is no longer necessary with glibc-2.1, which has its own clone() */
-#ifdef linux
-/* Look to see if glibc is available, and if so, what version */
-#include <features.h>
-
-#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
-#define HAVE_CLONE
-#endif /* glibc 2.1 or newer */
-#endif /* linux */
-
-#if defined(linux) && !defined(SDL_USE_PTHREADS) && !defined(HAVE_CLONE)
-
-#if defined(__i386__)
-/************************************************************************/
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   Contributed by Richard Henderson (rth@tamu.edu)
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <asm/errno.h>
-#include <asm/unistd.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-        .text
-	.align	4
-	.globl	__clone
-        .type   __clone,@function
-	.weak	clone
-	clone   = __clone
-__clone:
-	/* Sanity check arguments.  */
-	movl	$-EINVAL,%eax
-	movl	4(%esp),%ecx		/* no NULL function pointers */
-	testl	%ecx,%ecx
-	jz	syscall_error
-	movl	8(%esp),%ecx		/* no NULL stack pointers */
-	testl	%ecx,%ecx
-	jz	syscall_error
-
-	/* Insert the argument onto the new stack.  */
-	subl	$8,%ecx
-	movl	16(%esp),%eax
-	movl	%eax,4(%ecx)
-
-	/* Save the function pointer as the zeroth argument. */
-	/* It will be popped off in the child in the ebx frobbing below.  */
-	movl	4(%esp),%eax
-	movl	%eax,0(%ecx)
-
-	/* Do the system call */
-	pushl	%ebx
-	movl	16(%esp),%ebx
-	movl	$__NR_clone,%eax
-	int	$0x80
-	popl	%ebx
-
-	test	%eax,%eax
-	jl	syscall_error
-	jz	thread_start
-
-	ret
-
-syscall_error:
-	negl    %eax
-        pushl   %eax
-#ifdef __PIC__
-        call    __errno_location@PLT
-#else
-        call    __errno_location
-#endif
-        popl    0(%eax)
-	movl	$-1, %eax
-	ret
-
-thread_start:
-	subl	%ebp,%ebp	/* terminate the stack frame */
-	call	*%ebx
-        pushl   %eax
-#ifdef __PIC__
-	call	_exit@PLT
-#else
-	call	_exit
-#endif
-/************************************************************************/
-#elif defined(sparc)
-/************************************************************************/
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx)
-   Based on code written for the Intel by Richard 
-   Henderson (rth@tamu.edu)
-	
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-	
-#include <asm/errno.h>
-#include <asm/unistd.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
-	.weak	clone
-	clone   = __clone
-__clone:	
-	save	%sp,-96,%sp
-	/* sanity check arguments */
-	tst	%i0
-	be	__clone_syscall_error
-	tst	%i1
-	be	__clone_syscall_error
-        nop
-
-	/* Do the system call */
-	mov	%i1,%o1
-	mov	%i2,%o0
-	set	__NR_clone,%g1
-	ta	0x10
-	bcs	__clone_syscall_error
-	tst	%o1
-	bne	__thread_start
-	nop
-	mov	%o0,%i0
-	ret
-	restore
-	
-__clone_syscall_error:
-	call	__errno_location
-	set	EINVAL,%i0
-	st	%i0,[%o0]
-	mov	-1,%i0
-	ret
-	restore
-
-__thread_start:
-	call	%i0
-	mov	%i3,%o0
-	call	_exit,0
-	nop
-/************************************************************************/
-#else 
-#error "Unknown Linux architecture"
-#endif
-
-#endif /* Linux && ! SDL_USE_PTHREADS */
--- a/src/thread/os2/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/os2/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,7 +28,7 @@
 #include <os2.h>
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
 typedef struct ThreadStartParms
 {
--- a/src/thread/pth/SDL_syscond.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/pth/SDL_syscond.c	Thu Feb 16 10:11:48 2006 +0000
@@ -7,9 +7,13 @@
 #include <pth.h>
 
 #include "SDL_thread.h"
-#include "SDL_syscond_c.h"
 #include "SDL_sysmutex_c.h"
 
+struct SDL_cond
+{
+	pth_cond_t	condpth_p;
+};
+
 /* Create a condition variable */
 SDL_cond * SDL_CreateCond(void)
 {
--- a/src/thread/pth/SDL_syscond_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#ifndef _SDL_SYSCOND_C_H_
-#define _SDL_SYSCOND_C_H_
-
-struct SDL_cond
-{
-	pth_cond_t	condpth_p;
-};
-
-#endif /* _SDL_SYSCOND_C_H_ */
--- a/src/thread/pth/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/pth/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,10 +27,10 @@
  */
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
+#include <pth.h>
 #include <signal.h>
-#include <pth.h>
 
 /* List of signals to mask in the subthreads */
 static int sig_list[] = {
@@ -91,7 +91,7 @@
 
 void SDL_SYS_WaitThread(SDL_Thread *thread)
 {
-	pth_join(thread->handle, 0);
+	pth_join(thread->handle, NULL);
 }
 
 void SDL_SYS_KillThread(SDL_Thread *thread)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_syscond.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,154 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <sys/time.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include "SDL_thread.h"
+#include "SDL_sysmutex_c.h"
+
+struct SDL_cond
+{
+	pthread_cond_t cond;
+};
+
+/* Create a condition variable */
+SDL_cond * SDL_CreateCond(void)
+{
+	SDL_cond *cond;
+
+	cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
+	if ( cond ) {
+		if ( pthread_cond_init(&cond->cond, NULL) < 0 ) {
+			SDL_SetError("pthread_cond_init() failed");
+			SDL_free(cond);
+			cond = NULL;
+		}
+	}
+	return(cond);
+}
+
+/* Destroy a condition variable */
+void SDL_DestroyCond(SDL_cond *cond)
+{
+	if ( cond ) {
+		pthread_cond_destroy(&cond->cond);
+		SDL_free(cond);
+	}
+}
+
+/* Restart one of the threads that are waiting on the condition variable */
+int SDL_CondSignal(SDL_cond *cond)
+{
+	int retval;
+
+	if ( ! cond ) {
+		SDL_SetError("Passed a NULL condition variable");
+		return -1;
+	}
+
+	retval = 0;
+	if ( pthread_cond_signal(&cond->cond) != 0 ) {
+		SDL_SetError("pthread_cond_signal() failed");
+		retval = -1;
+	}
+	return retval;
+}
+
+/* Restart all threads that are waiting on the condition variable */
+int SDL_CondBroadcast(SDL_cond *cond)
+{
+	int retval;
+
+	if ( ! cond ) {
+		SDL_SetError("Passed a NULL condition variable");
+		return -1;
+	}
+
+	retval = 0;
+	if ( pthread_cond_broadcast(&cond->cond) != 0 ) {
+		SDL_SetError("pthread_cond_broadcast() failed");
+		retval = -1;
+	}
+	return retval;
+}
+
+int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
+{
+	int retval;
+	struct timeval delta;
+	struct timespec abstime;
+
+	if ( ! cond ) {
+		SDL_SetError("Passed a NULL condition variable");
+		return -1;
+	}
+
+	gettimeofday(&delta, NULL);
+
+	abstime.tv_sec = delta.tv_sec + (ms/1000);
+	abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000;
+        if ( abstime.tv_nsec > 1000000000 ) {
+          abstime.tv_sec += 1;
+          abstime.tv_nsec -= 1000000000;
+        }
+
+  tryagain:
+	retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime);
+	switch (retval) {
+	    case EINTR:
+		goto tryagain;
+		break;
+	    case ETIMEDOUT:
+		retval = SDL_MUTEX_TIMEDOUT;
+		break;
+	    case 0:
+		break;
+	    default:
+		SDL_SetError("pthread_cond_timedwait() failed");
+		retval = -1;
+		break;
+	}
+	return retval;
+}
+
+/* Wait on the condition variable, unlocking the provided mutex.
+   The mutex must be locked before entering this function!
+ */
+int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)
+{
+	int retval;
+
+	if ( ! cond ) {
+		SDL_SetError("Passed a NULL condition variable");
+		return -1;
+	}
+
+	retval = 0;
+	if ( pthread_cond_wait(&cond->cond, &mutex->id) != 0 ) {
+		SDL_SetError("pthread_cond_wait() failed");
+		retval = -1;
+	}
+	return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_sysmutex.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,152 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <pthread.h>
+
+#include "SDL_thread.h"
+
+#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \
+    !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
+#define FAKE_RECURSIVE_MUTEX
+#endif
+
+struct SDL_mutex {
+	pthread_mutex_t id;
+#if FAKE_RECURSIVE_MUTEX
+	int recursive;
+	pthread_t owner;
+#endif
+};
+
+SDL_mutex *SDL_CreateMutex (void)
+{
+	SDL_mutex *mutex;
+	pthread_mutexattr_t attr;
+
+	/* Allocate the structure */
+	mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
+	if ( mutex ) {
+		pthread_mutexattr_init(&attr);
+#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
+		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+#elif SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
+		pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+#else
+		/* No extra attributes necessary */
+#endif
+		if ( pthread_mutex_init(&mutex->id, &attr) != 0 ) {
+			SDL_SetError("pthread_mutex_init() failed");
+			SDL_free(mutex);
+			mutex = NULL;
+		}
+	} else {
+		SDL_OutOfMemory();
+	}
+	return(mutex);
+}
+
+void SDL_DestroyMutex(SDL_mutex *mutex)
+{
+	if ( mutex ) {
+		pthread_mutex_destroy(&mutex->id);
+		SDL_free(mutex);
+	}
+}
+
+/* Lock the mutex */
+int SDL_mutexP(SDL_mutex *mutex)
+{
+	int retval;
+#if FAKE_RECURSIVE_MUTEX
+	pthread_t this_thread;
+#endif
+
+	if ( mutex == NULL ) {
+		SDL_SetError("Passed a NULL mutex");
+		return -1;
+	}
+
+	retval = 0;
+#if FAKE_RECURSIVE_MUTEX
+	this_thread = pthread_self();
+	if ( mutex->owner == this_thread ) {
+		++mutex->recursive;
+	} else {
+		/* The order of operations is important.
+		   We set the locking thread id after we obtain the lock
+		   so unlocks from other threads will fail.
+		*/
+		if ( pthread_mutex_lock(&mutex->id) == 0 ) {
+			mutex->owner = this_thread;
+			mutex->recursive = 0;
+		} else {
+			SDL_SetError("pthread_mutex_lock() failed");
+			retval = -1;
+		}
+	}
+#else
+	if ( pthread_mutex_lock(&mutex->id) < 0 ) {
+		SDL_SetError("pthread_mutex_lock() failed");
+		retval = -1;
+	}
+#endif
+	return retval;
+}
+
+int SDL_mutexV(SDL_mutex *mutex)
+{
+	int retval;
+
+	if ( mutex == NULL ) {
+		SDL_SetError("Passed a NULL mutex");
+		return -1;
+	}
+
+	retval = 0;
+#if FAKE_RECURSIVE_MUTEX
+	/* We can only unlock the mutex if we own it */
+	if ( pthread_self() == mutex->owner ) {
+		if ( mutex->recursive ) {
+			--mutex->recursive;
+		} else {
+			/* The order of operations is important.
+			   First reset the owner so another thread doesn't lock
+			   the mutex and set the ownership before we reset it,
+			   then release the lock semaphore.
+			 */
+			mutex->owner = 0;
+			pthread_mutex_unlock(&mutex->id);
+		}
+	} else {
+		SDL_SetError("mutex not owned by this thread");
+		retval = -1;
+	}
+
+#else
+	if ( pthread_mutex_unlock(&mutex->id) < 0 ) {
+		SDL_SetError("pthread_mutex_unlock() failed");
+		retval = -1;
+	}
+#endif /* FAKE_RECURSIVE_MUTEX */
+
+	return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_sysmutex_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,30 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#ifndef _SDL_mutex_c_h
+#define _SDL_mutex_c_h
+
+struct SDL_mutex {
+	pthread_mutex_t id;
+};
+
+#endif /* _SDL_mutex_c_h */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,174 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+
+/* Wrapper around POSIX 1003.1b semaphores */
+
+#if MACOSX
+#define USE_NAMED_SEMAPHORES 1
+#endif /* MACOSX */
+
+struct SDL_semaphore {
+	sem_t *sem;
+#if !USE_NAMED_SEMAPHORES
+	sem_t sem_data;
+#endif
+};
+
+/* Create a semaphore, initialized with value */
+SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
+{
+	SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
+	if ( sem ) {
+#if USE_NAMED_SEMAPHORES
+		static int semnum = 0;
+		char name[32];
+
+		SDL_snprintf(name, SDL_arraysize(name), "/SDL_sem-%d-%4.4d", getpid(), semnum++);
+		sem->sem = sem_open(name, O_CREAT, 0600, initial_value);
+		if ( sem->sem == (sem_t *)SEM_FAILED ) {
+			SDL_SetError("sem_open(%s) failed", name);
+			SDL_free(sem);
+			sem = NULL;
+		} else {
+			sem_unlink(name);
+		}
+#else
+		if ( sem_init(&sem->sem_data, 0, initial_value) < 0 ) {
+			SDL_SetError("sem_init() failed");
+			SDL_free(sem);
+			sem = NULL;
+		} else {
+			sem->sem = &sem->sem_data;
+		}
+#endif /* USE_NAMED_SEMAPHORES */
+	} else {
+		SDL_OutOfMemory();
+	}
+	return sem;
+}
+
+void SDL_DestroySemaphore(SDL_sem *sem)
+{
+	if ( sem ) {
+#if USE_NAMED_SEMAPHORES
+		sem_close(sem->sem);
+#else
+		sem_destroy(sem->sem);
+#endif
+		SDL_free(sem);
+	}
+}
+
+int SDL_SemTryWait(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+	retval = SDL_MUTEX_TIMEDOUT;
+	if ( sem_trywait(sem->sem) == 0 ) {
+		retval = 0;
+	}
+	return retval;
+}
+
+int SDL_SemWait(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	retval = sem_wait(sem->sem);
+	if ( retval < 0 ) {
+		SDL_SetError("sem_wait() failed");
+	}
+	return retval;
+}
+
+int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	/* Try the easy cases first */
+	if ( timeout == 0 ) {
+		return SDL_SemTryWait(sem);
+	}
+	if ( timeout == SDL_MUTEX_MAXWAIT ) {
+		return SDL_SemWait(sem);
+	}
+
+	/* Ack!  We have to busy wait... */
+	timeout += SDL_GetTicks();
+	do {
+		retval = SDL_SemTryWait(sem);
+		if ( retval == 0 ) {
+			break;
+		}
+		SDL_Delay(1);
+	} while ( SDL_GetTicks() < timeout );
+
+	return retval;
+}
+
+Uint32 SDL_SemValue(SDL_sem *sem)
+{
+	int ret = 0;
+	if ( sem ) {
+		sem_getvalue(sem->sem, &ret);
+		if ( ret < 0 ) {
+			ret = 0;
+		}
+	}
+	return (Uint32)ret;
+}
+
+int SDL_SemPost(SDL_sem *sem)
+{
+	int retval;
+
+	if ( ! sem ) {
+		SDL_SetError("Passed a NULL semaphore");
+		return -1;
+	}
+
+	retval = sem_post(sem->sem);
+	if ( retval < 0 ) {
+		SDL_SetError("sem_post() failed");
+	}
+	return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,104 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <pthread.h>
+#include <signal.h>
+
+#include "SDL_thread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
+
+/* List of signals to mask in the subthreads */
+static int sig_list[] = {
+	SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
+	SIGVTALRM, SIGPROF, 0
+};
+
+
+static void *RunThread(void *data)
+{
+	SDL_RunThread(data);
+	pthread_exit((void*)0);
+	return((void *)0);		/* Prevent compiler warning */
+}
+
+int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
+{
+	pthread_attr_t type;
+
+	/* Set the thread attributes */
+	if ( pthread_attr_init(&type) != 0 ) {
+		SDL_SetError("Couldn't initialize pthread attributes");
+		return(-1);
+	}
+	pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
+
+	/* Create the thread and go! */
+	if ( pthread_create(&thread->handle, &type, RunThread, args) != 0 ) {
+		SDL_SetError("Not enough resources to create thread");
+		return(-1);
+	}
+	return(0);
+}
+
+void SDL_SYS_SetupThread(void)
+{
+	int i;
+	sigset_t mask;
+
+	/* Mask asynchronous signals for this thread */
+	sigemptyset(&mask);
+	for ( i=0; sig_list[i]; ++i ) {
+		sigaddset(&mask, sig_list[i]);
+	}
+	pthread_sigmask(SIG_BLOCK, &mask, 0);
+
+#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
+	/* Allow ourselves to be asynchronously cancelled */
+	{ int oldstate;
+		pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate);
+	}
+#endif
+}
+
+/* WARNING:  This may not work for systems with 64-bit pid_t */
+Uint32 SDL_ThreadID(void)
+{
+	return((Uint32)pthread_self());
+}
+
+void SDL_SYS_WaitThread(SDL_Thread *thread)
+{
+	pthread_join(thread->handle, 0);
+}
+
+void SDL_SYS_KillThread(SDL_Thread *thread)
+{
+#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
+	pthread_cancel(thread->handle);
+#else
+#ifdef __FreeBSD__
+#warning For some reason, this doesnt actually kill a thread - FreeBSD 3.2
+#endif
+	pthread_kill(thread->handle, SIGKILL);
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/thread/pthread/SDL_systhread_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,25 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <pthread.h>
+
+typedef pthread_t SYS_ThreadHandle;
--- a/src/thread/riscos/SDL_syscond.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_syscond.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,7 @@
 
 /* RISC OS implementations uses pthreads based on linux code */
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 #include "../generic/SDL_syscond.c"
 #else
 #include <sys/time.h>
--- a/src/thread/riscos/SDL_sysmutex.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_sysmutex.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,17 +22,17 @@
 
 /* RISC OS implementations uses pthreads based on linux code */
 
-#ifdef DISABLE_THREADS
+#include "SDL_thread.h"
+
+#if SDL_THREADS_DISABLED
 #include "../generic/SDL_sysmutex.c"
 #else
 
 #include <pthread.h>
 
-#include "SDL_thread.h"
-
 struct SDL_mutex {
 	pthread_mutex_t id;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
+#if SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX
 	int recursive;
 	pthread_t owner;
 #endif
@@ -47,11 +47,11 @@
 	mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
 	if ( mutex ) {
 		pthread_mutexattr_init(&attr);
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
+#if SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX
 		/* No extra attributes necessary */
 #else
 		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-#endif /* PTHREAD_NO_RECURSIVE_MUTEX */
+#endif /* SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX */
 		if ( pthread_mutex_init(&mutex->id, &attr) != 0 ) {
 			SDL_SetError("pthread_mutex_init() failed");
 			SDL_free(mutex);
@@ -75,7 +75,7 @@
 int SDL_mutexP(SDL_mutex *mutex)
 {
 	int retval;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
+#if SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX
 	pthread_t this_thread;
 #endif
 
@@ -85,7 +85,7 @@
 	}
 
 	retval = 0;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
+#if SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX
 	this_thread = pthread_self();
 	if ( mutex->owner == this_thread ) {
 		++mutex->recursive;
@@ -121,7 +121,7 @@
 	}
 
 	retval = 0;
-#ifdef PTHREAD_NO_RECURSIVE_MUTEX
+#if SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX
 	/* We can only unlock the mutex if we own it */
 	if ( pthread_self() == mutex->owner ) {
 		if ( mutex->recursive ) {
@@ -145,7 +145,7 @@
 		SDL_SetError("pthread_mutex_unlock() failed");
 		retval = -1;
 	}
-#endif /* PTHREAD_NO_RECURSIVE_MUTEX */
+#endif /* SDL_THREAD_PTHREAD_NO_RECURSIVE_MUTEX */
 
 	return retval;
 }
--- a/src/thread/riscos/SDL_sysmutex_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_sysmutex_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef _SDL_mutex_c_h
 #define _SDL_mutex_c_h
 
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 struct SDL_mutex {
 	pthread_mutex_t id;
 };
--- a/src/thread/riscos/SDL_syssem.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_syssem.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include "SDL_thread.h"
 #include "SDL_systhread_c.h"
 
-#ifdef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 
 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
@@ -196,4 +196,4 @@
 	return retval;
 }
 
-#endif /* DISABLE_THREADS */
+#endif /* !SDL_THREADS_DISABLED */
--- a/src/thread/riscos/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,9 +23,9 @@
 /* RISC OS version based on pthreads linux source */
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_systhread.h"
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 
 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
 {
--- a/src/thread/riscos/SDL_systhread_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/riscos/SDL_systhread_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,7 +20,7 @@
     slouken@libsdl.org
 */
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 
 typedef int SYS_ThreadHandle;
 
--- a/src/thread/win32/SDL_systhread.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/thread/win32/SDL_systhread.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,8 @@
 #include "SDL_windows.h"
 
 #include "SDL_thread.h"
-#include "SDL_systhread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
 
 typedef struct ThreadStartParms
 {
--- a/src/timer/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-
-## Makefile.am for the SDL timer library
-
-noinst_LTLIBRARIES = libtimer.la
-
-ARCH_SUBDIRS = $(srcdir)/amigaos \
-               $(srcdir)/beos \
-               $(srcdir)/dc \
-               $(srcdir)/epoc \
-               $(srcdir)/linux \
-               $(srcdir)/macos \
-               $(srcdir)/mint \
-               $(srcdir)/riscos \
-               $(srcdir)/win32
-
-# Include the architecture-independent sources
-COMMON_SRCS = SDL_timer.c SDL_timer_c.h SDL_systimer.h
-
-# Include the architecture-specific sources
-if TARGET_MINT
-ARCH_SRCS = SDL_systimer.c mint/SDL_vbltimer.S mint/SDL_vbltimer_s.h
-else
-ARCH_SRCS = SDL_systimer.c
-endif
-
-libtimer_la_SOURCES = $(COMMON_SRCS) $(ARCH_SRCS)
-
-## Let automake know that it shouldn't distribute linked sources
-BUILT_SOURCES = $(ARCH_SRCS)
-
-## Let automake know that it should remove these for distribution
-DISTCLEANFILES = $(ARCH_SRCS)
-
-# The architecture specific directories need to be copied into place
-# when building a distribution.
-dist-hook:
-	(cd $(distdir) && rm -f $(BUILT_SOURCES))
-	cp -rp $(ARCH_SUBDIRS) $(distdir)
-	(cd $(distdir) && rm -rf `find . -name CVS`)
--- a/src/timer/amigaos/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/amigaos/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -49,11 +49,7 @@
 static struct GfxBase *GfxBase;
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
-
-#if defined(DISABLE_THREADS) || defined(FORK_HACK)
-#define USE_ITIMER
-#endif
+#include "../SDL_timer_c.h"
 
 /* The first ticks value of the application */
 
--- a/src/timer/beos/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/beos/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_thread.h"
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 static bigtime_t start;
 
--- a/src/timer/dc/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/dc/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_thread.h"
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 static unsigned start;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/timer/dummy/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,83 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+void SDL_StartTicks(void)
+{
+}
+
+Uint32 SDL_GetTicks (void)
+{
+	SDL_Unsupported();
+	return 0;
+}
+
+void SDL_Delay (Uint32 ms)
+{
+	SDL_Unsupported();
+}
+
+#include "SDL_thread.h"
+
+/* Data to handle a single periodic alarm */
+static int timer_alive = 0;
+static SDL_Thread *timer = NULL;
+
+static int RunTimer(void *unused)
+{
+	while ( timer_alive ) {
+		if ( SDL_timer_running ) {
+			SDL_ThreadedTimerCheck();
+		}
+		SDL_Delay(1);
+	}
+	return(0);
+}
+
+/* This is only called if the event thread is not running */
+int SDL_SYS_TimerInit(void)
+{
+	timer_alive = 1;
+	timer = SDL_CreateThread(RunTimer, NULL);
+	if ( timer == NULL )
+		return(-1);
+	return(SDL_SetTimerThreaded(1));
+}
+
+void SDL_SYS_TimerQuit(void)
+{
+	timer_alive = 0;
+	if ( timer ) {
+		SDL_WaitThread(timer, NULL);
+		timer = NULL;
+	}
+}
+
+int SDL_SYS_StartTimer(void)
+{
+	SDL_SetError("Internal logic error: threaded timer in use");
+	return(-1);
+}
+
+void SDL_SYS_StopTimer(void)
+{
+	return;
+}
--- a/src/timer/epoc/SDL_systimer.cpp	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/epoc/SDL_systimer.cpp	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,7 @@
 #include "SDL_error.h"
 #include "SDL_thread.h"
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 static TUint start = 0;
 static TInt tickPeriodMilliSeconds;
--- a/src/timer/linux/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-
-    RDTSC stuff by lompik (lompik@voila.fr) 20/03/2002 
-*/
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-/* The clock_gettime provides monotonous time, so we should use it if
-   it's available. The clock_gettime function is behind ifdef
-   for __USE_POSIX199309
-   Tommi Kyntola (tommi.kyntola@ray.fi) 27/09/2005
-*/
-#if (defined _POSIX_TIMERS && _POSIX_TIMERS + 0 > 0)
-#include <time.h>
-/*
- * clock_gettime() is missing in my system's glibc, and apparently isn't
- *  available before Linux kernel 2.6...you can uncomment the following
- *  define to use it, since it may be a better solution than
- *  gettimeofday() on systems that support the newer syscall.  --ryan.
- */
-/*#define USE_CLOCK_GETTIME*/
-#endif
-
-#include "SDL_timer.h"
-#include "SDL_timer_c.h"
-
-#if _POSIX_THREAD_SYSCALL_SOFT
-#include <pthread.h>
-#endif
-#ifdef ENABLE_PTH
-#include <pth.h>
-#endif
-
-#if defined(DISABLE_THREADS) || defined(FORK_HACK)
-#define USE_ITIMER
-#endif
-
-/* The following defines should really be determined at configure time */
-
-#if defined(linux)
-/* Linux select() changes its timeout parameter upon return to contain
-   the remaining time. Most other unixen leave it unchanged or undefined. */
-#define SELECT_SETS_REMAINING
-#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__sun) || defined(MACOSX)
-#define USE_NANOSLEEP
-#endif
-
-#if defined(i386) || defined(__i386__)
-/* This only works on pentium or newer x86 processors */
-/* Actually, this isn't reliable on multi-cpu systems, so is disabled */
-/*#define USE_RDTSC*/
-#endif
-
-
-#ifdef USE_RDTSC 
-
-/* The first ticks value of the application */
-static unsigned long long start;
-static float cpu_mhz1000 = 0.0f;
-
-#if 1
-/* This is for old binutils version that don't recognize rdtsc mnemonics.
-   But all binutils version supports this.
-*/
-#define rdtsc(t) asm __volatile__ (".byte 0x0f, 0x31; " : "=A" (t))
-#else
-#define rdtsc(t) asm __volatile__ ("rdtsc" : "=A" (t))
-#endif
-
-static float calc_cpu_mhz(void)
-{
-	float cpu_mhz;
-	unsigned long long tsc_start;
-	unsigned long long tsc_end;
-/* Slight code doubling here for the sake of readability */
-#ifdef USE_CLOCK_GETTIME
-	struct timespec tv_start, tv_end;
-	long usec_delay;
-
-	rdtsc(tsc_start);
-	clock_gettime(CLOCK_MONOTONIC,&tv_start);
-	sleep(1);
-	rdtsc(tsc_end);
-	clock_gettime(CLOCK_MONOTONIC,&tv_end);
-	usec_delay = (1000000000L * (tv_end.tv_sec - tv_start.tv_sec) +
-	                            (tv_end.tv_nsec - tv_start.tv_nsec)) / 1000;
-#else
-	struct timeval tv_start, tv_end;
-	long usec_delay;
-
-	rdtsc(tsc_start);
-	gettimeofday(&tv_start, NULL);
-	sleep(1);
-	rdtsc(tsc_end);
-	gettimeofday(&tv_end, NULL);
-	usec_delay = 1000000L * (tv_end.tv_sec - tv_start.tv_sec) +
-	                        (tv_end.tv_usec - tv_start.tv_usec);
-#endif /* USE_CLOCK_GETTIME */
-	cpu_mhz = (float)(tsc_end-tsc_start) / usec_delay;
-#if 0
-	printf("cpu MHz\t\t: %.3f\n", cpu_mhz);
-#endif
-	return cpu_mhz;
-}
-
-#else
-
-/* The first ticks value of the application */
-#ifdef USE_CLOCK_GETTIME
-static struct timespec start;
-#else
-static struct timeval start;
-#endif /* USE_CLOCK_GETTIME */
-
-#endif  /* USE_RDTSC */
-
-
-void SDL_StartTicks(void)
-{
-	/* Set first ticks value */
-#ifdef USE_RDTSC
-	if ( ! cpu_mhz1000 ) {
-		cpu_mhz1000 = calc_cpu_mhz() * 1000.0f;
-	}
-	rdtsc(start);
-#elif defined(USE_CLOCK_GETTIME)
-	clock_gettime(CLOCK_MONOTONIC,&start);
-#else
-	gettimeofday(&start, NULL);
-#endif
-}
-
-Uint32 SDL_GetTicks (void)
-{
-#ifdef USE_RDTSC 
-	unsigned long long now;
-	if ( ! cpu_mhz1000 ) {
-		return 0; /* Shouldn't happen. BUG!! */
-	}
-	rdtsc(now);
-	return (Uint32)((now-start)/cpu_mhz1000);
-#elif defined(USE_CLOCK_GETTIME)
-	Uint32 ticks;
-	struct timespec now;
-	clock_gettime(CLOCK_MONOTONIC,&now);
-	ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_nsec-start.tv_nsec)/1000000;
-	return(ticks);
-#else
-	Uint32 ticks;
-	struct timeval now;
-	gettimeofday(&now, NULL);
-	ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
-	return(ticks);
-#endif
-}
-
-void SDL_Delay (Uint32 ms)
-{
-#ifdef ENABLE_PTH
-	pth_time_t tv;
-	tv.tv_sec  =  ms/1000;
-	tv.tv_usec = (ms%1000)*1000;
-	pth_nap(tv);
-#else
-	int was_error;
-
-#ifdef USE_NANOSLEEP
-	struct timespec elapsed, tv;
-#else
-	struct timeval tv;
-#ifndef SELECT_SETS_REMAINING
-	Uint32 then, now, elapsed;
-#endif
-#endif
-
-	/* Set the timeout interval - Linux only needs to do this once */
-#ifdef SELECT_SETS_REMAINING
-	tv.tv_sec = ms/1000;
-	tv.tv_usec = (ms%1000)*1000;
-#elif defined(USE_NANOSLEEP)
-	elapsed.tv_sec = ms/1000;
-	elapsed.tv_nsec = (ms%1000)*1000000;
-#else
-	then = SDL_GetTicks();
-#endif
-	do {
-		errno = 0;
-
-#if _POSIX_THREAD_SYSCALL_SOFT
-		pthread_yield_np();
-#endif
-#ifdef USE_NANOSLEEP
-		tv.tv_sec = elapsed.tv_sec;
-		tv.tv_nsec = elapsed.tv_nsec;
-		was_error = nanosleep(&tv, &elapsed);
-#else
-#ifndef SELECT_SETS_REMAINING
-		/* Calculate the time interval left (in case of interrupt) */
-		now = SDL_GetTicks();
-		elapsed = (now-then);
-		then = now;
-		if ( elapsed >= ms ) {
-			break;
-		}
-		ms -= elapsed;
-		tv.tv_sec = ms/1000;
-		tv.tv_usec = (ms%1000)*1000;
-#endif
-		was_error = select(0, NULL, NULL, NULL, &tv);
-#endif /* USE_NANOSLEEP */
-	} while ( was_error && (errno == EINTR) );
-#endif /* ENABLE_PTH */
-}
-
-#ifdef USE_ITIMER
-
-static void HandleAlarm(int sig)
-{
-	Uint32 ms;
-
-	if ( SDL_alarm_callback ) {
-		ms = (*SDL_alarm_callback)(SDL_alarm_interval);
-		if ( ms != SDL_alarm_interval ) {
-			SDL_SetTimer(ms, SDL_alarm_callback);
-		}
-	}
-}
-
-int SDL_SYS_TimerInit(void)
-{
-	struct sigaction action;
-
-	/* Set the alarm handler (Linux specific) */
-	SDL_memset(&action, 0, sizeof(action));
-	action.sa_handler = HandleAlarm;
-	action.sa_flags = SA_RESTART;
-	sigemptyset(&action.sa_mask);
-	sigaction(SIGALRM, &action, NULL);
-	return(0);
-}
-
-void SDL_SYS_TimerQuit(void)
-{
-	SDL_SetTimer(0, NULL);
-}
-
-int SDL_SYS_StartTimer(void)
-{
-	struct itimerval timer;
-
-	timer.it_value.tv_sec = (SDL_alarm_interval/1000);
-	timer.it_value.tv_usec = (SDL_alarm_interval%1000)*1000;
-	timer.it_interval.tv_sec = (SDL_alarm_interval/1000);
-	timer.it_interval.tv_usec = (SDL_alarm_interval%1000)*1000;
-	setitimer(ITIMER_REAL, &timer, NULL);
-	return(0);
-}
-
-void SDL_SYS_StopTimer(void)
-{
-	struct itimerval timer;
-
-	SDL_memset(&timer, 0, (sizeof timer));
-	setitimer(ITIMER_REAL, &timer, NULL);
-}
-
-#else /* USE_ITIMER */
-
-#include "SDL_thread.h"
-
-/* Data to handle a single periodic alarm */
-static int timer_alive = 0;
-static SDL_Thread *timer = NULL;
-
-static int RunTimer(void *unused)
-{
-	while ( timer_alive ) {
-		if ( SDL_timer_running ) {
-			SDL_ThreadedTimerCheck();
-		}
-		SDL_Delay(1);
-	}
-	return(0);
-}
-
-/* This is only called if the event thread is not running */
-int SDL_SYS_TimerInit(void)
-{
-	timer_alive = 1;
-	timer = SDL_CreateThread(RunTimer, NULL);
-	if ( timer == NULL )
-		return(-1);
-	return(SDL_SetTimerThreaded(1));
-}
-
-void SDL_SYS_TimerQuit(void)
-{
-	timer_alive = 0;
-	if ( timer ) {
-		SDL_WaitThread(timer, NULL);
-		timer = NULL;
-	}
-}
-
-int SDL_SYS_StartTimer(void)
-{
-	SDL_SetError("Internal logic error: Linux uses threaded timer");
-	return(-1);
-}
-
-void SDL_SYS_StopTimer(void)
-{
-	return;
-}
-
-#endif /* USE_ITIMER */
--- a/src/timer/macos/SDL_MPWtimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/macos/SDL_MPWtimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #include <LowMem.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 #define MS_PER_TICK	(1000/60)		/* MacOS tick = 1/60 second */
 
--- a/src/timer/macos/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/macos/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #include <LowMem.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 #include "FastTimes.h"
 
--- a/src/timer/mint/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/mint/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -40,7 +40,7 @@
 #include <mint/mintbind.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 #include "SDL_thread.h"
 
 #include "mint/SDL_vbltimer_s.h"
--- a/src/timer/os2/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/os2/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,7 +31,7 @@
 
 #include "SDL_thread.h"
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 
 #define TIME_WRAP_VALUE (~(DWORD)0)
--- a/src/timer/riscos/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/riscos/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,10 +28,10 @@
 #include <errno.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
-#ifdef DISABLE_THREADS
-/* Timer start/reset time */
+#if SDL_THREADS_DISABLED
+/* Timer  SDL_arraysize(Timer ),start/reset time */
 static Uint32 timerStart;
 /* Timer running function */
 void RISCOS_CheckTimer();
@@ -81,7 +81,7 @@
 void SDL_Delay (Uint32 ms)
 {
     Uint32 now,then,elapsed;
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
     int is_event_thread;
     if (riscos_using_threads)
     {
@@ -101,7 +101,7 @@
 
 	do {
 		/* Do background tasks required while sleeping as we are not multithreaded */
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 		RISCOS_BackgroundTasks();
 #else
 		/* For threaded build only run background tasks in event thread */
@@ -116,7 +116,7 @@
 			break;
 		}
 		ms -= elapsed;
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
             /* Need to yield to let other threads have a go */
             if (riscos_using_threads) pthread_yield();
 #endif
@@ -124,7 +124,7 @@
 	} while ( 1 );
 }
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 
 /* Non-threaded version of timer */
 
@@ -225,4 +225,4 @@
 	return;
 }
 
-#endif /* DISABLE_THREADS */
+#endif /* SDL_THREADS_DISABLED */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/timer/unix/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -0,0 +1,240 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "SDL_timer.h"
+#include "../SDL_timer_c.h"
+
+/* The clock_gettime provides monotonous time, so we should use it if
+   it's available. The clock_gettime function is behind ifdef
+   for __USE_POSIX199309
+   Tommi Kyntola (tommi.kyntola@ray.fi) 27/09/2005
+*/
+#if HAVE_CLOCK_GETTIME
+#include <time.h>
+#endif
+
+#if SDL_THREAD_PTH
+#include <pth.h>
+#elif _POSIX_THREAD_SYSCALL_SOFT
+#include <pthread.h>
+#endif
+
+#if SDL_THREADS_DISABLED
+#define USE_ITIMER
+#endif
+
+/* The first ticks value of the application */
+#ifdef HAVE_CLOCK_GETTIME
+static struct timespec start;
+#else
+static struct timeval start;
+#endif /* HAVE_CLOCK_GETTIME */
+
+
+void SDL_StartTicks(void)
+{
+	/* Set first ticks value */
+#if HAVE_CLOCK_GETTIME
+	clock_gettime(CLOCK_MONOTONIC,&start);
+#else
+	gettimeofday(&start, NULL);
+#endif
+}
+
+Uint32 SDL_GetTicks (void)
+{
+#if HAVE_CLOCK_GETTIME
+	Uint32 ticks;
+	struct timespec now;
+	clock_gettime(CLOCK_MONOTONIC,&now);
+	ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_nsec-start.tv_nsec)/1000000;
+	return(ticks);
+#else
+	Uint32 ticks;
+	struct timeval now;
+	gettimeofday(&now, NULL);
+	ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
+	return(ticks);
+#endif
+}
+
+void SDL_Delay (Uint32 ms)
+{
+#if SDL_THREAD_PTH
+	pth_time_t tv;
+	tv.tv_sec  =  ms/1000;
+	tv.tv_usec = (ms%1000)*1000;
+	pth_nap(tv);
+#else
+	int was_error;
+
+#if HAVE_NANOSLEEP
+	struct timespec elapsed, tv;
+#else
+	struct timeval tv;
+	Uint32 then, now, elapsed;
+#endif
+
+	/* Set the timeout interval */
+#if HAVE_NANOSLEEP
+	elapsed.tv_sec = ms/1000;
+	elapsed.tv_nsec = (ms%1000)*1000000;
+#else
+	then = SDL_GetTicks();
+#endif
+	do {
+		errno = 0;
+
+#if _POSIX_THREAD_SYSCALL_SOFT
+		pthread_yield_np();
+#endif
+#if HAVE_NANOSLEEP
+		tv.tv_sec = elapsed.tv_sec;
+		tv.tv_nsec = elapsed.tv_nsec;
+		was_error = nanosleep(&tv, &elapsed);
+#else
+		/* Calculate the time interval left (in case of interrupt) */
+		now = SDL_GetTicks();
+		elapsed = (now-then);
+		then = now;
+		if ( elapsed >= ms ) {
+			break;
+		}
+		ms -= elapsed;
+		tv.tv_sec = ms/1000;
+		tv.tv_usec = (ms%1000)*1000;
+
+		was_error = select(0, NULL, NULL, NULL, &tv);
+#endif /* HAVE_NANOSLEEP */
+	} while ( was_error && (errno == EINTR) );
+#endif /* SDL_THREAD_PTH */
+}
+
+#ifdef USE_ITIMER
+
+static void HandleAlarm(int sig)
+{
+	Uint32 ms;
+
+	if ( SDL_alarm_callback ) {
+		ms = (*SDL_alarm_callback)(SDL_alarm_interval);
+		if ( ms != SDL_alarm_interval ) {
+			SDL_SetTimer(ms, SDL_alarm_callback);
+		}
+	}
+}
+
+int SDL_SYS_TimerInit(void)
+{
+	struct sigaction action;
+
+	/* Set the alarm handler (Linux specific) */
+	SDL_memset(&action, 0, sizeof(action));
+	action.sa_handler = HandleAlarm;
+	action.sa_flags = SA_RESTART;
+	sigemptyset(&action.sa_mask);
+	sigaction(SIGALRM, &action, NULL);
+	return(0);
+}
+
+void SDL_SYS_TimerQuit(void)
+{
+	SDL_SetTimer(0, NULL);
+}
+
+int SDL_SYS_StartTimer(void)
+{
+	struct itimerval timer;
+
+	timer.it_value.tv_sec = (SDL_alarm_interval/1000);
+	timer.it_value.tv_usec = (SDL_alarm_interval%1000)*1000;
+	timer.it_interval.tv_sec = (SDL_alarm_interval/1000);
+	timer.it_interval.tv_usec = (SDL_alarm_interval%1000)*1000;
+	setitimer(ITIMER_REAL, &timer, NULL);
+	return(0);
+}
+
+void SDL_SYS_StopTimer(void)
+{
+	struct itimerval timer;
+
+	SDL_memset(&timer, 0, (sizeof timer));
+	setitimer(ITIMER_REAL, &timer, NULL);
+}
+
+#else /* USE_ITIMER */
+
+#include "SDL_thread.h"
+
+/* Data to handle a single periodic alarm */
+static int timer_alive = 0;
+static SDL_Thread *timer = NULL;
+
+static int RunTimer(void *unused)
+{
+	while ( timer_alive ) {
+		if ( SDL_timer_running ) {
+			SDL_ThreadedTimerCheck();
+		}
+		SDL_Delay(1);
+	}
+	return(0);
+}
+
+/* This is only called if the event thread is not running */
+int SDL_SYS_TimerInit(void)
+{
+	timer_alive = 1;
+	timer = SDL_CreateThread(RunTimer, NULL);
+	if ( timer == NULL )
+		return(-1);
+	return(SDL_SetTimerThreaded(1));
+}
+
+void SDL_SYS_TimerQuit(void)
+{
+	timer_alive = 0;
+	if ( timer ) {
+		SDL_WaitThread(timer, NULL);
+		timer = NULL;
+	}
+}
+
+int SDL_SYS_StartTimer(void)
+{
+	SDL_SetError("Internal logic error: Linux uses threaded timer");
+	return(-1);
+}
+
+void SDL_SYS_StopTimer(void)
+{
+	return;
+}
+
+#endif /* USE_ITIMER */
--- a/src/timer/win32/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/win32/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #include <mmsystem.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 #ifdef _WIN32_WCE
   #error This is WinCE. Please use src/timer/wince/SDL_systimer.c instead.
--- a/src/timer/wince/SDL_systimer.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/timer/wince/SDL_systimer.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #include <mmsystem.h>
 
 #include "SDL_timer.h"
-#include "SDL_timer_c.h"
+#include "../SDL_timer_c.h"
 
 static Uint64 start_date;
 static Uint64 start_ticks;
--- a/src/video/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-
-## Makefile.am for the SDL video library
-
-noinst_LTLIBRARIES = libvideo.la
-
-# Define which subdirectories need to be built
-SUBDIRS = @VIDEO_SUBDIRS@
-DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
-               wincommon windib windx5 \
-               maccommon macdsp macrom riscos quartz \
-               bwindow ps2gs photon cybergfx epoc picogui \
-               ataricommon xbios gem dc qtopia Xext wscons gapi \
-               ipod os2fslib
-
-DRIVERS = @VIDEO_DRIVERS@
-
-# Include the architecture-independent sources
-COMMON_SRCS =			\
-	SDL_RLEaccel.c		\
-	SDL_RLEaccel_c.h	\
-	SDL_blit.c		\
-	SDL_blit.h		\
-	SDL_blit_0.c		\
-	SDL_blit_1.c		\
-	SDL_blit_A.c		\
-	SDL_blit_N.c		\
-	SDL_bmp.c		\
-	SDL_cursor.c		\
-	SDL_cursor_c.h		\
-	SDL_gamma.c		\
-	SDL_glfuncs.h		\
-	SDL_leaks.h		\
-	SDL_pixels.c		\
-	SDL_pixels_c.h		\
-	SDL_surface.c		\
-	SDL_stretch.c		\
-	SDL_stretch_c.h		\
-	SDL_sysvideo.h		\
-	SDL_video.c		\
-	SDL_yuv.c		\
-	SDL_yuvfuncs.h		\
-	SDL_yuv_sw.c		\
-	SDL_yuv_sw_c.h		\
-	SDL_yuv_mmx.c		\
-	mmx.h			\
-	math_private.h		\
-	e_log.h			\
-	e_pow.h			\
-	e_sqrt.h		\
-	blank_cursor.h		\
-	default_cursor.h
-
-libvideo_la_SOURCES = $(COMMON_SRCS)
-libvideo_la_LIBADD = $(DRIVERS)
-libvideo_la_DEPENDENCIES = $(DRIVERS)
--- a/src/video/SDL_RLEaccel.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_RLEaccel.c	Thu Feb 16 10:11:48 2006 +0000
@@ -90,7 +90,7 @@
 #include "SDL_blit.h"
 #include "SDL_RLEaccel_c.h"
 
-#if (defined(i386) || defined(__x86_64__)) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if (i386 || __x86_64__) && __GNUC__ && SDL_ASSEMBLY_BLITTERS
 #define MMX_ASMBLIT
 #endif
 
--- a/src/video/SDL_blit.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_blit.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 #include "SDL_RLEaccel_c.h"
 #include "SDL_pixels_c.h"
 
-#if (defined(i386) || defined(__x86_64__)) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if (i386 || __x86_64__) && __GNUC__ && SDL_ASSEMBLY_BLITTERS
 #define MMX_ASMBLIT
 #endif
 
--- a/src/video/SDL_blit_A.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_blit_A.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,13 +23,13 @@
 #include "SDL_video.h"
 #include "SDL_blit.h"
 
-#if (defined(i386) || defined(__x86_64__)) && defined(__GNUC__) && defined(USE_ASMBLIT)
-#define MMX_ASMBLIT
+#if (defined(i386) || defined(__x86_64__)) && __GNUC__ && SDL_ASSEMBLY_BLITTERS
+#define MMX_ASMBLIT 1
 #endif
 
 /* Function to check the CPU flags */
 #include "SDL_cpuinfo.h"
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 #include "mmx.h"
 #endif
 
@@ -197,7 +197,7 @@
 	}
 }
 
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 /* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
 static void BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info)
 {
@@ -413,8 +413,8 @@
 }
 #endif
 
-#ifdef USE_ALTIVEC_BLITTERS
-#ifdef HAVE_ALTIVEC_H
+#if SDL_ALTIVEC_BLITTERS
+#if HAVE_ALTIVEC_H
 #include <altivec.h>
 #endif
 #include <assert.h>
@@ -1183,7 +1183,7 @@
         dstp += dstskip;
     }
 }
-#endif /* USE_ALTIVEC_BLITTERS */
+#endif /* SDL_ALTIVEC_BLITTERS */
 
 /* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
 static void BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo *info)
@@ -1325,7 +1325,7 @@
 	}
 }
 
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 /* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
 inline static void BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo *info)
 {
@@ -1527,7 +1527,7 @@
 	}
 }
 
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 /* fast RGB565->RGB565 blending with surface alpha */
 static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
 {
@@ -2136,7 +2136,7 @@
 	    if(df->BytesPerPixel == 1)
 		return BlitNto1SurfaceAlphaKey;
 	    else
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
 	if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
 	    !(surface->map->dst->flags & SDL_HWSURFACE) && SDL_HasAltiVec())
             return Blit32to32SurfaceAlphaKeyAltivec;
@@ -2153,7 +2153,7 @@
 		if(surface->map->identity) {
 		    if(df->Gmask == 0x7e0)
 		    {
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 		if(SDL_HasMMX())
 			return Blit565to565SurfaceAlphaMMX;
 		else
@@ -2162,7 +2162,7 @@
 		    }
 		    else if(df->Gmask == 0x3e0)
 		    {
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 		if(SDL_HasMMX())
 			return Blit555to555SurfaceAlphaMMX;
 		else
@@ -2179,12 +2179,12 @@
 		   && (sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff
 		   && sf->BytesPerPixel == 4)
 		{
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 		if(SDL_HasMMX())
 		    return BlitRGBtoRGBSurfaceAlphaMMX;
 		else
 #endif
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
 	if(!(surface->map->dst->flags & SDL_HWSURFACE) && SDL_HasAltiVec())
             return BlitRGBtoRGBSurfaceAlphaAltivec;
         else
@@ -2192,7 +2192,7 @@
 		    return BlitRGBtoRGBSurfaceAlpha;
 		}
 		else
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
         if((sf->BytesPerPixel == 4) &&
 	   !(surface->map->dst->flags & SDL_HWSURFACE) && SDL_HasAltiVec())
             return Blit32to32SurfaceAlphaAltivec;
@@ -2212,7 +2212,7 @@
 	    return BlitNto1PixelAlpha;
 
 	case 2:
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
 	if(sf->BytesPerPixel == 4 && !(surface->map->dst->flags & SDL_HWSURFACE) &&
            df->Gmask == 0x7e0 &&
 	   df->Bmask == 0x1f && SDL_HasAltiVec())
@@ -2237,7 +2237,7 @@
 	       && sf->Bmask == df->Bmask
 	       && sf->BytesPerPixel == 4)
 	    {
-#ifdef MMX_ASMBLIT
+#if MMX_ASMBLIT
 		if(SDL_Has3DNow())
 		    return BlitRGBtoRGBPixelAlphaMMX3DNOW;
 		else
@@ -2245,14 +2245,14 @@
 		    return BlitRGBtoRGBPixelAlphaMMX;
 		else
 #endif
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
 	if(!(surface->map->dst->flags & SDL_HWSURFACE) && SDL_HasAltiVec())
             return BlitRGBtoRGBPixelAlphaAltivec;
         else
 #endif
 		    return BlitRGBtoRGBPixelAlpha;
 	    }
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
         if (sf->Amask && sf->BytesPerPixel == 4 &&
 	    !(surface->map->dst->flags & SDL_HWSURFACE) && SDL_HasAltiVec())
             return Blit32to32PixelAlphaAltivec;
--- a/src/video/SDL_blit_N.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_blit_N.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 
 /* Functions to blit from N-bit surfaces to other surfaces */
 
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
 #ifdef HAVE_ALTIVEC_H
 #include <altivec.h>
 #endif
@@ -842,7 +842,7 @@
 #define LO	1
 #endif
 
-#ifdef USE_ASMBLIT
+#if SDL_HERMES_BLITTERS
 
 /* Heheheh, we coerce Hermes into using SDL blit information */
 #define X86_ASSEMBLER
@@ -850,8 +850,8 @@
 #define HermesClearInterface		void
 #define STACKCALL
 
-#include "HeadMMX.h"
-#include "HeadX86.h"
+#include "../hermes/HeadMMX.h"
+#include "../hermes/HeadX86.h"
 
 #else
 
@@ -1200,7 +1200,7 @@
 #endif /* USE_DUFFS_LOOP */
 }
 
-#endif /* USE_ASMBLIT */
+#endif /* SDL_HERMES_BLITTERS */
 
 
 /* Special optimized blit for RGB 5-6-5 --> 32-bit RGB surfaces */
@@ -2272,15 +2272,14 @@
 	{ 0,0,0, 0, 0,0,0, 0, NULL, NULL },
 };
 static const struct blit_table normal_blit_2[] = {
-#ifdef USE_ASMBLIT
+#if SDL_HERMES_BLITTERS
     { 0x0000F800,0x000007E0,0x0000001F, 2, 0x0000001F,0x000007E0,0x0000F800,
       0, ConvertX86p16_16BGR565, ConvertX86, NO_ALPHA },
     { 0x0000F800,0x000007E0,0x0000001F, 2, 0x00007C00,0x000003E0,0x0000001F,
       0, ConvertX86p16_16RGB555, ConvertX86, NO_ALPHA },
     { 0x0000F800,0x000007E0,0x0000001F, 2, 0x0000001F,0x000003E0,0x00007C00,
       0, ConvertX86p16_16BGR555, ConvertX86, NO_ALPHA },
-#endif
-#ifdef USE_ALTIVEC_BLITTERS
+#elif SDL_ALTIVEC_BLITTERS
     /* has-altivec */
     { 0x0000F800,0x000007E0,0x0000001F, 4, 0x00000000,0x00000000,0x00000000,
       2, NULL, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
@@ -2304,7 +2303,7 @@
     { 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 }
 };
 static const struct blit_table normal_blit_4[] = {
-#ifdef USE_ASMBLIT
+#if SDL_HERMES_BLITTERS
     { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000F800,0x000007E0,0x0000001F,
       1, ConvertMMXpII32_16RGB565, ConvertMMX, NO_ALPHA },
     { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000F800,0x000007E0,0x0000001F,
@@ -2332,7 +2331,7 @@
     { 0x00FF0000,0x0000FF00,0x000000FF, 4, 0x0000FF00,0x00FF0000,0xFF000000,
       0, ConvertX86p32_32BGRA888, ConvertX86, NO_ALPHA },
 #else
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
     /* has-altivec | dont-use-prefetch */
     { 0x00000000,0x00000000,0x00000000, 4, 0x00000000,0x00000000,0x00000000,
       6, NULL, ConvertAltivec32to32_noprefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
@@ -2393,7 +2392,7 @@
 	    else if(dstfmt->BytesPerPixel == 1)
 		return BlitNto1Key;
 	    else {
-#ifdef USE_ALTIVEC_BLITTERS
+#if SDL_ALTIVEC_BLITTERS
         if((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4) && SDL_HasAltiVec()) {
             return Blit32to32KeyAltivec;
         } else
@@ -2416,7 +2415,7 @@
 			if ( surface->map->table ) {
 				blitfun = Blit_RGB888_index8_map;
 			} else {
-#ifdef USE_ASMBLIT
+#if SDL_HERMES_BLITTERS
 				sdata->aux_data = ConvertX86p32_8RGB332;
 				blitfun = ConvertX86;
 #else
@@ -2461,7 +2460,7 @@
 	}
 
 #ifdef DEBUG_ASM
-#ifdef USE_ASMBLIT
+#if SDL_HERMES_BLITTERS
 	if ( blitfun == ConvertMMX )
 		fprintf(stderr, "Using mmx blit\n");
 	else
--- a/src/video/SDL_bmp.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_bmp.c	Thu Feb 16 10:11:48 2006 +0000
@@ -20,8 +20,6 @@
     slouken@libsdl.org
 */
 
-#ifndef DISABLE_FILE
-
 /* 
    Code to load and save surfaces in Windows BMP format.
 
@@ -519,5 +517,3 @@
 	}
 	return((SDL_strcmp(SDL_GetError(), "") == 0) ? 0 : -1);
 }
-
-#endif /* ENABLE_FILE */
--- a/src/video/SDL_cursor.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_cursor.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,12 +26,12 @@
 #include "SDL_video.h"
 #include "SDL_mouse.h"
 #include "SDL_blit.h"
-#include "SDL_events_c.h"
 #include "SDL_sysvideo.h"
-#include "SDL_sysevents.h"
 #include "SDL_cursor_c.h"
 #include "SDL_pixels_c.h"
 #include "default_cursor.h"
+#include "../events/SDL_sysevents.h"
+#include "../events/SDL_events_c.h"
 
 /* These are static for our cursor handling code */
 volatile int SDL_cursorstate = CURSOR_VISIBLE;
--- a/src/video/SDL_stretch.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_stretch.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,15 +33,14 @@
    into the general blitting mechanism.
 */
 
-#if (defined(WIN32) && !defined(_M_ALPHA) && !defined(_WIN32_WCE) && \
-     !defined(__WATCOMC__) && !defined(__LCC__) && !defined(__FREEBCC__)) || \
-    (defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT))
+#if ((defined(_MFC_VER) && defined(_M_IX86)/* && !defined(_WIN32_WCE) still needed? */) || \
+     (defined(i386) && defined(__GNUC__))) && SDL_ASSEMBLY_BLITTERS
 #define USE_ASM_STRETCH
 #endif
 
 #ifdef USE_ASM_STRETCH
 
-#if defined(WIN32) || defined(i386)
+#if defined(_M_IX86) || defined(i386)
 #define PREFIX16	0x66
 #define STORE_BYTE	0xAA
 #define STORE_WORD	0xAB
@@ -282,7 +281,7 @@
 			: "0" (dstp), "1" (srcp), "r" (copy_row)
 			: "memory" );
 #else
-#ifdef WIN32
+#ifdef _MSC_VER
 		{ void *code = copy_row;
 			__asm {
 				push edi
--- a/src/video/SDL_sysvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_sysvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -34,19 +34,16 @@
 
 /* OpenGL is pretty much available on all Windows systems */
 #ifdef WIN32
-#ifndef _WIN32_WCE
-#define HAVE_OPENGL
-#endif
 #include "SDL_windows.h"
 #endif
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #ifdef MACOSX
 #include <OpenGL/gl.h>  /* OpenGL.framework */
 #else
 #include <GL/gl.h>
 #endif /* MACOSX */
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 /* The SDL video driver */
 typedef struct SDL_VideoDevice SDL_VideoDevice;
@@ -194,7 +191,7 @@
 	void (*GL_SwapBuffers)(_THIS);
 
   	/* OpenGL functions for SDL_OPENGLBLIT */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #ifndef WIN32
 #define WINAPI
 #endif
@@ -326,103 +323,97 @@
 	SDL_VideoDevice *(*create)(int devindex);
 } VideoBootStrap;
 
-#ifdef ENABLE_X11
+#if SDL_VIDEO_DRIVER_QUARTZ
+extern VideoBootStrap QZ_bootstrap;
+#endif
+#if SDL_VIDEO_DRIVER_X11
 extern VideoBootStrap X11_bootstrap;
 #endif
-#ifdef ENABLE_DGA
+#if SDL_VIDEO_DRIVER_DGA
 extern VideoBootStrap DGA_bootstrap;
 #endif
-#ifdef ENABLE_NANOX
+#if SDL_VIDEO_DRIVER_NANOX
 extern VideoBootStrap NX_bootstrap;
 #endif
-#ifdef ENABLE_IPOD
+#if SDL_VIDEO_DRIVER_IPOD
 extern VideoBootStrap iPod_bootstrap;
 #endif
-#ifdef ENABLE_FBCON
+#if SDL_VIDEO_DRIVER_QTOPIA
+extern VideoBootStrap Qtopia_bootstrap;
+#endif
+#if SDL_VIDEO_DRIVER_WSCONS
+extern VideoBootStrap WSCONS_bootstrap;
+#endif
+#if SDL_VIDEO_DRIVER_FBCON
 extern VideoBootStrap FBCON_bootstrap;
 #endif
-#ifdef ENABLE_DIRECTFB
+#if SDL_VIDEO_DRIVER_DIRECTFB
 extern VideoBootStrap DirectFB_bootstrap;
 #endif
-#ifdef ENABLE_PS2GS
+#if SDL_VIDEO_DRIVER_PS2GS
 extern VideoBootStrap PS2GS_bootstrap;
 #endif
-#ifdef ENABLE_GGI
+#if SDL_VIDEO_DRIVER_GGI
 extern VideoBootStrap GGI_bootstrap;
 #endif
-#ifdef ENABLE_VGL
+#if SDL_VIDEO_DRIVER_VGL
 extern VideoBootStrap VGL_bootstrap;
 #endif
-#ifdef ENABLE_SVGALIB
+#if SDL_VIDEO_DRIVER_SVGALIB
 extern VideoBootStrap SVGALIB_bootstrap;
 #endif
-#ifdef ENABLE_AALIB
-extern VideoBootStrap AALIB_bootstrap;
-#endif
-#ifdef ENABLE_GAPI
+#if SDL_VIDEO_DRIVER_GAPI
 extern VideoBootStrap GAPI_bootstrap;
 #endif
-#ifdef ENABLE_WINDIB
+#if SDL_VIDEO_DRIVER_WINDIB
 extern VideoBootStrap WINDIB_bootstrap;
 #endif
-#ifdef ENABLE_DIRECTX
+#if SDL_VIDEO_DRIVER_DDRAW
 extern VideoBootStrap DIRECTX_bootstrap;
 #endif
-#ifdef ENABLE_BWINDOW
+#if SDL_VIDEO_DRIVER_BWINDOW
 extern VideoBootStrap BWINDOW_bootstrap;
 #endif
-/* MacOS X gets the proper defines from configure */
-#if defined(macintosh) && !defined(MACOSX)
-#define ENABLE_TOOLBOX
-#if !TARGET_API_MAC_CARBON
-#define ENABLE_DRAWSPROCKET
-#endif
-#endif
-#ifdef ENABLE_TOOLBOX
+#if SDL_VIDEO_DRIVER_TOOLBOX
 extern VideoBootStrap TOOLBOX_bootstrap;
 #endif
-#ifdef ENABLE_DRAWSPROCKET
+#if SDL_VIDEO_DRIVER_DRAWSPROCKET
 extern VideoBootStrap DSp_bootstrap;
 #endif
-#ifdef ENABLE_QUARTZ
-extern VideoBootStrap QZ_bootstrap;
-#endif
-#ifdef ENABLE_CYBERGRAPHICS
+#if SDL_VIDEO_DRIVER_CYBERGRAPHICS
 extern VideoBootStrap CGX_bootstrap;
 #endif
-#ifdef ENABLE_PHOTON
+#if SDL_VIDEO_DRIVER_PHOTON
 extern VideoBootStrap ph_bootstrap;
 #endif
-#ifdef ENABLE_EPOC
+#if SDL_VIDEO_DRIVER_EPOC
 extern VideoBootStrap EPOC_bootstrap;
 #endif
-#ifdef ENABLE_DUMMYVIDEO
-extern VideoBootStrap DUMMY_bootstrap;
-#endif
-#ifdef ENABLE_XBIOS
+#if SDL_VIDEO_DRIVER_XBIOS
 extern VideoBootStrap XBIOS_bootstrap;
 #endif
-#ifdef ENABLE_GEM
+#if SDL_VIDEO_DRIVER_GEM
 extern VideoBootStrap GEM_bootstrap;
 #endif
-#ifdef ENABLE_QTOPIA
-extern VideoBootStrap Qtopia_bootstrap;
-#endif
-#ifdef ENABLE_WSCONS
-extern VideoBootStrap WSCONS_bootstrap;
-#endif
-#ifdef ENABLE_PICOGUI
+#if SDL_VIDEO_DRIVER_PICOGUI
 extern VideoBootStrap PG_bootstrap;
 #endif
-#ifdef ENABLE_DC
+#if SDL_VIDEO_DRIVER_DC
 extern VideoBootStrap DC_bootstrap;
 #endif
-#ifdef ENABLE_RISCOS
+#if SDL_VIDEO_DRIVER_RISCOS
 extern VideoBootStrap RISCOS_bootstrap;
 #endif
-#ifdef __OS2__
+#if SDL_VIDEO_DRIVER_OS2FS
 extern VideoBootStrap OS2FSLib_bootstrap;
 #endif
+#if SDL_VIDEO_DRIVER_AALIB
+extern VideoBootStrap AALIB_bootstrap;
+#endif
+#if SDL_VIDEO_DRIVER_DUMMY
+extern VideoBootStrap DUMMY_bootstrap;
+#endif
+
 /* This is the current video device */
 extern SDL_VideoDevice *current_video;
 
--- a/src/video/SDL_video.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_video.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,102 +24,102 @@
 
 #include "SDL.h"
 #include "SDL_sysvideo.h"
-#include "SDL_sysevents.h"
 #include "SDL_blit.h"
 #include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
 #include "SDL_cursor_c.h"
+#include "../events/SDL_sysevents.h"
+#include "../events/SDL_events_c.h"
 
 /* Available video drivers */
 static VideoBootStrap *bootstrap[] = {
-#ifdef ENABLE_QUARTZ
+#if SDL_VIDEO_DRIVER_QUARTZ
 	&QZ_bootstrap,
 #endif
-#ifdef ENABLE_X11
+#if SDL_VIDEO_DRIVER_X11
 	&X11_bootstrap,
 #endif
-#ifdef ENABLE_DGA
+#if SDL_VIDEO_DRIVER_DGA
 	&DGA_bootstrap,
 #endif
-#ifdef ENABLE_NANOX
+#if SDL_VIDEO_DRIVER_NANOX
 	&NX_bootstrap,
 #endif
-#ifdef ENABLE_IPOD
+#if SDL_VIDEO_DRIVER_IPOD
 	&iPod_bootstrap,
 #endif
-#ifdef ENABLE_QTOPIA
+#if SDL_VIDEO_DRIVER_QTOPIA
 	&Qtopia_bootstrap,
 #endif
-#ifdef ENABLE_WSCONS
+#if SDL_VIDEO_DRIVER_WSCONS
 	&WSCONS_bootstrap,
 #endif
-#ifdef ENABLE_FBCON
+#if SDL_VIDEO_DRIVER_FBCON
 	&FBCON_bootstrap,
 #endif
-#ifdef ENABLE_DIRECTFB
+#if SDL_VIDEO_DRIVER_DIRECTFB
 	&DirectFB_bootstrap,
 #endif
-#ifdef ENABLE_PS2GS
+#if SDL_VIDEO_DRIVER_PS2GS
 	&PS2GS_bootstrap,
 #endif
-#ifdef ENABLE_GGI
+#if SDL_VIDEO_DRIVER_GGI
 	&GGI_bootstrap,
 #endif
-#ifdef ENABLE_VGL
+#if SDL_VIDEO_DRIVER_VGL
 	&VGL_bootstrap,
 #endif
-#ifdef ENABLE_SVGALIB
+#if SDL_VIDEO_DRIVER_SVGALIB
 	&SVGALIB_bootstrap,
 #endif
-#ifdef ENABLE_AALIB
+#if SDL_VIDEO_DRIVER_GAPI
+	&GAPI_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_WINDIB
+	&WINDIB_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DDRAW
+	&DIRECTX_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_BWINDOW
+	&BWINDOW_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_TOOLBOX
+	&TOOLBOX_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DRAWSPROCKET
+	&DSp_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_CYBERGRAPHICS
+	&CGX_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_PHOTON
+	&ph_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_EPOC
+	&EPOC_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_XBIOS
+	&XBIOS_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_GEM
+	&GEM_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_PICOGUI
+	&PG_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DC
+	&DC_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_RISCOS
+	&RISCOS_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_OS2FS
+	&OS2FSLib_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_AALIB
 	&AALIB_bootstrap,
 #endif
-#ifdef ENABLE_GAPI
-	&GAPI_bootstrap,
-#endif
-#ifdef ENABLE_WINDIB
-	&WINDIB_bootstrap,
-#endif
-#ifdef ENABLE_DIRECTX
-	&DIRECTX_bootstrap,
-#endif
-#ifdef ENABLE_BWINDOW
-	&BWINDOW_bootstrap,
-#endif
-#ifdef ENABLE_TOOLBOX
-	&TOOLBOX_bootstrap,
-#endif
-#ifdef ENABLE_DRAWSPROCKET
-	&DSp_bootstrap,
-#endif
-#ifdef ENABLE_CYBERGRAPHICS
-	&CGX_bootstrap,
-#endif
-#ifdef ENABLE_PHOTON
-	&ph_bootstrap,
-#endif
-#ifdef ENABLE_EPOC
-	&EPOC_bootstrap,
-#endif
-#ifdef ENABLE_XBIOS
-	&XBIOS_bootstrap,
-#endif
-#ifdef ENABLE_GEM
-	&GEM_bootstrap,
-#endif
-#ifdef ENABLE_PICOGUI
-	&PG_bootstrap,
-#endif
-#ifdef ENABLE_DC
-	&DC_bootstrap,
-#endif
-#ifdef ENABLE_RISCOS
-	&RISCOS_bootstrap,
-#endif
-#ifdef __OS2__
-	&OS2FSLib_bootstrap,
-#endif
-#ifdef ENABLE_DUMMYVIDEO
+#if SDL_VIDEO_DRIVER_DUMMY
 	&DUMMY_bootstrap,
 #endif
 	NULL
@@ -133,7 +133,7 @@
 void SDL_GL_UpdateRectsLock(SDL_VideoDevice* this, int numrects, SDL_Rect* rects);
 
 static SDL_GrabMode SDL_WM_GrabInputOff(void);
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 static int lock_count = 0;
 #endif
 
@@ -743,7 +743,7 @@
 	SDL_WM_GrabInput(saved_grab);
 	SDL_GetRelativeMouseState(NULL, NULL); /* Clear first large delta */
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* Load GL symbols (before MakeCurrent, where we need glGetString). */
 	if ( flags & (SDL_OPENGL | SDL_OPENGLBLIT) ) {
 
@@ -769,7 +769,7 @@
 #include "SDL_glfuncs.h"
 #undef SDL_PROC	
 	}
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 	/* If we're running OpenGL, make the context current */
 	if ( (video->screen->flags & SDL_OPENGL) &&
@@ -782,7 +782,7 @@
 	/* Set up a fake SDL surface for OpenGL "blitting" */
 	if ( (flags & SDL_OPENGLBLIT) == SDL_OPENGLBLIT ) {
 		/* Load GL functions for performing the texture updates */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 		/* Create a software surface for blitting */
 #ifdef GL_VERSION_1_2
@@ -857,7 +857,7 @@
 
 		video->UpdateRects = SDL_GL_UpdateRectsLock;
 #else
-		SDL_SetError("Somebody forgot to #define HAVE_OPENGL");
+		SDL_SetError("Somebody forgot to #define SDL_VIDEO_OPENGL");
 		return(NULL);
 #endif
 	}
@@ -1513,7 +1513,7 @@
 /* Update rects without state setting and changing (the caller is responsible for it) */
 void SDL_GL_UpdateRects(int numrects, SDL_Rect *rects)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	SDL_VideoDevice *this = current_video;
 	SDL_Rect update, tmp;
 	int x, y, i;
@@ -1587,7 +1587,7 @@
 /* Lock == save current state */
 void SDL_GL_Lock()
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	lock_count--;
 	if (lock_count==-1)
 	{
@@ -1635,7 +1635,7 @@
 /* Unlock == restore saved state */
 void SDL_GL_Unlock()
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	lock_count++;
 	if (lock_count==0)
 	{
--- a/src/video/SDL_yuv_mmx.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_yuv_mmx.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,7 @@
 
 #include "SDL_stdinc.h"
 
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if i386 && __GNUC__ && SDL_ASSEMBLY_BLITTERS
 
 #define ASM_ARRAY(x) x[] __asm__("_" #x) __attribute__((used))
  
--- a/src/video/SDL_yuv_sw.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/SDL_yuv_sw.c	Thu Feb 16 10:11:48 2006 +0000
@@ -1058,7 +1058,7 @@
 	    case SDL_YV12_OVERLAY:
 	    case SDL_IYUV_OVERLAY:
 		if ( display->format->BytesPerPixel == 2 ) {
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if i386 && __GNUC__ && SDL_ASSEMBLY_BLITTERS
 			/* inline assembly functions */
 			if ( SDL_HasMMX() && (Rmask == 0xF800) &&
 			                     (Gmask == 0x07E0) &&
@@ -1080,7 +1080,7 @@
 			swdata->Display2X = Color24DitherYV12Mod2X;
 		}
 		if ( display->format->BytesPerPixel == 4 ) {
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if i386 && __GNUC__ && SDL_ASSEMBLY_BLITTERS
 			/* inline assembly functions */
 			if ( SDL_HasMMX() && (Rmask == 0x00FF0000) &&
 			                     (Gmask == 0x0000FF00) &&
--- a/src/video/Xext/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-SUBDIRS = extensions Xinerama Xv Xxf86dga Xxf86vm XME
-
-EXTRA_DIST = README
--- a/src/video/Xext/XME/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-
-## Makefile.am for the XME library
-
-noinst_LTLIBRARIES = libXME.la
-libXME_la_SOURCES = xme.c
-
--- a/src/video/Xext/XME/xme.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/XME/xme.c	Thu Feb 16 10:11:48 2006 +0000
@@ -19,7 +19,7 @@
 #include <X11/Xmd.h>
 #include <X11/Xproto.h>
 #include <X11/extensions/Xext.h>
-#include "extutil.h"
+#include "../extensions/extutil.h"
 
 #include "../../x11/SDL_x11dyn.h"
 
--- a/src/video/Xext/Xinerama/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-## Makefile.am for the XFree86 Xinerama library
-
-noinst_LTLIBRARIES = libXext_Xinerama.la
-libXext_Xinerama_la_SOURCES = Xinerama.c
--- a/src/video/Xext/Xinerama/Xinerama.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xinerama/Xinerama.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,10 +30,10 @@
 #include <X11/Xlibint.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/Xext.h>	/* in ../include */
-#include "extutil.h"			/* in ../include */
-#include "panoramiXext.h"
-#include "panoramiXproto.h"		/* in ../include */
-#include "Xinerama.h"
+#include "../extensions/extutil.h"			/* in ../include */
+#include "../extensions/panoramiXext.h"
+#include "../extensions/panoramiXproto.h"		/* in ../include */
+#include "../extensions/Xinerama.h"
 
 #include "../../x11/SDL_x11dyn.h"
 
--- a/src/video/Xext/Xv/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-## Makefile.am for the XFree86 Xv library
-
-noinst_LTLIBRARIES = libXext_Xv.la
-libXext_Xv_la_SOURCES = Xv.c Xvlibint.h
--- a/src/video/Xext/Xv/Xv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xv/Xv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -54,7 +54,7 @@
 #include "Xvlibint.h"
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/XShm.h>
-#include "extutil.h"
+#include "../extensions/extutil.h"
 
 #include "../../x11/SDL_x11dyn.h"
 
--- a/src/video/Xext/Xv/Xvlibint.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xv/Xvlibint.h	Thu Feb 16 10:11:48 2006 +0000
@@ -44,8 +44,8 @@
 #define NEED_REPLIES
 
 #include <X11/Xlibint.h>
-#include "Xvproto.h"
-#include "Xvlib.h"
+#include "../extensions/Xvproto.h"
+#include "../extensions/Xvlib.h"
 
 #if !defined(UNIXCPP)
 #define XvGetReq(name, req) \
--- a/src/video/Xext/Xxf86dga/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-## Makefile.am for the XFree86 Xxf86dga library
-
-noinst_LTLIBRARIES = libXext_Xxf86dga.la
-libXext_Xxf86dga_la_SOURCES = XF86DGA2.c XF86DGA.c
--- a/src/video/Xext/Xxf86dga/XF86DGA.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xxf86dga/XF86DGA.c	Thu Feb 16 10:11:48 2006 +0000
@@ -59,10 +59,10 @@
 #define NEED_EVENTS
 #define NEED_REPLIES
 #include <X11/Xlibint.h>
-#include "xf86dga.h"
-#include "xf86dgastr.h"
+#include "../extensions/xf86dga.h"
+#include "../extensions/xf86dgastr.h"
 #include <X11/extensions/Xext.h>
-#include "extutil.h"
+#include "../extensions/extutil.h"
 
 #include "../../x11/SDL_x11dyn.h"
 
@@ -341,7 +341,7 @@
 /* Helper functions */
 
 #include <X11/Xmd.h>
-#include <Xext/extensions/xf86dga.h>
+#include "../extensions/xf86dga.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
--- a/src/video/Xext/Xxf86dga/XF86DGA2.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xxf86dga/XF86DGA2.c	Thu Feb 16 10:11:48 2006 +0000
@@ -17,10 +17,10 @@
 #define NEED_EVENTS
 #define NEED_REPLIES
 #include <X11/Xlibint.h>
-#include "xf86dga.h"
-#include "xf86dgastr.h"
+#include "../extensions/xf86dga.h"
+#include "../extensions/xf86dgastr.h"
 #include <X11/extensions/Xext.h>
-#include "extutil.h"
+#include "../extensions/extutil.h"
 #include <stdio.h>
 
 #if defined(ENABLE_FBCON)  /* Needed for framebuffer console support */
--- a/src/video/Xext/Xxf86vm/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-## Makefile.am for the XFree86 Xxf86vm library
-
-noinst_LTLIBRARIES = libXext_Xxf86vm.la
-libXext_Xxf86vm_la_SOURCES = XF86VMode.c
--- a/src/video/Xext/Xxf86vm/XF86VMode.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/Xxf86vm/XF86VMode.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,9 +37,9 @@
 #define NEED_REPLIES
 #ifndef XBUILD_IN_CLIENT
 #include <X11/Xlibint.h>
-#include "xf86vmstr.h"
+#include "../extensions/xf86vmstr.h"
 #include <X11/extensions/Xext.h>
-#include "extutil.h"
+#include "../extensions/extutil.h"
 #else
 #include "lib/X11/Xlibint.h"
 #include "include/extensions/xf86vmstr.h"
--- a/src/video/Xext/extensions/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-noinst_HEADERS =	\
-	extutil.h	\
-	panoramiXext.h	\
-	panoramiXproto.h \
-	xf86dga1.h	\
-	xf86dga1str.h	\
-	xf86dga.h	\
-	xf86dgastr.h	\
-	xf86vmode.h	\
-	xf86vmstr.h	\
-	Xinerama.h	\
-	Xv.h		\
-	Xvlib.h		\
-	Xvproto.h	\
-	xme.h
-
--- a/src/video/Xext/extensions/Xvlib.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/extensions/Xvlib.h	Thu Feb 16 10:11:48 2006 +0000
@@ -54,7 +54,7 @@
 */
 
 #include <X11/Xfuncproto.h>
-#include <Xext/extensions/Xv.h>
+#include "Xv.h"
 #include "SDL_name.h"
 
 typedef struct {
--- a/src/video/Xext/extensions/xf86dga.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/extensions/xf86dga.h	Thu Feb 16 10:11:48 2006 +0000
@@ -7,7 +7,7 @@
 #define _XF86DGA_H_
 
 #include <X11/Xfuncproto.h>
-#include <Xext/extensions/xf86dga1.h>
+#include "xf86dga1.h"
 #include "SDL_name.h"
 
 #define X_XDGAQueryVersion		0
--- a/src/video/Xext/extensions/xf86dgastr.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/extensions/xf86dgastr.h	Thu Feb 16 10:11:48 2006 +0000
@@ -9,7 +9,7 @@
 #ifndef _XF86DGASTR_H_
 #define _XF86DGASTR_H_
 
-#include <Xext/extensions/xf86dga1str.h>
+#include "xf86dga1str.h"
 
 #define XF86DGANAME "XFree86-DGA"
 
--- a/src/video/Xext/extensions/xf86vmstr.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/Xext/extensions/xf86vmstr.h	Thu Feb 16 10:11:48 2006 +0000
@@ -35,7 +35,7 @@
 #ifndef _XF86VIDMODESTR_H_
 #define _XF86VIDMODESTR_H_
 
-#include <Xext/extensions/xf86vmode.h>
+#include "xf86vmode.h"
 
 #define XF86VIDMODENAME "XFree86-VidModeExtension"
 
--- a/src/video/aalib/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for SDL using the AAlib video driver
-
-noinst_LTLIBRARIES = libvideo_aa.la
-libvideo_aa_la_SOURCES = $(AA_SRCS)
-
-# The SDL AAlib video driver sources
-AA_SRCS = 			\
-	SDL_aavideo.h		\
-	SDL_aaevents.c	\
-	SDL_aaevents_c.h	\
-	SDL_aamouse.c		\
-	SDL_aamouse_c.h	\
-	SDL_aavideo.c
-
--- a/src/video/aalib/SDL_aaevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/aalib/SDL_aaevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,8 +27,8 @@
 #include <aalib.h>
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_aavideo.h"
 #include "SDL_aaevents_c.h"
 
--- a/src/video/aalib/SDL_aamouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/aalib/SDL_aamouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #include <stdio.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_aamouse_c.h"
 
--- a/src/video/aalib/SDL_aavideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/aalib/SDL_aavideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,9 +29,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_aavideo.h"
 #include "SDL_aaevents_c.h"
--- a/src/video/aalib/SDL_aavideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/aalib/SDL_aavideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #define _SDL_aavideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 #include <aalib.h>
 
--- a/src/video/ataricommon/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-
-## Makefile.am for SDL using the Atari bios
-
-noinst_LTLIBRARIES = libvideo_ataricommon.la
-libvideo_ataricommon_la_SOURCES = $(ATARICOMMON_SRCS)
-
-# The SDL Atari bios driver sources
-ATARICOMMON_SRCS = 	\
-	SDL_ataric2p.S	\
-	SDL_ataric2p_s.h	\
-	SDL_atarieddi.S	\
-	SDL_atarieddi_s.h	\
-	SDL_atarievents.c	\
-	SDL_atarievents_c.h	\
-	SDL_atarigl.c	\
-	SDL_atarigl_c.h	\
-	SDL_atarikeys.h	\
-	SDL_atarimxalloc.c	\
-	SDL_atarimxalloc_c.h	\
-	SDL_biosevents.c	\
-	SDL_biosevents_c.h	\
-	SDL_gemdosevents.c	\
-	SDL_gemdosevents_c.h \
-	SDL_ikbdevents.c	\
-	SDL_ikbdevents_c.h \
-	SDL_ikbdinterrupt.S	\
-	SDL_ikbdinterrupt_s.h \
-	SDL_xbiosevents.c \
-	SDL_xbiosevents_c.h \
-	SDL_xbiosinterrupt.S \
-	SDL_xbiosinterrupt_s.h
--- a/src/video/ataricommon/SDL_atarievents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_atarievents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 
 #include <mint/cookie.h>
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_atarievents_c.h"
 #include "SDL_biosevents_c.h"
--- a/src/video/ataricommon/SDL_atarievents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_atarievents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_ATARI_EVENTS_H_
 #define _SDL_ATARI_EVENTS_H_
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ataricommon/SDL_atarigl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_atarigl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 /*--- Includes ---*/
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #include <GL/osmesa.h>
 #endif
 
@@ -33,7 +33,7 @@
 #include "SDL_endian.h"
 #include "SDL_video.h"
 #include "SDL_atarigl_c.h"
-#ifdef ENABLE_OSMESA_SHARED
+#if SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
 #include "SDL_loadso.h"
 #endif
 
@@ -49,7 +49,7 @@
 
 static void SDL_AtariGL_UnloadLibrary(_THIS);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 static void CopyShadowNull(_THIS, SDL_Surface *surface);
 static void CopyShadowDirect(_THIS, SDL_Surface *surface);
 static void CopyShadowRGBTo555(_THIS, SDL_Surface *surface);
@@ -76,7 +76,7 @@
 
 int SDL_AtariGL_Init(_THIS, SDL_Surface *current)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (gl_oldmesa) {
 		gl_active = InitOld(this, current);		
 	} else {
@@ -89,7 +89,7 @@
 
 void SDL_AtariGL_Quit(_THIS, SDL_bool unload)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (gl_oldmesa) {
 		/* Old mesa implementations */
 		if (this->gl_data->OSMesaDestroyLDG) {
@@ -113,15 +113,15 @@
 		SDL_AtariGL_UnloadLibrary(this);
 	}
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 	gl_active = 0;
 }
 
 int SDL_AtariGL_LoadLibrary(_THIS, const char *path)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
-#ifdef ENABLE_OSMESA_SHARED
+#if SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
 	void *handle;
 	SDL_bool cancel_load;
 
@@ -237,7 +237,7 @@
 void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc)
 {
 	void *func = NULL;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 	if (this->gl_config.dll_handle) {
 		func = SDL_LoadFunction(this->gl_config.dll_handle, (void *)proc);
@@ -251,7 +251,7 @@
 
 int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	GLenum mesa_attrib;
 	SDL_Surface *surface;
 
@@ -307,7 +307,7 @@
 
 int SDL_AtariGL_MakeCurrent(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	SDL_Surface *surface;
 	GLenum type;
 
@@ -351,7 +351,7 @@
 
 void SDL_AtariGL_SwapBuffers(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (gl_active) {
 		if (this->gl_config.dll_handle) {
 			if (this->gl_data->glFinish) {
@@ -370,7 +370,7 @@
 
 void SDL_AtariGL_InitPointers(_THIS)
 {
-#if defined(HAVE_OPENGL)
+#if SDL_VIDEO_OPENGL
 	this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
 	this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
 	this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
@@ -390,7 +390,7 @@
 
 static void SDL_AtariGL_UnloadLibrary(_THIS)
 {
-#if defined(HAVE_OPENGL)
+#if SDL_VIDEO_OPENGL
 	if (this->gl_config.dll_handle) {
 		SDL_UnloadObject(this->gl_config.dll_handle);
 		this->gl_config.dll_handle = NULL;
@@ -403,7 +403,7 @@
 
 /*--- Creation of an OpenGL context using new/old functions ---*/
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 static int InitNew(_THIS, SDL_Surface *current)
 {
 	GLenum osmesa_format;
@@ -1084,4 +1084,4 @@
 	}
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
--- a/src/video/ataricommon/SDL_atarigl_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_atarigl_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,11 +25,13 @@
 #ifndef _SDL_ATARIGL_H_
 #define _SDL_ATARIGL_H_
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #include <GL/osmesa.h>
 #endif
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
+
+/* Hidden "this" pointer for the video functions */
 #define _THIS   SDL_VideoDevice *this
 
 struct SDL_PrivateGLData {
@@ -50,7 +52,7 @@
 	/* to convert the shadow buffer to the screen format */
 	void (*CopyShadow)(_THIS, SDL_Surface *surface);	
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	OSMesaContext	ctx;
 
 	/* OpenGL functions */
--- a/src/video/ataricommon/SDL_biosevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_biosevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 #include <mint/osbind.h>
 #include <mint/cookie.h>
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
--- a/src/video/ataricommon/SDL_biosevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_biosevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_ATARI_BIOSEVENTS_H_
 #define _SDL_ATARI_BIOSEVENTS_H_
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ataricommon/SDL_gemdosevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_gemdosevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 #include <mint/osbind.h>
 #include <mint/cookie.h>
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
--- a/src/video/ataricommon/SDL_gemdosevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_gemdosevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_ATARI_GEMDOSEVENTS_H_
 #define _SDL_ATARI_GEMDOSEVENTS_H_
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ataricommon/SDL_ikbdevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_ikbdevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,8 +29,8 @@
 /* Mint includes */
 #include <mint/osbind.h>
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
--- a/src/video/ataricommon/SDL_ikbdevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_ikbdevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_ATARI_IKBDEVENTS_H_
 #define _SDL_ATARI_IKBDEVENTS_H_
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ataricommon/SDL_xbiosevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,7 +28,7 @@
 
 #include <mint/osbind.h>
 
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_xbiosevents_c.h"
 #include "SDL_xbiosinterrupt_s.h"
 
--- a/src/video/ataricommon/SDL_xbiosevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #ifndef _SDL_ATARI_XBIOSEVENTS_H_
 #define _SDL_ATARI_XBIOSEVENTS_H_
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/bwindow/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-
-## Makefile.am for SDL using the BeOS BWindow video driver
-
-noinst_LTLIBRARIES = libvideo_bwindow.la
-libvideo_bwindow_la_SOURCES = $(BWINDOW_SRCS)
-
-# The SDL BWindow video driver sources
-BWINDOW_SRCS = 			\
-	SDL_BView.h		\
-	SDL_BWin.h		\
-	SDL_lowvideo.h		\
-	SDL_sysevents.cc	\
-	SDL_sysevents_c.h	\
-	SDL_sysmouse.cc		\
-	SDL_sysmouse_c.h	\
-	SDL_sysvideo.cc		\
-	SDL_syswm.cc		\
-	SDL_syswm_c.h		\
-	SDL_sysyuv.cc		\
-	SDL_sysyuv.h
-
--- a/src/video/bwindow/SDL_BView.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_BView.h	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 /* This is the event handling and graphics update portion of SDL_BWin */
 
 extern "C" {
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 };
 
 class SDL_BView : public BView
--- a/src/video/bwindow/SDL_BWin.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_BWin.h	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 #include <AppKit.h>
 #include <InterfaceKit.h>
 #include <be/game/DirectWindow.h>
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #include <be/opengl/GLView.h>
 #endif
 #include <support/UTF8.h>
@@ -37,7 +37,7 @@
 #include "SDL_BView.h"
 
 extern "C" {
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 };
 
 class SDL_BWin : public BDirectWindow
@@ -49,7 +49,7 @@
 		last_buttons = 0;
 
 		the_view = NULL;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 		SDL_GLView = NULL;
 #endif
 		SDL_View = NULL;
@@ -61,7 +61,7 @@
 	virtual ~SDL_BWin() {
 		Lock();
 		if ( the_view ) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 			if ( the_view == SDL_GLView ) {
 				SDL_GLView->UnlockGL();
 			}
@@ -70,7 +70,7 @@
 			the_view = NULL;
 		}
 		Unlock();
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 		if ( SDL_GLView ) {
 			delete SDL_GLView;
 		}
@@ -218,7 +218,7 @@
 		retval = 0;
 		Lock();
 		if ( flags & SDL_OPENGL ) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 			if ( SDL_GLView == NULL ) {
 				SDL_GLView = new BGLView(Bounds(), "SDL GLView",
 					 	B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS),
@@ -242,7 +242,7 @@
 			}
 			if ( the_view != SDL_View ) {
 				if ( the_view ) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 					if ( the_view == SDL_GLView ) {
 						SDL_GLView->UnlockGL();
 					}
@@ -260,7 +260,7 @@
 		SDL_View->SetBitmap(bitmap);
 	}
 	virtual void SetXYOffset(int x, int y) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 		if ( the_view == SDL_GLView ) {
 			return;
 		}
@@ -268,7 +268,7 @@
 		SDL_View->SetXYOffset(x, y);		
 	}
 	virtual void GetXYOffset(int &x, int &y) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 		if ( the_view == SDL_GLView ) {
 			x = 0;
 			y = 0;
@@ -287,7 +287,7 @@
 		SDL_View->Sync();
 		Unlock();
 	}
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	virtual void SwapBuffers(void) {
 		SDL_GLView->UnlockGL();
 		SDL_GLView->LockGL();
@@ -540,7 +540,7 @@
 	}
 
 private:
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	BGLView *SDL_GLView;
 #endif
 	SDL_BView *SDL_View;
--- a/src/video/bwindow/SDL_lowvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_lowvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 
 #include "SDL_BWin.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *_this
--- a/src/video/bwindow/SDL_sysevents.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_sysevents.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 
 extern "C" {
 
-#include "SDL_events_c.h"
-#include "SDL_sysevents.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_sysevents_c.h"
 
 void BE_PumpEvents(_THIS)
--- a/src/video/bwindow/SDL_sysvideo.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_sysvideo.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -27,18 +27,18 @@
 #include "SDL_BeApp.h"
 #include "SDL_BWin.h"
 #include "SDL_timer.h"
-#include "blank_cursor.h"
 
 extern "C" {
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_sysmouse_c.h"
-#include "SDL_sysevents_c.h"
-#include "SDL_events_c.h"
 #include "SDL_syswm_c.h"
 #include "SDL_lowvideo.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 #include "SDL_sysyuv.h"
+#include "../blank_cursor.h"
 
 #define BEOS_HIDDEN_SIZE	32	/* starting hidden window size */
 
@@ -60,7 +60,7 @@
 static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
 
 /* OpenGL functions */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 static int BE_GL_LoadLibrary(_THIS, const char *path);
 static void* BE_GL_GetProcAddress(_THIS, const char *proc);
 static int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
@@ -123,7 +123,7 @@
 	device->FlipHWSurface = NULL;
 	device->FreeHWSurface = BE_FreeHWSurface;
 	/* Gamma support */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* OpenGL support */
 	device->GL_LoadLibrary = BE_GL_LoadLibrary;
 	device->GL_GetProcAddress = BE_GL_GetProcAddress;
@@ -303,7 +303,7 @@
 	bounds.bottom = BEOS_HIDDEN_SIZE;
 	SDL_Win = new SDL_BWin(bounds);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* testgl application doesn't load library, just tries to load symbols */
 	/* is it correct? if so we have to load library here */
 	BE_GL_LoadLibrary(_this, NULL);
@@ -624,7 +624,7 @@
 	}
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 /* Passing a NULL path means load pointers from the application */
 int BE_GL_LoadLibrary(_THIS, const char *path)
 {
@@ -815,7 +815,7 @@
 		_this->screen->pixels = NULL;
 	}
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (_this->gl_config.dll_handle != NULL)
 		unload_add_on((image_id)_this->gl_config.dll_handle);
 #endif
--- a/src/video/bwindow/SDL_sysyuv.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/bwindow/SDL_sysyuv.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_video.h"
 #include "SDL_sysyuv.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 extern "C" {
 
--- a/src/video/cybergfx/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-
-## Makefile.am for SDL using the CyberGFX video driver
-
-noinst_LTLIBRARIES = libvideo_cgx.la
-libvideo_cgx_la_SOURCES = $(CGX_SRCS)
-
-# The SDL CyberGFX video driver sources
-CGX_SRCS = 			\
-	SDL_amigaevents.c	\
-	SDL_amigaevents_c.h	\
-	SDL_amigamouse.c	\
-	SDL_amigamouse_c.h	\
-	SDL_cgxaccel.c		\
-	SDL_cgxgl.c		\
-	SDL_cgxgl_c.h		\
-	SDL_cgximage.c		\
-	SDL_cgximage_c.h	\
-	SDL_cgxmodes.c		\
-	SDL_cgxmodes_c.h	\
-	SDL_cgxvideo.c		\
-	SDL_cgxvideo.h		\
-	SDL_cgxwm.c		\
-	SDL_cgxwm_c.h		\
-	SDL_cgxyuv.c		\
-	SDL_cgxyuv_c.h
--- a/src/video/cybergfx/SDL_amigaevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_amigaevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,9 +24,9 @@
 #include "SDL.h"
 
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_cgxvideo.h"
 #include "SDL_cgxmodes_c.h"
 #include "SDL_cgximage_c.h"
--- a/src/video/cybergfx/SDL_amigamouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_amigamouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,8 +21,8 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_amigamouse_c.h"
 
 
@@ -73,40 +73,4 @@
 /* Check to see if we need to enter or leave mouse relative mode */
 void amiga_CheckMouseMode(_THIS)
 {
-	/* If the mouse is hidden and input is grabbed, we use relative mode */
-#if 0
-	SDL_Lock_EventThread();
-	if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
-	     (this->input_grab != SDL_GRAB_OFF) ) {
-		mouse_relative = 1;
-		X11_EnableDGAMouse(this);
-		if ( ! (using_dga & DGA_MOUSE) ) {
-			char *use_mouse_accel;
-
-			SDL_GetMouseState(&mouse_last.x, &mouse_last.y);
-			/* Use as raw mouse mickeys as possible */
-			XGetPointerControl(SDL_Display,
-						&mouse_accel.numerator, 
-						&mouse_accel.denominator,
-						&mouse_accel.threshold);
-			use_mouse_accel = SDL_getenv("SDL_VIDEO_X11_MOUSEACCEL");
-			if ( use_mouse_accel ) {
-				SetMouseAccel(this, use_mouse_accel);
-			}
-		}
-	} else {
-		if ( mouse_relative ) {
-			if ( using_dga & DGA_MOUSE ) {
-				X11_DisableDGAMouse(this);
-			} else {
-				XChangePointerControl(SDL_Display, True, True,
-						mouse_accel.numerator, 
-						mouse_accel.denominator,
-						mouse_accel.threshold);
-			}
-			mouse_relative = 0;
-		}
-	}
-	SDL_Unlock_EventThread();
-#endif
 }
--- a/src/video/cybergfx/SDL_cgxaccel.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxaccel.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,8 +22,8 @@
 
 #include "SDL_endian.h"
 #include "SDL_video.h"
-#include "SDL_sysvideo.h"
-#include "SDL_blit.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_blit.h"
 #include "SDL_cgxvideo.h"
 
 static int CGX_HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
--- a/src/video/cybergfx/SDL_cgxgl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxgl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,14 +25,14 @@
 #include "SDL_cgxgl_c.h"
 #include "SDL_cgxvideo.h"
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 AmigaMesaContext glcont=NULL;
 #endif
 
 /* Init OpenGL */
 int CGX_GL_Init(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
    int i = 0;
 	struct TagItem attributes [ 14 ]; /* 14 should be more than enough :) */
    struct Window *win = (struct Window *)SDL_Window;
@@ -101,7 +101,7 @@
 /* Quit OpenGL */
 void CGX_GL_Quit(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if ( glcont != NULL ) {
 		AmigaMesaDestroyContext(glcont);
 		glcont = NULL;
@@ -114,7 +114,7 @@
 /* Attach context to another window */
 int CGX_GL_Update(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	struct TagItem tags[2];
 	struct Window *win = (struct Window*)SDL_Window;
 	if(glcont == NULL) {
@@ -132,7 +132,7 @@
 #endif
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 /* Make the current context active */
 int CGX_GL_MakeCurrent(_THIS)
@@ -207,5 +207,5 @@
 	return 0;
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
--- a/src/video/cybergfx/SDL_cgxgl_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxgl_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -22,13 +22,14 @@
 
 /* StormMesa implementation of SDL OpenGL support */
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
+
 #define _THIS   SDL_VideoDevice *_this
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #include <GL/Amigamesa.h>
 extern void *AmiGetGLProc(const char *proc);
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 struct SDL_PrivateGLData {
 	int gl_active;
@@ -38,7 +39,7 @@
 extern int CGX_GL_Init(_THIS);
 extern void CGX_GL_Quit(_THIS);
 extern int CGX_GL_Update(_THIS);
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 extern int CGX_GL_MakeCurrent(_THIS);
 extern int CGX_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
 extern void CGX_GL_SwapBuffers(_THIS);
--- a/src/video/cybergfx/SDL_cgxmodes.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxmodes.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_timer.h"
 #include "SDL_events.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_cgxvideo.h"
 #include "SDL_cgxwm_c.h"
 #include "SDL_cgxmodes_c.h"
@@ -272,23 +272,6 @@
 		CGX_DestroyWindow(this,this->screen);
 		set_best_resolution(this, real_w,real_h);
 
-        /* Grab the mouse on the fullscreen window
-           The event handling will know when we become active, and then
-           enter fullscreen mode if we can't grab the mouse this time.
-         */
-#if 0
-        if ( (XGrabPointer(SDL_Display, FSwindow, True, 0,
-                          GrabModeAsync, GrabModeAsync,
-                          FSwindow, None, CurrentTime) != GrabSuccess) ||
-             (XGrabKeyboard(SDL_Display, WMwindow, True,
-                          GrabModeAsync, GrabModeAsync, CurrentTime) != 0) ) {
-            XUnmapWindow(SDL_Display, FSwindow);
-            X11_WaitUnmapped(this, FSwindow);
-            X11_QueueEnterFullScreen(this);
-            return(0);
-        }
-#endif
-
         currently_fullscreen = 1;
 		  this->screen->flags = saved_flags;
 
--- a/src/video/cybergfx/SDL_cgxvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,9 +30,9 @@
 #include "SDL_thread.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_cgxgl_c.h"
 #include "SDL_cgxvideo.h"
 #include "SDL_cgxwm_c.h"
@@ -40,7 +40,6 @@
 #include "SDL_amigaevents_c.h"
 #include "SDL_cgxmodes_c.h"
 #include "SDL_cgximage_c.h"
-#include "SDL_cgxyuv_c.h"
 
 /* Initialization/Query functions */
 static int CGX_VideoInit(_THIS, SDL_PixelFormat *vformat);
@@ -208,9 +207,6 @@
 	device->SetVideoMode = CGX_SetVideoMode;
 	device->ToggleFullScreen = CGX_ToggleFullScreen;
 	device->UpdateMouse = CGX_UpdateMouse;
-#ifdef XFREE86_XV
-	device->CreateYUVOverlay = X11_CreateYUVOverlay;
-#endif
 	device->SetColors = CGX_SetColors;
 	device->UpdateRects = NULL;
 	device->VideoQuit = CGX_VideoQuit;
@@ -227,7 +223,7 @@
 	device->GetGamma = CGX_GetGamma;
 	device->SetGammaRamp = CGX_SetGammaRamp;
 	device->GetGammaRamp = NULL;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_LoadLibrary = CGX_GL_LoadLibrary;
 	device->GL_GetProcAddress = CGX_GL_GetProcAddress;
 	device->GL_GetAttribute = CGX_GL_GetAttribute;
--- a/src/video/cybergfx/SDL_cgxvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -44,7 +44,7 @@
 #endif
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 #include "mydebug.h"
 
 #define USE_CGX_WRITELUTPIXEL
--- a/src/video/cybergfx/SDL_cgxwm.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxwm.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #include "SDL_timer.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_events_c.h"
-#include "SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_pixels_c.h"
 #include "SDL_cgxmodes_c.h"
 #include "SDL_cgxwm_c.h"
 
@@ -34,166 +34,7 @@
 
 void CGX_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
 {
-#if 0
-	SDL_Surface *sicon;
-	XWMHints *wmhints;
-	XImage *icon_image;
-	Pixmap icon_pixmap;
-	Pixmap mask_pixmap;
-#ifdef USE_ICON_WINDOW
-	Window icon_window;
-#endif
-	GC GC;
-	XGCValues GCvalues;
-	int i, b, dbpp;
-	SDL_Rect bounds;
-	Uint8 *LSBmask, *color_tried;
-	Visual *dvis;
-
-	/* Lock the event thread, in multi-threading environments */
-	SDL_Lock_EventThread();
-
-	/* The icon must use the default visual, depth and colormap of the
-	   screen, so it might need a conversion */
-	dbpp = DefaultDepth(SDL_Display, SDL_Screen);
-	switch(dbpp) {
-	case 15:
-	    dbpp = 16; break;
-	case 24:
-	    dbpp = 32; break;
-	}
-	dvis = DefaultVisual(SDL_Display, SDL_Screen);
-
-	/* The Visual struct is supposed to be opaque but we cheat a little */
-	sicon = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
-				     dbpp,
-				     dvis->red_mask, dvis->green_mask,
-				     dvis->blue_mask, 0);
-
-	if ( sicon == NULL ) {
-		goto done;
-	}
-	/* If we already have allocated colours from the default colormap,
-	   copy them */
-	if(SDL_Visual == dvis && SDL_XColorMap == SDL_DisplayColormap
-	   && this->screen->format->palette && sicon->format->palette) {
-	    SDL_memcpy(sicon->format->palette->colors,
-		   this->screen->format->palette->colors,
-		   this->screen->format->palette->ncolors * sizeof(SDL_Color));
-	}
-
-	bounds.x = 0;
-	bounds.y = 0;
-	bounds.w = icon->w;
-	bounds.h = icon->h;
-	if ( SDL_LowerBlit(icon, &bounds, sicon, &bounds) < 0 )
-		goto done;
-
-	/* Lock down the colors used in the colormap */
-	color_tried = NULL;
-	if ( sicon->format->BitsPerPixel == 8 ) {
-		SDL_Palette *palette;
-		Uint8 *p;
-		XColor wanted;
-
-		palette = sicon->format->palette;
-		color_tried = SDL_malloc(palette->ncolors);
-		if ( color_tried == NULL ) {
-			goto done;
-		}
-		if ( SDL_iconcolors != NULL ) {
-			SDL_free(SDL_iconcolors);
-		}
-		SDL_iconcolors = SDL_malloc(palette->ncolors
-					* sizeof(*SDL_iconcolors));
-		if ( SDL_iconcolors == NULL ) {
-			SDL_free(color_tried);
-			goto done;
-		}
-		SDL_memset(color_tried, 0, palette->ncolors);
-		SDL_memset(SDL_iconcolors, 0,
-		       palette->ncolors * sizeof(*SDL_iconcolors));
-
-		p = (Uint8 *)sicon->pixels; 
-		for ( i = sicon->w*sicon->h; i > 0; --i, ++p ) {
-			if ( ! color_tried[*p] ) {
-				wanted.pixel = *p;
-				wanted.red   = (palette->colors[*p].r<<8);
-				wanted.green = (palette->colors[*p].g<<8);
-				wanted.blue  = (palette->colors[*p].b<<8);
-				wanted.flags = (DoRed|DoGreen|DoBlue);
-				if (XAllocColor(SDL_Display,
-						SDL_DisplayColormap, &wanted)) {
-					++SDL_iconcolors[wanted.pixel];
-				}
-				color_tried[*p] = 1;
-			}
-		}
-	}
-	if ( color_tried != NULL ) {
-		SDL_free(color_tried);
-	}
-
-	/* Translate mask data to LSB order and set the icon mask */
-	i = (sicon->w/8)*sicon->h;
-	LSBmask = (Uint8 *)SDL_malloc(i);
-	if ( LSBmask == NULL ) {
-		goto done;
-	}
-	SDL_memset(LSBmask, 0, i);
-	while ( --i >= 0 ) {
-		for ( b=0; b<8; ++b )
-			LSBmask[i] |= (((mask[i]>>b)&0x01)<<(7-b));
-	}
-	mask_pixmap = XCreatePixmapFromBitmapData(SDL_Display, WMwindow,
-					LSBmask, sicon->w, sicon->h, 1L, 0L, 1);
-
-	/* Transfer the image to an X11 pixmap */
-	icon_image = XCreateImage(SDL_Display,
-			DefaultVisual(SDL_Display, SDL_Screen),
-			DefaultDepth(SDL_Display, SDL_Screen),
-			ZPixmap, 0, (char *)sicon->pixels, sicon->w, sicon->h,
-			((sicon->format)->BytesPerPixel == 3) ? 32 :
-				(sicon->format)->BytesPerPixel*8, 0);
-	icon_pixmap = XCreatePixmap(SDL_Display, SDL_Root, sicon->w, sicon->h,
-			DefaultDepth(SDL_Display, SDL_Screen));
-	GC = XCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
-	XPutImage(SDL_Display, icon_pixmap, GC, icon_image,
-					0, 0, 0, 0, sicon->w, sicon->h);
-	XFreeGC(SDL_Display, GC);
-	XDestroyImage(icon_image);
-	SDL_free(LSBmask);
-	sicon->pixels = NULL;
-
-#ifdef USE_ICON_WINDOW
-	/* Create an icon window and set the pixmap as its background */
-	icon_window = XCreateSimpleWindow(SDL_Display, SDL_Root,
-					0, 0, sicon->w, sicon->h, 0,
-					CopyFromParent, CopyFromParent);
-	XSetWindowBackgroundPixmap(SDL_Display, icon_window, icon_pixmap);
-	XClearWindow(SDL_Display, icon_window);
-#endif
-
-	/* Set the window icon to the icon pixmap (and icon window) */
-	wmhints = XAllocWMHints();
-	wmhints->flags = (IconPixmapHint | IconMaskHint);
-	wmhints->icon_pixmap = icon_pixmap;
-	wmhints->icon_mask = mask_pixmap;
-#ifdef USE_ICON_WINDOW
-	wmhints->flags |= IconWindowHint;
-	wmhints->icon_window = icon_window;
-#endif
-	XSetWMHints(SDL_Display, WMwindow, wmhints);
-	XFree(wmhints);
-	XSync(SDL_Display, False);
-
-  done:
-	SDL_Unlock_EventThread();
-	if ( sicon != NULL ) {
-		SDL_FreeSurface(sicon);
-	}
-#endif
-	return;
+/* Not yet implemented */
 }
 
 void CGX_SetCaption(_THIS, const char *title, const char *icon)
@@ -205,117 +46,13 @@
 /* Iconify the window */
 int CGX_IconifyWindow(_THIS)
 {
-#if 0
-	int result;
-
-	SDL_Lock_EventThread();
-	result = XIconifyWindow(SDL_Display, WMwindow, SDL_Screen);
-	XSync(SDL_Display, False);
-	SDL_Unlock_EventThread();
-	return(result);
-#else
+/* Not yet implemented */
 	return 0;
-#endif
 }
 
-#if 0
-SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
-{
-	int numtries, result;
-
-	if ( this->screen == NULL ) {
-		return(SDL_GRAB_OFF);
-	}
-	if ( ! SDL_Window ) {
-		return(mode);	/* Will be set later on mode switch */
-	}
-	if ( mode == SDL_GRAB_OFF ) {
-		XUngrabPointer(SDL_Display, CurrentTime);
-		if ( this->screen->flags & SDL_FULLSCREEN ) {
-			/* Rebind the mouse to the fullscreen window */
-			for ( numtries = 0; numtries < 10; ++numtries ) {
-				result = XGrabPointer(SDL_Display, FSwindow,
-						True, 0,
-						GrabModeAsync, GrabModeAsync,
-						FSwindow, None, CurrentTime);
-				if ( result == AlreadyGrabbed ) {
-					break;
-				}
-				SDL_Delay(100);
-			}
-		}
-#ifdef GRAB_FULLSCREEN
-		if ( !(this->screen->flags & SDL_FULLSCREEN) )
-#endif
-		XUngrabKeyboard(SDL_Display, CurrentTime);
-	} else {
-		if ( this->screen->flags & SDL_FULLSCREEN ) {
-			/* Unbind the mouse from the fullscreen window */
-			XUngrabPointer(SDL_Display, CurrentTime);
-		}
-		/* Try to grab the mouse */
-		for ( numtries = 0; numtries < 10; ++numtries ) {
-			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
-						GrabModeAsync, GrabModeAsync,
-						SDL_Window, None, CurrentTime);
-			if ( result != AlreadyGrabbed ) {
-				break;
-			}
-			SDL_Delay(100);
-		}
-#ifdef GRAB_FULLSCREEN
-		if ( !(this->screen->flags & SDL_FULLSCREEN) )
-#endif
-		XGrabKeyboard(SDL_Display, WMwindow, True,
-			GrabModeAsync, GrabModeAsync, CurrentTime);
-	}
-	XSync(SDL_Display, False);
-
-	return(mode);
-}
-
-SDL_GrabMode X11_GrabInput(_THIS, SDL_GrabMode mode)
-{
-	SDL_Lock_EventThread();
-	mode = X11_GrabInputNoLock(this, mode);
-	SDL_Unlock_EventThread();
-
-	return(mode);
-}
-
-/* If 'info' is the right version, this function fills it and returns 1.
-   Otherwise, in case of a version mismatch, it returns -1.
-*/
-static void lock_display(void)
-{
-	SDL_Lock_EventThread();
-}
-static void unlock_display(void)
-{
-	/* Make sure any X11 transactions are completed */
-	SDL_VideoDevice *this = current_video;
-	XSync(SDL_Display, False);
-	SDL_Unlock_EventThread();
-}
-
-#endif
-
 int CGX_GetWMInfo(_THIS, SDL_SysWMinfo *info)
 {
 	if ( info->version.major <= SDL_MAJOR_VERSION ) {
-#if 0
-		info->subsystem = SDL_SYSWM_X11;
-		info->info.x11.display = SDL_Display;
-		info->info.x11.window = SDL_Window;
-		if ( SDL_VERSIONNUM(info->version.major,
-		                    info->version.minor,
-		                    info->version.patch) >= 1002 ) {
-			info->info.x11.fswindow = FSwindow;
-			info->info.x11.wmwindow = WMwindow;
-		}
-		info->info.x11.lock_func = lock_display;
-		info->info.x11.unlock_func = unlock_display;
-#endif
 		return(1);
 	} else {
 		SDL_SetError("Application not compiled with SDL %d.%d\n",
--- a/src/video/cybergfx/SDL_cgxyuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* This is the XFree86 Xv extension implementation of YUV video overlays */
-
-#ifdef XFREE86_XV
-
-#include <X11/Xlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#include <X11/extensions/Xvlib.h>
-
-#include "SDL_video.h"
-#include "SDL_x11yuv_c.h"
-#include "SDL_yuvfuncs.h"
-
-/* The functions used to manipulate software video overlays */
-static struct private_yuvhwfuncs x11_yuvfuncs = {
-	X11_LockYUVOverlay,
-	X11_UnlockYUVOverlay,
-	X11_DisplayYUVOverlay,
-	X11_FreeYUVOverlay
-};
-
-struct private_yuvhwdata {
-	int port;
-	XShmSegmentInfo yuvshm;
-	XvImage *image;
-};
-
-
-SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display)
-{
-	SDL_Overlay *overlay;
-	struct private_yuvhwdata *hwdata;
-	int xv_port;
-	int i, j;
-	int adaptors;
-	XvAdaptorInfo *ainfo;
-	XShmSegmentInfo *yuvshm;
-
-	xv_port = -1;
-	if ( (Success == XvQueryExtension(GFX_Display, &j, &j, &j, &j, &j)) &&
-	     (Success == XvQueryAdaptors(GFX_Display,
-	                                 RootWindow(GFX_Display, SDL_Screen),
-	                                 &adaptors, &ainfo)) ) {
-		for ( i=0; (i<adaptors) && (xv_port == -1); ++i ) {
-			if ( (ainfo[i].type & XvInputMask) &&
-			     (ainfo[i].type & XvImageMask) ) {
-				int num_formats;
-				XvImageFormatValues *formats;
-				formats = XvListImageFormats(GFX_Display,
-				              ainfo[i].base_id, &num_formats);
-				for ( j=0; j<num_formats; ++j ) {
-					if ( (Uint32)formats[j].id == format ) {
-						xv_port = ainfo[i].base_id;
-						break;
-					}
-				}
-			}
-		}
-	}
-	if ( xv_port == -1 ) {
-		SDL_SetError("No available video ports for requested format");
-		return(NULL);
-	}
-
-	/* Create the overlay structure */
-	overlay = (SDL_Overlay *)SDL_malloc(sizeof *overlay);
-	if ( overlay == NULL ) {
-		SDL_OutOfMemory();
-		return(NULL);
-	}
-	SDL_memset(overlay, 0, (sizeof *overlay));
-
-	/* Fill in the basic members */
-	overlay->format = format;
-	overlay->w = width;
-	overlay->h = height;
-
-	/* Set up the YUV surface function structure */
-	overlay->hwfuncs = &x11_yuvfuncs;
-
-	/* Create the pixel data and lookup tables */
-	hwdata = (struct private_yuvhwdata *)SDL_malloc(sizeof *hwdata);
-	overlay->hwdata = hwdata;
-	if ( hwdata == NULL ) {
-		SDL_OutOfMemory();
-		SDL_FreeYUVOverlay(overlay);
-		return(NULL);
-	}
-	yuvshm = &hwdata->yuvshm;
-	SDL_memset(yuvshm, 0, sizeof(*yuvshm));
-	hwdata->port = xv_port;
-	hwdata->image = XvShmCreateImage(GFX_Display, xv_port, format,
-	                                 0, width, height, yuvshm);
-	if ( hwdata->image == NULL ) {
-		SDL_OutOfMemory();
-		SDL_FreeYUVOverlay(overlay);
-		return(NULL);
-	}
-	yuvshm->shmid = shmget(IPC_PRIVATE, hwdata->image->data_size,
-	                       IPC_CREAT | 0777);
-	if ( yuvshm->shmid < 0 ) {
-		SDL_SetError("Unable to get %d bytes shared memory",
-		             hwdata->image->data_size);
-		SDL_FreeYUVOverlay(overlay);
-		return(NULL);
-	}
-	yuvshm->shmaddr  = (caddr_t) shmat(yuvshm->shmid, 0, 0);
-	yuvshm->readOnly = False;
-	hwdata->image->data = yuvshm->shmaddr;
-
-	XShmAttach(GFX_Display, yuvshm);
-	XSync(GFX_Display, False);
-	shmctl(yuvshm->shmid, IPC_RMID, 0);
-
-	/* We're all done.. */
-	return(overlay);
-}
-
-int X11_LockYUVOverlay(_THIS, SDL_Overlay *overlay)
-{
-	overlay->pixels = overlay->hwdata->image->data;
-	/* What should the pitch be set to? */
-	return(0);
-}
-
-void X11_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay)
-{
-	overlay->pixels = NULL;
-}
-
-int X11_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect)
-{
-	struct private_yuvhwdata *hwdata;
-
-	hwdata = overlay->hwdata;
-	XvShmPutImage(GFX_Display, hwdata->port, SDL_Window, SDL_GC,
-	              hwdata->image, 0, 0, overlay->w, overlay->h,
-	              dstrect->x, dstrect->y, dstrect->w, dstrect->h, False);
-	XSync(GFX_Display, False);
-	return(0);
-}
-
-void X11_FreeYUVOverlay(_THIS, SDL_Overlay *overlay)
-{
-	struct private_yuvhwdata *hwdata;
-
-	hwdata = overlay->hwdata;
-	if ( hwdata ) {
-		if ( hwdata->yuvshm.shmaddr ) {
-			XShmDetach(GFX_Display, &hwdata->yuvshm);
-			shmdt(hwdata->yuvshm.shmaddr);
-		}
-		if ( hwdata->image ) {
-			XFree(hwdata->image);
-		}
-		SDL_free(hwdata);
-	}
-}
-
-#endif /* XFREE86_XV */
--- a/src/video/cybergfx/SDL_cgxyuv_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2006 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* This is the XFree86 Xv extension implementation of YUV video overlays */
-
-#include "SDL_video.h"
-#include "SDL_cgxvideo.h"
-
-#ifdef XFREE86_XV
-
-extern SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
-
-extern int X11_LockYUVOverlay(_THIS, SDL_Overlay *overlay);
-
-extern void X11_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay);
-
-extern int X11_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect);
-
-extern void X11_FreeYUVOverlay(_THIS, SDL_Overlay *overlay);
-
-#endif /* XFREE86_XV */
--- a/src/video/dc/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-## Makefile.am for SDL using the Dreamcast video driver
-
-noinst_LTLIBRARIES = libvideo_dc.la
-libvideo_dc_la_SOURCES = $(SRCS)
-
-# The SDL Dreamcast video driver sources
-SRCS = 				\
-	SDL_dcevents.c		\
-	SDL_dcevents_c.h	\
-	SDL_dcmouse.c		\
-	SDL_dcmouse_c.h		\
-	SDL_dcvideo.c		\
-	SDL_dcvideo.h
--- a/src/video/dc/SDL_dcevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dc/SDL_dcevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,8 +21,8 @@
 */
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_dcvideo.h"
 #include "SDL_dcevents_c.h"
 
--- a/src/video/dc/SDL_dcmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dc/SDL_dcmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #include <stdio.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_dcmouse_c.h"
 
--- a/src/video/dc/SDL_dcvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dc/SDL_dcvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,9 +22,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_dcvideo.h"
 #include "SDL_dcevents_c.h"
@@ -33,10 +33,6 @@
 #include <dc/video.h>
 #include <dc/pvr.h>
 
-#ifdef HAVE_OPENGL
-#include <GL/gl.h>
-#endif
-
 
 /* Initialization/Query functions */
 static int DC_VideoInit(_THIS, SDL_PixelFormat *vformat);
@@ -111,7 +107,7 @@
 	device->UnlockHWSurface = DC_UnlockHWSurface;
 	device->FlipHWSurface = DC_FlipHWSurface;
 	device->FreeHWSurface = DC_FreeHWSurface;
-#ifdef	HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_LoadLibrary = DC_GL_LoadLibrary;
 	device->GL_GetProcAddress = DC_GL_GetProcAddress;
 	device->GL_GetAttribute = DC_GL_GetAttribute;
@@ -184,7 +180,7 @@
         512*1024
 };
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 static int pvr_inited;
 #endif
 
@@ -220,7 +216,7 @@
 		Rmask = 0x00ff0000;
 		Gmask = 0x0000ff00;
 		Bmask = 0x000000ff;
-#ifdef	HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 		if (!(flags & SDL_OPENGL))
 #endif
 		break;
@@ -241,7 +237,7 @@
 	current->h = height;
 	current->pitch = pitch;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (pvr_inited) {
 		pvr_inited = 0;
 		pvr_shutdown();
@@ -252,7 +248,7 @@
 
 	current->pixels = vram_s;
 
-#ifdef	HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (flags & SDL_OPENGL) {
 		this->gl_config.driver_loaded = 1;
 		current->flags = SDL_FULLSCREEN | SDL_OPENGL;
@@ -318,7 +314,7 @@
 */
 static void DC_VideoQuit(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (pvr_inited) {
 		pvr_inited = 0;
 		pvr_shutdown();
@@ -326,7 +322,7 @@
 #endif
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 void dmyfunc(void) {}
 
--- a/src/video/dc/SDL_dcvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dc/SDL_dcvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #define _SDL_dcvideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/dga/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-## Makefile.am for SDL using the DGA 2.0 video driver
-
-noinst_LTLIBRARIES = libvideo_dga.la
-libvideo_dga_la_SOURCES = $(DGA_SRCS)
-
-# The SDL DGA 2.0 video driver sources
-DGA_SRCS = 			\
-	SDL_dgaevents.c		\
-	SDL_dgaevents_c.h	\
-	SDL_dgamouse.c		\
-	SDL_dgamouse_c.h	\
-	SDL_dgavideo.c		\
-	SDL_dgavideo.h
--- a/src/video/dga/SDL_dgaevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dga/SDL_dgaevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,10 +24,10 @@
 
 #include <stdio.h>
 #include <X11/Xlib.h>
-#include <Xext/extensions/xf86dga.h>
+#include "../Xext/extensions/xf86dga.h"
 
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_dgavideo.h"
 #include "SDL_dgaevents_c.h"
 
--- a/src/video/dga/SDL_dgamouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dga/SDL_dgamouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #include <stdio.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_dgavideo.h"
 #include "SDL_dgamouse_c.h"
 
--- a/src/video/dga/SDL_dgavideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,13 +26,13 @@
 #include <stdio.h>
 
 #include <X11/Xlib.h>
-#include <Xext/extensions/xf86dga.h>
+#include "../Xext/extensions/xf86dga.h"
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_dgavideo.h"
 #include "SDL_dgamouse_c.h"
 #include "SDL_dgaevents_c.h"
--- a/src/video/dga/SDL_dgavideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 
 #include "SDL_mouse.h"
 #include "SDL_mutex.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/directfb/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-## Makefile.am for SDL using the DirectFB video driver
-
-INCLUDES = $(DIRECTFB_CFLAGS)
-
-noinst_LTLIBRARIES = libvideo_directfb.la
-libvideo_directfb_la_SOURCES = $(DIRECTFB_SRCS)
-libvideo_directfb_la_LIBADD  = $(DIRECTFB_LIBS)
-
-# The SDL DirectFB video driver sources
-DIRECTFB_SRCS = 		\
-	SDL_DirectFB_events.c	\
-	SDL_DirectFB_events.h	\
-	SDL_DirectFB_video.c	\
-	SDL_DirectFB_video.h	\
-	SDL_DirectFB_yuv.c	\
-	SDL_DirectFB_yuv.h
--- a/src/video/directfb/SDL_DirectFB_events.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/directfb/SDL_DirectFB_events.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,9 +31,9 @@
 #include <directfb.h>
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_events.h"
 
--- a/src/video/directfb/SDL_DirectFB_video.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/directfb/SDL_DirectFB_video.c	Thu Feb 16 10:11:48 2006 +0000
@@ -36,9 +36,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_events.h"
 #include "SDL_DirectFB_yuv.h"
--- a/src/video/directfb/SDL_DirectFB_video.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/directfb/SDL_DirectFB_video.h	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 #include <directfb.h>
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 #define _THIS SDL_VideoDevice *this
 
--- a/src/video/directfb/SDL_DirectFB_yuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/directfb/SDL_DirectFB_yuv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_video.h"
 #include "SDL_DirectFB_yuv.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 
 /* The functions used to manipulate software video overlays */
--- a/src/video/dummy/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for SDL using the null video driver
-
-noinst_LTLIBRARIES = libvideo_null.la
-libvideo_null_la_SOURCES = $(NULL_SRCS)
-
-# The SDL null video driver sources
-NULL_SRCS = 			\
-	SDL_nullvideo.h		\
-	SDL_nullevents.c	\
-	SDL_nullevents_c.h	\
-	SDL_nullmouse.c		\
-	SDL_nullmouse_c.h	\
-	SDL_nullvideo.c
-
--- a/src/video/dummy/SDL_nullevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dummy/SDL_nullevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,9 @@
    most of the API. */
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+
 #include "SDL_nullvideo.h"
 #include "SDL_nullevents_c.h"
 
--- a/src/video/dummy/SDL_nullmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dummy/SDL_nullmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_nullmouse_c.h"
 
--- a/src/video/dummy/SDL_nullvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dummy/SDL_nullvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,9 +37,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_nullvideo.h"
 #include "SDL_nullevents_c.h"
--- a/src/video/dummy/SDL_nullvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/dummy/SDL_nullvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,9 +23,7 @@
 #ifndef _SDL_nullvideo_h
 #define _SDL_nullvideo_h
 
-#include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/epoc/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-
-## Makefile.am for SDL using the EPOC video driver
-
-noinst_LTLIBRARIES = libvideo_epoc.la
-libvideo_epoc_la_SOURCES = $(EPOC_SRCS)
-
-# The SDL EPOC video driver sources
-EPOC_SRCS = 			\
-	SDL_epocevents.cpp	\
-	SDL_epocevents_c.h	\
-	SDL_epocvideo.cpp	\
-	SDL_epocvideo.h
--- a/src/video/epoc/SDL_epocevents.cpp	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/epoc/SDL_epocevents.cpp	Thu Feb 16 10:11:48 2006 +0000
@@ -36,8 +36,8 @@
 #include "SDL_video.h"
 #include "SDL_keysym.h"
 #include "SDL_keyboard.h"
-#include "SDL_events_c.h"
 #include "SDL_timer.h"
+#include "../../events/SDL_events_c.h"
 }; /* extern "C" */
 
 #include "SDL_epocvideo.h"
--- a/src/video/epoc/SDL_epocevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/epoc/SDL_epocevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 
 
 extern "C" {
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 };
 
 #define MAX_SCANCODE 255
--- a/src/video/epoc/SDL_epocvideo.cpp	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/epoc/SDL_epocvideo.cpp	Thu Feb 16 10:11:48 2006 +0000
@@ -33,7 +33,7 @@
 #include "SDL_timer.h"
 #include "SDL_video.h"
 #undef NULL
-#include "SDL_pixels_c.h"
+#include "../SDL_pixels_c.h"
 };
 
 #include "SDL_epocvideo.h"
--- a/src/video/epoc/SDL_epocvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/epoc/SDL_epocvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -32,7 +32,7 @@
 
 extern "C" {
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 };
 
 #include <e32std.h>
--- a/src/video/fbcon/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-
-## Makefile.am for SDL using the framebuffer console video driver
-
-noinst_LTLIBRARIES = libvideo_fbcon.la
-libvideo_fbcon_la_SOURCES = $(FBCON_SRCS)
-
-# The SDL framebuffer console video driver sources
-FBCON_SRCS = 			\
-	SDL_fbkeys.h		\
-	SDL_fbvideo.h		\
-	SDL_fbelo.c \
-	SDL_fbelo.h \
-	SDL_fbevents.c		\
-	SDL_fbevents_c.h	\
-	SDL_fb3dfx.c		\
-	SDL_fb3dfx.h		\
-	SDL_fbmatrox.c		\
-	SDL_fbmatrox.h		\
-	SDL_fbmouse.c		\
-	SDL_fbmouse_c.h		\
-	SDL_fbriva.c		\
-	SDL_fbriva.h		\
-	SDL_fbvideo.c		\
-	3dfx_mmio.h		\
-	3dfx_regs.h		\
-	matrox_mmio.h		\
-	matrox_regs.h		\
-	riva_mmio.h		\
-	riva_regs.h
--- a/src/video/fbcon/SDL_fb3dfx.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fb3dfx.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_video.h"
-#include "SDL_blit.h"
+#include "../SDL_blit.h"
 #include "SDL_fb3dfx.h"
 #include "3dfx_mmio.h"
 
--- a/src/video/fbcon/SDL_fbevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -41,9 +41,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_mutex.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_fbvideo.h"
 #include "SDL_fbevents_c.h"
 #include "SDL_fbkeys.h"
@@ -316,13 +316,13 @@
 
 void FB_CloseMouse(_THIS)
 {
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 	if (ts_dev != NULL) {
 		ts_close(ts_dev);
 		ts_dev = NULL;
 		mouse_fd = -1;
 	}
-#endif /* HAVE_TSLIB */
+#endif /* SDL_INPUT_TSLIB */
 	if ( mouse_fd > 0 ) {
 		close(mouse_fd);
 	}
@@ -501,7 +501,7 @@
 	mousedev = SDL_getenv("SDL_MOUSEDEV");
 	mouse_fd = -1;
 
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 	if ((mousedrv != NULL) && (SDL_strcmp(mousedrv, "TSLIB") == 0)) {
 		if (mousedev == NULL) mousedev = SDL_getenv("TSLIB_TSDEVICE");
 		if (mousedev != NULL) {
@@ -518,7 +518,7 @@
 		mouse_drv = MOUSE_NONE;
 		return mouse_fd;
 	}
-#endif /* HAVE_TSLIB */
+#endif /* SDL_INPUT_TSLIB */
 
 	/* ELO TOUCHSCREEN SUPPORT */
 
@@ -663,7 +663,7 @@
 }
 
 /* Handle input from tslib */
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 static void handle_tslib(_THIS)
 {
 	struct ts_sample sample;
@@ -676,7 +676,7 @@
 	}
 	return;
 }
-#endif /* HAVE_TSLIB */
+#endif /* SDL_INPUT_TSLIB */
 
 /* For now, use MSC, PS/2, and MS protocols
    Driver adapted from the SVGAlib mouse driver code (taken from gpm, etc.)
@@ -718,7 +718,7 @@
 			}
 			return; /* nothing left to do */
 		case MOUSE_TSLIB:
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 			handle_tslib(this);
 #endif
 			return; /* nothing left to do */
--- a/src/video/fbcon/SDL_fbmatrox.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbmatrox.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_video.h"
-#include "SDL_blit.h"
+#include "../SDL_blit.h"
 #include "SDL_fbmatrox.h"
 #include "matrox_mmio.h"
 
--- a/src/video/fbcon/SDL_fbmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_fbvideo.h"
 #include "SDL_fbmouse_c.h"
 
--- a/src/video/fbcon/SDL_fbriva.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbriva.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_video.h"
-#include "SDL_blit.h"
+#include "../SDL_blit.h"
 #include "SDL_fbriva.h"
 #include "riva_mmio.h"
 #include "riva_regs.h"
--- a/src/video/fbcon/SDL_fbvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_fbvideo.h"
 #include "SDL_fbmouse_c.h"
 #include "SDL_fbevents_c.h"
@@ -432,7 +432,7 @@
         return b->h - a->h;
 }
 
-static int FB_SortModes(_THIS)
+static void FB_SortModes(_THIS)
 {
 	int i;
 	for ( i=0; i<NUM_MODELISTS; ++i ) {
@@ -464,7 +464,7 @@
 		return(-1);
 	}
 
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 	/* Create the hardware surface lock mutex */
 	hw_lock = SDL_CreateMutex();
 	if ( hw_lock == NULL ) {
--- a/src/video/fbcon/SDL_fbvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/fbcon/SDL_fbvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,8 +29,8 @@
 
 #include "SDL_mouse.h"
 #include "SDL_mutex.h"
-#include "SDL_sysvideo.h"
-#ifdef HAVE_TSLIB
+#include "../SDL_sysvideo.h"
+#if SDL_INPUT_TSLIB
 #include "tslib.h"
 #endif
 
@@ -63,7 +63,7 @@
 	struct termios saved_kbd_termios;
 
 	int mouse_fd;
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 	struct tsdev *ts_dev;
 #endif
 
@@ -96,9 +96,9 @@
 #define saved_kbd_mode		(this->hidden->saved_kbd_mode)
 #define saved_kbd_termios	(this->hidden->saved_kbd_termios)
 #define mouse_fd		(this->hidden->mouse_fd)
-#ifdef HAVE_TSLIB
+#if SDL_INPUT_TSLIB
 #define ts_dev			(this->hidden->ts_dev)
-#endif /* HAVE_TSLIB */
+#endif
 #define cache_vinfo		(this->hidden->cache_vinfo)
 #define saved_vinfo		(this->hidden->saved_vinfo)
 #define saved_cmaplen		(this->hidden->saved_cmaplen)
--- a/src/video/gapi/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-## Makefile.am for SDL using the PocketPC GAPI video driver
-
-noinst_LTLIBRARIES = libvideo_gapi.la
-libvideo_gapi_la_SOURCES = $(GAPI_SRCS)
-
-# The SDL GAPI driver sources
-GAPI_SRCS = 			\
-	SDL_gapivideo.c		\
-	SDL_gapivideo.h
--- a/src/video/gapi/SDL_gapivideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gapi/SDL_gapivideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -34,9 +34,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_syswm_c.h"
 #include "SDL_sysmouse_c.h"
--- a/src/video/gapi/SDL_gapivideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gapi/SDL_gapivideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #define _SDL_gapivideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 /* From gx.h, since it's not really C compliant */
 
--- a/src/video/gem/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-## Makefile.am for SDL using the GEM video driver
-
-noinst_LTLIBRARIES = libvideo_gem.la
-libvideo_gem_la_SOURCES = $(GEM_SRCS)
-
-# The SDL GEM video driver sources
-GEM_SRCS = 	\
-	SDL_gemvideo.h	\
-	SDL_gemvideo.c	\
-	SDL_gemevents_c.h	\
-	SDL_gemevents.c \
-	SDL_gemmouse_c.h	\
-	SDL_gemmouse.c \
-	SDL_gemwm_c.h	\
-	SDL_gemwm.c
--- a/src/video/gem/SDL_gemevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gem/SDL_gemevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,8 +31,8 @@
 
 #include <gem.h>
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_gemvideo.h"
 #include "SDL_gemevents_c.h"
 #include "SDL_atarikeys.h"	/* for keyboard scancodes */
--- a/src/video/gem/SDL_gemmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gem/SDL_gemmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,8 +29,8 @@
 #include <gem.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_gemmouse_c.h"
 
 /* Defines */
--- a/src/video/gem/SDL_gemvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,10 +37,10 @@
 #include "SDL_endian.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 
 #include "SDL_ataric2p_s.h"
 #include "SDL_atarieddi_s.h"
@@ -100,7 +100,7 @@
 static void GEM_UnlockScreen(_THIS);
 static void refresh_window(_THIS, int winhandle, short *rect);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 /* OpenGL functions */
 static void GEM_GL_SwapBuffers(_THIS);
 #endif
@@ -179,7 +179,7 @@
 	device->WarpWMCursor = NULL /*GEM_WarpWMCursor*/;
 	device->CheckMouseMode = GEM_CheckMouseMode;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* OpenGL functions */
 	device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
 	device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
@@ -455,7 +455,7 @@
 
 	SDL_modelist[1] = NULL;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	SDL_AtariGL_InitPointers(this);
 #endif
 
@@ -796,7 +796,7 @@
 		current->pitch = VDI_pitch;
 	}
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (flags & SDL_OPENGL) {
 		if (!SDL_AtariGL_Init(this, current)) {
 			GEM_FreeBuffers(this);
@@ -1096,7 +1096,7 @@
 
 	GEM_FreeBuffers(this);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (gl_active) {
 		SDL_AtariGL_Quit(this, SDL_TRUE);
 	}
@@ -1318,7 +1318,7 @@
 	vro_cpyfm( VDI_handle, S_ONLY, pxy, &mfdb_src, &VDI_dst_mfdb);
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 static void GEM_GL_SwapBuffers(_THIS)
 {
--- a/src/video/gem/SDL_gemvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/gem/SDL_gemvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,8 @@
 #ifndef _SDL_gemvideo_h
 #define _SDL_gemvideo_h
 
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ggi/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-## Makefile.am for SDL using the GGI video driver
-
-noinst_LTLIBRARIES = libvideo_ggi.la
-libvideo_ggi_la_SOURCES = $(GGI_SRCS)
-libvideo_ggi_la_LIBADD = -lggi -lgii -lgg
-
-# The SDL GGI video driver sources
-GGI_SRCS = 			\
-	SDL_ggikeys.h		\
-	SDL_ggivideo.h		\
-	SDL_ggievents.c		\
-	SDL_ggimouse.c		\
-	SDL_ggivideo.c		\
-	SDL_ggievents_c.h	\
-       	SDL_ggimouse_c.h
--- a/src/video/ggi/SDL_ggievents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ggi/SDL_ggievents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -33,9 +33,9 @@
 #include "SDL_ggikeys.h"
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ggivideo.h"
 #include "SDL_ggievents_c.h"
 
--- a/src/video/ggi/SDL_ggimouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ggi/SDL_ggimouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ggimouse_c.h"
 
 
--- a/src/video/ggi/SDL_ggivideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ggi/SDL_ggivideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -32,9 +32,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ggivideo.h"
 #include "SDL_ggimouse_c.h"
 #include "SDL_ggievents_c.h"
--- a/src/video/ggi/SDL_ggivideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ggi/SDL_ggivideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 #include <ggi/ggi.h>
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 #define _THIS SDL_VideoDevice *this
 
--- a/src/video/ipod/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-## Makefile.am for SDL using the iPod framebuffer driver
-
-noinst_LTLIBRARIES = libvideo_ipod.la
-libvideo_ipod_la_SOURCES = SDL_ipodvideo.c SDL_ipodvideo.h
--- a/src/video/ipod/SDL_ipodvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ipod/SDL_ipodvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -14,9 +14,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_sysevents.h"
 #include "SDL_ipodvideo.h"
 
--- a/src/video/maccommon/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-## Makefile.am for SDL using the MacOS toolbox
-
-noinst_LTLIBRARIES = libvideo_maccommon.la
-libvideo_maccommon_la_SOURCES = $(COMMON_SRCS)
-
-# The SDL Mac toolbox driver sources
-COMMON_SRCS = 			\
-	SDL_lowvideo.h		\
-	SDL_macevents.c		\
-	SDL_macevents_c.h	\
-	SDL_macgl.c		\
-	SDL_macgl_c.h		\
-	SDL_mackeys.h		\
-	SDL_macmouse.c		\
-	SDL_macmouse_c.h	\
-	SDL_macwm.c		\
-	SDL_macwm_c.h
--- a/src/video/maccommon/SDL_lowvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/maccommon/SDL_lowvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -34,7 +34,7 @@
 #include <DrawSprocket.h>
 #endif
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #ifdef MACOSX
 #include <OpenGL/gl.h> /* OpenGL.framework */
 #include <AGL/agl.h>   /* AGL.framework */
@@ -42,10 +42,10 @@
 #include <GL/gl.h>
 #include <agl.h>
 #endif /* MACOSX */
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 #include "SDL_video.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
@@ -84,7 +84,7 @@
 	/* Information used by DrawSprocket driver */
 	struct DSpInfo *dspinfo;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	AGLContext appleGLContext;
 
 	void *libraryHandle;
--- a/src/video/maccommon/SDL_macevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/maccommon/SDL_macevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,9 +37,9 @@
 #include "SDL_events.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
-#include "SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_macevents_c.h"
 #include "SDL_mackeys.h"
 #include "SDL_macmouse_c.h"
@@ -380,7 +380,7 @@
 #endif
 	  case updateEvt: {
 		BeginUpdate(SDL_Window);
-	#ifdef HAVE_OPENGL
+	#if SDL_VIDEO_OPENGL
 		if (SDL_VideoSurface->flags & SDL_OPENGL)
 			SDL_GL_SwapBuffers();
 		else
--- a/src/video/maccommon/SDL_macgl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/maccommon/SDL_macgl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,7 +30,7 @@
 /* krat: adding OpenGL support */
 int Mac_GL_Init(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	AGLPixelFormat format;
    	int i = 0;
 	GLint attributes [ 24 ]; /* 24 is max possible in this setup */
@@ -121,7 +121,7 @@
 
 void Mac_GL_Quit(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if ( glContext != NULL ) {
 		aglSetCurrentContext(NULL);
 		aglSetDrawable(glContext, NULL);
@@ -131,7 +131,7 @@
 #endif
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 /* Make the current context active */
 int Mac_GL_MakeCurrent(_THIS)
@@ -175,5 +175,5 @@
 	return SDL_LoadFunction( this->hidden->libraryHandle, proc );
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
--- a/src/video/maccommon/SDL_macgl_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/maccommon/SDL_macgl_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,7 @@
 
 /* AGL implementation of SDL OpenGL support */
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #ifdef MACOSX
 #include <OpenGL/gl.h> /* OpenGL.framework */
 #include <AGL/agl.h>   /* AGL.framework */
@@ -30,12 +30,12 @@
 #include <GL/gl.h>
 #include <agl.h>
 #endif /* MACOSX */
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 /* OpenGL functions */
 extern int Mac_GL_Init(_THIS);
 extern void Mac_GL_Quit(_THIS);
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 extern int Mac_GL_MakeCurrent(_THIS);
 extern int Mac_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
 extern void Mac_GL_SwapBuffers(_THIS);
--- a/src/video/macdsp/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-## Makefile.am for SDL using the Mac DrawSprocket video driver
-
-noinst_LTLIBRARIES = libvideo_macdsp.la
-libvideo_macdsp_la_SOURCES = $(DSP_SRCS)
-
-# The SDL Mac DrawSprocket driver sources
-DSP_SRCS = 			\
-	SDL_dspvideo.c		\
-	SDL_dspvideo.h
--- a/src/video/macdsp/SDL_dspvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/macdsp/SDL_dspvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -138,10 +138,10 @@
 #endif
 
 #include "SDL_video.h"
-#include "SDL_blit.h"
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_blit.h"
+#include "../SDL_pixels_c.h"
 #include "SDL_dspvideo.h"
 #include "SDL_macgl_c.h"
 #include "SDL_macwm_c.h"
@@ -177,7 +177,7 @@
                            SDL_Surface *dst, SDL_Rect *dstrect);
 static int DSp_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
    static void DSp_GL_SwapBuffers (_THIS);
 #endif
 
@@ -296,7 +296,7 @@
 	device->UnlockHWSurface = DSp_UnlockHWSurface;
 	device->FlipHWSurface   = DSp_FlipHWSurface;
 	device->FreeHWSurface   = DSp_FreeHWSurface;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_MakeCurrent  = Mac_GL_MakeCurrent;
 	device->GL_SwapBuffers  = DSp_GL_SwapBuffers;
 	device->GL_LoadLibrary = Mac_GL_LoadLibrary;
@@ -1390,7 +1390,7 @@
    DSpShutdown ();
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 /* swap buffers with v-sync */
 static void DSp_GL_SwapBuffers (_THIS) {
--- a/src/video/macrom/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-## Makefile.am for SDL using the Mac toolbox video driver
-
-noinst_LTLIBRARIES = libvideo_macrom.la
-libvideo_macrom_la_SOURCES = $(ROM_SRCS)
-
-# The SDL Mac toolbox driver sources
-ROM_SRCS = 			\
-	SDL_romvideo.c		\
-	SDL_romvideo.h
--- a/src/video/macrom/SDL_romvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/macrom/SDL_romvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -43,7 +43,7 @@
 
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 #include "SDL_romvideo.h"
 #include "SDL_macgl_c.h"
 #include "SDL_macwm_c.h"
@@ -156,7 +156,7 @@
 	device->UnlockHWSurface = ROM_UnlockHWSurface;
 	device->FlipHWSurface = NULL;
 	device->FreeHWSurface = ROM_FreeHWSurface;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_MakeCurrent = Mac_GL_MakeCurrent;
 	device->GL_SwapBuffers = Mac_GL_SwapBuffers;
 	device->GL_LoadLibrary = Mac_GL_LoadLibrary;
--- a/src/video/math_private.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/math_private.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,10 +20,7 @@
 #include "SDL_endian.h"
 
 #define huge		really_big /* huge is a reserved keyword in VC++ 6.0 */
-#define int32_t 	math_int32_t
-#define u_int32_t	math_u_int32_t
-typedef Sint32 math_int32_t;
-typedef Uint32 math_u_int32_t;
+#define u_int32_t	uint32_t
 
 /* The original fdlibm code used statements like:
 	n0 = ((*(int*)&one)>>29)^1;		* index of high word *
--- a/src/video/nanox/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-
-## Makefile.am for SDL using the nanox video driver
-
-noinst_LTLIBRARIES = libvideo_nanox.la
-libvideo_nanox_la_SOURCES = $(NANOX_SRCS)
-
-# The SDL nanox video driver sources
-NANOX_SRCS =         \
-    SDL_nxmodes.c    \
-    SDL_nxmodes_c.h  \
-    SDL_nxmouse.c    \
-    SDL_nxmouse_c.h  \
-    SDL_nxvideo.c    \
-    SDL_nxvideo.h    \
-    SDL_nxwm.c       \
-    SDL_nxwm_c.h     \
-    SDL_nxevents.c   \
-    SDL_nxevents_c.h \
-    SDL_nximage.c    \
-    SDL_nximage_c.h
--- a/src/video/nanox/SDL_nxevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/nanox/SDL_nxevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 */
 
 #include "SDL_keysym.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_nxevents_c.h"
 #include "SDL_nximage_c.h"
--- a/src/video/nanox/SDL_nxmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/nanox/SDL_nxmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
     clare@setabox.com
 */
 
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_nxmouse_c.h"
 
--- a/src/video/nanox/SDL_nxvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/nanox/SDL_nxvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,8 +27,8 @@
 
 #include "SDL_thread.h"
 #include "SDL_video.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #define MWINCLUDECOLORS
 #include "SDL_nxvideo.h"
@@ -119,7 +119,7 @@
     device -> SetGammaRamp = NX_SetGammaRamp ;
     device -> GetGammaRamp = NX_GetGammaRamp ;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     device -> GL_LoadLibrary = NULL ;
     device -> GL_GetProcAddress = NULL ;
     device -> GL_GetAttribute = NULL ;
--- a/src/video/nanox/SDL_nxvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/nanox/SDL_nxvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 
 #include <microwin/nano-X.h>
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 #ifdef ENABLE_NANOX_DEBUG
 #define Dprintf printf
--- a/src/video/nanox/SDL_nxwm.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/nanox/SDL_nxwm.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 */
 
 #include "SDL_syswm.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_nxwm_c.h"
 
--- a/src/video/os2fslib/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-## Makefile.am for SDL using the os2fslib video driver
-
-noinst_LTLIBRARIES = libvideo_os2fslib.la
-libvideo_os2fslib_la_SOURCES = $(OS2FSLIB_SRCS)
-
-# The SDL os2fslib driver sources
-OS2FSLIB_SRCS = 			\
-	SDL_os2fslib.c		\
-	SDL_os2fslib.h		\
-	SDL_vkeys.h
--- a/src/video/os2fslib/SDL_os2fslib.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/os2fslib/SDL_os2fslib.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,9 +25,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_os2fslib.h"
 
--- a/src/video/photon/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-## Makefile.am for SDL using the QNX Photon video driver
-
-noinst_LTLIBRARIES = libvideo_photon.la
-libvideo_photon_la_SOURCES = $(PH_SRCS)
-
-# The SDL QNX Photon video driver sources
-PH_SRCS = 			\
-	SDL_ph_events.c		\
-	SDL_ph_events_c.h	\
-	SDL_ph_image.c		\
-	SDL_ph_image_c.h	\
-	SDL_ph_modes.c		\
-	SDL_ph_modes_c.h	\
-	SDL_ph_mouse.c		\
-	SDL_ph_mouse_c.h	\
-	SDL_ph_video.c		\
-	SDL_ph_video.h		\
-	SDL_ph_gl.c		\
-	SDL_ph_gl.h		\
-	SDL_ph_wm.c		\
-	SDL_ph_wm_c.h		\
-	SDL_phyuv.c		\
-	SDL_phyuv_c.h
--- a/src/video/photon/SDL_ph_events.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_events.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,8 +22,6 @@
 
 /* Handle the event stream, converting photon events into SDL events */
 
-#define DISABLE_X11
-
 #include <stdio.h>
 #include <setjmp.h>
 #include <sys/time.h>
@@ -33,9 +31,9 @@
 
 #include "SDL.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ph_video.h"
 #include "SDL_ph_modes_c.h"
 #include "SDL_ph_image_c.h"
--- a/src/video/photon/SDL_ph_gl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_gl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #include "SDL.h"
 #include "SDL_ph_gl.h"
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 #if (_NTO_VERSION >= 630)
     /* PhotonGL functions */
@@ -96,7 +96,7 @@
 #if (_NTO_VERSION < 630)
 int ph_GL_LoadLibrary(_THIS, const char* path)
 {
-    /* if code compiled with HAVE_OPENGL, that mean that library already linked */
+    /* if code compiled with SDL_VIDEO_OPENGL, that mean that library already linked */
     this->gl_config.driver_loaded = 1;
 
     return 0;
@@ -402,4 +402,4 @@
 
 #endif /* _NTO_VERSION */
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
--- a/src/video/photon/SDL_ph_gl.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_gl.h	Thu Feb 16 10:11:48 2006 +0000
@@ -27,7 +27,7 @@
 
 #define DEFAULT_OPENGL "/usr/lib/libGL.so"
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     void  ph_GL_SwapBuffers(_THIS);
     int   ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
     int   ph_GL_LoadLibrary(_THIS, const char* path);
@@ -35,6 +35,6 @@
     int   ph_GL_MakeCurrent(_THIS);
 
     int   ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags);
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 #endif /* __SDL_PH_GL_H__ */
--- a/src/video/photon/SDL_ph_image.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_image.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 
 #include "SDL_endian.h"
 #include "SDL_video.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_pixels_c.h"
 #include "SDL_ph_video.h"
 #include "SDL_ph_image_c.h"
 #include "SDL_ph_modes_c.h"
@@ -293,7 +293,7 @@
     return 0;
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen)
 {
@@ -321,12 +321,12 @@
     return 0;
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 void ph_DestroyImage(_THIS, SDL_Surface* screen)
 {
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     if ((screen->flags & SDL_OPENGL)==SDL_OPENGL)
     {
         if (oglctx)
@@ -354,7 +354,7 @@
 
         return;
     }
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
     if (currently_fullscreen)
     {
@@ -484,14 +484,14 @@
 
     ph_DestroyImage(this, screen);
     
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     if ((flags & SDL_OPENGL)==SDL_OPENGL)
     {
         setupresult=ph_SetupOpenGLImage(this, screen);
     }
     else
     {
-#endif /* HAVE_OPENGL */
+#endif
        if ((flags & SDL_FULLSCREEN)==SDL_FULLSCREEN)
        {
            setupresult=ph_SetupFullScreenImage(this, screen);
@@ -507,9 +507,9 @@
               setupresult=ph_SetupImage(this, screen);
           }
        }
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     }
-#endif /* HAVE_OPENGL */
+#endif
     if (setupresult!=-1)
     {
        ph_UpdateHWInfo(this);
@@ -954,14 +954,14 @@
     return 0;
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects)
 {
    this->GL_SwapBuffers(this);
    
    return;
 }
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
 {
--- a/src/video/photon/SDL_ph_image_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_image_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 #ifndef __SDL_PH_IMAGE_H__
 #define __SDL_PH_IMAGE_H__
 
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ph_video.h"
 
 struct private_hwdata
--- a/src/video/photon/SDL_ph_modes.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_modes.c	Thu Feb 16 10:11:48 2006 +0000
@@ -310,13 +310,9 @@
         {
             if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL)
             {
-#ifdef HAVE_OPENGL
-    #if (_NTO_VERSION < 630)
-                return 0;
-    #endif /* 6.3.0 */
-#else
-                return 0;
-#endif /* HAVE_OPENGL */
+#if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630)
+                return 0; /* 6.3.0 */
+#endif
             }
         }
 
@@ -350,13 +346,9 @@
     {
         if ((this->screen) && ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL))
         {
-#ifdef HAVE_OPENGL
-    #if (_NTO_VERSION < 630)
+#if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630)
             return 0;
-    #endif /* 6.3.0 */
-#else
-            return 0;
-#endif /* HAVE_OPENGL */
+#endif
         }
 
         /* release routines starts here */
--- a/src/video/photon/SDL_ph_mouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_mouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,8 +21,8 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_ph_mouse_c.h"
 
 struct WMcursor
--- a/src/video/photon/SDL_ph_video.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_video.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,9 +28,9 @@
 #include "SDL_thread.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ph_video.h"
 #include "SDL_ph_modes_c.h"
 #include "SDL_ph_image_c.h"
@@ -39,7 +39,7 @@
 #include "SDL_ph_wm_c.h"
 #include "SDL_ph_gl.h"
 #include "SDL_phyuv_c.h"
-#include "blank_cursor.h"
+#include "../blank_cursor.h"
 
 static int  ph_VideoInit(_THIS, SDL_PixelFormat *vformat);
 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
@@ -123,19 +123,13 @@
     device->PumpEvents = ph_PumpEvents;
 
     /* OpenGL support. */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     device->GL_MakeCurrent = ph_GL_MakeCurrent;
     device->GL_SwapBuffers = ph_GL_SwapBuffers;
     device->GL_GetAttribute = ph_GL_GetAttribute;
     device->GL_LoadLibrary = ph_GL_LoadLibrary;
     device->GL_GetProcAddress = ph_GL_GetProcAddress;
-#else
-    device->GL_MakeCurrent = NULL;
-    device->GL_SwapBuffers = NULL;
-    device->GL_GetAttribute = NULL;
-    device->GL_LoadLibrary = NULL;
-    device->GL_GetProcAddress = NULL;
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
     device->free = ph_DeleteDevice;
     
@@ -357,12 +351,12 @@
     window=NULL;
     desktoppal=SDLPH_PAL_NONE;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     oglctx=NULL;
     oglbuffers=NULL;
     oglflags=0;
     oglbpp=0;
-#endif /* HAVE_OPENGL */
+#endif
     
     old_video_mode=-1;
     old_refresh_rate=-1;
@@ -478,12 +472,12 @@
 
     if ((current->flags & SDL_OPENGL)==SDL_OPENGL)
     {
-#if !defined(HAVE_OPENGL)
+#if !SDL_VIDEO_OPENGL
         /* if no built-in OpenGL support */
         SDL_SetError("ph_SetVideoMode(): no OpenGL support, you need to recompile SDL.\n");
         current->flags &= ~SDL_OPENGL;
         return NULL;
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
     }
     else
     {
--- a/src/video/photon/SDL_ph_video.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_video.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #define __SDL_PH_VIDEO_H__
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 #include <sys/neutrino.h>
 
@@ -33,14 +33,14 @@
 #include <photon/Pg.h>
 #include <photon/PdDirect.h>
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     #if (_NTO_VERSION < 630)
         #include <photon/PdGL.h>
     #else
         #include <GL/qnxgl.h>
         #include <GL/GLPh.h>
     #endif /* 6.3.0 */
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice* this
@@ -74,7 +74,7 @@
     PgDisplaySettings_t mode_settings;	
     PtWidget_t *Window;                  /* used to handle input events */
     PhImage_t *image;	                 /* used to display image       */
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     #if (_NTO_VERSION < 630)
         PdOpenGLContext_t* OGLContext;   /* OpenGL context              */
         void* OGLBuffers;                /* OpenGL buffers (unused)     */
@@ -85,7 +85,7 @@
 
     Uint32 OGLFlags;                     /* OpenGL flags                */
     Uint32 OGLBPP;                       /* OpenGL bpp                  */
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
     PgColor_t savedpal[_Pg_MAX_PALETTE];
     PgColor_t syspalph[_Pg_MAX_PALETTE];
 
@@ -146,11 +146,11 @@
 #define SDL_BlankCursor       (this->hidden->BlankCursor)
 #define videomode_emulatemode (this->hidden->videomode_emulatemode)
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
      #define oglctx               (this->hidden->OGLContext)
      #define oglbuffers           (this->hidden->OGLBuffers)
      #define oglflags             (this->hidden->OGLFlags)
      #define oglbpp               (this->hidden->OGLBPP)
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 #endif /* __SDL_PH_VIDEO_H__ */
--- a/src/video/photon/SDL_ph_wm.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_ph_wm.c	Thu Feb 16 10:11:48 2006 +0000
@@ -20,8 +20,6 @@
     slouken@libsdl.org
 */
 
-#define DISABLE_X11
-
 #include <Ph.h>
 #include <photon/PpProto.h>
 #include <photon/PhWm.h>
@@ -31,8 +29,8 @@
 #include "SDL_timer.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_events_c.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_ph_modes_c.h"
 #include "SDL_ph_wm_c.h"
 
--- a/src/video/photon/SDL_phyuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/photon/SDL_phyuv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 
 #include "SDL_video.h"
 #include "SDL_phyuv_c.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 #define OVERLAY_STATE_UNINIT 0
 #define OVERLAY_STATE_ACTIVE 1
--- a/src/video/picogui/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-## Makefile.am for SDL using the PicoGUI video driver
-
-noinst_LTLIBRARIES = libvideo_picogui.la
-libvideo_picogui_la_SOURCES = $(PICOGUI_SRCS)
-
-# The SDL PicoGUI video driver sources
-PICOGUI_SRCS = 			\
-	SDL_pgevents.c		\
-	SDL_pgevents_c.h	\
-	SDL_pgvideo.c		\
-	SDL_pgvideo.h
-
--- a/src/video/picogui/SDL_pgevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/picogui/SDL_pgevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 */
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_pgvideo.h"
 #include "SDL_pgevents_c.h"
 
--- a/src/video/picogui/SDL_pgvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/picogui/SDL_pgvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,9 +25,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_pgvideo.h"
 #include "SDL_pgevents_c.h"
--- a/src/video/picogui/SDL_pgvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/picogui/SDL_pgvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -27,8 +27,8 @@
 #define _SDL_pgvideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 #include <picogui.h>
 #include <sys/shm.h>
--- a/src/video/ps2gs/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-## Makefile.am for SDL using the framebuffer console video driver
-
-noinst_LTLIBRARIES = libvideo_ps2gs.la
-libvideo_ps2gs_la_SOURCES = $(PS2GS_SRCS)
-
-# The SDL framebuffer console video driver sources
-PS2GS_SRCS = 			\
-	SDL_gsevents.c		\
-	SDL_gsevents_c.h	\
-	SDL_gskeys.h		\
-	SDL_gsmouse.c		\
-	SDL_gsmouse_c.h		\
-	SDL_gsvideo.c		\
-	SDL_gsvideo.h		\
-	SDL_gsyuv.c		\
-	SDL_gsyuv_c.h
--- a/src/video/ps2gs/SDL_gsevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ps2gs/SDL_gsevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -39,9 +39,9 @@
 #include <linux/keyboard.h>
 
 #include "SDL_mutex.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_gsvideo.h"
 #include "SDL_gsevents_c.h"
 #include "SDL_gskeys.h"
--- a/src/video/ps2gs/SDL_gsmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ps2gs/SDL_gsmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,8 +23,8 @@
 #include <sys/ioctl.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_gsvideo.h"
 #include "SDL_gsmouse_c.h"
 
--- a/src/video/ps2gs/SDL_gsvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ps2gs/SDL_gsvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,10 +30,10 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_gsvideo.h"
 #include "SDL_gsmouse_c.h"
 #include "SDL_gsevents_c.h"
--- a/src/video/ps2gs/SDL_gsvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ps2gs/SDL_gsvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -30,7 +30,7 @@
 
 #include "SDL_mouse.h"
 #include "SDL_mutex.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/ps2gs/SDL_gsyuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/ps2gs/SDL_gsyuv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,7 +30,7 @@
 
 #include "SDL_video.h"
 #include "SDL_gsyuv_c.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 /* The maximum number of 16x16 pixel block converted at once */
 #define MAX_MACROBLOCKS	1024	/* 2^10 macroblocks at once */
--- a/src/video/qtopia/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-## Makefile.am for SDL using the Qtopia backend
-
-noinst_LTLIBRARIES = libvideo_qtopia.la
-libvideo_qtopia_la_SOURCES = $(QTOPIA_SRCS)
-
-# The SDL BWindow video driver sources
-QTOPIA_SRCS = 			\
-	SDL_QWin.h		\
-	SDL_QWin.cc		\
-	SDL_lowvideo.h		\
-	SDL_sysmouse.cc		\
-	SDL_sysmouse_c.h	\
-	SDL_sysvideo.cc		\
-	SDL_syswm.cc		\
-	SDL_syswm_c.h		\
-	SDL_sysevents.cc	\
-	SDL_sysevents_c.h	
--- a/src/video/qtopia/SDL_QWin.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/qtopia/SDL_QWin.h	Thu Feb 16 10:11:48 2006 +0000
@@ -34,7 +34,7 @@
 #include "SDL_events.h"
 
 extern "C" {
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 };
 
 typedef enum { 
--- a/src/video/qtopia/SDL_lowvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/qtopia/SDL_lowvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #define _SDL_lowvideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *_this
--- a/src/video/qtopia/SDL_sysevents.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/qtopia/SDL_sysevents.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -31,8 +31,8 @@
 #include "SDL_timer.h"
 
 extern "C" {
-#include "SDL_events_c.h"
-#include "SDL_sysevents.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_sysevents_c.h"
 
   //  static SDLKey keymap[128];
--- a/src/video/qtopia/SDL_sysvideo.cc	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/qtopia/SDL_sysvideo.cc	Thu Feb 16 10:11:48 2006 +0000
@@ -33,10 +33,10 @@
 
 extern "C" {
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+#include "SDL_sysevents_c.h"
 #include "SDL_sysmouse_c.h"
-#include "SDL_sysevents_c.h"
-#include "SDL_events_c.h"
 #include "SDL_syswm_c.h"
 #include "SDL_lowvideo.h"
 
--- a/src/video/quartz/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-## Makefile.am for SDL using the MacOS X Quartz video driver
-
-noinst_LTLIBRARIES = libvideo_quartz.la
-libvideo_quartz_la_SOURCES = $(QUARTZ_SRCS)
-
-# The SDL MacOS X Quartz video driver sources
-QUARTZ_SRCS = 			\
-	CGS.h			\
-	SDL_QuartzEvents.m	\
-	SDL_QuartzGL.m		\
-	SDL_QuartzKeys.h	\
-	SDL_QuartzVideo.h	\
-	SDL_QuartzVideo.m	\
-	SDL_QuartzWindow.h	\
-	SDL_QuartzWindow.m	\
-	SDL_QuartzWM.m		\
-	SDL_QuartzYUV.m
--- a/src/video/quartz/SDL_QuartzVideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -60,11 +60,11 @@
 #include "SDL_video.h"
 #include "SDL_error.h"
 #include "SDL_timer.h"
+#include "SDL_loadso.h"
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
-#include "SDL_loadso.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 /* 
     This is a workaround to directly access NSOpenGLContext's CGL context
--- a/src/video/quartz/SDL_QuartzYUV.m	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/quartz/SDL_QuartzYUV.m	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,7 @@
 
 #include "SDL_QuartzVideo.h"
 #include "SDL_QuartzWindow.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 
 #define yuv_idh (this->hidden->yuv_idh)
--- a/src/video/riscos/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-
-## Makefile.am for SDL using the RISC OS video driver
-
-noinst_LTLIBRARIES = libvideo_riscos.la
-libvideo_riscos_la_SOURCES = $(CGX_SRCS)
-
-# The SDL RISC OS video driver sources
-CGX_SRCS = 				\
-	SDL_riscosASM.s			\
-	SDL_riscosevents.c		\
-	SDL_riscosevents_c.h		\
-	SDL_riscosFullScreenVideo.c	\
-	SDL_riscosmouse.c		\
-	SDL_riscosmouse_c.h		\
-	SDL_riscossprite.c		\
-	SDL_riscostask.c		\
-	SDL_riscostask.h		\
-	SDL_riscosvideo.c		\
-	SDL_riscosvideo.h		\
-	SDL_wimppoll.c			\
-	SDL_wimpvideo.c
--- a/src/video/riscos/SDL_riscosFullScreenVideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscosFullScreenVideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,9 +29,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_riscostask.h"
 #include "SDL_riscosvideo.h"
--- a/src/video/riscos/SDL_riscosevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscosevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,12 +29,12 @@
 
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../timer/SDL_timer_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_riscosvideo.h"
 #include "SDL_riscosevents_c.h"
-#include "SDL_timer_c.h"
-#include "SDL_cursor_c.h"
 
 #include "memory.h"
 #include "stdlib.h"
@@ -76,7 +76,7 @@
 
 void RISCOS_PollMouseHelper(_THIS, int fullscreen);
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 extern void DRenderer_FillBuffers();
 
 /* Timer running function */
@@ -89,7 +89,7 @@
     /* Current implementation requires keyboard and mouse polling */
 	RISCOS_PollKeyboard();
 	RISCOS_PollMouse(this);
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 //	DRenderer_FillBuffers();
 	if (SDL_timer_running) RISCOS_CheckTimer();
 #endif
--- a/src/video/riscos/SDL_riscosmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscosmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,7 +28,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_riscosmouse_c.h"
 
--- a/src/video/riscos/SDL_riscostask.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscostask.c	Thu Feb 16 10:11:48 2006 +0000
@@ -37,7 +37,7 @@
 #include "SDL_stdinc.h"
 #include "SDL_riscostask.h"
 
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 #include <pthread.h>
 pthread_t main_thread;
 #endif
@@ -110,7 +110,7 @@
 	   return 1;
    }
 
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
    main_thread = pthread_self();
 #endif
 
--- a/src/video/riscos/SDL_riscosvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscosvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -32,9 +32,9 @@
 #include "SDL_video.h"
 #include "SDL_mouse.h"
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_riscostask.h"
 #include "SDL_riscosvideo.h"
--- a/src/video/riscos/SDL_riscosvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_riscosvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #define _SDL_riscosvideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/riscos/SDL_wimppoll.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_wimppoll.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,8 +29,8 @@
 
 #include "SDL.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_riscosvideo.h"
 #include "SDL_riscosevents_c.h"
 #include "SDL_riscosmouse_c.h"
@@ -44,7 +44,7 @@
 #include "swis.h"
 #include "unixlib/os.h"
 
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 #include <pthread.h>
 #endif
 
@@ -61,10 +61,9 @@
 extern void WIMP_PollMouse(_THIS);
 extern void RISCOS_PollKeyboard();
 
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 /* Timer running function */
 extern void RISCOS_CheckTimer();
-
 #else
 extern int riscos_using_threads;
 #endif
@@ -84,7 +83,7 @@
 	WIMP_Poll(this, 0);
 	if (hasFocus) RISCOS_PollKeyboard();
 	if (mouseInWindow) WIMP_PollMouse(this);
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 	if (SDL_timer_running) RISCOS_CheckTimer();
 #endif
 }
@@ -110,7 +109,7 @@
 
     while (doPoll)
     {
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
        /* Stop thread callbacks while program is paged out */
        if (riscos_using_threads) __pthread_stop_ticker();
 #endif
@@ -289,7 +288,7 @@
 			/* Fall out of polling loop if message is successfully posted */
 			if (SDL_PrivateSysWMEvent(&wmmsg)) doPoll = 0;
 		}
-#ifndef DISABLE_THREADS
+#if !SDL_THREADS_DISABLED
 		if (riscos_using_threads)
 		{
                    /* Restart ticker here so other thread can not interfere
@@ -324,7 +323,7 @@
 	{
 		WIMP_Poll(current_video, 0);
 	}
-#ifdef DISABLE_THREADS
+#if SDL_THREADS_DISABLED
 	if (SDL_timer_running) RISCOS_CheckTimer();
 #endif
 }
--- a/src/video/riscos/SDL_wimpvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/riscos/SDL_wimpvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -29,9 +29,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_riscostask.h"
 #include "SDL_riscosvideo.h"
--- a/src/video/svga/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for SDL using the SVGAlib video driver
-
-noinst_LTLIBRARIES = libvideo_svga.la
-libvideo_svga_la_SOURCES = $(SVGA_SRCS)
-
-# The SDL SVGAlib video driver sources
-SVGA_SRCS = 			\
-	SDL_svgavideo.h		\
-	SDL_svgaevents.c	\
-	SDL_svgaevents_c.h	\
-	SDL_svgamouse.c		\
-	SDL_svgamouse_c.h	\
-	SDL_svgavideo.c
-
--- a/src/video/svga/SDL_svgaevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/svga/SDL_svgaevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -34,8 +34,8 @@
 #error You must choose your operating system here
 #endif
 
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_svgavideo.h"
 #include "SDL_svgaevents_c.h"
 
--- a/src/video/svga/SDL_svgamouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/svga/SDL_svgamouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_svgavideo.h"
 #include "SDL_svgamouse_c.h"
 
--- a/src/video/svga/SDL_svgavideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/svga/SDL_svgavideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -42,9 +42,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_svgavideo.h"
 #include "SDL_svgaevents_c.h"
 #include "SDL_svgamouse_c.h"
--- a/src/video/svga/SDL_svgavideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/svga/SDL_svgavideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #define _SDL_svgavideo_h
 
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/vgl/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for SDL using the libVGL video driver
-
-noinst_LTLIBRARIES = libvideo_vgl.la
-libvideo_vgl_la_SOURCES = $(VGL_SRCS)
-
-# The SDL libVGL video driver sources
-VGL_SRCS = 			\
-	SDL_vglvideo.h		\
-	SDL_vglevents.c		\
-	SDL_vglevents_c.h	\
-	SDL_vglmouse.c		\
-	SDL_vglmouse_c.h	\
-	SDL_vglvideo.c
-
--- a/src/video/vgl/SDL_vglevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/vgl/SDL_vglevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -31,8 +31,8 @@
 
 #include "SDL.h"
 #include "SDL_thread.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_vglvideo.h"
 #include "SDL_vglevents_c.h"
 
--- a/src/video/vgl/SDL_vglmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/vgl/SDL_vglmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_vglvideo.h"
 #include "SDL_vglmouse_c.h"
 
--- a/src/video/vgl/SDL_vglvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/vgl/SDL_vglvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -35,9 +35,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_vglvideo.h"
 #include "SDL_vglevents_c.h"
 #include "SDL_vglmouse_c.h"
--- a/src/video/vgl/SDL_vglvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/vgl/SDL_vglvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 
 #include "SDL_mouse.h"
 #include "SDL_mutex.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/wincommon/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-## Makefile.am for common files used by the SDL Win32 video drivers
-
-noinst_LTLIBRARIES = libvideo_wincommon.la
-libvideo_wincommon_la_SOURCES = $(WINCOMMON_SRCS)
-
-# The SDL Win32 video driver common sources
-WINCOMMON_SRCS =		\
-	SDL_lowvideo.h		\
-	SDL_sysevents.c		\
-	SDL_sysmouse.c		\
-	SDL_sysmouse_c.h	\
-	SDL_syswm.c		\
-	SDL_syswm_c.h		\
-	SDL_wingl.c		\
-	SDL_wingl_c.h		\
-	wmmsg.h
--- a/src/video/wincommon/SDL_lowvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_lowvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 
 #include "SDL_windows.h"
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/src/video/wincommon/SDL_sysevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,9 +25,9 @@
 #include "SDL_events.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_lowvideo.h"
 #include "SDL_syswm_c.h"
 #include "SDL_main.h"
@@ -724,7 +724,7 @@
 	class.hbrBackground	= NULL;
 	class.hInstance		= SDL_Instance;
 	class.style		= SDL_Appstyle;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	class.style		|= CS_OWNDC;
 #endif
 	class.lpfnWndProc	= WinMessage;
--- a/src/video/wincommon/SDL_sysmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_sysmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -23,9 +23,9 @@
 #include "SDL_windows.h"
 
 #include "SDL_mouse.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_sysmouse_c.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
 #include "SDL_lowvideo.h"
 
 #ifdef _WIN32_WCE
--- a/src/video/wincommon/SDL_syswm.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_syswm.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,21 +24,18 @@
 
 #include "SDL_version.h"
 #include "SDL_video.h"
+#include "SDL_loadso.h"
 #include "SDL_syswm.h"
+#include "../SDL_pixels_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_syswm_c.h"
 #include "SDL_wingl_c.h"
-#include "SDL_pixels_c.h"
-#include "SDL_loadso.h"
 
 
 #ifdef _WIN32_WCE
 #define DISABLE_ICON_SUPPORT
 #endif
 
-/*	RJR: March 28, 2000
-	we need "SDL_cursor_c.h" for mods to WIN_GrabInput */
-#include "SDL_cursor_c.h"
-
 /* The screen icon -- needs to be freed on SDL_VideoQuit() */
 HICON   screen_icn = NULL;
 
@@ -307,7 +304,7 @@
 		                    info->version.minor,
 		                    info->version.patch) >=
 		     SDL_VERSIONNUM(1, 2, 5) ) {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 			info->hglrc = GL_hrc;
 #else
 			info->hglrc = NULL;
--- a/src/video/wincommon/SDL_wingl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_wingl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,13 +22,13 @@
 
 /* WGL implementation of SDL OpenGL support */
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #include "SDL_opengl.h"
 #endif
 #include "SDL_lowvideo.h"
 #include "SDL_wingl_c.h"
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 #define DEFAULT_GL_DRIVER_PATH "OPENGL32.DLL"
 #endif
 
@@ -69,7 +69,7 @@
 	return(status);
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 static int ExtensionSupported(const char *extension, const char *extensions)
 {
@@ -159,12 +159,12 @@
 	DestroyWindow(hwnd);
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 
 int WIN_GL_SetupWindow(_THIS)
 {
 	int retval;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	int i;
 	unsigned int matching;
 	int iAttribs[64];
@@ -330,7 +330,7 @@
 
 void WIN_GL_ShutDown(_THIS)
 {
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* Clean up OpenGL */
 	if ( GL_hrc ) {
 		this->gl_data->wglMakeCurrent(NULL, NULL);
@@ -344,10 +344,10 @@
 	gl_active = 0;
 
 	WIN_GL_UnloadLibrary(this);
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 /* Make the current context active */
 int WIN_GL_MakeCurrent(_THIS)
@@ -569,4 +569,4 @@
 	return func;
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
--- a/src/video/wincommon/SDL_wingl_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wincommon/SDL_wingl_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -22,13 +22,13 @@
 
 /* WGL implementation of SDL OpenGL support */
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 
 struct SDL_PrivateGLData {
     int gl_active; /* to stop switching drivers while we have a valid context */
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
     PIXELFORMATDESCRIPTOR GL_pfd;
     HDC GL_hdc;
     HGLRC GL_hrc;
@@ -52,7 +52,7 @@
                                                 UINT nAttributes, 
                                                 const int *piAttributes,
                                                 int *piValues);
-#endif /* HAVE_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
 };
 
 /* Old variable names */
@@ -65,7 +65,7 @@
 /* OpenGL functions */
 extern int WIN_GL_SetupWindow(_THIS);
 extern void WIN_GL_ShutDown(_THIS);
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 extern int WIN_GL_MakeCurrent(_THIS);
 extern int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
 extern void WIN_GL_SwapBuffers(_THIS);
@@ -74,7 +74,7 @@
 extern void *WIN_GL_GetProcAddress(_THIS, const char* proc);
 #endif
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 #ifndef WGL_ARB_pixel_format
 #define WGL_NUMBER_PIXEL_FORMATS_ARB   0x2000
--- a/src/video/windib/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-## Makefile.am for SDL using the Win32 DIB video driver
-
-noinst_LTLIBRARIES = libvideo_windib.la
-libvideo_windib_la_SOURCES = $(WINDIB_SRCS)
-
-# The SDL Win32 DIB video driver sources
-WINDIB_SRCS = 			\
-	SDL_dibevents.c		\
-	SDL_dibevents_c.h	\
-	SDL_dibvideo.c		\
-	SDL_dibvideo.h		\
-	SDL_vkeys.h
--- a/src/video/windib/SDL_dibevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windib/SDL_dibevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -25,9 +25,9 @@
 #include "SDL_main.h"
 #include "SDL_events.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
-#include "SDL_lowvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../wincommon/SDL_lowvideo.h"
 #include "SDL_dibvideo.h"
 #include "SDL_vkeys.h"
 
--- a/src/video/windib/SDL_dibevents_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windib/SDL_dibevents_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,7 +20,7 @@
     slouken@libsdl.org
 */
 
-#include "SDL_lowvideo.h"
+#include "../wincommon/SDL_lowvideo.h"
 
 /* Variables and functions exported by SDL_dibevents.c to other parts 
    of the native video subsystem (SDL_dibvideo.c)
--- a/src/video/windib/SDL_dibvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -35,15 +35,15 @@
 #endif
 
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_dibvideo.h"
-#include "SDL_syswm_c.h"
-#include "SDL_sysmouse_c.h"
+#include "../wincommon/SDL_syswm_c.h"
+#include "../wincommon/SDL_sysmouse_c.h"
 #include "SDL_dibevents_c.h"
-#include "SDL_wingl_c.h"
+#include "../wincommon/SDL_wingl_c.h"
 
 #ifdef _WIN32_WCE
 #define NO_GETDIBITS
@@ -151,7 +151,7 @@
 	device->FreeHWSurface = DIB_FreeHWSurface;
 	device->SetGammaRamp = DIB_SetGammaRamp;
 	device->GetGammaRamp = DIB_GetGammaRamp;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_LoadLibrary = WIN_GL_LoadLibrary;
 	device->GL_GetProcAddress = WIN_GL_GetProcAddress;
 	device->GL_GetAttribute = WIN_GL_GetAttribute;
@@ -291,7 +291,7 @@
 	if ( DIB_CreateWindow(this) < 0 ) {
 		return(-1);
 	}
-#ifndef DISABLE_AUDIO
+#if !SDL_AUDIO_DISABLED
 	DX5_SoundFocus(SDL_Window);
 #endif
 
@@ -1022,7 +1022,7 @@
 }
 
 /* Stub in case DirectX isn't available */
-#ifndef ENABLE_DIRECTX
+#if !SDL_AUDIO_DRIVER_DSOUND
 void DX5_SoundFocus(HWND hwnd)
 {
 	return;
--- a/src/video/windx5/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-## Makefile.am for SDL using the DirectX video driver
-
-noinst_LTLIBRARIES = libvideo_windx5.la
-libvideo_windx5_la_SOURCES = $(DIRECTX_SRCS)
-
-# The SDL DirectX video driver sources
-DIRECTX_SRCS = 			\
-	SDL_dx5events.c		\
-	SDL_dx5events_c.h	\
-	SDL_dx5video.c		\
-	SDL_dx5video.h		\
-	SDL_dx5yuv.c		\
-	SDL_dx5yuv_c.h		\
-	directx.h
--- a/src/video/windx5/SDL_dx5events.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windx5/SDL_dx5events.c	Thu Feb 16 10:11:48 2006 +0000
@@ -28,9 +28,9 @@
 #include "SDL_events.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
-#include "SDL_lowvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../wincommon/SDL_lowvideo.h"
 #include "SDL_dx5video.h"
 
 #ifndef WM_APP
--- a/src/video/windx5/SDL_dx5events_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windx5/SDL_dx5events_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,7 +20,7 @@
     slouken@libsdl.org
 */
 
-#include "SDL_lowvideo.h"
+#include "../wincommon/SDL_lowvideo.h"
 
 /* Variables and functions exported by SDL_dx5events.c to other parts 
    of the native video subsystem (SDL_dx5video.c)
--- a/src/video/windx5/SDL_dx5video.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,15 +30,15 @@
 #include "SDL_timer.h"
 #include "SDL_events.h"
 #include "SDL_syswm.h"
-#include "SDL_sysvideo.h"
-#include "SDL_blit.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_blit.h"
+#include "../SDL_pixels_c.h"
 #include "SDL_dx5video.h"
-#include "SDL_syswm_c.h"
-#include "SDL_sysmouse_c.h"
+#include "../wincommon/SDL_syswm_c.h"
+#include "../wincommon/SDL_sysmouse_c.h"
 #include "SDL_dx5events_c.h"
 #include "SDL_dx5yuv_c.h"
-#include "SDL_wingl_c.h"
+#include "../wincommon/SDL_wingl_c.h"
 
 #ifdef _WIN32_WCE
 #define NO_CHANGEDISPLAYSETTINGS
@@ -598,7 +598,7 @@
 	device->FreeHWSurface = DX5_FreeHWSurface;
 	device->SetGammaRamp = DX5_SetGammaRamp;
 	device->GetGammaRamp = DX5_GetGammaRamp;
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	device->GL_LoadLibrary = WIN_GL_LoadLibrary;
 	device->GL_GetProcAddress = WIN_GL_GetProcAddress;
 	device->GL_GetAttribute = WIN_GL_GetAttribute;
@@ -901,7 +901,7 @@
 	if ( DX5_CreateWindow(this) < 0 ) {
 		return(-1);
 	}
-#ifndef DISABLE_AUDIO
+#if !SDL_AUDIO_DISABLED
 	DX5_SoundFocus(SDL_Window);
 #endif
 
--- a/src/video/windx5/SDL_dx5yuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windx5/SDL_dx5yuv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 
 #include "SDL_video.h"
 #include "SDL_dx5yuv_c.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 //#define USE_DIRECTX_OVERLAY
 
--- a/src/video/windx5/SDL_dx5yuv_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/windx5/SDL_dx5yuv_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -23,7 +23,7 @@
 /* This is the DirectDraw implementation of YUV video overlays */
 
 #include "SDL_video.h"
-#include "SDL_lowvideo.h"
+#include "../wincommon/SDL_lowvideo.h"
 #include "SDL_dx5video.h"
 
 extern SDL_Overlay *DX5_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
--- a/src/video/wscons/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-## Makefile.am for SDL using the wscons video driver
-
-noinst_LTLIBRARIES = libvideo_wscons.la
-libvideo_wscons_la_SOURCES = $(WSCONS_SRCS)
-
-# The SDL wscons video driver sources
-WSCONS_SRCS = 			\
-	SDL_wsconsvideo.h	\
-	SDL_wsconsevents.c	\
-	SDL_wsconsevents_c.h	\
-	SDL_wsconsmouse.c	\
-	SDL_wsconsmouse_c.h	\
-	SDL_wsconsvideo.c
-
--- a/src/video/wscons/SDL_wsconsevents.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wscons/SDL_wsconsevents.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,8 +30,8 @@
 #include <string.h>
 
 #include "SDL.h"
-#include "SDL_sysevents.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_wsconsvideo.h"
 #include "SDL_wsconsevents_c.h"
 
--- a/src/video/wscons/SDL_wsconsmouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wscons/SDL_wsconsmouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_wsconsmouse_c.h"
 
--- a/src/video/wscons/SDL_wsconsvideo.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wscons/SDL_wsconsvideo.c	Thu Feb 16 10:11:48 2006 +0000
@@ -30,9 +30,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_wsconsvideo.h"
 #include "SDL_wsconsevents_c.h"
--- a/src/video/wscons/SDL_wsconsvideo.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/wscons/SDL_wsconsvideo.h	Thu Feb 16 10:11:48 2006 +0000
@@ -26,9 +26,10 @@
 #include <sys/time.h>
 #include <termios.h>
 #include <dev/wscons/wsconsio.h>
+
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
 
 void WSCONS_ReportError(char *fmt, ...);
 
--- a/src/video/x11/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-
-## Makefile.am for SDL using the X11 video driver
-
-noinst_LTLIBRARIES = libvideo_x11.la
-libvideo_x11_la_SOURCES = $(X11_SRCS)
-
-x11_lib = \"@x11_lib@\"
-x11ext_lib = \"@x11ext_lib@\"
-
-# The SDL X11 video driver sources
-X11_SRCS = 			\
-	SDL_x11dga.c		\
-	SDL_x11dga_c.h		\
-	SDL_x11events.c		\
-	SDL_x11events_c.h	\
-	SDL_x11gamma.c		\
-	SDL_x11gamma_c.h	\
-	SDL_x11gl.c		\
-	SDL_x11gl_c.h		\
-	SDL_x11image.c		\
-	SDL_x11image_c.h	\
-	SDL_x11modes.c		\
-	SDL_x11modes_c.h	\
-	SDL_x11mouse.c		\
-	SDL_x11mouse_c.h	\
-	SDL_x11video.c		\
-	SDL_x11video.h		\
-	SDL_x11wm.c		\
-	SDL_x11wm_c.h		\
-	SDL_x11yuv.c		\
-	SDL_x11yuv_c.h		\
-	SDL_x11dyn.c		\
-	SDL_x11dyn.h		\
-	SDL_x11sym.h
-
--- a/src/video/x11/SDL_x11dga.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11dga.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,7 +26,7 @@
 */
 
 #include "SDL_video.h"
-#include "SDL_cursor_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_x11dga_c.h"
 
 /* Global for the error handler */
@@ -34,17 +34,13 @@
 
 void X11_EnableDGAMouse(_THIS)
 {
-#ifdef XFREE86_DGAMOUSE
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
     int dga_major, dga_minor;
     int use_dgamouse;
     const char *env_use_dgamouse;
 
     /* Check configuration to see if we should use DGA mouse */
-#ifdef DEFAULT_DGAMOUSE
     use_dgamouse = 1;
-#else
-    use_dgamouse = 0;
-#endif
     env_use_dgamouse = SDL_getenv("SDL_VIDEO_X11_DGAMOUSE");
     if ( env_use_dgamouse ) {
         use_dgamouse = atoi(env_use_dgamouse);
@@ -61,13 +57,13 @@
             using_dga |= DGA_MOUSE;
         }
     }
-#endif /* XFREE86_DGAMOUSE */
+#endif /* SDL_VIDEO_DRIVER_X11_DGAMOUSE */
 }
 
 /* Argh.  Glide resets DGA mouse mode when it makes the context current! */
 void X11_CheckDGAMouse(_THIS)
 {
-#ifdef XFREE86_DGAMOUSE
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
     int flags;
 
     if ( using_dga & DGA_MOUSE ) {
@@ -81,10 +77,10 @@
 
 void X11_DisableDGAMouse(_THIS)
 {
-#ifdef XFREE86_DGAMOUSE
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
     if ( using_dga & DGA_MOUSE ) {
 	SDL_NAME(XF86DGADirectVideo)(SDL_Display, SDL_Screen, 0);
         using_dga &= ~DGA_MOUSE;
     }
-#endif /* XFREE86_DGAMOUSE */
+#endif /* SDL_VIDEO_DRIVER_X11_DGAMOUSE */
 }
--- a/src/video/x11/SDL_x11dyn.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,6 +24,8 @@
 #define DEBUG_DYNAMIC_X11 1
 #endif
 
+#include "SDL_config.h"
+
 #define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
 #include "SDL_x11dyn.h"
 
@@ -31,13 +33,13 @@
 #include <stdio.h>
 #endif
 
-#ifdef X11_DYNAMIC
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
 #include <dlfcn.h>
 #include "SDL_name.h"
 #include "SDL_loadso.h"
-static const char *x11_library = X11_DYNAMIC;
+static const char *x11_library = SDL_VIDEO_DRIVER_X11_DYNAMIC;
 static void *x11_handle = NULL;
-static const char *x11ext_library = X11EXT_DYNAMIC;
+static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT;
 static void *x11ext_handle = NULL;
 
 static void *X11_GetSym(int required, const char *fnname, int *rc)
@@ -65,7 +67,7 @@
 
 	return fn;
 }
-#endif  /* defined X11_DYNAMIC */
+#endif  /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
 
 /* Define all the function pointers... */
 #define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL;
@@ -84,7 +86,7 @@
 			#include "SDL_x11sym.h"
 			#undef SDL_X11_SYM
 
-			#ifdef X11_DYNAMIC
+			#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
 			if (x11_handle != NULL) {
 				SDL_UnloadObject(x11_handle);
 				x11_handle = NULL;
@@ -105,7 +107,7 @@
 
     /* deal with multiple modules (dga, x11, etc) needing these symbols... */
 	if (x11_load_refcount++ == 0) {
-		#ifdef X11_DYNAMIC
+		#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
 			x11_handle = SDL_LoadObject(x11_library);
 			x11ext_handle = SDL_LoadObject(x11ext_library);
 			rc = ((x11_handle != NULL) && (x11ext_handle != NULL));
--- a/src/video/x11/SDL_x11dyn.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.h	Thu Feb 16 10:11:48 2006 +0000
@@ -29,7 +29,7 @@
 #include <X11/Xlibint.h>
 #include <X11/Xproto.h>
 
-#include <Xext/extensions/extutil.h>
+#include "../Xext/extensions/extutil.h"
 
 #ifndef NO_SHARED_MEMORY
 #include <sys/ipc.h>
@@ -71,7 +71,7 @@
 #define XFree pXFree
 #define _XData32 p_XData32
 
-#if defined(__osf__) && defined(X11_DYNAMIC)
+#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC)
 #define _SmtBufferOverflow p_SmtBufferOverflow
 #define _SmtIpError p_SmtIpError
 #define ipAllocateData pipAllocateData
--- a/src/video/x11/SDL_x11events.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11events.c	Thu Feb 16 10:11:48 2006 +0000
@@ -35,9 +35,9 @@
 
 #include "SDL_timer.h"
 #include "SDL_syswm.h"
-#include "SDL_sysevents.h"
-#include "SDL_sysvideo.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11video.h"
 #include "SDL_x11dga_c.h"
 #include "SDL_x11modes_c.h"
--- a/src/video/x11/SDL_x11gamma.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11gamma.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,7 @@
 
 #include "SDL.h"
 #include "SDL_events.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11video.h"
 
 /* From the X server sources... */
@@ -31,7 +31,7 @@
 
 static int X11_SetGammaNoLock(_THIS, float red, float green, float blue)
 {
-#ifdef XFREE86_VMGAMMA
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     if (use_vidmode >= 200) {
         SDL_NAME(XF86VidModeGamma) gamma;
         Bool succeeded;
@@ -92,7 +92,7 @@
 
 static int X11_GetGammaNoLock(_THIS, float *red, float *green, float *blue)
 {
-#ifdef XFREE86_VMGAMMA
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     if (use_vidmode >= 200) {
         SDL_NAME(XF86VidModeGamma) gamma;
         if (SDL_NAME(XF86VidModeGetGamma)(SDL_Display, SDL_Screen, &gamma)) {
--- a/src/video/x11/SDL_x11gl.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11gl.c	Thu Feb 16 10:11:48 2006 +0000
@@ -21,7 +21,7 @@
 */
 
 #include "SDL_x11video.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11dga_c.h"
 #include "SDL_x11gl_c.h"
 
@@ -42,7 +42,7 @@
 
 XVisualInfo *X11_GL_GetVisual(_THIS)
 {
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 	/* 64 seems nice. */
 	int attribs[64];
 	int i;
@@ -170,7 +170,7 @@
 int X11_GL_CreateWindow(_THIS, int w, int h)
 {
 	int retval;
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 	XSetWindowAttributes attributes;
 	unsigned long mask;
 	unsigned long black;
@@ -202,7 +202,7 @@
 int X11_GL_CreateContext(_THIS)
 {
 	int retval;
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 	/* We do this to create a clean separation between X and GLX errors. */
 	pXSync( SDL_Display, False );
 	glx_context = this->gl_data->glXCreateContext(GFX_Display, 
@@ -228,7 +228,7 @@
 
 void X11_GL_Shutdown(_THIS)
 {
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 	/* Clean up OpenGL */
 	if( glx_context ) {
 		this->gl_data->glXMakeCurrent(GFX_Display, None, NULL);
@@ -239,10 +239,10 @@
 		glx_context = NULL;
 	}
 	gl_active = 0;
-#endif /* HAVE_OPENGL_X11 */
+#endif /* SDL_VIDEO_OPENGL_GLX */
 }
 
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 
 /* Make the current context active */
 int X11_GL_MakeCurrent(_THIS)
@@ -331,19 +331,14 @@
 	this->gl_data->glXSwapBuffers(GFX_Display, SDL_Window);
 }
 
-#endif /* HAVE_OPENGL_X11 */
+#endif /* SDL_VIDEO_OPENGL_GLX */
 
 void X11_GL_UnloadLibrary(_THIS)
 {
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 	if ( this->gl_config.driver_loaded ) {
 
-		/* !!! FIXME: Can we just use SDL_UnloadObject() everywhere? */
-		#ifdef USE_DLOPEN
-		dlclose(this->gl_config.dll_handle);
-		#else
 		SDL_UnloadObject(this->gl_config.dll_handle);
-		#endif
 
 		this->gl_data->glXGetProcAddress = NULL;
 		this->gl_data->glXChooseVisual = NULL;
@@ -358,21 +353,7 @@
 #endif
 }
 
-#ifdef HAVE_OPENGL_X11
-
-static void *do_dlsym(void *handle, const char *name)
-{
-	/* !!! FIXME: Can we just use SDL_LoadFunction() everywhere? */
-#ifdef USE_DLOPEN
-	return dlsym(handle, name);
-#else
-	return SDL_LoadFunction(handle, name);
-#endif
-}
-
-#if defined(__OpenBSD__) && !defined(__ELF__)
-#define do_dlsym(x,y) do_dlsym(x, "_" y)
-#endif
+#if SDL_VIDEO_OPENGL_GLX
 
 /* Passing a NULL path means load pointers from the application */
 int X11_GL_LoadLibrary(_THIS, const char* path) 
@@ -391,49 +372,32 @@
 		}
 	}
 
-	/* !!! FIXME: Can we just use SDL_LoadObject() everywhere? */
-	#ifdef USE_DLOPEN
-	{
-		#ifdef RTLD_GLOBAL
-			int dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
-		#else
-			int dlopen_flags = RTLD_LAZY;
-		#endif
-		handle = dlopen(path, dlopen_flags);
-		if ( handle == NULL ) {
-			SDL_SetError("Could not load OpenGL library: %s", (const char *) dlerror());
-			return -1;
-		}
+	handle = SDL_LoadObject(path);
+	if ( handle == NULL ) {
+		/* SDL_LoadObject() will call SDL_SetError() for us. */
+		return -1;
 	}
-	#else
-		handle = SDL_LoadObject(path);
-		if ( handle == NULL ) {
-			/* SDL_LoadObject() will call SDL_SetError() for us. */
-			return -1;
-		}
-	#endif
-
 
 	/* Unload the old driver and reset the pointers */
 	X11_GL_UnloadLibrary(this);
 
 	/* Load new function pointers */
 	this->gl_data->glXGetProcAddress =
-		(void *(*)(const GLubyte *)) do_dlsym(handle, "glXGetProcAddressARB");
+		(void *(*)(const GLubyte *)) SDL_LoadFunction(handle, "glXGetProcAddressARB");
 	this->gl_data->glXChooseVisual =
-		(XVisualInfo *(*)(Display *, int, int *)) do_dlsym(handle, "glXChooseVisual");
+		(XVisualInfo *(*)(Display *, int, int *)) SDL_LoadFunction(handle, "glXChooseVisual");
 	this->gl_data->glXCreateContext =
-		(GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) do_dlsym(handle, "glXCreateContext");
+		(GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) SDL_LoadFunction(handle, "glXCreateContext");
 	this->gl_data->glXDestroyContext =
-		(void (*)(Display *, GLXContext)) do_dlsym(handle, "glXDestroyContext");
+		(void (*)(Display *, GLXContext)) SDL_LoadFunction(handle, "glXDestroyContext");
 	this->gl_data->glXMakeCurrent =
-		(int (*)(Display *, GLXDrawable, GLXContext)) do_dlsym(handle, "glXMakeCurrent");
+		(int (*)(Display *, GLXDrawable, GLXContext)) SDL_LoadFunction(handle, "glXMakeCurrent");
 	this->gl_data->glXSwapBuffers =
-		(void (*)(Display *, GLXDrawable)) do_dlsym(handle, "glXSwapBuffers");
+		(void (*)(Display *, GLXDrawable)) SDL_LoadFunction(handle, "glXSwapBuffers");
 	this->gl_data->glXGetConfig =
-		(int (*)(Display *, XVisualInfo *, int, int *)) do_dlsym(handle, "glXGetConfig");
+		(int (*)(Display *, XVisualInfo *, int, int *)) SDL_LoadFunction(handle, "glXGetConfig");
 	this->gl_data->glXQueryExtensionsString =
-		(const char *(*)(Display *, int)) do_dlsym(handle, "glXQueryExtensionsString");
+		(const char *(*)(Display *, int)) SDL_LoadFunction(handle, "glXQueryExtensionsString");
 	
 
 	if ( (this->gl_data->glXChooseVisual == NULL) || 
@@ -460,24 +424,13 @@
 
 void *X11_GL_GetProcAddress(_THIS, const char* proc)
 {
-	static char procname[1024];
 	void* handle;
-	void* retval;
 	
 	handle = this->gl_config.dll_handle;
 	if ( this->gl_data->glXGetProcAddress ) {
 		return this->gl_data->glXGetProcAddress((const GLubyte *)proc);
 	}
-#if defined(__OpenBSD__) && !defined(__ELF__)
-#undef do_dlsym
-#endif
-	retval = do_dlsym(handle, proc);
-	if (!retval && SDL_strlen(proc) <= 1022) {
-		procname[0] = '_';
-		SDL_strcpy(procname + 1, proc);
-		retval = do_dlsym(handle, procname);
-	}
-	return retval;
+	return SDL_LoadFunction(handle, proc);
 }
 
-#endif /* HAVE_OPENGL_X11 */
+#endif /* SDL_VIDEO_OPENGL_GLX */
--- a/src/video/x11/SDL_x11gl_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11gl_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -20,21 +20,17 @@
     slouken@libsdl.org
 */
 
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 #include <GL/glx.h>
-#ifdef USE_DLOPEN
-#include <dlfcn.h>
-#else
 #include "SDL_loadso.h"
 #endif
-#endif
 
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 struct SDL_PrivateGLData {
     int gl_active; /* to stop switching drivers while we have a valid context */
 
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
     GLXContext glx_context;	/* Current GL context */
     XVisualInfo* glx_visualinfo; /* XVisualInfo* returned by glXChooseVisual */
 
@@ -75,7 +71,7 @@
 	      int screen );
 
     
-#endif /* HAVE_OPENGL_X11 */
+#endif /* SDL_VIDEO_OPENGL_GLX */
 };
 
 /* Old variable names */
@@ -88,7 +84,7 @@
 extern int X11_GL_CreateWindow(_THIS, int w, int h);
 extern int X11_GL_CreateContext(_THIS);
 extern void X11_GL_Shutdown(_THIS);
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 extern int X11_GL_MakeCurrent(_THIS);
 extern int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
 extern void X11_GL_SwapBuffers(_THIS);
--- a/src/video/x11/SDL_x11image.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11image.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include "SDL_endian.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11image_c.h"
 
 #ifndef NO_SHARED_MEMORY
--- a/src/video/x11/SDL_x11modes.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11modes.c	Thu Feb 16 10:11:48 2006 +0000
@@ -26,27 +26,27 @@
 
 #include "SDL_timer.h"
 #include "SDL_events.h"
-#include "SDL_events_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11video.h"
 #include "SDL_x11wm_c.h"
 #include "SDL_x11modes_c.h"
 #include "SDL_x11image_c.h"
 
-#ifdef HAVE_XINERAMA
-#include <Xext/extensions/Xinerama.h>
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+#include "../Xext/extensions/Xinerama.h"
 #endif 
 
 #define MAX(a, b)        (a > b ? a : b)
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info)
 {
     SDL_NAME(XF86VidModeModeLine) *l = (SDL_NAME(XF86VidModeModeLine)*)((char*)info + sizeof info->dotclock);
     return SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, (int*)&info->dotclock, l);
 }
-#endif /* XFREE86_VM */
+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 static void save_mode(_THIS)
 {
     SDL_memset(&saved_mode, 0, sizeof(saved_mode));
@@ -55,7 +55,7 @@
 }
 #endif
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 static void restore_mode(_THIS)
 {
     SDL_NAME(XF86VidModeModeLine) mode;
@@ -73,7 +73,7 @@
 }
 #endif
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 static int cmpmodes(const void *va, const void *vb)
 {
     const SDL_NAME(XF86VidModeModeInfo) *a = *(const SDL_NAME(XF86VidModeModeInfo)**)va;
@@ -89,7 +89,7 @@
 
 static void set_best_resolution(_THIS, int width, int height)
 {
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     if ( use_vidmode ) {
         SDL_NAME(XF86VidModeModeLine) mode;
         SDL_NAME(XF86VidModeModeInfo) **modes;
@@ -137,10 +137,10 @@
             pXFree(modes);
         }
     }
-#endif /* XFREE86_VM */
+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
 
                                 /* XiG */
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
 #ifdef XIG_DEBUG
     fprintf(stderr, "XME: set_best_resolution(): w = %d, h = %d\n",
             width, height);
@@ -177,13 +177,13 @@
             }
         }
     }
-#endif /* HAVE_XIGXME */
+#endif /* SDL_VIDEO_DRIVER_X11_XME */
 
 }
 
 static void get_real_resolution(_THIS, int* w, int* h)
 {
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     if ( use_vidmode ) {
         SDL_NAME(XF86VidModeModeLine) mode;
         int unused;
@@ -196,7 +196,7 @@
     }
 #endif
 
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
     if ( use_xme ) {
         int ractive;
         XiGMiscResolutionInfo *modelist;
@@ -277,13 +277,13 @@
 
 int X11_GetVideoModes(_THIS)
 {
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     int buggy_X11;
     int vm_major, vm_minor;
     int nmodes;
     SDL_NAME(XF86VidModeModeInfo) **modes;
 #endif
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
     int xme_major, xme_minor;
     int ractive, nummodes;
     XiGMiscResolutionInfo *modelist;
@@ -297,7 +297,7 @@
     screen_w = DisplayWidth(SDL_Display, SDL_Screen);
     screen_h = DisplayHeight(SDL_Display, SDL_Screen);
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     /* Metro-X 4.3.0 and earlier has a broken implementation of
        XF86VidModeGetAllModeLines() - it hangs the client.
      */
@@ -407,10 +407,10 @@
         use_vidmode = vm_major * 100 + vm_minor;
         save_mode(this);
     }
-#endif /* XFREE86_VM */
+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
 
                                 /* XiG */
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
     /* first lets make sure we have the extension, and it's at least v2.0 */
     if (XiGMiscQueryVersion(SDL_Display, &xme_major, &xme_minor)) {
 #ifdef XIG_DEBUG
@@ -478,7 +478,7 @@
     if ( modelist ) {
         pXFree(modelist);
     }
-#endif /* HAVE_XIGXME */
+#endif /* SDL_VIDEO_DRIVER_X11_XME */
 
     {
         static int depth_list[] = { 32, 24, 16, 15, 8 };
@@ -544,7 +544,7 @@
         printf("XFree86 VidMode is enabled\n");
     }
 
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
     if ( use_xme )
       printf("Xi Graphics XME fullscreen is enabled\n");
     else
@@ -563,7 +563,7 @@
     xinerama_x = 0;
     xinerama_y = 0;
 
-#ifdef HAVE_XINERAMA
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
     /* Query Xinerama extention */
     if ( SDL_NAME(XineramaQueryExtension)(SDL_Display, &i, &i) &&
          SDL_NAME(XineramaIsActive)(SDL_Display) ) {
@@ -596,7 +596,7 @@
         }
         pXFree(xinerama);
     }
-#endif /* HAVE_XINERAMA */
+#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
 
     return 0;
 }
@@ -740,7 +740,7 @@
     pXRaiseWindow(SDL_Display, FSwindow);
 #endif
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     /* Save the current video mode */
     if ( use_vidmode ) {
         SDL_NAME(XF86VidModeLockModeSwitch)(SDL_Display, SDL_Screen, True);
@@ -777,14 +777,14 @@
 {
     if ( currently_fullscreen ) {
         pXReparentWindow(SDL_Display, SDL_Window, WMwindow, 0, 0);
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
         if ( use_vidmode ) {
             restore_mode(this);
             SDL_NAME(XF86VidModeLockModeSwitch)(SDL_Display, SDL_Screen, False);
         }
 #endif
 
-#ifdef HAVE_XIGXME
+#if SDL_VIDEO_DRIVER_X11_XME
         if ( use_xme ) {
             int rw, rh;        
             
--- a/src/video/x11/SDL_x11mouse.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Thu Feb 16 10:11:48 2006 +0000
@@ -24,8 +24,8 @@
 #include <X11/Xutil.h>
 
 #include "SDL_mouse.h"
-#include "SDL_events_c.h"
-#include "SDL_cursor_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_cursor_c.h"
 #include "SDL_x11dga_c.h"
 #include "SDL_x11mouse_c.h"
 
--- a/src/video/x11/SDL_x11video.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11video.c	Thu Feb 16 10:11:48 2006 +0000
@@ -39,9 +39,9 @@
 #include "SDL_thread.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11video.h"
 #include "SDL_x11wm_c.h"
 #include "SDL_x11mouse_c.h"
@@ -51,7 +51,7 @@
 #include "SDL_x11yuv_c.h"
 #include "SDL_x11gl_c.h"
 #include "SDL_x11gamma_c.h"
-#include "blank_cursor.h"
+#include "../blank_cursor.h"
 
 /* Initialization/Query functions */
 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat);
@@ -125,7 +125,7 @@
 		device->SetVideoMode = X11_SetVideoMode;
 		device->ToggleFullScreen = X11_ToggleFullScreen;
 		device->UpdateMouse = X11_UpdateMouse;
-#ifdef XFREE86_XV
+#if SDL_VIDEO_DRIVER_X11_XV
 		device->CreateYUVOverlay = X11_CreateYUVOverlay;
 #endif
 		device->SetColors = X11_SetColors;
@@ -144,7 +144,7 @@
 		device->GetGamma = X11_GetVidModeGamma;
 		device->SetGammaRamp = X11_SetGammaRamp;
 		device->GetGammaRamp = NULL;
-#ifdef HAVE_OPENGL_X11
+#if SDL_VIDEO_OPENGL_GLX
 		device->GL_LoadLibrary = X11_GL_LoadLibrary;
 		device->GL_GetProcAddress = X11_GL_GetProcAddress;
 		device->GL_GetAttribute = X11_GL_GetAttribute;
@@ -179,14 +179,14 @@
 static int (*X_handler)(Display *, XErrorEvent *) = NULL;
 static int x_errhandler(Display *d, XErrorEvent *e)
 {
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 	extern int vm_error;
 #endif
-#ifdef XFREE86_DGAMOUSE
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
 	extern int dga_error;
 #endif
 
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
 	/* VidMode errors are non-fatal. :) */
 	/* Are the errors offset by one from the error base?
 	   e.g. the error base is 143, the code is 148, and the
@@ -204,9 +204,9 @@
 #endif
         	return(0);
         }
-#endif /* XFREE86_VM */
+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
 
-#ifdef XFREE86_DGAMOUSE
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
 	/* DGA errors can be non-fatal. :) */
         if ( (dga_error >= 0) &&
 	     ((e->error_code > dga_error) &&
@@ -219,7 +219,7 @@
 #endif
         	return(0);
         }
-#endif /* XFREE86_DGAMOUSE */
+#endif /* SDL_VIDEO_DRIVER_X11_DGAMOUSE */
 
 	return(X_handler(d,e));
 }
@@ -451,7 +451,7 @@
 		local_X11 = 0;
 	}
 	SDL_Display = pXOpenDisplay(display);
-#if defined(__osf__) && defined(X11_DYNAMIC)
+#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC)
 	/* On Tru64 if linking without -lX11, it fails and you get following message.
 	 * Xlib: connection to ":0.0" refused by server
 	 * Xlib: XDM authorization key matches an existing client!
--- a/src/video/x11/SDL_x11video.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11video.h	Thu Feb 16 10:11:48 2006 +0000
@@ -27,20 +27,19 @@
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 
-#ifdef XFREE86_DGAMOUSE
-#include <Xext/extensions/xf86dga.h>
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
+#include "../Xext/extensions/xf86dga.h"
 #endif
-#ifdef XFREE86_VM
-#include <Xext/extensions/xf86vmode.h>
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
+#include "../Xext/extensions/xf86vmode.h"
 #endif
-#ifdef HAVE_XIGXME
-#include <Xext/extensions/xme.h>
+#if SDL_VIDEO_DRIVER_X11_XME
+#include "../Xext/extensions/xme.h"
 #endif
 
-#include <string.h>
-
-#include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
 #include "SDL_x11dyn.h"
 
 /* Hidden "this" pointer for the video functions */
@@ -106,13 +105,13 @@
     int depth;			/* current visual depth (not bpp) */
 
     /* Variables used by the X11 video mode code */
-#ifdef XFREE86_VM
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
     SDL_NAME(XF86VidModeModeInfo) saved_mode;
     struct {
         int x, y;
     } saved_view;
 #endif
-#ifdef HAVE_XIGXME /* XiG XME fullscreen */
+#if SDL_VIDEO_DRIVER_X11_XME /* XiG XME fullscreen */
     int use_xme;
     XiGMiscResolutionInfo saved_res;
 #endif
--- a/src/video/x11/SDL_x11wm.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11wm.c	Thu Feb 16 10:11:48 2006 +0000
@@ -27,8 +27,8 @@
 #include "SDL_timer.h"
 #include "SDL_video.h"
 #include "SDL_syswm.h"
-#include "SDL_events_c.h"
-#include "SDL_pixels_c.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 #include "SDL_x11modes_c.h"
 #include "SDL_x11wm_c.h"
 
--- a/src/video/x11/SDL_x11yuv.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11yuv.c	Thu Feb 16 10:11:48 2006 +0000
@@ -22,7 +22,9 @@
 
 /* This is the XFree86 Xv extension implementation of YUV video overlays */
 
-#ifdef XFREE86_XV
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_X11_XV
 
 #include <X11/Xlib.h>
 #ifndef NO_SHARED_MEMORY
@@ -30,11 +32,10 @@
 #include <sys/shm.h>
 #include <X11/extensions/XShm.h>
 #endif
-#include <Xext/extensions/Xvlib.h>
+#include "../Xext/extensions/Xvlib.h"
 
-#include "SDL_video.h"
 #include "SDL_x11yuv_c.h"
-#include "SDL_yuvfuncs.h"
+#include "../SDL_yuvfuncs.h"
 
 #define XFREE86_REFRESH_HACK
 #ifdef XFREE86_REFRESH_HACK
@@ -407,4 +408,4 @@
 #endif
 }
 
-#endif /* XFREE86_XV */
+#endif /* SDL_VIDEO_DRIVER_X11_XV */
--- a/src/video/x11/SDL_x11yuv_c.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/x11/SDL_x11yuv_c.h	Thu Feb 16 10:11:48 2006 +0000
@@ -25,7 +25,7 @@
 #include "SDL_video.h"
 #include "SDL_x11video.h"
 
-#ifdef XFREE86_XV
+#if SDL_VIDEO_DRIVER_X11_XV
 
 extern SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
 
@@ -37,4 +37,4 @@
 
 extern void X11_FreeYUVOverlay(_THIS, SDL_Overlay *overlay);
 
-#endif /* XFREE86_XV */
+#endif /* SDL_VIDEO_DRIVER_X11_XV */
--- a/src/video/xbios/Makefile.am	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-## Makefile.am for SDL using the XBIOS video driver
-
-noinst_LTLIBRARIES = libvideo_xbios.la
-libvideo_xbios_la_SOURCES = $(XBIOS_SRCS)
-
-# The SDL XBIOS video driver sources
-XBIOS_SRCS = 	\
-	SDL_xbios.c	\
-	SDL_xbios.h	\
-	SDL_xbios_blowup.c	\
-	SDL_xbios_blowup.h	\
-	SDL_xbios_centscreen.c	\
-	SDL_xbios_centscreen.h	\
-	SDL_xbios_sb3.c	\
-	SDL_xbios_sb3.h
--- a/src/video/xbios/SDL_xbios.c	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/xbios/SDL_xbios.c	Thu Feb 16 10:11:48 2006 +0000
@@ -36,9 +36,9 @@
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
-#include "SDL_sysvideo.h"
-#include "SDL_pixels_c.h"
-#include "SDL_events_c.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
 
 #include "SDL_ataric2p_s.h"
 #include "SDL_atarievents_c.h"
@@ -78,7 +78,7 @@
 static void XBIOS_FreeHWSurface(_THIS, SDL_Surface *surface);
 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 /* OpenGL functions */
 static void XBIOS_GL_SwapBuffers(_THIS);
 #endif
@@ -174,7 +174,7 @@
 	device->FlipHWSurface = XBIOS_FlipHWSurface;
 	device->FreeHWSurface = XBIOS_FreeHWSurface;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	/* OpenGL functions */
 	device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
 	device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
@@ -452,7 +452,7 @@
 	/* Init chunky to planar routine */
 	SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	SDL_AtariGL_InitPointers(this);
 #endif
 
@@ -566,7 +566,7 @@
 
 	XBIOS_screens[0]=(void *) (( (long) XBIOS_screensmem[0]+256) & 0xFFFFFF00UL);
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (flags & SDL_OPENGL) {
 		if (this->gl_config.double_buffer) {
 			flags |= SDL_DOUBLEBUF;
@@ -610,7 +610,7 @@
 
 	XBIOS_fbnum = 0;
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (flags & SDL_OPENGL) {
 		if (!SDL_AtariGL_Init(this, current)) {
 			XBIOS_FreeBuffers(this);
@@ -891,7 +891,7 @@
 #endif
 
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 	if (gl_active) {
 		SDL_AtariGL_Quit(this, SDL_TRUE);
 	}
@@ -922,7 +922,7 @@
 	this->screen->pixels = NULL;	
 }
 
-#ifdef HAVE_OPENGL
+#if SDL_VIDEO_OPENGL
 
 static void XBIOS_GL_SwapBuffers(_THIS)
 {
--- a/src/video/xbios/SDL_xbios.h	Fri Feb 10 07:29:08 2006 +0000
+++ b/src/video/xbios/SDL_xbios.h	Thu Feb 16 10:11:48 2006 +0000
@@ -24,7 +24,7 @@
 #define _SDL_xbios_h
 
 #include "SDL_stdinc.h"
-#include "SDL_sysvideo.h"
+#include "../SDL_sysvideo.h"
 
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
--- a/strip_fPIC.sh	Fri Feb 10 07:29:08 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# libtool assumes that the compiler can handle the -fPIC flag
-# This isn't always true (for example, nasm can't handle it)
-command=""
-while [ $# -gt 0 ]; do
-    case "$1" in
-        -?PIC)
-            # Ignore -fPIC and -DPIC options
-            ;;
-        *)
-            command="$command $1"
-            ;;
-    esac
-    shift
-done
-echo $command
-exec $command