SDL-1.1.8 patches for Cygwin/gcc

I had to make the following changes in order to compile SDL-1.1.8 with
gcc in a recent Cygwin environment under Winblows 2000. The problem
is that gcc defines “unix” even though it’s not Unix. (There are
probably valid reasons for this since the intended environment is
quite Unix-like, but whether you agree or not, that’s the way it is.)

In addition to these compile issues, I was never able to get the
shared library version working. Running “configure” with the option
–enable-shared=no was required.

The default installation location is root (/) which is probably not
what’s intended. I added the configure option --prefix=/usr/local to
solve this problem.----------------------------------------------------------------------

diff -c -r SDL-1.1.8.orig/include/SDL_events.h SDL-1.1.8.modified/include/SDL_events.h
*** SDL-1.1.8.orig/include/SDL_events.h Sun Feb 11 18:34:54 2001
— SDL-1.1.8.modified/include/SDL_events.h Fri Feb 23 15:52:14 2001


*** 30,35 ****
— 30,39 ----
#ifndef _SDL_events_h
#define _SDL_events_h

  • #ifdef CYGWIN32
  • include <w32api/windows.h>

  • #endif /* CYGWIN32 */
  • #include “SDL_types.h”
    #include “SDL_active.h”
    #include "SDL_keyboard.h"
    diff -c -r SDL-1.1.8.orig/include/SDL_syswm.h SDL-1.1.8.modified/include/SDL_syswm.h
    *** SDL-1.1.8.orig/include/SDL_syswm.h Sat Feb 10 02:20:02 2001
    — SDL-1.1.8.modified/include/SDL_syswm.h Fri Feb 23 15:52:14 2001

*** 50,56 ****

/* This is the structure for custom window manager events /
#if (defined(unix) || defined(unix) || defined(_AIX)) &&
! !defined(DISABLE_X11)
/
AIX is unix, of course, but the native compiler CSet doesn’t define unix */
#include <X11/Xlib.h>
#include <X11/Xatom.h>
— 50,56 ----

/* This is the structure for custom window manager events /
#if (defined(unix) || defined(unix) || defined(_AIX)) &&
! (!defined(DISABLE_X11) && !defined(CYGWIN32))
/
AIX is unix, of course, but the native compiler CSet doesn’t define unix */
#include <X11/Xlib.h>
#include <X11/Xatom.h>
diff -c -r SDL-1.1.8.orig/src/audio/SDL_audio.c SDL-1.1.8.modified/src/audio/SDL_audio.c
*** SDL-1.1.8.orig/src/audio/SDL_audio.c Sat Feb 10 02:20:04 2001
— SDL-1.1.8.modified/src/audio/SDL_audio.c Fri Feb 23 15:52:20 2001


*** 40,46 ****

/* Available audio drivers */
static AudioBootStrap *bootstrap[] = {
! #if defined(unix) && !defined(linux) && !defined(FreeBSD)
&AUDIO_bootstrap,
#endif
#ifdef OSS_SUPPORT
— 40,46 ----

/* Available audio drivers */
static AudioBootStrap *bootstrap[] = {
! #if defined(unix) && !defined(linux) && !defined(FreeBSD) && !defined(CYGWIN32)
&AUDIO_bootstrap,
#endif
#ifdef OSS_SUPPORT
diff -c -r SDL-1.1.8.orig/src/audio/SDL_sysaudio.h SDL-1.1.8.modified/src/audio/SDL_sysaudio.h
*** SDL-1.1.8.orig/src/audio/SDL_sysaudio.h Sat Feb 10 02:20:04 2001
— SDL-1.1.8.modified/src/audio/SDL_sysaudio.h Fri Feb 23 15:52:20 2001


*** 99,105 ****
SDL_AudioDevice *(*create)(int devindex);
} AudioBootStrap;

! #ifdef unix
extern AudioBootStrap AUDIO_bootstrap;
#endif
#ifdef OSS_SUPPORT
— 99,105 ----
SDL_AudioDevice *(*create)(int devindex);
} AudioBootStrap;

! #if defined(unix) && !defined(CYGWIN32)
extern AudioBootStrap AUDIO_bootstrap;
#endif
#ifdef OSS_SUPPORT
diff -c -r SDL-1.1.8.orig/src/video/wincommon/SDL_lowvideo.h SDL-1.1.8.modified/src/video/wincommon/SDL_lowvideo.h
*** SDL-1.1.8.orig/src/video/wincommon/SDL_lowvideo.h Sat Feb 10 02:20:08 2001
— SDL-1.1.8.modified/src/video/wincommon/SDL_lowvideo.h Fri Feb 23 15:52:22 2001


*** 28,33 ****
— 28,37 ----
#ifndef _SDL_lowvideo_h
#define _SDL_lowvideo_h

  • #ifdef CYGWIN32

  • include <w32api/windows.h>

  • #endif /* CYGWIN32 */

  • #include “SDL_sysvideo.h”

    /* Hidden “this” pointer for the video functions */

please use unified diffs (diff -u); they are easier to read for humans

Thanks, I’ve applied some of your patches to the CVS source, and the
ones that I didn’t apply, I added a note below:

*** SDL-1.1.8.orig/include/SDL_events.h Sun Feb 11 18:34:54 2001
— SDL-1.1.8.modified/include/SDL_events.h Fri Feb 23 15:52:14 2001


*** 30,35 ****
— 30,39 ----
#ifndef _SDL_events_h
#define _SDL_events_h

  • #ifdef CYGWIN32
  • include <w32api/windows.h>

  • #endif /* CYGWIN32 */
  • #include “SDL_types.h”
    #include “SDL_active.h”
    #include “SDL_keyboard.h”

Why was this necessary?

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga writes:

Thanks, I’ve applied some of your patches to the CVS source, and the
ones that I didn’t apply, I added a note below:

*** SDL-1.1.8.orig/include/SDL_events.h Sun Feb 11 18:34:54 2001
— SDL-1.1.8.modified/include/SDL_events.h Fri Feb 23 15:52:14 2001


*** 30,35 ****
— 30,39 ----
#ifndef _SDL_events_h
#define _SDL_events_h

  • #ifdef CYGWIN32
  • include <w32api/windows.h>

  • #endif /* CYGWIN32 */
  • #include “SDL_types.h”
    #include “SDL_active.h”
    #include “SDL_keyboard.h”

Why was this necessary?

It was for some variable or function that was referenced but otherwise
undeclared (the external declaration was in w32api/windows.h or one of
its sub-includes). I don’t recall which variable or function it was,
and apparently it was something that was referenced in 1.1.7 but not
in 1.1.8. I just removed that patch and recompiled the entire 1.1.8
library and test directory successfully.

I think you can safely ignore that patch. If I encounter the problem
again, I’ll let you know.

Derrell