Lots of fixes importing SDL source wholesale into a new iOS project
authorSam Lantinga <slouken@libsdl.org>
Mon, 31 Oct 2011 05:56:58 -0400
changeset 6044 35448a5ea044
parent 6043 46d78e48ae8b
child 6045 b8e995dab018
Lots of fixes importing SDL source wholesale into a new iOS project
include/SDL_config.h.in
include/SDL_opengl.h
src/SDL_error_c.h
src/audio/alsa/SDL_alsa_audio.c
src/audio/android/SDL_androidaudio.c
src/audio/arts/SDL_artsaudio.c
src/audio/baudio/SDL_beaudio.cc
src/audio/bsd/SDL_bsdaudio.c
src/audio/directsound/SDL_directsound.c
src/audio/disk/SDL_diskaudio.c
src/audio/dsp/SDL_dspaudio.c
src/audio/esd/SDL_esdaudio.c
src/audio/fusionsound/SDL_fsaudio.c
src/audio/nas/SDL_nasaudio.c
src/audio/nds/SDL_ndsaudio.c
src/audio/paudio/SDL_paudio.c
src/audio/pulseaudio/SDL_pulseaudio.c
src/audio/qsa/SDL_qsa_audio.c
src/audio/sun/SDL_sunaudio.c
src/audio/ums/SDL_umsaudio.c
src/audio/ums/SDL_umsaudio.h
src/audio/winmm/SDL_winmm.c
src/audio/xaudio2/SDL_xaudio2.c
src/core/android/SDL_android.cpp
src/core/windows/SDL_windows.c
src/events/SDL_gesture.c
src/events/SDL_keyboard.c
src/events/SDL_touch.c
src/libm/e_atan2.c
src/libm/e_log.c
src/libm/e_pow.c
src/libm/e_rem_pio2.c
src/libm/e_sqrt.c
src/libm/k_cos.c
src/libm/k_rem_pio2.c
src/libm/k_sin.c
src/libm/math.h
src/libm/math_libm.h
src/libm/s_atan.c
src/libm/s_copysign.c
src/libm/s_cos.c
src/libm/s_fabs.c
src/libm/s_floor.c
src/libm/s_scalbn.c
src/libm/s_sin.c
src/main/android/SDL_android_main.cpp
src/main/beos/SDL_BeApp.cc
src/main/windows/SDL_windows_main.c
src/power/beos/SDL_syspower.c
src/power/linux/SDL_syspower.c
src/power/macosx/SDL_syspower.c
src/power/nds/SDL_syspower.c
src/power/uikit/SDL_syspower.h
src/power/uikit/SDL_syspower.m
src/power/windows/SDL_syspower.c
src/render/SDL_render.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
src/render/software/SDL_render_sw.c
src/stdlib/SDL_string.c
src/thread/SDL_thread.c
src/thread/SDL_thread_c.h
src/thread/beos/SDL_syssem.c
src/thread/beos/SDL_systhread.c
src/thread/irix/SDL_syssem.c
src/thread/irix/SDL_systhread.c
src/thread/irix/SDL_systhread_c.h
src/thread/nds/SDL_systhread.c
src/thread/windows/SDL_sysmutex.c
src/thread/windows/SDL_syssem.c
src/thread/windows/SDL_systhread.c
src/thread/windows/win_ce_semaphore.c
src/video/SDL_rect.c
src/video/SDL_shape.c
src/video/SDL_video.c
src/video/android/SDL_androidevents.c
src/video/android/SDL_androidgl.c
src/video/android/SDL_androidkeyboard.c
src/video/android/SDL_androidtouch.c
src/video/android/SDL_androidvideo.c
src/video/android/SDL_androidwindow.c
src/video/bwindow/SDL_bclipboard.cc
src/video/bwindow/SDL_bevents.cc
src/video/bwindow/SDL_bframebuffer.cc
src/video/bwindow/SDL_bkeyboard.cc
src/video/bwindow/SDL_bmodes.cc
src/video/bwindow/SDL_bopengl.cc
src/video/bwindow/SDL_bvideo.cc
src/video/bwindow/SDL_bwindow.cc
src/video/cocoa/SDL_cocoaclipboard.m
src/video/cocoa/SDL_cocoaevents.m
src/video/cocoa/SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoamodes.m
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoashape.m
src/video/cocoa/SDL_cocoavideo.m
src/video/cocoa/SDL_cocoawindow.m
src/video/directfb/SDL_DirectFB_WM.c
src/video/directfb/SDL_DirectFB_dyn.c
src/video/directfb/SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_modes.c
src/video/directfb/SDL_DirectFB_mouse.c
src/video/directfb/SDL_DirectFB_opengl.c
src/video/directfb/SDL_DirectFB_render.c
src/video/directfb/SDL_DirectFB_shape.c
src/video/directfb/SDL_DirectFB_video.c
src/video/directfb/SDL_DirectFB_window.c
src/video/dummy/SDL_nullevents.c
src/video/dummy/SDL_nullframebuffer.c
src/video/dummy/SDL_nullvideo.c
src/video/nds/SDL_ndsevents.c
src/video/nds/SDL_ndsvideo.c
src/video/nds/SDL_ndswindow.c
src/video/pandora/SDL_pandora.c
src/video/pandora/SDL_pandora_events.c
src/video/uikit/SDL_uikitappdelegate.m
src/video/uikit/SDL_uikitevents.m
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitopenglview.m
src/video/uikit/SDL_uikitvideo.m
src/video/uikit/SDL_uikitview.m
src/video/uikit/SDL_uikitviewcontroller.m
src/video/uikit/SDL_uikitwindow.m
src/video/windows/SDL_windowsclipboard.c
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowsframebuffer.c
src/video/windows/SDL_windowskeyboard.c
src/video/windows/SDL_windowsmodes.c
src/video/windows/SDL_windowsmouse.c
src/video/windows/SDL_windowsopengl.c
src/video/windows/SDL_windowsshape.c
src/video/windows/SDL_windowsvideo.c
src/video/windows/SDL_windowswindow.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11opengles.c
src/video/x11/imKStoUCS.c
--- a/include/SDL_config.h.in	Mon Oct 31 03:06:32 2011 -0400
+++ b/include/SDL_config.h.in	Mon Oct 31 05:56:58 2011 -0400
@@ -233,7 +233,6 @@
 #undef SDL_THREAD_PTHREAD
 #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
 #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
-#undef SDL_THREAD_SPROC
 #undef SDL_THREAD_WINDOWS
 
 /* Enable various timer systems */
--- a/include/SDL_opengl.h	Mon Oct 31 03:06:32 2011 -0400
+++ b/include/SDL_opengl.h	Mon Oct 31 05:56:58 2011 -0400
@@ -30,6 +30,8 @@
 
 #include "SDL_config.h"
 
+#ifndef __IPHONEOS__
+
 #ifdef __WIN32__
 #define WIN32_LEAN_AND_MEAN
 #ifndef NOMINMAX
@@ -11123,6 +11125,8 @@
 /* *INDENT-ON* */
 #endif /* NO_SDL_GLEXT */
 
+#endif /* !__IPHONEOS__ */
+
 #endif /* _SDL_opengl_h */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/SDL_error_c.h	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/SDL_error_c.h	Mon Oct 31 05:56:58 2011 -0400
@@ -56,6 +56,9 @@
     } args[ERR_MAX_ARGS];
 } SDL_error;
 
+/* Defined in SDL_thread.c */
+extern SDL_error *SDL_GetErrBuf(void);
+
 #endif /* _SDL_error_c_h */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/alsa/SDL_alsa_audio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/alsa/SDL_alsa_audio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_ALSA
+
 /* Allow access to a raw mixing buffer */
 
 #include <sys/types.h>
@@ -33,7 +35,7 @@
 #include "../SDL_audio_c.h"
 #include "SDL_alsa_audio.h"
 
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 #include "SDL_loadso.h"
 #endif
 
@@ -84,7 +86,7 @@
 static int (*ALSA_snd_pcm_sw_params_set_avail_min)
   (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
 
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
 #define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
 
@@ -147,7 +149,7 @@
 
 #undef SDL_ALSA_SYM
 
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 
 static void
 UnloadALSALibrary(void)
@@ -693,4 +695,6 @@
     "alsa", "ALSA PCM audio", ALSA_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_ALSA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/android/SDL_androidaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/android/SDL_androidaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_ANDROID
+
 /* Output audio to Android */
 
 #include "SDL_audio.h"
@@ -154,4 +156,6 @@
 	SDL_RunAudio(audioDevice);
 }
 
+#endif /* SDL_AUDIO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/arts/SDL_artsaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/arts/SDL_artsaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_ARTS
+
 /* Allow access to a raw mixing buffer */
 
 #ifdef HAVE_SIGNAL_H
@@ -34,14 +36,14 @@
 #include "../SDL_audio_c.h"
 #include "SDL_artsaudio.h"
 
-#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
+#if SDL_AUDIO_DRIVER_ARTS_DYNAMIC
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
 #define SDL_NAME(X)	X
 #endif
 
-#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
+#if SDL_AUDIO_DRIVER_ARTS_DYNAMIC
 
 static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
 static void *arts_handle = NULL;
@@ -372,4 +374,6 @@
     "arts", "Analog RealTime Synthesizer", ARTS_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_ARTS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/baudio/SDL_beaudio.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/baudio/SDL_beaudio.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_BEOSAUDIO
+
 /* Allow access to the audio stream on BeOS */
 
 #include <SoundPlayer.h>
@@ -214,4 +216,6 @@
     "baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_BEOSAUDIO */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/bsd/SDL_bsdaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/bsd/SDL_bsdaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_BSD
