Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use consistent identifiers for the various platforms we support.
Make sure every source file includes SDL_config.h, so the proper system
headers are chosen.
  • Loading branch information
slouken committed Feb 21, 2006
1 parent 1aa7ad5 commit fd03c21
Show file tree
Hide file tree
Showing 502 changed files with 974 additions and 219 deletions.
30 changes: 10 additions & 20 deletions configure.in
Expand Up @@ -57,10 +57,10 @@ fi
case "$target" in
*-*-cygwin*)
# We build SDL on cygwin without the UNIX emulation layer
CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
CFLAGS="$CFLAGS -I/usr/include/mingw -mno-cygwin"
BUILD_CFLAGS="$CFLAGS \$(INCLUDE)"
BUILD_LDFLAGS="$LDFLAGS -mno-cygwin"
SDL_CFLAGS="-I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
SDL_CFLAGS="-I/usr/include/mingw -mno-cygwin"
SDL_LIBS="-lSDL -mno-cygwin"
;;
*)
Expand Down Expand Up @@ -239,11 +239,11 @@ AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]])
if test x$enable_cpuinfo != xyes; then
AC_DEFINE(SDL_CPUINFO_DISABLED)
fi
AC_ARG_ENABLE(assembly-blit,
AC_HELP_STRING([--enable-asm-blit], [Enable assembly blitters [default=yes]]),
, enable_asm_blit=yes)
if test x$enable_asm_blit = xyes; then
AC_DEFINE(SDL_ASSEMBLY_BLITTERS)
AC_ARG_ENABLE(assembly,
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [default=yes]]),
, enable_assembly=yes)
if test x$enable_assembly = xyes; then
AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
fi

dnl See if the OSS audio interface is supported
Expand Down Expand Up @@ -559,7 +559,7 @@ CheckNASM()
AC_ARG_ENABLE(nasm,
AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [default=yes]]),
, enable_nasm=yes)
if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_nasm = xyes; then
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
AC_PATH_PROG(NASM, nasm)
if test x$NASM != x -a x$NASM != x'"$NASM"'; then
AC_DEFINE(SDL_HERMES_BLITTERS)
Expand Down Expand Up @@ -595,7 +595,7 @@ CheckAltivec()
AC_ARG_ENABLE(altivec,
AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [default=yes]]),
, enable_altivec=yes)
if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_altivec = xyes; then
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
have_altivec_h_hdr=no
AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)

Expand Down Expand Up @@ -2012,13 +2012,6 @@ case "$target" in
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes
fi
# Do any final platform setup
case $ARCH in
openbsd|netbsd)
# OpenBSD and NetBSD do not define "unix"
BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
;;
esac
;;
*-*-qnx*)
ARCH=qnx
Expand Down Expand Up @@ -2221,8 +2214,7 @@ case "$target" in
fi
# The MacOS X platform requires special setup.
SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
AC_DEFINE(TARGET_API_MAC_CARBON)
BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings -DMACOSX"
BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings"
SDL_LIBS="-lSDLmain $SDL_LIBS"
if test x$enable_video_cocoa = xyes; then
BUILD_LDFLAGS="$BUILD_LDFLAGS -framework Cocoa"
Expand Down Expand Up @@ -2279,8 +2271,6 @@ case "$target" in
fi
have_timers=yes
fi
# MiNT does not define "unix"
BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
;;
*-riscos)
ARCH=riscos
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h
Expand Up @@ -25,6 +25,8 @@

/* This is the minimal configuration that can be used to build SDL */

#include "SDL_platform.h"

#include <stdarg.h>

typedef signed char int8_t;
Expand Down
14 changes: 6 additions & 8 deletions include/SDL_config.h.in
Expand Up @@ -25,6 +25,9 @@

/* This is a set of defines to configure the SDL features */

/* General platform specific identifiers */
#include "SDL_platform.h"

/* C language features */
#undef const
#undef inline
Expand All @@ -48,7 +51,7 @@

/* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC
#ifdef HAVE_LIBC
#if HAVE_LIBC

/* Useful headers */
#undef HAVE_ALLOCA_H
Expand Down Expand Up @@ -127,10 +130,6 @@
#include <stdarg.h>
#endif /* HAVE_LIBC */

/* General platform specific identifiers */
#undef TARGET_API_MAC_CARBON
#undef TARGET_API_MAC_OSX

/* Allow disabling of core subsystems */
#undef SDL_AUDIO_DISABLED
#undef SDL_CDROM_DISABLED
Expand All @@ -155,7 +154,6 @@
#undef SDL_AUDIO_DRIVER_DC
#undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DRENDERER
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
Expand Down Expand Up @@ -285,8 +283,8 @@
#undef SDL_VIDEO_OPENGL_OSMESA
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC

/* Enable assembly blit routines */
#undef SDL_ASSEMBLY_BLITTERS
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
#undef SDL_HERMES_BLITTERS
#undef SDL_ALTIVEC_BLITTERS

Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.minimal
Expand Up @@ -25,6 +25,8 @@

/* This is the minimal configuration that can be used to build SDL */

#include "SDL_platform.h"

#include <stdarg.h>

typedef signed char int8_t;
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_cpuinfo.h
Expand Up @@ -23,11 +23,11 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* CPU feature detection for SDL */

#include "SDL_stdinc.h"

#ifndef _SDL_cpuinfo_h
#define _SDL_cpuinfo_h

#include "SDL_stdinc.h"

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions include/SDL_main.h
Expand Up @@ -27,9 +27,9 @@

/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */

#if defined(WIN32) || defined(_WIN32) || \
#if defined(__WIN32__) || \
(defined(__MWERKS__) && !defined(__BEOS__)) || \
defined(macintosh) || defined(__APPLE__) || \
defined(__MACOS__) || defined(__MACOSX__) || \
defined(__SYMBIAN32__) || defined(QWS)

#ifdef __cplusplus
Expand All @@ -54,7 +54,7 @@ extern C_LINKAGE int SDL_main(int argc, char *argv[]);


/* From the SDL library code -- needed for registering the app on Win32 */
#if defined(WIN32)
#ifdef __WIN32__

#include "begin_code.h"
#ifdef __cplusplus
Expand All @@ -74,7 +74,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp();
#endif

/* From the SDL library code -- needed for registering QuickDraw on MacOS */
#if defined(macintosh)
#if defined(__MACOS__)

#include "begin_code.h"
#ifdef __cplusplus
Expand Down
6 changes: 4 additions & 2 deletions include/SDL_opengl.h
Expand Up @@ -22,7 +22,9 @@

/* This is a simple file to encapsulate the OpenGL API headers */

#ifdef WIN32
#include "SDL_config.h"

#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX /* Don't defined min() and max() */
Expand All @@ -32,7 +34,7 @@
#ifndef NO_SDL_GLEXT
#define __glext_h_ /* Don't let gl.h include glext.h */
#endif
#if defined(__APPLE__) && defined(__MACH__)
#ifdef __MACOSX__
#include <OpenGL/gl.h> /* Header File For The OpenGL Library */
#include <OpenGL/glu.h> /* Header File For The GLU Library */
#else
Expand Down
104 changes: 104 additions & 0 deletions include/SDL_platform.h
@@ -0,0 +1,104 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/

/* Try to get a standard set of platform defines */

