Changeset 632


Ignore:
Timestamp:
Feb 11, 2011, 10:45:35 PM (10 years ago)
Author:
sam
Message:

Properly detect SDL libraries when sdl-config and pkg-config are here
together.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r629 r632  
    5858AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
    5959
    60 # Use SDL?
     60# Use SDL? (always required)
    6161ac_cv_my_have_sdl="yes"
    62 save_CPPFLAGS="${CPPFLAGS}"
    6362AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
    6463if test "${SDL_CONFIG}" != "no"; then
    65   CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
     64  SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
     65  SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
    6666fi
    67 AC_CHECK_HEADERS(SDL_image.h,
    68  [:],[ac_cv_my_have_sdl="no"])
    69 AC_CHECK_HEADERS(SDL_mixer.h,
    70  [:],[ac_cv_my_have_sdl="no"])
     67PKG_CHECK_MODULES(SDL, sdl, [:],
     68 [SDL_LIBS="${SDL_LIBS} -lSDL"])
     69SDL_LIBS="${SDL_LIBS} -lGL" # FIXME: quite hackish
     70PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
     71 [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
     72PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
     73 [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
     74save_CPPFLAGS="${CPPFLAGS}"
     75SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
     76SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
     77
     78CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
     79AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
     80AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
    7181CPPFLAGS="${save_CPPFLAGS}"
    72 if test "${ac_cv_my_have_sdl}" != "no"; then
     82if test "${ac_cv_my_have_sdl}" = "no"; then
     83  AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
     84else
    7385  AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
    7486fi
    7587AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
    76 
    77 if test "${ac_cv_my_have_sdl}" = "no"; then
    78   AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
    79 fi
    8088
    8189
     
    108116
    109117# How to use the Lol Engine inside this tree
    110 LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src `pkg-config --cflags sdl gl SDL_image`"
    111 LOL_LIBS="$LOL_LIBS `pkg-config --libs sdl gl SDL_image` -lSDL_mixer"
     118LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src $SDL_CFLAGS"
     119LOL_LIBS="$LOL_LIBS $SDL_LIBS"
    112120
    113121if test "${enable_release}" = "yes"; then
Note: See TracChangeset for help on using the changeset viewer.