+
 /*
  * Driver for native OpenBSD/NetBSD audio(4).
  * vedge@vedge.com.ar.
@@ -364,4 +366,6 @@
     "bsd", "BSD audio", BSDAUDIO_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_BSD */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/directsound/SDL_directsound.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/directsound/SDL_directsound.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_DSOUND
+
 /* Allow access to a raw mixing buffer */
 
 #include "SDL_timer.h"
@@ -549,4 +551,6 @@
     "directsound", "DirectSound", DSOUND_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_DSOUND */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/disk/SDL_diskaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/disk/SDL_diskaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_DISK
+
 /* Output raw audio data to a file. */
 
 #if HAVE_STDIO_H
@@ -159,4 +161,6 @@
     "disk", "direct-to-disk audio", DISKAUD_Init, 1
 };
 
+#endif /* SDL_AUDIO_DRIVER_DISK */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/dsp/SDL_dspaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/dsp/SDL_dspaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_OSS
+
 /* Allow access to a raw mixing buffer */
 
 #include <stdio.h>              /* For perror() */
@@ -312,4 +314,6 @@
     "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_OSS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/esd/SDL_esdaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/esd/SDL_esdaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_ESD
+
 /* Allow access to an ESD network stream mixing buffer */
 
 #include <sys/types.h>
@@ -34,14 +36,14 @@
 #include "../SDL_audio_c.h"
 #include "SDL_esdaudio.h"
 
-#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#if SDL_AUDIO_DRIVER_ESD_DYNAMIC
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
 #define SDL_NAME(X)	X
 #endif
 
-#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#if SDL_AUDIO_DRIVER_ESD_DYNAMIC
 
 static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC;
 static void *esd_handle = NULL;
@@ -345,4 +347,6 @@
     "esd", "Enlightened Sound Daemon", ESD_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_ESD */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/fusionsound/SDL_fsaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/fusionsound/SDL_fsaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
+
 /* Allow access to a raw mixing buffer */
 
 #ifdef HAVE_SIGNAL_H
@@ -37,7 +39,7 @@
 
 //#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
 
-#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#if SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
@@ -51,7 +53,7 @@
 /* Buffers to use - more than 2 gives a lot of latency */
 #define FUSION_BUFFERS				(2)
 
-#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#if SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
 
 static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC;
 static void *fs_handle = NULL;
@@ -345,4 +347,6 @@
     "fusionsound", "FusionSound", SDL_FS_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/nas/SDL_nasaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/nas/SDL_nasaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_NAS
+
 /* Allow access to a raw mixing buffer */
 
 #include <signal.h>
@@ -50,7 +52,7 @@
   (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer);
 
 
-#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
+#if SDL_AUDIO_DRIVER_NAS_DYNAMIC
 
 static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC;
 static void *nas_handle = NULL;
@@ -89,7 +91,7 @@
 
 #undef SDL_NAS_SYM
 
-#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
+#if SDL_AUDIO_DRIVER_NAS_DYNAMIC
 
 static void
 UnloadNASLibrary(void)
@@ -397,4 +399,6 @@
     "nas", "Network Audio System", NAS_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_NAS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/nds/SDL_ndsaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/nds/SDL_ndsaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_NDS
+
 /* Output audio to NDS */
 
 #include <nds.h>
@@ -122,4 +124,6 @@
     "nds", "SDL NDS audio driver", NDSAUD_Init, 0       /*1? */
 };
 
+#endif /* SDL_AUDIO_DRIVER_NDS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/paudio/SDL_paudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/paudio/SDL_paudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_PAUDIO
+
 /* Allow access to a raw mixing buffer */
 
 #include <errno.h>
@@ -545,4 +547,6 @@
     "paud", "AIX Paudio", PAUDIO_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_PAUDIO */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/pulseaudio/SDL_pulseaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -106,7 +106,7 @@
 static int load_pulseaudio_syms(void);
 
 
-#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
+#if SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
 
 static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
 static void *pulseaudio_handle = NULL;
--- a/src/audio/qsa/SDL_qsa_audio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/qsa/SDL_qsa_audio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,6 +21,8 @@
 
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_QSA
+
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -863,4 +865,6 @@
     "qsa", "QNX QSA Audio", QSA_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_QSA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/sun/SDL_sunaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/sun/SDL_sunaudio.c	Mon Oct 31 05:56:58 2011 -0400
@@ -1,8 +1,3 @@
-/* I'm gambling no one uses this audio backend...we'll see who emails.  :)  */
-#error this code has not been updated for SDL 1.3.
-#error if no one emails icculus at icculus.org and tells him that this
-#error  code is needed, this audio backend will eventually be removed from SDL.
-
 /*
   Simple DirectMedia Layer
   Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
@@ -25,6 +20,13 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_SUNAUDIO
+
+/* I'm gambling no one uses this audio backend...we'll see who emails.  :)  */
+#error this code has not been updated for SDL 1.3.
+#error if no one emails icculus at icculus.org and tells him that this
+#error  code is needed, this audio backend will eventually be removed from SDL.
+
 /* Allow access to a raw mixing buffer */
 
 #include <fcntl.h>
@@ -450,4 +452,6 @@
     return (mask & sample);
 }
 