#if defined(_AIX)
#undef __AIX__
#define __AIX__ 1
#endif
#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
/* FIXME: is this the right test for AmigaOS? */
#undef __AMIGA__
#define __AMIGA__ 1
#endif
#if defined(__BEOS__)
#undef __BEOS__
#define __BEOS__ 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
#define __BSDI__ 1
#endif
#if defined(DREAMCAST)
/* FIXME: is this the right test for Dreamcast? */
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#endif
#if defined(__FreeBSD__)
#undef __FREEBSD__
#define __FREEBSD__ 1
#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
#endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
#undef __IRIX__
#define __IRIX__ 1
#endif
#if defined(linux) || defined(__linux) || defined(__linux__)
#undef __LINUX__
#define __LINUX__ 1
#endif
#if defined(macintosh)
#undef __MACOS__
#define __MACOS__ 1
#endif
#if defined(__GNUC__) && (defined(__APPLE_CC__) || defined(__APPLE_CPP__))
#undef __MACOSX__
#define __MACOSX__ 1
#define TARGET_API_MAC_CARBON 1
#endif
#if defined(__NetBSD__)
#undef __NETBSD__
#define __NETBSD__ 1
#endif
#if defined(__OpenBSD__)
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
#if defined(__OS2__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
#undef __OSF__
#define __OSF__ 1
#endif
#if defined(__QNXNTO__)
#undef __QNXNTO__
#define __QNXNTO__ 1
#endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
#undef __RISCOS__
#define __RISCOS__ 1
#endif
#if defined(solaris) || defined(__solaris) || defined(__solaris__)
/* FIXME: is this the right test for Solaris? Check SDL_sunaudio.c */
#undef __SOLARIS__
#define __SOLARIS__ 1
#endif
#if defined(WIN32) || defined(_WIN32)
#undef __WIN32__
#define __WIN32__ 1
#endif
6 changes: 3 additions & 3 deletions include/SDL_rwops.h
Expand Up @@ -24,8 +24,8 @@
data sources. It can easily be extended to files, memory, etc.
*/

#ifndef _SDL_RWops_h
#define _SDL_RWops_h
#ifndef _SDL_rwops_h
#define _SDL_rwops_h

#include "SDL_stdinc.h"
#include "SDL_error.h"
Expand Down Expand Up @@ -130,4 +130,4 @@ extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
#endif
#include "close_code.h"

#endif /* _SDL_RWops_h */
#endif /* _SDL_rwops_h */
6 changes: 3 additions & 3 deletions include/SDL_stdinc.h
Expand Up @@ -159,12 +159,12 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem);
#if HAVE_ALLOCA && !defined(alloca)
# if HAVE_ALLOCA_H
# include <alloca.h>
# elif __GNUC__
# elif defined(__GNUC__)
# define alloca __builtin_alloca
# elif _MSC_VER
# elif defined(_MSC_VER)
# include <malloc.h>
# define alloca _alloca
# elif _AIX
# elif defined(__AIX__)
#pragma alloca
# else
char *alloca ();
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_thread.h
Expand Up @@ -45,7 +45,7 @@ struct SDL_Thread;
typedef struct SDL_Thread SDL_Thread;

/* Create a thread */
#if defined(_WIN32) || defined(__OS2__)
#if defined(__WIN32__) || defined(__OS2__)
/*
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
creates a new thread for the calling process with the SDL_CreateThread()
Expand Down
11 changes: 3 additions & 8 deletions include/begin_code.h
Expand Up @@ -31,11 +31,6 @@
#endif
#define _begin_code_h

/* Make sure the correct platform symbols are defined */
#if !defined(WIN32) && defined(_WIN32)
#define WIN32
#endif /* Windows */

/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# ifdef __BEOS__
Expand All @@ -45,7 +40,7 @@
# define DECLSPEC __declspec(export)
# endif
# else
# ifdef WIN32
# ifdef __WIN32__
# ifdef __BORLANDC__
# ifdef BUILD_SDL
# define DECLSPEC
Expand Down Expand Up @@ -75,7 +70,7 @@

/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if defined(WIN32) && !defined(__GNUC__)
#if defined(__WIN32__) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#ifdef __OS2__
Expand Down Expand Up @@ -107,7 +102,7 @@
#pragma nopackwarning
#endif
#pragma pack(push,4)
#elif (defined(__MWERKS__) && defined(macintosh))
#elif (defined(__MWERKS__) && defined(__MACOS__))
#pragma options align=mac68k4byte
#pragma enumsalwaysint on
#endif /* Compiler needs structure packing set */
Expand Down

0 comments on commit fd03c21

Please sign in to comment.