diff --git a/configure.ac b/configure.ac index dc2aa0ff..9c0b807c 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ fi dnl Checks for libraries. #Check if the compiler support attributes -AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.]) +AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compiler supports attributes for structures.]) AC_MSG_CHECKING(if compiler allows __attribute__) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ typedef struct { } __attribute__((packed)) junk;]], @@ -149,12 +149,12 @@ typedef struct { } __attribute__((packed)) junk;]], OLDCFLAGS="$CFLAGS" CFLAGS="-Werror" -AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compilers supports always_inline attribute.]) +AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compiler supports always_inline attribute.]) AC_MSG_CHECKING(if compiler allows __attribute__((always_inline)) ) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ inline void __attribute__((always_inline)) test(){} ])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no)) -AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compilers supports fastcall attribute.]) +AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compiler supports fastcall attribute.]) AC_MSG_CHECKING(if compiler allows __attribute__((fastcall)) ) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ void __attribute__((fastcall)) test(){} ])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no)) @@ -436,6 +436,26 @@ case "$host" in esac fi +AH_TEMPLATE(C_DDRAW,[Define to 1 to enable output=ddraw (Win32)]) +AC_ARG_ENABLE(ddraw,AC_HELP_STRING([--disable-ddraw],[Disable ddraw support]),enable_ddraw=yes) +AC_CHECK_HEADER(ddraw.h, have_ddraw_h=yes , have_ddraw_h=no , ) +AC_MSG_CHECKING(whether ddraw display output will be enabled) +if test x$enable_opengl = xyes; then +case "$host" in + *-*-cygwin* | *-*-mingw32*) + if test x$have_ddraw_h = xyes ; then + AC_MSG_RESULT(yes) + AC_DEFINE(C_DDRAW,1) + else + AC_MSG_RESULT(no) + fi + ;; + *) + AC_MSG_RESULT(no) + ;; +esac +fi + AH_TEMPLATE(C_SDL_SOUND,[Define to 1 to enable SDL_sound support]) AC_CHECK_HEADER(SDL_sound.h,have_SDL_sound_h=yes,) AC_CHECK_LIB(SDL_sound, Sound_Init, have_SDL_sound_init=yes,,) @@ -472,7 +492,6 @@ dnl Some target detection and actions for them case "$host" in *-*-cygwin* | *-*-mingw32*) LIBS="$LIBS -lwinmm" - AC_CHECK_HEADERS(ddraw.h) AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2 only).]) if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then LIBS="$LIBS -lws2_32" diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index c59815dc..db0a828f 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -99,7 +99,7 @@ extern char** environ; #define WIN32_LEAN_AND_MEAN #endif #include -#if (HAVE_DDRAW_H) +#if C_DDRAW #include struct private_hwdata { LPDIRECTDRAWSURFACE3 dd_surface; @@ -189,7 +189,7 @@ struct SDL_Block { #endif struct { SDL_Surface * surface; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW RECT rect; #endif } blit; @@ -380,7 +380,7 @@ check_surface: else if (flags & GFX_LOVE_16) testbpp=16; else if (flags & GFX_LOVE_32) testbpp=32; else testbpp=0; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW check_gotbpp: #endif if (sdl.desktop.fullscreen) gotbpp=SDL_VideoModeOK(640,480,testbpp,SDL_FULLSCREEN|SDL_HWSURFACE|SDL_HWPALETTE); @@ -403,7 +403,7 @@ check_gotbpp: } flags |= GFX_CAN_RANDOM; break; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW case SCREEN_SURFACE_DDRAW: if (!(flags&(GFX_CAN_15|GFX_CAN_16|GFX_CAN_32))) goto check_surface; if (flags & GFX_LOVE_15) testbpp=15; @@ -613,7 +613,7 @@ dosurface: } } break; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW case SCREEN_SURFACE_DDRAW: if (flags & GFX_CAN_15) bpp=15; if (flags & GFX_CAN_16) bpp=16; @@ -887,7 +887,7 @@ bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch) { } sdl.updating=true; return true; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW case SCREEN_SURFACE_DDRAW: if (SDL_LockSurface(sdl.blit.surface)) { // LOG_MSG("SDL Lock failed"); @@ -923,7 +923,7 @@ bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch) { void GFX_EndUpdate( const Bit16u *changedLines ) { -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW int ret; #endif if (!sdl.updating) @@ -964,7 +964,7 @@ void GFX_EndUpdate( const Bit16u *changedLines ) { SDL_UpdateRects( sdl.surface, rectCount, sdl.updateRects ); } break; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW case SCREEN_SURFACE_DDRAW: SDL_UnlockSurface(sdl.blit.surface); ret=IDirectDrawSurface3_Blt( @@ -1273,7 +1273,7 @@ static void GUI_StartUp(Section * sec) { if (output == "surface") { sdl.desktop.want_type=SCREEN_SURFACE; -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW } else if (output == "ddraw") { sdl.desktop.want_type=SCREEN_SURFACE_DDRAW; #endif @@ -1681,7 +1681,7 @@ void Config_Add_SDL() { #if C_OPENGL "opengl", "openglnb", #endif -#if (HAVE_DDRAW_H) && defined(WIN32) +#if C_DDRAW "ddraw", #endif 0 }; diff --git a/src/platform/visualc/config.h b/src/platform/visualc/config.h index fffd256e..8b7bab26 100644 --- a/src/platform/visualc/config.h +++ b/src/platform/visualc/config.h @@ -3,6 +3,9 @@ /* Define to 1 to enable internal debugger, requires libcurses */ #define C_DEBUG 0 +/* Define to 1 to enable output=ddraw */ +#define C_DDRAW 1 + /* Define to 1 to enable screenshots, requires libpng */ #define C_SSHOT 1 @@ -46,10 +49,7 @@ /* environ can be linked */ #define ENVIRON_LINKED 1 -/* Define to 1 if you have the header file. */ -#define HAVE_DDRAW_H 1 - -/* Define to 1 if you want serial passthrough support (Win32 only). */ +/* Define to 1 if you want serial passthrough support. */ #define C_DIRECTSERIAL 1 #define GCC_ATTRIBUTE(x) /* attribute not supported */