+#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/ums/SDL_umsaudio.c	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,556 +0,0 @@
-/* I'm gambling no one uses this audio backend...we'll see who emails.  :)  */
-#error this code has not been updated for SDL 1.3.
-#error if no one emails icculus at icculus.org and tells him that this
-#error  code is needed, this audio backend will eventually be removed from SDL.
-
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-/* Allow access to a raw mixing buffer */
-
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "SDL_umsaudio.h"
-
-#define DEBUG_AUDIO 1
-
-/* Audio driver functions */
-static int UMS_OpenAudio(_THIS, SDL_AudioSpec * spec);
-static void UMS_PlayAudio(_THIS);
-static Uint8 *UMS_GetAudioBuf(_THIS);
-static void UMS_CloseAudio(_THIS);
-
-static UMSAudioDevice_ReturnCode UADOpen(_THIS, string device, string mode,
-                                         long flags);
-static UMSAudioDevice_ReturnCode UADClose(_THIS);
-static UMSAudioDevice_ReturnCode UADGetBitsPerSample(_THIS, long *bits);
-static UMSAudioDevice_ReturnCode UADSetBitsPerSample(_THIS, long bits);
-static UMSAudioDevice_ReturnCode UADSetSampleRate(_THIS, long rate,
-                                                  long *set_rate);
-static UMSAudioDevice_ReturnCode UADSetByteOrder(_THIS, string byte_order);
-static UMSAudioDevice_ReturnCode UADSetAudioFormatType(_THIS, string fmt);
-static UMSAudioDevice_ReturnCode UADSetNumberFormat(_THIS, string fmt);
-static UMSAudioDevice_ReturnCode UADInitialize(_THIS);
-static UMSAudioDevice_ReturnCode UADStart(_THIS);
-static UMSAudioDevice_ReturnCode UADStop(_THIS);
-static UMSAudioDevice_ReturnCode UADSetTimeFormat(_THIS,
-                                                  UMSAudioTypes_TimeFormat
-                                                  fmt);
-static UMSAudioDevice_ReturnCode UADWriteBuffSize(_THIS, long *buff_size);
-static UMSAudioDevice_ReturnCode UADWriteBuffRemain(_THIS, long *buff_size);
-static UMSAudioDevice_ReturnCode UADWriteBuffUsed(_THIS, long *buff_size);
-static UMSAudioDevice_ReturnCode UADSetDMABufferSize(_THIS, long bytes,
-                                                     long *bytes_ret);
-static UMSAudioDevice_ReturnCode UADSetVolume(_THIS, long volume);
-static UMSAudioDevice_ReturnCode UADSetBalance(_THIS, long balance);
-static UMSAudioDevice_ReturnCode UADSetChannels(_THIS, long channels);
-static UMSAudioDevice_ReturnCode UADPlayRemainingData(_THIS, boolean block);
-static UMSAudioDevice_ReturnCode UADEnableOutput(_THIS, string output,
-                                                 long *left_gain,
-                                                 long *right_gain);
-static UMSAudioDevice_ReturnCode UADWrite(_THIS, UMSAudioTypes_Buffer * buff,
-                                          long samples,
-                                          long *samples_written);
-
-/* Audio driver bootstrap functions */
-static int
-Audio_Available(void)
-{
-    return 1;
-}
-
-static void
-Audio_DeleteDevice(_THIS)
-{
-    if (this->hidden->playbuf._buffer)
-        SDL_free(this->hidden->playbuf._buffer);
-    if (this->hidden->fillbuf._buffer)
-        SDL_free(this->hidden->fillbuf._buffer);
-    _somFree(this->hidden->umsdev);
-    SDL_free(this->hidden);
-    SDL_free(this);
-}
-
-static SDL_AudioDevice *
-Audio_CreateDevice(int devindex)
-{
-    SDL_AudioDevice *this;
-
-    /*
-     * Allocate and initialize management storage and private management
-     * storage for this SDL-using library.
-     */
-    this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
-    if (this) {
-        SDL_memset(this, 0, (sizeof *this));
-        this->hidden = (struct SDL_PrivateAudioData *)
-            SDL_malloc((sizeof *this->hidden));
-    }
-    if ((this == NULL) || (this->hidden == NULL)) {
-        SDL_OutOfMemory();
-        if (this) {
-            SDL_free(this);
-        }
-        return (0);
-    }
-    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "Creating UMS Audio device\n");
-#endif
-
-    /*
-     * Calls for UMS env initialization and audio object construction.
-     */
-    this->hidden->ev = somGetGlobalEnvironment();
-    this->hidden->umsdev = UMSAudioDeviceNew();
-
-    /*
-     * Set the function pointers.
-     */
-    this->OpenAudio = UMS_OpenAudio;
-    this->WaitAudio = NULL;     /* we do blocking output */
-    this->PlayAudio = UMS_PlayAudio;
-    this->GetAudioBuf = UMS_GetAudioBuf;
-    this->CloseAudio = UMS_CloseAudio;
-    this->free = Audio_DeleteDevice;
-
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "done\n");
-#endif
-    return this;
-}
-
-AudioBootStrap UMS_bootstrap = {
-    "ums", "AIX UMS audio", Audio_Available, Audio_CreateDevice, 0
-};
-
-static Uint8 *
-UMS_GetAudioBuf(_THIS)
-{
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "enter UMS_GetAudioBuf\n");
-#endif
-    return this->hidden->fillbuf._buffer;
-/*
-    long                      bufSize;
-    UMSAudioDevice_ReturnCode rc;
-
-    rc = UADSetTimeFormat(this, UMSAudioTypes_Bytes );
-    rc = UADWriteBuffSize(this,  bufSize );
-*/
-}
-
-static void
-UMS_CloseAudio(_THIS)
-{
-    UMSAudioDevice_ReturnCode rc;
-
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "enter UMS_CloseAudio\n");
-#endif
-    rc = UADPlayRemainingData(this, TRUE);
-    rc = UADStop(this);
-    rc = UADClose(this);
-}
-
-static void
-UMS_PlayAudio(_THIS)
-{
-    UMSAudioDevice_ReturnCode rc;
-    long samplesToWrite;
-    long samplesWritten;
-    UMSAudioTypes_Buffer swpbuf;
-
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "enter UMS_PlayAudio\n");
-#endif
-    samplesToWrite =
-        this->hidden->playbuf._length / this->hidden->bytesPerSample;
-    do {
-        rc = UADWrite(this, &this->hidden->playbuf,
-                      samplesToWrite, &samplesWritten);
-        samplesToWrite -= samplesWritten;
-
-        /* rc values: UMSAudioDevice_Success
-         *            UMSAudioDevice_Failure
-         *            UMSAudioDevice_Preempted
-         *            UMSAudioDevice_Interrupted
-         *            UMSAudioDevice_DeviceError
-         */
-        if (rc == UMSAudioDevice_DeviceError) {
-#ifdef DEBUG_AUDIO
-            fprintf(stderr, "Returning from PlayAudio with devices error\n");
-#endif
-            return;
-        }
-    } while (samplesToWrite > 0);
-
-    SDL_LockAudio();
-    SDL_memcpy(&swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer));
-    SDL_memcpy(&this->hidden->playbuf, &this->hidden->fillbuf,
-               sizeof(UMSAudioTypes_Buffer));
-    SDL_memcpy(&this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer));
-    SDL_UnlockAudio();
-
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "Wrote audio data and swapped buffer\n");
-#endif
-}
-
-#if 0
-//      /* Set the DSP frequency */
-//      value = spec->freq;
-//      if ( ioctl(this->hidden->audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) {
-//              SDL_SetError("Couldn't set audio frequency");
-//              return(-1);
-//      }
-//      spec->freq = value;
-#endif
-
-static int
-UMS_OpenAudio(_THIS, SDL_AudioSpec * spec)
-{
-    char *audiodev = "/dev/paud0";
-    long lgain;
-    long rgain;
-    long outRate;
-    long outBufSize;
-    long bitsPerSample;
-    long samplesPerSec;
-    long success;
-    SDL_AudioFormat test_format;
-    int frag_spec;
-    UMSAudioDevice_ReturnCode rc;
-
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "enter UMS_OpenAudio\n");
-#endif
-    rc = UADOpen(this, audiodev, "PLAY", UMSAudioDevice_BlockingIO);
-    if (rc != UMSAudioDevice_Success) {
-        SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
-        return -1;
-    }
-
-    rc = UADSetAudioFormatType(this, "PCM");
-
-    success = 0;
-    test_format = SDL_FirstAudioFormat(spec->format);
-    do {
-#ifdef DEBUG_AUDIO
-        fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
-#endif
-        switch (test_format) {
-        case AUDIO_U8:
-/* from the mac code: better ? */
-/* sample_bits = spec->size / spec->samples / spec->channels * 8; */
-            success = 1;
-            bitsPerSample = 8;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "MSB");  /* irrelevant */
-            rc = UADSetNumberFormat(this, "UNSIGNED");
-            break;
-        case AUDIO_S8:
-            success = 1;
-            bitsPerSample = 8;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "MSB");  /* irrelevant */
-            rc = UADSetNumberFormat(this, "SIGNED");
-            break;
-        case AUDIO_S16LSB:
-            success = 1;
-            bitsPerSample = 16;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "LSB");
-            rc = UADSetNumberFormat(this, "SIGNED");
-            break;
-        case AUDIO_S16MSB:
-            success = 1;
-            bitsPerSample = 16;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "MSB");
-            rc = UADSetNumberFormat(this, "SIGNED");
-            break;
-        case AUDIO_U16LSB:
-            success = 1;
-            bitsPerSample = 16;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "LSB");
-            rc = UADSetNumberFormat(this, "UNSIGNED");
-            break;
-        case AUDIO_U16MSB:
-            success = 1;
-            bitsPerSample = 16;
-            rc = UADSetSampleRate(this, spec->freq << 16, &outRate);
-            rc = UADSetByteOrder(this, "MSB");
-            rc = UADSetNumberFormat(this, "UNSIGNED");
-            break;
-        default:
-            break;
-        }
-        if (!success) {
-            test_format = SDL_NextAudioFormat();
-        }
-    } while (!success && test_format);
-
-    if (success == 0) {
-        SDL_SetError("Couldn't find any hardware audio formats");
-        return -1;
-    }
-
-    spec->format = test_format;
-
-    for (frag_spec = 0; (0x01 << frag_spec) < spec->size; ++frag_spec);
-    if ((0x01 << frag_spec) != spec->size) {
-        SDL_SetError("Fragment size must be a power of two");
-        return -1;
-    }
-    if (frag_spec > 2048)
-        frag_spec = 2048;
-
-    this->hidden->bytesPerSample = (bitsPerSample / 8) * spec->channels;
-    samplesPerSec = this->hidden->bytesPerSample * outRate;
-
-    this->hidden->playbuf._length = 0;
-    this->hidden->playbuf._maximum = spec->size;
-    this->hidden->playbuf._buffer = (unsigned char *) SDL_malloc(spec->size);
-    this->hidden->fillbuf._length = 0;
-    this->hidden->fillbuf._maximum = spec->size;
-    this->hidden->fillbuf._buffer = (unsigned char *) SDL_malloc(spec->size);
-
-    rc = UADSetBitsPerSample(this, bitsPerSample);
-    rc = UADSetDMABufferSize(this, frag_spec, &outBufSize);
-    rc = UADSetChannels(this, spec->channels);  /* functions reduces to mono or stereo */
-
-    lgain = 100;                /*maximum left input gain */
-    rgain = 100;                /*maimum right input gain */
-    rc = UADEnableOutput(this, "LINE_OUT", &lgain, &rgain);
-    rc = UADInitialize(this);
-    rc = UADStart(this);
-    rc = UADSetVolume(this, 100);
-    rc = UADSetBalance(this, 0);
-
-    /* We're ready to rock and roll. :-) */
-    return 0;
-}
-
-
-static UMSAudioDevice_ReturnCode
-UADGetBitsPerSample(_THIS, long *bits)
-{
-    return UMSAudioDevice_get_bits_per_sample(this->hidden->umsdev,
-                                              this->hidden->ev, bits);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetBitsPerSample(_THIS, long bits)
-{
-    return UMSAudioDevice_set_bits_per_sample(this->hidden->umsdev,
-                                              this->hidden->ev, bits);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetSampleRate(_THIS, long rate, long *set_rate)
-{
-    /* from the mac code: sample rate = spec->freq << 16; */
-    return UMSAudioDevice_set_sample_rate(this->hidden->umsdev,
-                                          this->hidden->ev, rate, set_rate);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetByteOrder(_THIS, string byte_order)
-{
-    return UMSAudioDevice_set_byte_order(this->hidden->umsdev,
-                                         this->hidden->ev, byte_order);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetAudioFormatType(_THIS, string fmt)
-{
-    /* possible PCM, A_LAW or MU_LAW */
-    return UMSAudioDevice_set_audio_format_type(this->hidden->umsdev,
-                                                this->hidden->ev, fmt);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetNumberFormat(_THIS, string fmt)
-{
-    /* possible SIGNED, UNSIGNED, or TWOS_COMPLEMENT */
-    return UMSAudioDevice_set_number_format(this->hidden->umsdev,
-                                            this->hidden->ev, fmt);
-}
-
-static UMSAudioDevice_ReturnCode
-UADInitialize(_THIS)
-{
-    return UMSAudioDevice_initialize(this->hidden->umsdev, this->hidden->ev);
-}
-
-static UMSAudioDevice_ReturnCode
-UADStart(_THIS)
-{
-    return UMSAudioDevice_start(this->hidden->umsdev, this->hidden->ev);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetTimeFormat(_THIS, UMSAudioTypes_TimeFormat fmt)
-{
-    /*
-     * Switches the time format to the new format, immediately.
-     * possible UMSAudioTypes_Msecs, UMSAudioTypes_Bytes or UMSAudioTypes_Samples
-     */
-    return UMSAudioDevice_set_time_format(this->hidden->umsdev,
-                                          this->hidden->ev, fmt);
-}
-
-static UMSAudioDevice_ReturnCode
-UADWriteBuffSize(_THIS, long *buff_size)
-{
-    /*
-     * returns write buffer size in the current time format
-     */
-    return UMSAudioDevice_write_buff_size(this->hidden->umsdev,
-                                          this->hidden->ev, buff_size);
-}
-
-static UMSAudioDevice_ReturnCode
-UADWriteBuffRemain(_THIS, long *buff_size)
-{
-    /*
-     * returns amount of available space in the write buffer
-     * in the current time format
-     */
-    return UMSAudioDevice_write_buff_remain(this->hidden->umsdev,
-                                            this->hidden->ev, buff_size);
-}
-
-static UMSAudioDevice_ReturnCode
-UADWriteBuffUsed(_THIS, long *buff_size)
-{
-    /*
-     * returns amount of filled space in the write buffer
-     * in the current time format
-     */
-    return UMSAudioDevice_write_buff_used(this->hidden->umsdev,
-                                          this->hidden->ev, buff_size);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetDMABufferSize(_THIS, long bytes, long *bytes_ret)
-{
-    /*
-     * Request a new DMA buffer size, maximum requested size 2048.
-     * Takes effect with next initialize() call.
-     * Devices may or may not support DMA.
-     */
-    return UMSAudioDevice_set_DMA_buffer_size(this->hidden->umsdev,
-                                              this->hidden->ev,
-                                              bytes, bytes_ret);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetVolume(_THIS, long volume)
-{
-    /*
-     * Set the volume.
-     * Takes effect immediately.
-     */
-    return UMSAudioDevice_set_volume(this->hidden->umsdev,
-                                     this->hidden->ev, volume);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetBalance(_THIS, long balance)
-{
-    /*
-     * Set the balance.
-     * Takes effect immediately.
-     */
-    return UMSAudioDevice_set_balance(this->hidden->umsdev,
-                                      this->hidden->ev, balance);
-}
-
-static UMSAudioDevice_ReturnCode
-UADSetChannels(_THIS, long channels)
-{
-    /*
-     * Set mono or stereo.
-     * Takes effect with next initialize() call.
-     */
-    if (channels != 1)
-        channels = 2;
-    return UMSAudioDevice_set_number_of_channels(this->hidden->umsdev,
-                                                 this->hidden->ev, channels);
-}
-
-static UMSAudioDevice_ReturnCode
-UADOpen(_THIS, string device, string mode, long flags)
-{
-    return UMSAudioDevice_open(this->hidden->umsdev,
-                               this->hidden->ev, device, mode, flags);
-}
-
-static UMSAudioDevice_ReturnCode
-UADWrite(_THIS, UMSAudioTypes_Buffer * buff,
-         long samples, long *samples_written)
-{
-    return UMSAudioDevice_write(this->hidden->umsdev,
-                                this->hidden->ev,
-                                buff, samples, samples_written);
-}
-
-static UMSAudioDevice_ReturnCode
-UADPlayRemainingData(_THIS, boolean block)
-{
-    return UMSAudioDevice_play_remaining_data(this->hidden->umsdev,
-                                              this->hidden->ev, block);
-}
-
-static UMSAudioDevice_ReturnCode
-UADStop(_THIS)
-{
-    return UMSAudioDevice_stop(this->hidden->umsdev, this->hidden->ev);
-}
-
-static UMSAudioDevice_ReturnCode
-UADClose(_THIS)
-{
-    return UMSAudioDevice_close(this->hidden->umsdev, this->hidden->ev);
-}
-
-static UMSAudioDevice_ReturnCode
-UADEnableOutput(_THIS, string output, long *left_gain, long *right_gain)
-{
-    return UMSAudioDevice_enable_output(this->hidden->umsdev,
-                                        this->hidden->ev,
-                                        output, left_gain, right_gain);
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/ums/SDL_umsaudio.h	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_UMSaudio_h
-#define _SDL_UMSaudio_h
-
-#include <UMS/UMSAudioDevice.h>
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS	SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData
-{
-    /* Pointer to the (open) UMS audio device */
-    Environment *ev;
-    UMSAudioDevice umsdev;
-
-    /* Raw mixing buffer */
-    UMSAudioTypes_Buffer playbuf;
-    UMSAudioTypes_Buffer fillbuf;
-
-    long bytesPerSample;
-};
-
-#endif /* _SDL_UMSaudio_h */
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/winmm/SDL_winmm.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/winmm/SDL_winmm.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_AUDIO_DRIVER_WINMM
+
 /* Allow access to a raw mixing buffer */
 
 #include "../../core/windows/SDL_windows.h"
@@ -406,4 +408,6 @@
     "winmm", "Windows Waveform Audio", WINMM_Init, 0
 };
 
+#endif /* SDL_AUDIO_DRIVER_WINMM */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/audio/xaudio2/SDL_xaudio2.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/audio/xaudio2/SDL_xaudio2.c	Mon Oct 31 05:56:58 2011 -0400
@@ -19,14 +19,15 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_config.h"
+
+#if SDL_AUDIO_DRIVER_XAUDIO2
+
 #include "../../core/windows/SDL_windows.h"
 #include "SDL_audio.h"
 #include "../SDL_audio_c.h"
 #include "../SDL_sysaudio.h"
 #include "SDL_assert.h"
 
-#if SDL_AUDIO_DRIVER_XAUDIO2
-
 #include <dxsdkver.h> /* XAudio2 exists as of the March 2008 DirectX SDK */
 #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
 #  warning Your DirectX SDK is too old. Disabling XAudio2 support.
--- a/src/core/android/SDL_android.cpp	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/core/android/SDL_android.cpp	Mon Oct 31 05:56:58 2011 -0400
@@ -21,6 +21,8 @@
 #include "SDL_config.h"
 #include "SDL_stdinc.h"
 
+#ifdef __ANDROID__
+
 #include "SDL_android.h"
 
 extern "C" {
@@ -605,4 +607,6 @@
     return Android_JNI_FileClose(ctx, true);
 }
 
+#endif /* __ANDROID__ */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/core/windows/SDL_windows.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/core/windows/SDL_windows.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#ifdef __WIN32__
+
 #include "SDL_error.h"
 #include "SDL_windows.h"
 
@@ -59,4 +61,6 @@
     CoUninitialize();
 }
 
+#endif /* __WIN32__ */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/events/SDL_gesture.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/events/SDL_gesture.c	Mon Oct 31 05:56:58 2011 -0400
@@ -103,7 +103,7 @@
   return (touchId < 0);
 }
 
-unsigned long SDL_HashDollar(SDL_FloatPoint* points) {
+static unsigned long SDL_HashDollar(SDL_FloatPoint* points) {
   unsigned long hash = 5381;
   int i;
   for(i = 0;i < DOLLARNPOINTS; i++) { 
@@ -242,7 +242,7 @@
 }
 
 
-float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
+static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
   //  SDL_FloatPoint p[DOLLARNPOINTS];
   float dist = 0;
   SDL_FloatPoint p;
@@ -257,7 +257,7 @@
   
 }
 
-float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
+static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
   //------------BEGIN DOLLAR BLACKBOX----------------//
   //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
   //-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
@@ -294,7 +294,7 @@
 }
 
 //DollarPath contains raw points, plus (possibly) the calculated length
-int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
+static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
   int i;
   float interval;
   float dist;
@@ -387,7 +387,7 @@
   return numPoints;
 }
 
-float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {
+static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {
         
         SDL_FloatPoint points[DOLLARNPOINTS];
         int i;
@@ -431,20 +431,7 @@
   return 0;
 }
 
-int SDL_GestureRemoveTouch(SDL_TouchID id) {
-  int i;
-  for (i = 0; i < SDL_numGestureTouches; i++) {
-    if (SDL_gestureTouch[i].id == id) {
-      SDL_numGestureTouches--;
-      SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i]));
-      return 1;
-    }
-  }
-  return -1;
-}
-
-
-SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
+static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
   int i;
   for(i = 0;i < SDL_numGestureTouches; i++) {
     //printf("%i ?= %i\n",SDL_gestureTouch[i].id,id);
@@ -453,7 +440,7 @@
   return NULL;
 }
 
-int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) {
+static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) {
   SDL_Event event;
   event.mgesture.type = SDL_MULTIGESTURE;
   event.mgesture.touchId = touch->id;
@@ -465,7 +452,7 @@
   return SDL_PushEvent(&event) > 0;
 }
 
-int SDL_SendGestureDollar(SDL_GestureTouch* touch,
+static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
                           SDL_GestureID gestureId,float error) {
   SDL_Event event;
   event.dgesture.type = SDL_DOLLARGESTURE;
@@ -483,7 +470,7 @@
 }
 
 
-int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) {
+static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) {
   SDL_Event event;
   event.dgesture.type = SDL_DOLLARRECORD;
   event.dgesture.touchId = touch->id;
--- a/src/events/SDL_keyboard.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/events/SDL_keyboard.c	Mon Oct 31 05:56:58 2011 -0400
@@ -854,23 +854,6 @@
     return keyboard->keymap[scancode];
 }
 
-SDL_Keycode SDL_GetKeycodeFromName(const char *name)
-{
-	int i;
-
-	if (!name || !*name) {
-		return SDL_SCANCODE_UNKNOWN;
-	}
-
-	for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
-		if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
-			return (SDL_Scancode)i;
-		}
-	}
-	return SDL_SCANCODE_UNKNOWN;
-}
-
-
 SDL_Scancode
 SDL_GetScancodeFromKey(SDL_Keycode key)
 {
--- a/src/events/SDL_touch.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/events/SDL_touch.c	Mon Oct 31 05:56:58 2011 -0400
@@ -59,7 +59,7 @@
     return SDL_touchPads[index];
 }
 
