Changeset 2300


Ignore:
Timestamp:
Jan 31, 2013, 2:17:09 AM (6 years ago)
Author:
sam
Message:

build: add SDL detection code in new file lol-sdl.m4. The SDL2 version is
disabled until the engine code itself is ported to SDL2.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r2285 r2300  
    219219LOL_CHECK_OPENGL
    220220
    221 
    222 dnl Use SDL? (always required on Linux or Win32)
    223 ac_cv_my_have_sdl="no"
    224 ac_cv_my_have_sdl_image="no"
    225 ac_cv_my_have_sdl_mixer="no"
    226 dnl
    227 dnl  First, try the proper pkg-config check
    228 PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
    229 PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
    230 PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
    231 dnl
    232 dnl  Then the old sdl-config method
    233 if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
    234   AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
    235   if test "${SDL_CONFIG}" != "no"; then
    236     SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
    237     SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
    238     ac_cv_my_have_sdl="yes"
    239   fi
    240 fi
    241 dnl
    242 dnl  Maybe all this has failed, try direct inclusion
    243 save_CPPFLAGS="${CPPFLAGS}"
    244 save_LIBS="${LIBS}"
    245 CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
    246 LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
    247 AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
    248 AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
    249 AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
    250 AC_CHECK_LIB(SDL, main,
    251  [SDL_LIBS="${SDL_LIBS} -lSDL"],
    252  [ac_cv_my_have_sdl="no"])
    253 AC_CHECK_LIB(SDLmain, main,
    254  [SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"])
    255 AC_CHECK_LIB(SDL_mixer, main,
    256  [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
    257  [ac_cv_my_have_sdl_mixer="no"])
    258 AC_CHECK_LIB(SDL_image, main,
    259  [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
    260  [ac_cv_my_have_sdl_image="no"])
    261 SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
    262 SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
    263 CPPFLAGS="${save_CPPFLAGS}"
    264 LIBS="${save_LIBS}"
    265 if test "${ac_cv_my_have_sdl}" = "no"; then
    266   AC_MSG_WARN([SDL not found])
    267 else
    268   AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
    269 fi
    270 if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
    271   AC_MSG_WARN([SDL_mixer not found])
    272 else
    273   AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
    274 fi
    275 if test "${ac_cv_my_have_sdl_image}" = "no"; then
    276   AC_MSG_WARN([SDL_image not found])
    277 else
    278   AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
    279 fi
    280 AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
    281 AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
    282 AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
    283 
     221LOL_CHECK_SDL
    284222
    285223dnl  Use Flex's FlexLexer.h or ours?
  • trunk/src/application/application.cpp

    r2222 r2300  
    5555    /* FIXME: this macro is only deactivated if we include "lolgl.h" */
    5656    EglApp app;
    57 #elif defined HAVE_SDL_H
     57#elif defined HAVE_SDL_H || defined HAVE_SDL_SDL_H
    5858    SdlApp app;
    5959#else
  • trunk/src/eglapp.cpp

    r2222 r2300  
    2626
    2727#if defined USE_SDL
    28 #   if defined HAVE_SDL_SDL_H
     28#   if defined HAVE_SDL_H || defined HAVE_SDL_SDL_H
    2929#      include <SDL/SDL.h>
    3030#   else
  • trunk/src/input/input.cpp

    r2216 r2300  
    116116{
    117117#if defined USE_SDL
    118 #if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3
     118#   if SDL_VERSION_ATLEAST(1,3,0)
    119119    Uint8 *keystate = SDL_GetKeyboardState(NULL);
    120 #else
     120#   else
    121121    Uint8 *keystate = SDL_GetKeyState(NULL);
    122 #endif
     122#   endif
    123123    //SOOOoooo ugly.
    124124    for (int i = 0; i < Key::Last; ++i)
     
    270270#if defined USE_SDL
    271271    /* Simulate a joystick using the keyboard. This SDL call is free. */
    272 #if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3
     272#   if SDL_VERSION_ATLEAST(1,3,0)
    273273    Uint8 *keystate = SDL_GetKeyboardState(NULL);
    274 #else
     274#   else
    275275    Uint8 *keystate = SDL_GetKeyState(NULL);
    276 #endif
     276#   endif
    277277    int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]);
    278278    int up = (keystate[SDLK_w] | keystate[SDLK_z]) - keystate[SDLK_s] ;
     
    303303{
    304304#if defined USE_SDL
    305 #   if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3
     305#   if SDL_VERSION_ATLEAST(1,3,0)
    306306    Uint8 *keystate = SDL_GetKeyboardState(NULL);
    307307#   else
  • trunk/src/platform/sdl/sdlapp.cpp

    r2276 r2300  
    1414
    1515#if defined USE_SDL
    16 #   if defined HAVE_SDL_SDL_H
     16#   if defined HAVE_SDL2_SDL_H
     17#      include <SDL2/SDL.h>
     18#   elif defined HAVE_SDL_SDL_H
    1719#      include <SDL/SDL.h>
    1820#   else
     
    7476    SDL_GetWMInfo(&wminfo);
    7577    g_hwnd = wminfo.window;
     78#   elif SDL_VERSION_ATLEAST(2,0,0)
     79    TODO
    7680#   else
    7781    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  • trunk/src/sys/timer.cpp

    r2257 r2300  
    3131#   include <sys/timer.h>
    3232#   include <sys/time_util.h>
    33 #elif defined HAVE_SDL_SDL_H
     33#elif defined HAVE_SDL_H || defined HAVE_SDL_SDL_H
    3434#   include <SDL/SDL.h>
    3535#else
Note: See TracChangeset for help on using the changeset viewer.