cmake/sdlchecks.cmake
changeset 8017 d84a30e5cbd5
parent 8016 3746af784462
child 8062 4fc5f66d63cc
equal deleted inserted replaced
8016:3746af784462 8017:d84a30e5cbd5
       
     1 macro(FindLibraryAndSONAME _LIB)
       
     2   string(TOUPPER ${_LIB} _UPPERLNAME)
       
     3   string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}")
       
     4 
       
     5   find_library(${_LNAME}_LIB ${_LIB})
       
     6   if(${_LNAME}_LIB)
       
     7     # reduce the library name for shared linking
       
     8 
       
     9     get_filename_component(_LIB_REALPATH ${${_LNAME}_LIB} REALPATH)  # resolves symlinks
       
    10     get_filename_component(_LIB_JUSTNAME ${_LIB_REALPATH} NAME)
       
    11 
       
    12     if(APPLE)
       
    13       string(REGEX REPLACE "(\\.[0-9]*)\\.[0-9\\.]*dylib$" "\\1.dylib" _LIB_REGEXD "${_LIB_JUSTNAME}")
       
    14     else()
       
    15       string(REGEX REPLACE "(\\.[0-9]*)\\.[0-9\\.]*$" "\\1" _LIB_REGEXD "${_LIB_JUSTNAME}")
       
    16     endif()
       
    17 
       
    18     SET(_DEBUG_FindSONAME FALSE)
       
    19     if(_DEBUG_FindSONAME)
       
    20       message_warn("DYNLIB OUTPUTVAR: ${_LIB} ... ${_LNAME}_LIB")
       
    21       message_warn("DYNLIB ORIGINAL LIB: ${_LIB} ... ${${_LNAME}_LIB}")
       
    22       message_warn("DYNLIB REALPATH LIB: ${_LIB} ... ${_LIB_REALPATH}")
       
    23       message_warn("DYNLIB JUSTNAME LIB: ${_LIB} ... ${_LIB_JUSTNAME}")
       
    24       message_warn("DYNLIB REGEX'd LIB: ${_LIB} ... ${_LIB_REGEXD}")
       
    25     endif()
       
    26 
       
    27     message(STATUS "dynamic lib${_LIB} -> ${_LIB_REGEXD}")
       
    28     set(${_LNAME}_LIB_SONAME ${_LIB_REGEXD})
       
    29   endif()
       
    30 endmacro()
       
    31 
     1 macro(CheckDLOPEN)
    32 macro(CheckDLOPEN)
     2   check_function_exists(dlopen HAVE_DLOPEN)
    33   check_function_exists(dlopen HAVE_DLOPEN)
     3   if(NOT HAVE_DLOPEN)
    34   if(NOT HAVE_DLOPEN)
     4     foreach(_LIBNAME dl tdl)
    35     foreach(_LIBNAME dl tdl)
     5       check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
    36       check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
    81       set(SDL_AUDIO_DRIVER_ALSA 1)
   112       set(SDL_AUDIO_DRIVER_ALSA 1)
    82       if(ALSA_SHARED)
   113       if(ALSA_SHARED)
    83         if(NOT HAVE_DLOPEN)
   114         if(NOT HAVE_DLOPEN)
    84           message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
   115           message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
    85         else()
   116         else()
    86           find_library(_ALSA_LIB asound)
   117           FindLibraryAndSONAME("asound")
    87           get_filename_component(F_ALSA_LIB ${_ALSA_LIB} NAME)
   118           set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
    88           set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${F_ALSA_LIB}\"")
       
    89           set(HAVE_ALSA_SHARED TRUE)
   119           set(HAVE_ALSA_SHARED TRUE)
    90         endif(NOT HAVE_DLOPEN)
   120         endif(NOT HAVE_DLOPEN)
    91       else(ALSA_SHARED)
   121       else(ALSA_SHARED)
    92         list(APPEND EXTRA_LIBS asound)
   122         list(APPEND EXTRA_LIBS asound)
    93       endif(ALSA_SHARED)
   123       endif(ALSA_SHARED)
   112       list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS})
   142       list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS})
   113       if(PULSEAUDIO_SHARED)
   143       if(PULSEAUDIO_SHARED)
   114         if(NOT HAVE_DLOPEN)
   144         if(NOT HAVE_DLOPEN)
   115           message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
   145           message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
   116         else()
   146         else()
   117           find_library(D_PULSE_LIB pulse-simple)
   147           FindLibraryAndSONAME("pulse-simple")
   118           get_filename_component(F_PULSE_LIB ${D_PULSE_LIB} NAME)
   148           set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
   119           set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${F_PULSE_LIB}\"")
       
   120           set(HAVE_PULSEAUDIO_SHARED TRUE)
   149           set(HAVE_PULSEAUDIO_SHARED TRUE)
   121         endif(NOT HAVE_DLOPEN)
   150         endif(NOT HAVE_DLOPEN)
   122       else(PULSEAUDIO_SHARED)
   151       else(PULSEAUDIO_SHARED)
   123         list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
   152         list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
   124       endif(PULSEAUDIO_SHARED)
   153       endif(PULSEAUDIO_SHARED)
   143       list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS})
   172       list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS})
   144       if(ESD_SHARED)
   173       if(ESD_SHARED)
   145         if(NOT HAVE_DLOPEN)
   174         if(NOT HAVE_DLOPEN)
   146           message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
   175           message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
   147         else()
   176         else()
   148           find_library(D_ESD_LIB esd)
   177           FindLibraryAndSONAME(esd)
   149           get_filename_component(F_ESD_LIB ${D_ESD_LIB} NAME)
   178           set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"")
   150           set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${F_ESD_LIB}\"")
       
   151           set(HAVE_ESD_SHARED TRUE)
   179           set(HAVE_ESD_SHARED TRUE)
   152         endif(NOT HAVE_DLOPEN)
   180         endif(NOT HAVE_DLOPEN)
   153       else(ESD_SHARED)
   181       else(ESD_SHARED)
   154         list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS})
   182         list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS})
   155       endif(ESD_SHARED)
   183       endif(ESD_SHARED)
   179       if(ARTS_SHARED)
   207       if(ARTS_SHARED)
   180         if(NOT HAVE_DLOPEN)
   208         if(NOT HAVE_DLOPEN)
   181           message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading")
   209           message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading")
   182         else()
   210         else()
   183           # TODO
   211           # TODO
   184           find_library(D_ARTS_LIB artsc)
   212           FindLibraryAndSONAME(artsc)
   185           get_filename_component(F_ARTS_LIB ${D_ARTS_LIB} NAME)
   213           set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"")
   186           set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${F_ARTS_LIB}\"")
       
   187           set(HAVE_ARTS_SHARED TRUE)
   214           set(HAVE_ARTS_SHARED TRUE)
   188         endif(NOT HAVE_DLOPEN)
   215         endif(NOT HAVE_DLOPEN)
   189       else(ARTS_SHARED)
   216       else(ARTS_SHARED)
   190         list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS})
   217         list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS})
   191       endif(ARTS_SHARED)
   218       endif(ARTS_SHARED)
   211       set(SDL_AUDIO_DRIVER_NAS 1)
   238       set(SDL_AUDIO_DRIVER_NAS 1)
   212       if(NAS_SHARED)
   239       if(NAS_SHARED)
   213         if(NOT HAVE_DLOPEN)
   240         if(NOT HAVE_DLOPEN)
   214           message_warn("You must have SDL_LoadObject() support for dynamic NAS loading")
   241           message_warn("You must have SDL_LoadObject() support for dynamic NAS loading")
   215         else()
   242         else()
   216           get_filename_component(F_NAS_LIB ${D_NAS_LIB} NAME)
   243           FindLibraryAndSONAME("audio")
   217           set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${F_NAS_LIB}\"")
   244           set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"")
   218           set(HAVE_NAS_SHARED TRUE)
   245           set(HAVE_NAS_SHARED TRUE)
   219         endif(NOT HAVE_DLOPEN)
   246         endif(NOT HAVE_DLOPEN)
   220       else(NAS_SHARED)
   247       else(NAS_SHARED)
   221         list(APPEND EXTRA_LIBS ${D_NAS_LIB})
   248         list(APPEND EXTRA_LIBS ${D_NAS_LIB})
   222       endif(NAS_SHARED)
   249       endif(NAS_SHARED)
   232 # - HAVE_DLOPEN opt
   259 # - HAVE_DLOPEN opt
   233 macro(CheckSNDIO)
   260 macro(CheckSNDIO)
   234   if(SNDIO)
   261   if(SNDIO)
   235     # TODO: set include paths properly, so the sndio headers are found
   262     # TODO: set include paths properly, so the sndio headers are found
   236     check_include_file(sndio.h HAVE_SNDIO_H)
   263     check_include_file(sndio.h HAVE_SNDIO_H)
   237     find_library(D_SNDIO_LIB audio)
   264     find_library(D_SNDIO_LIB sndio)
   238     if(HAVE_SNDIO_H AND D_SNDIO_LIB)
   265     if(HAVE_SNDIO_H AND D_SNDIO_LIB)
   239       set(HAVE_SNDIO TRUE)
   266       set(HAVE_SNDIO TRUE)
   240       file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
   267       file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
   241       set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
   268       set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
   242       set(SDL_AUDIO_DRIVER_SNDIO 1)
   269       set(SDL_AUDIO_DRIVER_SNDIO 1)
   243       if(SNDIO_SHARED)
   270       if(SNDIO_SHARED)
   244         if(NOT HAVE_DLOPEN)
   271         if(NOT HAVE_DLOPEN)
   245           message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
   272           message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
   246         else()
   273         else()
   247           get_filename_component(F_SNDIO_LIB ${D_SNDIO_LIB} NAME)
   274           FindLibraryAndSONAME("sndio")
   248           set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${F_SNDIO_LIB}\"")
   275           set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
   249           set(HAVE_SNDIO_SHARED TRUE)
   276           set(HAVE_SNDIO_SHARED TRUE)
   250         endif(NOT HAVE_DLOPEN)
   277         endif(NOT HAVE_DLOPEN)
   251       else(SNDIO_SHARED)
   278       else(SNDIO_SHARED)
   252         list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
   279         list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
   253       endif(SNDIO_SHARED)
   280       endif(SNDIO_SHARED)
   272       list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS})
   299       list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS})
   273       if(FUSIONSOUND_SHARED)
   300       if(FUSIONSOUND_SHARED)
   274         if(NOT HAVE_DLOPEN)
   301         if(NOT HAVE_DLOPEN)
   275           message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading")
   302           message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading")
   276         else()
   303         else()
   277           find_library(D_FUSIONSOUND_LIB fusionsound)
   304           FindLibraryAndSONAME("fusionsound")
   278           get_filename_component(F_FUSIONSOUND_LIB ${D_FUSIONSOUND_LIB} NAME)
   305           set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"")
   279           set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${F_FUSIONSOUND_LIB}\"")
       
   280           set(HAVE_FUSIONSOUND_SHARED TRUE)
   306           set(HAVE_FUSIONSOUND_SHARED TRUE)
   281         endif(NOT HAVE_DLOPEN)
   307         endif(NOT HAVE_DLOPEN)
   282       else(FUSIONSOUND_SHARED)
   308       else(FUSIONSOUND_SHARED)
   283         list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS})
   309         list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS})
   284       endif(FUSIONSOUND_SHARED)
   310       endif(FUSIONSOUND_SHARED)
   293 # - X11_SHARED opt
   319 # - X11_SHARED opt
   294 # - HAVE_DLOPEN opt
   320 # - HAVE_DLOPEN opt
   295 macro(CheckX11)
   321 macro(CheckX11)
   296   if(VIDEO_X11)
   322   if(VIDEO_X11)
   297     foreach(_LIB X11 Xext Xcursor Xinerama Xi Xrandr Xrender Xss Xxf86vm)
   323     foreach(_LIB X11 Xext Xcursor Xinerama Xi Xrandr Xrender Xss Xxf86vm)
   298       string(TOUPPER ${_LIB} _LNAME)
   324         FindLibraryAndSONAME("${_LIB}")
   299       find_library(${_LNAME}_LIB ${_LIB})
       
   300       if(${_LNAME}_LIB)
       
   301         # reduce the library name for shared linking
       
   302         get_filename_component(_TMP ${${_LNAME}_LIB} NAME)
       
   303         set(${_LNAME}_LIB ${_TMP})
       
   304       endif()
       
   305     endforeach()
   325     endforeach()
   306 
   326 
   307     find_path(X_INCLUDEDIR X11/Xlib.h)
   327     find_path(X_INCLUDEDIR X11/Xlib.h)
   308     if(X_INCLUDEDIR)
   328     if(X_INCLUDEDIR)
   309       set(X_CFLAGS "-I${X_INCLUDEDIR}")
   329       set(X_CFLAGS "-I${X_INCLUDEDIR}")
   353           set(HAVE_X11_SHARED FALSE)
   373           set(HAVE_X11_SHARED FALSE)
   354         else(NOT HAVE_DLOPEN)
   374         else(NOT HAVE_DLOPEN)
   355           set(HAVE_X11_SHARED TRUE)
   375           set(HAVE_X11_SHARED TRUE)
   356         endif()
   376         endif()
   357         if(HAVE_X11_SHARED)
   377         if(HAVE_X11_SHARED)
   358           set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB}\"")
   378           set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"")
   359           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB}\"")
   379           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"")
   360         else(HAVE_X11_SHARED)
   380         else(HAVE_X11_SHARED)
   361           list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
   381           list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
   362         endif(HAVE_X11_SHARED)
   382         endif(HAVE_X11_SHARED)
   363       endif(X11_SHARED)
   383       endif(X11_SHARED)
   364 
   384 
   400       check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
   420       check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
   401 
   421 
   402       if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
   422       if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
   403         set(HAVE_VIDEO_X11_XCURSOR TRUE)
   423         set(HAVE_VIDEO_X11_XCURSOR TRUE)
   404         if(HAVE_X11_SHARED AND XCURSOR_LIB)
   424         if(HAVE_X11_SHARED AND XCURSOR_LIB)
   405           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "\"${XCURSOR_LIB}\"")
   425           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "\"${XCURSOR_LIB_SONAME}\"")
   406         else(HAVE_X11_SHARED AND XCURSOR_LIB)
   426         else(HAVE_X11_SHARED AND XCURSOR_LIB)
   407           list(APPEND EXTRA_LIBS ${XCURSOR_LIB})
   427           list(APPEND EXTRA_LIBS ${XCURSOR_LIB})
   408         endif(HAVE_X11_SHARED AND XCURSOR_LIB)
   428         endif(HAVE_X11_SHARED AND XCURSOR_LIB)
   409         set(SDL_VIDEO_DRIVER_X11_XCURSOR 1)
   429         set(SDL_VIDEO_DRIVER_X11_XCURSOR 1)
   410       endif(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
   430       endif(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
   411 
   431 
   412       if(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H)
   432       if(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H)
   413         set(HAVE_VIDEO_X11_XINERAMA TRUE)
   433         set(HAVE_VIDEO_X11_XINERAMA TRUE)
   414         if(HAVE_X11_SHARED AND XINERAMA_LIB)
   434         if(HAVE_X11_SHARED AND XINERAMA_LIB)
   415           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB}\"")
   435           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB_SONAME}\"")
   416         else(HAVE_X11_SHARED AND XINERAMA_LIB)
   436         else(HAVE_X11_SHARED AND XINERAMA_LIB)
   417           list(APPEND EXTRA_LIBS ${XINERAMA_LIB})
   437           list(APPEND EXTRA_LIBS ${XINERAMA_LIB})
   418         endif(HAVE_X11_SHARED AND XINERAMA_LIB)
   438         endif(HAVE_X11_SHARED AND XINERAMA_LIB)
   419         set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
   439         set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
   420       endif(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H)
   440       endif(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H)
   421 
   441 
   422       if(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
   442       if(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
   423         set(HAVE_VIDEO_X11_XINPUT TRUE)
   443         set(HAVE_VIDEO_X11_XINPUT TRUE)
   424         if(HAVE_X11_SHARED AND XI_LIB)
   444         if(HAVE_X11_SHARED AND XI_LIB)
   425           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB}\"")
   445           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"")
   426         else(HAVE_X11_SHARED AND XI_LIB)
   446         else(HAVE_X11_SHARED AND XI_LIB)
   427           list(APPEND EXTRA_LIBS ${XI_LIB})
   447           list(APPEND EXTRA_LIBS ${XI_LIB})
   428         endif(HAVE_X11_SHARED AND XI_LIB)
   448         endif(HAVE_X11_SHARED AND XI_LIB)
   429         set(SDL_VIDEO_DRIVER_X11_XINPUT2 1)
   449         set(SDL_VIDEO_DRIVER_X11_XINPUT2 1)
   430 
   450 
   445         endif(HAVE_XINPUT2_MULTITOUCH)
   465         endif(HAVE_XINPUT2_MULTITOUCH)
   446       endif(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
   466       endif(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
   447 
   467 
   448       if(VIDEO_X11_XRANDR AND HAVE_XRANDR_H)
   468       if(VIDEO_X11_XRANDR AND HAVE_XRANDR_H)
   449         if(HAVE_X11_SHARED AND XRANDR_LIB)
   469         if(HAVE_X11_SHARED AND XRANDR_LIB)
   450           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "\"${XRANDR_LIB}\"")
   470           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "\"${XRANDR_LIB_SONAME}\"")
   451         else(HAVE_X11_SHARED AND XRANDR_LIB)
   471         else(HAVE_X11_SHARED AND XRANDR_LIB)
   452           list(APPEND EXTRA_LIBS ${XRANDR_LIB})
   472           list(APPEND EXTRA_LIBS ${XRANDR_LIB})
   453         endif(HAVE_X11_SHARED AND XRANDR_LIB)
   473         endif(HAVE_X11_SHARED AND XRANDR_LIB)
   454         set(SDL_VIDEO_DRIVER_X11_XRANDR 1)
   474         set(SDL_VIDEO_DRIVER_X11_XRANDR 1)
   455         set(HAVE_VIDEO_X11_XRANDR TRUE)
   475         set(HAVE_VIDEO_X11_XRANDR TRUE)
   456       endif(VIDEO_X11_XRANDR AND HAVE_XRANDR_H)
   476       endif(VIDEO_X11_XRANDR AND HAVE_XRANDR_H)
   457 
   477 
   458       if(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H)
   478       if(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H)
   459         if(HAVE_X11_SHARED AND XSS_LIB)
   479         if(HAVE_X11_SHARED AND XSS_LIB)
   460           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "\"${XSS_LIB}\"")
   480           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "\"${XSS_LIB_SONAME}\"")
   461         else(HAVE_X11_SHARED AND XSS_LIB)
   481         else(HAVE_X11_SHARED AND XSS_LIB)
   462           list(APPEND EXTRA_LIBS ${XSS_LIB})
   482           list(APPEND EXTRA_LIBS ${XSS_LIB})
   463         endif(HAVE_X11_SHARED AND XSS_LIB)
   483         endif(HAVE_X11_SHARED AND XSS_LIB)
   464         set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1)
   484         set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1)
   465         set(HAVE_VIDEO_X11_XSCRNSAVER TRUE)
   485         set(HAVE_VIDEO_X11_XSCRNSAVER TRUE)
   470         set(HAVE_VIDEO_X11_XSHAPE TRUE)
   490         set(HAVE_VIDEO_X11_XSHAPE TRUE)
   471       endif(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H)
   491       endif(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H)
   472 
   492 
   473       if(VIDEO_X11_XVM AND HAVE_XF86VM_H)
   493       if(VIDEO_X11_XVM AND HAVE_XF86VM_H)
   474         if(HAVE_X11_SHARED AND XF86VMODE_LIB)
   494         if(HAVE_X11_SHARED AND XF86VMODE_LIB)
   475           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XF86VMODE_LIB}\"")
   495           set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XF86VMODE_LIB_SONAME}\"")
   476         else(HAVE_X11_SHARED AND XF86VMODE_LIB)
   496         else(HAVE_X11_SHARED AND XF86VMODE_LIB)
   477           list(APPEND EXTRA_LIBS ${XF86VMODE_LIB})
   497           list(APPEND EXTRA_LIBS ${XF86VMODE_LIB})
   478         endif(HAVE_X11_SHARED AND XF86VMODE_LIB)
   498         endif(HAVE_X11_SHARED AND XF86VMODE_LIB)
   479         set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1)
   499         set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1)
   480         set(HAVE_VIDEO_X11_XVM TRUE)
   500         set(HAVE_VIDEO_X11_XVM TRUE)
   520       list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
   540       list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
   521       if(DIRECTFB_SHARED)
   541       if(DIRECTFB_SHARED)
   522         if(NOT HAVE_DLOPEN)
   542         if(NOT HAVE_DLOPEN)
   523           message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
   543           message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
   524         else()
   544         else()
   525           find_library(D_DIRECTFB_LIB directfb)
   545           FindLibraryAndSONAME("directfb")
   526           get_filename_component(F_DIRECTFB_LIB ${D_DIRECTFB_LIB} NAME)
   546           set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
   527           set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${F_DIRECTFB_LIB}\"")
       
   528           set(HAVE_DIRECTFB_SHARED TRUE)
   547           set(HAVE_DIRECTFB_SHARED TRUE)
   529         endif(NOT HAVE_DLOPEN)
   548         endif(NOT HAVE_DLOPEN)
   530       else(DIRECTFB_SHARED)
   549       else(DIRECTFB_SHARED)
   531         list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS})
   550         list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS})
   532       endif(DIRECTFB_SHARED)
   551       endif(DIRECTFB_SHARED)