-int
+static int
 SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid)
 {
     int i;
@@ -190,6 +190,7 @@
 {
     return SDL_num_touch;
 }
+
 SDL_Window *
 SDL_GetTouchFocusWindow(SDL_TouchID id)
 {
--- a/src/libm/e_atan2.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/e_atan2.c	Mon Oct 31 05:56:58 2011 -0400
@@ -36,7 +36,7 @@
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 static const double
--- a/src/libm/e_log.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/e_log.c	Mon Oct 31 05:56:58 2011 -0400
@@ -66,7 +66,7 @@
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 #ifdef __STDC__
--- a/src/libm/e_pow.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/e_pow.c	Mon Oct 31 05:56:58 2011 -0400
@@ -59,7 +59,7 @@
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(scalbn)
--- a/src/libm/e_rem_pio2.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/e_rem_pio2.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
  * use __kernel_rem_pio2()
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(fabs)
--- a/src/libm/e_sqrt.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/e_sqrt.c	Mon Oct 31 05:56:58 2011 -0400
@@ -85,7 +85,7 @@
  *---------------
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 #ifdef __STDC__
--- a/src/libm/k_cos.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/k_cos.c	Mon Oct 31 05:56:58 2011 -0400
@@ -50,7 +50,7 @@
  *	   thus, reducing the rounding error in the subtraction.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 #ifdef __STDC__
--- a/src/libm/k_rem_pio2.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/k_rem_pio2.c	Mon Oct 31 05:56:58 2011 -0400
@@ -131,7 +131,7 @@
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(scalbn)
--- a/src/libm/k_sin.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/k_sin.c	Mon Oct 31 05:56:58 2011 -0400
@@ -43,7 +43,7 @@
  *		sin(x) = x + (S1*x + (x *(r-y/2)+y))
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 #ifdef __STDC__
--- a/src/libm/math.h	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-#include "SDL_stdinc.h"
-
-/* Math routines from uClibc: http://www.uclibc.org */
-
-#ifdef HAVE_ATAN
-#define atan            SDL_uclibc_atan
-#else
-#define atan            SDL_atan
-#endif
-
-#ifndef HAVE_ATAN2
-#define __ieee754_atan2 SDL_atan2
-#endif
-
-#ifdef HAVE_COPYSIGN
-#define copysign        SDL_uclibc_copysign
-#else
-#define copysign        SDL_copysign
-#endif
-
-#ifdef HAVE_COS
-#define cos             SDL_uclibc_cos
-#else
-#define cos             SDL_cos
-#endif
-
-#ifdef HAVE_FABS
-#define fabs            SDL_uclibc_fabs
-#else
-#define fabs            SDL_fabs
-#endif
-
-#ifdef HAVE_FLOOR
-#define floor           SDL_uclibc_floor
-#else
-#define floor           SDL_floor
-#endif
-
-#ifndef HAVE_LOG
-#define __ieee754_log   SDL_log
-#endif
-
-#ifndef HAVE_POW
-#define __ieee754_pow   SDL_pow
-#endif
-
-#ifdef HAVE_SCALBN
-#define scalbn          SDL_uclibc_scalbn
-#else
-#define scalbn          SDL_scalbn
-#endif
-
-#ifdef HAVE_SIN
-#define sin             SDL_uclibc_sin
-#else
-#define sin             SDL_sin
-#endif
-
-#ifndef HAVE_SQRT
-#define __ieee754_sqrt  SDL_sqrt
-#endif
-
-/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/libm/math_libm.h	Mon Oct 31 05:56:58 2011 -0400
@@ -0,0 +1,91 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+#include "SDL_stdinc.h"
+
+/* Math routines from uClibc: http://www.uclibc.org */
+
+#ifdef HAVE_ATAN
+#define atan            SDL_uclibc_atan
+#else
+#define atan            SDL_atan
+#endif
+double atan(double x);
+
+#ifndef HAVE_ATAN2
+#define __ieee754_atan2 SDL_atan2
+#endif
+
+#ifdef HAVE_COPYSIGN
+#define copysign        SDL_uclibc_copysign
+#else
+#define copysign        SDL_copysign
+#endif
+double copysign(double x, double y);
+
+#ifdef HAVE_COS
+#define cos             SDL_uclibc_cos
+#else
+#define cos             SDL_cos
+#endif
+double cos(double x);
+
+#ifdef HAVE_FABS
+#define fabs            SDL_uclibc_fabs
+#else
+#define fabs            SDL_fabs
+#endif
+double fabs(double x);
+
+#ifdef HAVE_FLOOR
+#define floor           SDL_uclibc_floor
+#else
+#define floor           SDL_floor
+#endif
+double floor(double x);
+
+#ifndef HAVE_LOG
+#define __ieee754_log   SDL_log
+#endif
+
+#ifndef HAVE_POW
+#define __ieee754_pow   SDL_pow
+#endif
+
+#ifdef HAVE_SCALBN
+#define scalbn          SDL_uclibc_scalbn
+#else
+#define scalbn          SDL_scalbn
+#endif
+double scalbn(double x, int n);
+
+#ifdef HAVE_SIN
+#define sin             SDL_uclibc_sin
+#else
+#define sin             SDL_sin
+#endif
+double sin(double x);
+
+#ifndef HAVE_SQRT
+#define __ieee754_sqrt  SDL_sqrt
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/libm/s_atan.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_atan.c	Mon Oct 31 05:56:58 2011 -0400
@@ -29,7 +29,7 @@
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 static const double atanhi[] = {
--- a/src/libm/s_copysign.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_copysign.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
  * with the sign bit of y.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(copysign)
--- a/src/libm/s_cos.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_cos.c	Mon Oct 31 05:56:58 2011 -0400
@@ -46,7 +46,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(cos)
--- a/src/libm/s_fabs.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_fabs.c	Mon Oct 31 05:56:58 2011 -0400
@@ -19,7 +19,7 @@
  * fabs(x) returns the absolute value of x.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(fabs)
--- a/src/libm/s_floor.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_floor.c	Mon Oct 31 05:56:58 2011 -0400
@@ -24,7 +24,7 @@
  *	Inexact flag raised if x not equal to floor(x).
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 #ifdef __STDC__
--- a/src/libm/s_scalbn.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_scalbn.c	Mon Oct 31 05:56:58 2011 -0400
@@ -22,7 +22,7 @@
  * exponentiation or a multiplication.
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(copysign)
--- a/src/libm/s_sin.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/libm/s_sin.c	Mon Oct 31 05:56:58 2011 -0400
@@ -46,7 +46,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
-#include "math.h"
+#include "math_libm.h"
 #include "math_private.h"
 
 libm_hidden_proto(sin)
--- a/src/main/android/SDL_android_main.cpp	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/main/android/SDL_android_main.cpp	Mon Oct 31 05:56:58 2011 -0400
@@ -1,3 +1,7 @@
+
+#include "SDL_config.h"
+
+#ifdef __ANDROID__
 
 /* Include the SDL main definition header */
 #include "SDL_main.h"
@@ -33,4 +37,6 @@
     exit(status);
 }
 
+#endif /* __ANDROID__ */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/main/beos/SDL_BeApp.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/main/beos/SDL_BeApp.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#ifdef __BEOS__
+
 /* Handle the BeApp specific portions of the application */
 
 #include <AppKit.h>
@@ -116,8 +118,6 @@
     }
 }
 
