From 946280ddacab458fd244ffb6bb1aa97248c26def Mon Sep 17 00:00:00 2001 From: meep-eep Date: Sun, 24 Apr 2005 17:52:09 +0000 Subject: [PATCH] Fixes for SDL detection. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1681 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/port.h | 33 ++++++++++++++----- .../sc2code/libs/graphics/sdl/sdl_common.h | 2 +- sc2/src/sc2code/libs/graphics/sdl/sdluio.c | 2 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/sc2/src/port.h b/sc2/src/port.h index 4d7d2ea42..c7d6a8a5f 100644 --- a/sc2/src/port.h +++ b/sc2/src/port.h @@ -137,20 +137,35 @@ iswgraph(wint_t wc) } #endif -// Use SDL_INCLUDE to portably include the SDL files from the right -// location. TODO: Where SDL_H is located could be detected from the build -// script. +// Use SDL_INCLUDE and SDL_IMAGE_INCLUDE to portably include the SDL files +// from the right location. +// TODO: Where the SDL and SDL_image headers are located could be detected +// from the build script. #ifdef __APPLE__ -# define HAVE_SDL_SDL_H + // SDL_image.h in a directory SDL_image under the include dir. +# define SDL_DIR SDL +# define SDL_IMAGE_DIR SDL_image #else -# define HAVE_SDL_H + // SDL_image.h directly under the include dir. +# define SDL_DIR +# define SDL_IMAGE_DIR #endif -#ifdef HAVE_SDL_H + +#define xSDL_DIR x##SDL_DIR +#if xSDL_DIR == x # define SDL_INCLUDE(file) -#elif defined(HAVE_SDL_SDL_H) -# define SDL_INCLUDE(file) +#else +# define SDL_INCLUDE(file) #endif +#undef xSDL_DIR + +#define xSDL_IMAGE_DIR x##SDL_IMAGE_DIR +#if xSDL_IMAGE_DIR == x +# define SDL_IMAGE_INCLUDE(file) +#else +# define SDL_IMAGE_INCLUDE(file) +#endif +#undef xSDL_IMAGE_DIR #endif /* _PORT_H */ - diff --git a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.h b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.h index 7b18cc6f8..c4260cb0e 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.h +++ b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.h @@ -21,8 +21,8 @@ #include "port.h" #include SDL_INCLUDE(SDL.h) -#include SDL_INCLUDE(SDL_image.h) #include SDL_INCLUDE(SDL_byteorder.h) +#include SDL_IMAGE_INCLUDE(SDL_image.h) #include "libs/graphics/gfxintrn.h" #include "libs/graphics/tfb_draw.h" diff --git a/sc2/src/sc2code/libs/graphics/sdl/sdluio.c b/sc2/src/sc2code/libs/graphics/sdl/sdluio.c index 7f3f66f60..d4f1b2d16 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/sdluio.c +++ b/sc2/src/sc2code/libs/graphics/sdl/sdluio.c @@ -3,9 +3,9 @@ #include "port.h" #include "libs/uio.h" #include SDL_INCLUDE(SDL.h) -#include SDL_INCLUDE(SDL_image.h) #include SDL_INCLUDE(SDL_error.h) #include SDL_INCLUDE(SDL_rwops.h) +#include SDL_IMAGE_INCLUDE(SDL_image.h) #include "libs/misc.h" #include #include