-
-/* vi: set ts=4 sw=4 expandtab: */
 #ifdef __cplusplus
 }
 #endif
@@ -131,3 +131,7 @@
 		--i;
 	}
 }
+
+#endif /* __BEOS__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/main/windows/SDL_windows_main.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/main/windows/SDL_windows_main.c	Mon Oct 31 05:56:58 2011 -0400
@@ -3,6 +3,9 @@
 
     The WinMain function -- calls your program's main() function
 */
+#include "SDL_config.h"
+
+#ifdef __WIN32__
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -202,4 +205,6 @@
     return 0;
 }
 
+#endif /* __WIN32__ */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/power/beos/SDL_syspower.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/beos/SDL_syspower.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_BEOS
+#if SDL_POWER_BEOS
 
 #include <stdio.h>
 #include <stdlib.h>
--- a/src/power/linux/SDL_syspower.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/linux/SDL_syspower.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_LINUX
+#if SDL_POWER_LINUX
 
 #include <stdio.h>
 #include <unistd.h>
--- a/src/power/macosx/SDL_syspower.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/macosx/SDL_syspower.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_MACOSX
+#if SDL_POWER_MACOSX
 
 #include <Carbon/Carbon.h>
 #include <IOKit/ps/IOPowerSources.h>
--- a/src/power/nds/SDL_syspower.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/nds/SDL_syspower.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_NINTENDODS
+#if SDL_POWER_NINTENDODS
 
 #include "SDL_power.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/power/uikit/SDL_syspower.h	Mon Oct 31 05:56:58 2011 -0400
@@ -0,0 +1,32 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#if SDL_POWER_UIKIT
+
+#include "SDL_power.h"
+
+void SDL_UIKit_UpdateBatteryMonitoring(void);
+SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent);
+
+#endif /* SDL_POWER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/power/uikit/SDL_syspower.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/uikit/SDL_syspower.m	Mon Oct 31 05:56:58 2011 -0400
@@ -21,13 +21,14 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_UIKIT
+#if SDL_POWER_UIKIT
 
 #import <UIKit/UIKit.h>
 
 #include "SDL_power.h"
 #include "SDL_timer.h"
 #include "SDL_assert.h"
+#include "SDL_syspower.h"
 
 // turn off the battery monitor if it's been more than X ms since last check.
 static const int BATTERY_MONITORING_TIMEOUT = 3000;
--- a/src/power/windows/SDL_syspower.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/power/windows/SDL_syspower.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #ifndef SDL_POWER_DISABLED
-#ifdef SDL_POWER_WINDOWS
+#if SDL_POWER_WINDOWS
 
 #include "../../core/windows/SDL_windows.h"
 
--- a/src/render/SDL_render.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/render/SDL_render.c	Mon Oct 31 05:56:58 2011 -0400
@@ -745,7 +745,7 @@
     SDL_UnlockTexture(native);
 }
 
-void
+static void
 SDL_UnlockTextureNative(SDL_Texture * texture)
 {
     SDL_Texture *native = texture->native;
--- a/src/render/opengles/SDL_render_gles.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/render/opengles/SDL_render_gles.c	Mon Oct 31 05:56:58 2011 -0400
@@ -581,7 +581,6 @@
 GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
                       int count)
 {
-    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
     GLshort *vertices;
 
@@ -603,7 +602,6 @@
 GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
                      int count)
 {
-    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
     GLshort *vertices;
 
@@ -632,7 +630,6 @@
 GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects,
                      int count)
 {
-    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
 
     GLES_SetDrawingState(renderer);
--- a/src/render/opengles2/SDL_render_gles2.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/render/opengles2/SDL_render_gles2.c	Mon Oct 31 05:56:58 2011 -0400
@@ -877,7 +877,6 @@
 static int
 GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count)
 {
-    GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
     GLfloat *vertices;
     int idx;
 
@@ -910,7 +909,6 @@
 static int
 GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count)
 {
-    GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
     GLfloat *vertices;
     int idx;
 
@@ -943,7 +941,6 @@
 static int
 GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count)
 {
-    GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
     GLfloat vertices[8];
     int idx;
 
--- a/src/render/software/SDL_render_sw.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/render/software/SDL_render_sw.c	Mon Oct 31 05:56:58 2011 -0400
@@ -23,6 +23,7 @@
 #if !SDL_RENDER_DISABLED
 
 #include "../SDL_sysrender.h"
+#include "SDL_render_sw_c.h"
 
 #include "SDL_draw.h"
 #include "SDL_blendfillrect.h"
--- a/src/stdlib/SDL_string.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/stdlib/SDL_string.c	Mon Oct 31 05:56:58 2011 -0400
@@ -31,7 +31,7 @@
 #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4)
 #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
 
-int UTF8_TrailingBytes(unsigned char c)
+static int UTF8_TrailingBytes(unsigned char c)
 {
     if (c >= 0xC0 && c <= 0xDF)
         return 1;
--- a/src/thread/SDL_thread.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/SDL_thread.c	Mon Oct 31 05:56:58 2011 -0400
@@ -26,6 +26,7 @@
 #include "SDL_thread.h"
 #include "SDL_thread_c.h"
 #include "SDL_systhread.h"
+#include "../SDL_error_c.h"
 
 #define ARRAY_CHUNKSIZE	32
 /* The array of threads currently active in the application
--- a/src/thread/SDL_thread_c.h	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/SDL_thread_c.h	Mon Oct 31 05:56:58 2011 -0400
@@ -32,8 +32,6 @@
 #include "epoc/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_WINDOWS
 #include "windows/SDL_systhread_c.h"
 #elif SDL_THREAD_NDS
@@ -59,4 +57,5 @@
 extern void SDL_RunThread(void *data);
 
 #endif /* _SDL_thread_c_h */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/beos/SDL_syssem.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/beos/SDL_syssem.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#ifdef SDL_THREAD_BEOS
+
 /* Semaphores in the BeOS environment */
 
 #include <be/kernel/OS.h>
@@ -148,4 +150,6 @@
     return 0;
 }
 
+#endif /* SDL_THREAD_BEOS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/beos/SDL_systhread.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/beos/SDL_systhread.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#ifdef SDL_THREAD_BEOS
+
 /* BeOS thread management routines for SDL */
 
 #include <stdio.h>
@@ -120,4 +122,6 @@
     wait_for_thread(thread->handle, &the_status);
 }
 
+#endif /* SDL_THREAD_BEOS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/irix/SDL_syssem.c	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-#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;
-
-    sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
-    if (sem == NULL) {
-        SDL_OutOfMemory();
-        return (NULL);
-    }
-    sem->id = semget(IPC_PRIVATE, 1, (0600 | IPC_CREAT));
-    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 __IRIX__
-        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 __IRIX__
-        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;
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/irix/SDL_systhread.c	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-/* IRIX thread management routines for SDL */
-
-#include <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/prctl.h>
-
-#include "SDL_thread.h"
-#include "../SDL_systhread.h"
-
-
-static int sig_list[] = {
-    SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCLD, SIGWINCH,
-    SIGVTALRM, SIGPROF, 0
-};
-
-
-int
-SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
-{
-    /* Create the thread and go! */
-    if (sproc(SDL_RunThread, PR_SALL, args) < 0) {
-        SDL_SetError("Not enough resources to create thread");
-        return (-1);
-    }
-    return (0);
-}
-
-void
-SDL_SYS_SetupThread(const char *name)
-{
-    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, NULL);
-}
-
-SDL_threadID
-SDL_ThreadID(void)
-{
-    return ((SDL_threadID) getpid());
-}
-
-void
-SDL_WaitThread(SDL_Thread * thread, int *status)
-{
-    errno = 0;
-    while (errno != ECHILD) {
-        waitpid(thread->handle, NULL, 0);
-    }
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/irix/SDL_systhread_c.h	Mon Oct 31 03:06:32 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-#include <sys/types.h>
-
-typedef pid_t SYS_ThreadHandle;
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/nds/SDL_systhread.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/nds/SDL_systhread.c	Mon Oct 31 05:56:58 2011 -0400
@@ -61,10 +61,4 @@
     return (0);
 }
 
-void
-SDL_SYS_KillThread(SDL_Thread * thread)
-{
-    return;
-}
-
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/windows/SDL_sysmutex.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/windows/SDL_sysmutex.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_THREAD_WINDOWS
+
 /* Mutex functions using the Win32 API */
 
 #include "../../core/windows/SDL_windows.h"
@@ -90,4 +92,6 @@
     return (0);
 }
 
+#endif /* SDL_THREAD_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/windows/SDL_syssem.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/windows/SDL_syssem.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_THREAD_WINDOWS
+
 /* Semaphore functions using the Win32 API */
 
 #include "../../core/windows/SDL_windows.h"
@@ -169,4 +171,6 @@
     return 0;
 }
 
+#endif /* SDL_THREAD_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/windows/SDL_systhread.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/windows/SDL_systhread.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_THREAD_WINDOWS
+
 /* Win32 thread management routines for SDL */
 
 #include "SDL_thread.h"
@@ -216,4 +218,6 @@
     CloseHandle(thread->handle);
 }
 
+#endif /* SDL_THREAD_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/windows/win_ce_semaphore.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/thread/windows/win_ce_semaphore.c	Mon Oct 31 05:56:58 2011 -0400
@@ -26,7 +26,11 @@
    6. The wait function emulates WaitForSingleObject only. An emulation of
       WaitForMultipleObjects is much harder to implement outside the kernel,
       and it is not clear how to handle a mixture of WCE semaphores and normal
-      events and mutexes. */
+      events and mutexes.
+*/
+#include "SDL_config.h"
+
+#if SDL_THREAD_WINDOWS
 
 #include "../../core/windows/SDL_windows.h"
 
@@ -224,4 +228,6 @@
     return hSynch;
 }
 
+#endif /* SDL_THREAD_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_rect.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/SDL_rect.c	Mon Oct 31 05:56:58 2011 -0400
@@ -21,6 +21,7 @@
 #include "SDL_config.h"
 
 #include "SDL_rect.h"
+#include "SDL_rect_c.h"
 
 
 SDL_bool
--- a/src/video/SDL_shape.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/SDL_shape.c	Mon Oct 31 05:56:58 2011 -0400
@@ -115,7 +115,7 @@
         SDL_UnlockSurface(shape);
 }
 
-SDL_ShapeTree*
+static SDL_ShapeTree*
 RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rect dimensions) {
     int x = 0,y = 0;
     Uint8* pixel = NULL;
@@ -249,7 +249,7 @@
     return result;
 }
 
-SDL_bool
+static SDL_bool
 SDL_WindowHasAShape(SDL_Window *window) {
     if (window == NULL || !SDL_IsShapedWindow(window))
         return SDL_FALSE;
--- a/src/video/SDL_video.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/SDL_video.c	Mon Oct 31 05:56:58 2011 -0400
@@ -576,7 +576,7 @@
     return _this->num_displays;
 }
 
-int
+static int
 SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
 {
     int displayIndex;
@@ -655,12 +655,6 @@
     return SDL_TRUE;
 }
 
-SDL_VideoDisplay *
-SDL_GetFirstDisplay(void)
-{
-    return &_this->displays[0];
-}
-
 static int
 SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display)
 {
@@ -847,7 +841,7 @@
     return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
 }
 
-int
+static int
 SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
 {
     SDL_DisplayMode display_mode;
--- a/src/video/android/SDL_androidevents.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidevents.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 #include "SDL_androidevents.h"
 
 void
@@ -28,4 +30,6 @@
     /* No polling necessary */
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidgl.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidgl.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 /* Android SDL video driver implementation */
 
 #include "SDL_video.h"
@@ -112,4 +114,6 @@
     __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidkeyboard.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidkeyboard.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 #include <android/log.h>
 
 #include "../../events/SDL_events_c.h"
@@ -176,4 +178,6 @@
     return SDL_SendKeyboardKey(SDL_RELEASED, TranslateKeycode(keycode));
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidtouch.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidtouch.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 #include <android/log.h>
 
 #include "SDL_events.h"
@@ -85,4 +87,6 @@
     } 
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidvideo.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidvideo.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 /* Android SDL video driver implementation
 */
 
@@ -166,4 +168,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidwindow.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/android/SDL_androidwindow.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_ANDROID
+
 #include "../SDL_sysvideo.h"
 
 #include "SDL_androidvideo.h"
@@ -62,4 +64,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/bwindow/SDL_bclipboard.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bclipboard.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,10 +18,11 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 /* BWindow based framebuffer implementation */
-#include "SDL_config.h"
 
 #include <unistd.h>
 #include <TypeConstants.h>
@@ -91,3 +92,4 @@
 }					/* Extern C */
 #endif
 
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bevents.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bevents.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 #include "SDL_bevents.h"
 
@@ -32,3 +35,5 @@
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bframebuffer.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bframebuffer.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 #include "SDL_bframebuffer.h"
 
@@ -248,3 +251,5 @@
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bkeyboard.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bkeyboard.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -19,6 +19,9 @@
     Sam Lantinga
     slouken@libsdl.org
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 #include <SupportDefs.h>
 #include <support/UTF8.h>
@@ -182,3 +185,5 @@
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bmodes.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bmodes.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 #include <AppKit.h>
 #include <InterfaceKit.h>
@@ -327,3 +328,5 @@
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bopengl.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bopengl.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 #include "SDL_bopengl.h"
 
@@ -209,11 +212,8 @@
 
 
 
-
-
-
-
-
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bvideo.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bvideo.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-
+#if SDL_VIDEO_DRIVER_BWINDOW
 
 
 #ifdef __cplusplus
@@ -168,3 +169,5 @@
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/bwindow/SDL_bwindow.cc	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/bwindow/SDL_bwindow.cc	Mon Oct 31 05:56:58 2011 -0400
@@ -19,6 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_BWINDOW
 #include "../SDL_sysvideo.h"
 
 #include "SDL_BWin.h"
@@ -210,3 +212,4 @@
 }
 #endif
 
+#endif /* SDL_VIDEO_DRIVER_BWINDOW */
--- a/src/video/cocoa/SDL_cocoaclipboard.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoaclipboard.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_cocoavideo.h"
 #include "../../events/SDL_clipboardevents_c.h"
 
@@ -124,4 +126,6 @@
     [pool release];
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoaevents.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoaevents.m	Mon Oct 31 05:56:58 2011 -0400
@@ -19,6 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
 #include "SDL_timer.h"
 
 #include "SDL_cocoavideo.h"
@@ -220,4 +222,6 @@
     [pool release];
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoakeyboard.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoakeyboard.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_cocoavideo.h"
 
 #include "../../events/SDL_keyboard_c.h"
@@ -28,7 +30,7 @@
 #include <Carbon/Carbon.h>
 
 //#define DEBUG_IME NSLog
-#define DEBUG_IME (void)
+#define DEBUG_IME(...)
 
 #ifndef NX_DEVICERCTLKEYMASK
     #define NX_DEVICELCTLKEYMASK    0x00000001
@@ -733,4 +735,6 @@
 {
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoamodes.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoamodes.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_cocoavideo.h"
 
 /* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
@@ -113,7 +115,6 @@
 GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
 {
     SDL_DisplayModeData *data;
-    CFNumberRef number;
     long width, height, bpp, refreshRate;
 
     data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
@@ -146,6 +147,7 @@
 
     #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
+        CFNumberRef number;
         CFDictionaryRef vidmode = (CFDictionaryRef) moderef;
         number = CFDictionaryGetValue(vidmode, kCGDisplayWidth);
         CFNumberGetValue(number, kCFNumberLongType, &width);
@@ -448,4 +450,6 @@
     ShowMenuBar();
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoamouse.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoamouse.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_events.h"
 #include "SDL_cocoavideo.h"
 
@@ -147,21 +149,6 @@
     SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
 }
 
-static int
-ConvertMouseButtonToSDL(int button)
-{
-    switch (button)
-    {
-        case 0:
-            return(SDL_BUTTON_LEFT);   /* 1 */
-        case 1:
-            return(SDL_BUTTON_RIGHT);  /* 3 */
-        case 2:
-            return(SDL_BUTTON_MIDDLE); /* 2 */
-    }
-    return button+1;
-}
-
 void
 Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
 {
@@ -202,4 +189,6 @@
 {
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoaopengl.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoaopengl.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,11 +20,11 @@
 */
 #include "SDL_config.h"
 
-#include "SDL_cocoavideo.h"
-
 /* NSOpenGL implementation of SDL OpenGL support */
 
 #if SDL_VIDEO_OPENGL_CGL
+#include "SDL_cocoavideo.h"
+
 #include <OpenGL/CGLTypes.h>
 #include <OpenGL/OpenGL.h>
 #include <OpenGL/CGLRenderers.h>
--- a/src/video/cocoa/SDL_cocoashape.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoashape.m	Mon Oct 31 05:56:58 2011 -0400
@@ -19,6 +19,10 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_cocoavideo.h"
 #include "SDL_shape.h"
 #include "SDL_cocoashape.h"
@@ -89,6 +93,8 @@
 	closure.window = shaper->window;
     SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
     [closure.path addClip];
+
+    return 0;
 }
 
 int
@@ -97,3 +103,7 @@
     assert(data != NULL);
     return 0;
 }
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoavideo.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoavideo.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL.h"
 #include "SDL_endian.h"
 #include "SDL_cocoavideo.h"
@@ -259,4 +261,6 @@
     return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vim: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoawindow.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_COCOA
+
 #include "SDL_syswm.h"
 #include "SDL_timer.h"  /* For SDL_GetTicks() */
 #include "../SDL_sysvideo.h"
@@ -277,8 +279,6 @@
 
 - (void)mouseEntered:(NSEvent *)theEvent
 {
-    SDL_Mouse *mouse = SDL_GetMouse();
-
     SDL_SetMouseFocus(_data->window);
 
     SDL_SetCursor(NULL);
@@ -991,4 +991,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/directfb/SDL_DirectFB_WM.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_WM.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_window.h"
@@ -407,3 +410,4 @@
     return 0;
 }
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/directfb/SDL_DirectFB_dyn.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_dyn.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_dyn.h"
@@ -112,3 +113,5 @@
 {
 }
 #endif
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/directfb/SDL_DirectFB_events.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_events.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 /* Handle the event stream, converting DirectFB input events into SDL events */
 
@@ -743,3 +746,4 @@
 
 }
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/directfb/SDL_DirectFB_modes.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_modes.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_modes.h"
@@ -406,4 +409,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/directfb/SDL_DirectFB_mouse.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_mouse.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,10 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
 #include "SDL_assert.h"
 
 #include "SDL_DirectFB_video.h"
@@ -387,4 +389,6 @@
 
 #endif
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/directfb/SDL_DirectFB_opengl.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_opengl.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 
@@ -352,4 +355,6 @@
 
 #endif
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/directfb/SDL_DirectFB_render.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_render.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 //#include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_window.h"
 #include "SDL_DirectFB_modes.h"
@@ -1255,4 +1258,6 @@
 }
 #endif
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/directfb/SDL_DirectFB_shape.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_shape.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_assert.h"
 #include "SDL_DirectFB_video.h"
@@ -128,3 +131,4 @@
 	return -1;
 }
 
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/directfb/SDL_DirectFB_video.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_video.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 
@@ -416,3 +419,5 @@
     		ri->texture_formats[j++] = pixelformat_tab[i].sdl;
     ri->num_texture_formats = j;
 }
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/directfb/SDL_DirectFB_window.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/directfb/SDL_DirectFB_window.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
 
 #include "SDL_DirectFB_video.h"
 #include "SDL_DirectFB_modes.h"
@@ -520,3 +523,5 @@
   error:
     return;
 }
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
--- a/src/video/dummy/SDL_nullevents.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/dummy/SDL_nullevents.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_DUMMY
+
 /* Being a null driver, there's no event stream. We just define stubs for
    most of the API. */
 
@@ -34,4 +36,6 @@
     /* do nothing. */
 }
 
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/dummy/SDL_nullframebuffer.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/dummy/SDL_nullframebuffer.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,7 +20,10 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_DUMMY
+
 #include "../SDL_sysvideo.h"
+#include "SDL_nullframebuffer_c.h"
 
 
 #define DUMMY_SURFACE   "_SDL_DummySurface"
@@ -86,4 +89,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/dummy/SDL_nullvideo.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/dummy/SDL_nullvideo.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_DUMMY
+
 /* Dummy SDL video driver implementation; this is just enough to make an
  *  SDL-based application THINK it's got a working video driver, for
  *  applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it,
@@ -139,4 +141,6 @@
 {
 }
 
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/nds/SDL_ndsevents.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/nds/SDL_ndsevents.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,8 +20,7 @@
 */
 #include "SDL_config.h"
 
-/* Being a null driver, there's no event stream. We just define stubs for
-   most of the API. */
+#if SDL_VIDEO_DRIVER_NDS
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -50,4 +49,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_NDS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/nds/SDL_ndsvideo.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/nds/SDL_ndsvideo.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_NDS
+
 /* SDL Nintendo DS video driver implementation */
 
 #include <stdio.h>
@@ -394,4 +396,6 @@
 	return 0;
 }
 
+#endif /* SDL_VIDEO_DRIVER_NDS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/nds/SDL_ndswindow.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/nds/SDL_ndswindow.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_NDS
+
 #include "SDL_ndsvideo.h"
 
 
@@ -30,4 +32,6 @@
     return 0;
 }
 
+#endif /* SDL_VIDEO_DRIVER_NDS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/pandora/SDL_pandora.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/pandora/SDL_pandora.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,9 +18,11 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_PANDORA
 
 /* SDL internals */
-#include "SDL_config.h"
 #include "../SDL_sysvideo.h"
 #include "SDL_version.h"
 #include "SDL_syswm.h"
@@ -863,4 +865,6 @@
     return;
 }
 
+#endif /* SDL_VIDEO_DRIVER_PANDORA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/pandora/SDL_pandora_events.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/pandora/SDL_pandora_events.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_PANDORA
+
 /* Being a null driver, there's no event stream. We just define stubs for
    most of the API. */
 
@@ -31,4 +33,6 @@
     /* Not implemented. */
 }
 
+#endif /* SDL_VIDEO_DRIVER_PANDORA */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitappdelegate.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitappdelegate.m	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #import "../SDL_sysvideo.h"
 #import "SDL_assert.h"
@@ -159,4 +162,6 @@
 
 @end
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitevents.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitevents.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_UIKIT
+
 #include "../../events/SDL_events_c.h"
 
 #include "SDL_uikitvideo.h"
@@ -51,4 +53,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitopengles.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitopengles.m	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #include "SDL_uikitopengles.h"
 #include "SDL_uikitopenglview.h"
@@ -27,6 +30,7 @@
 #include "SDL_sysvideo.h"
 #include "../../events/SDL_keyboard_c.h"
 #include "../../events/SDL_mouse_c.h"
+#include "../../power/uikit/SDL_syspower.h"
 #include "SDL_loadso.h"
 #include <dlfcn.h>
 
@@ -73,8 +77,6 @@
     return 0;
 }
 
-extern void SDL_UIKit_UpdateBatteryMonitoring(void);
-
 void UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
 {
 #ifdef SDL_POWER_UIKIT
@@ -101,7 +103,6 @@
 {
     SDL_uikitopenglview *view;
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
-    UIScreen *uiscreen = (UIScreen *) SDL_GetDisplayForWindow(window)->driverdata;
     UIWindow *uiwindow = data->uiwindow;
 
     /* construct our view, passing in SDL's OpenGL configuration data */
@@ -150,4 +151,6 @@
     [view release];
 }
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitopenglview.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitopenglview.m	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #import <QuartzCore/QuartzCore.h>
 #import <OpenGLES/EAGLDrawable.h>
@@ -192,4 +195,6 @@
 
 @end
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitvideo.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitvideo.m	Mon Oct 31 05:56:58 2011 -0400
@@ -18,11 +18,12 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #import <UIKit/UIKit.h>
 
-#include "SDL_config.h"
-
 #include "SDL_video.h"
 #include "SDL_mouse.h"
 #include "../SDL_sysvideo.h"
@@ -143,7 +144,6 @@
         return;
     }
 
-    const NSArray *modes = [uiscreen availableModes];
     for (UIScreenMode *uimode in [uiscreen availableModes]) {
         CGSize size = [uimode size];
         mode.format = SDL_PIXELFORMAT_ABGR8888;
@@ -274,4 +274,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitview.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitview.m	Mon Oct 31 05:56:58 2011 -0400
@@ -18,6 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #import "SDL_uikitview.h"
 
@@ -28,6 +31,7 @@
 #if SDL_IPHONE_KEYBOARD
 #import "keyinfotable.h"
 #import "SDL_uikitappdelegate.h"
+#import "SDL_uikitkeyboard.h"
 #import "SDL_uikitwindow.h"
 #endif
 
@@ -311,7 +315,7 @@
 /* iPhone keyboard addition functions */
 #if SDL_IPHONE_KEYBOARD
 
-SDL_uikitview * getWindowView(SDL_Window * window)
+static SDL_uikitview * getWindowView(SDL_Window * window)
 {
     if (window == NULL) {
         SDL_SetError("Window does not exist");
@@ -405,4 +409,6 @@
 
 #endif /* SDL_IPHONE_KEYBOARD */
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitviewcontroller.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitviewcontroller.m	Mon Oct 31 05:56:58 2011 -0400
@@ -1,24 +1,26 @@
 /*
- Simple DirectMedia Layer
- Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
 
- This software is provided 'as-is', without any express or implied
- warranty.  In no event will the authors be held liable for any damages
- arising from the use of this software.
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
 
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
 
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
- */
-#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_UIKIT
 
 #include "SDL_video.h"
 #include "SDL_assert.h"
@@ -150,4 +152,6 @@
     SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
 }
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 @end
--- a/src/video/uikit/SDL_uikitwindow.m	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/uikit/SDL_uikitwindow.m	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_UIKIT
+
 #include "SDL_syswm.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
@@ -88,11 +90,11 @@
             [UIApplication sharedApplication].statusBarHidden = NO;
         }
 
-        const UIDeviceOrientation o = [[UIDevice currentDevice] orientation];
-        const BOOL landscape = (o == UIDeviceOrientationLandscapeLeft) ||
-                                   (o == UIDeviceOrientationLandscapeRight);
-        const BOOL rotate = ( ((window->w > window->h) && (!landscape)) ||
-                              ((window->w < window->h) && (landscape)) );
+        //const UIDeviceOrientation o = [[UIDevice currentDevice] orientation];
+        //const BOOL landscape = (o == UIDeviceOrientationLandscapeLeft) ||
+        //                           (o == UIDeviceOrientationLandscapeRight);
+        //const BOOL rotate = ( ((window->w > window->h) && (!landscape)) ||
+        //                      ((window->w < window->h) && (landscape)) );
 
         // The View Controller will handle rotating the view when the
         //  device orientation changes. This will trigger resize events, if
@@ -215,4 +217,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsclipboard.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsclipboard.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_windowsvideo.h"
 #include "SDL_windowswindow.h"
 #include "../../events/SDL_clipboardevents_c.h"
@@ -163,4 +165,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsevents.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsevents.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_WINDOWS
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsshape.h"
@@ -694,4 +695,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsframebuffer.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsframebuffer.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_windowsvideo.h"
 
 #ifndef _WIN32_WCE
@@ -121,4 +123,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowskeyboard.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowskeyboard.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #ifdef _WIN32_WCE
 #define SDL_DISABLE_WINDOWS_IME
 #endif
@@ -1539,4 +1541,6 @@
 
 #endif /* SDL_DISABLE_WINDOWS_IME */
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsmodes.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsmodes.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_windowsvideo.h"
 
 /* Windows CE compatibility */
@@ -316,4 +318,6 @@
     /* All fullscreen windows should have restored modes by now */
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsmouse.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsmouse.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_WINDOWS
 
 #include "SDL_assert.h"
 #include "SDL_windowsvideo.h"
@@ -162,4 +163,6 @@
 {
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsopengl.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsopengl.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_windowsvideo.h"
 
 /* WGL implementation of SDL OpenGL support */
@@ -605,4 +607,6 @@
 
 #endif /* SDL_VIDEO_OPENGL_WGL */
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsshape.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsshape.c	Mon Oct 31 05:56:58 2011 -0400
@@ -18,8 +18,10 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "SDL_config.h"
 
-#include <stdio.h>
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_assert.h"
 #include "SDL_windowsshape.h"
 #include "SDL_windowsvideo.h"
@@ -101,3 +103,5 @@
     
     return 0;
 }
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
--- a/src/video/windows/SDL_windowsvideo.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowsvideo.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "SDL_main.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
@@ -186,4 +188,6 @@
     WIN_QuitMouse(_this);
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vim: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowswindow.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/windows/SDL_windowswindow.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,6 +20,8 @@
 */
 #include "SDL_config.h"
 
+#if SDL_VIDEO_DRIVER_WINDOWS
+
 #include "../SDL_sysvideo.h"
 #include "../SDL_pixels_c.h"
 #include "../../events/SDL_keyboard_c.h"
@@ -746,4 +748,6 @@
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/SDL_x11opengl.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/x11/SDL_x11opengl.c	Mon Oct 31 05:56:58 2011 -0400
@@ -19,6 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
 #include "SDL_x11video.h"
 #include "SDL_assert.h"
 
@@ -610,4 +613,6 @@
 
 #endif /* SDL_VIDEO_OPENGL_GLX */
 
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/SDL_x11opengles.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/x11/SDL_x11opengles.c	Mon Oct 31 05:56:58 2011 -0400
@@ -20,7 +20,7 @@
 */
 #include "SDL_config.h"
 
-#if SDL_VIDEO_OPENGL_ES
+#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES
 
 #include "SDL_x11video.h"
 #include "SDL_x11opengles.h"
@@ -360,6 +360,6 @@
 
 }
 
-#endif /* SDL_VIDEO_OPENGL_ES */
+#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/imKStoUCS.c	Mon Oct 31 03:06:32 2011 -0400
+++ b/src/video/x11/imKStoUCS.c	Mon Oct 31 05:56:58 2011 -0400
@@ -22,6 +22,9 @@
 ings in this Software without prior written authorization from the XFree86
 Project.
 */
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_X11
 
 /* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.4 2003/04/29 11:29:18 pascal Exp $ */
 
@@ -343,3 +346,5 @@
     else
         return 0;
 }
+
+#endif /* SDL_VIDEO_DRIVER_X11 */