configure.in
changeset 8104 2e4f1bd21196
parent 8094 9efaae827924
child 8124 5226058345bf
     1.1 --- a/configure.in	Wed Jan 08 14:53:08 2014 -0500
     1.2 +++ b/configure.in	Thu Jan 09 13:56:21 2014 -0300
     1.3 @@ -1133,8 +1133,8 @@
     1.4          video_wayland=no
     1.5          if test x$PKG_CONFIG != xno; then
     1.6              if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
     1.7 -                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
     1.8 -                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
     1.9 +                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
    1.10 +                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
    1.11                  video_wayland=yes
    1.12              fi
    1.13          fi
    1.14 @@ -1147,8 +1147,50 @@
    1.15              fi
    1.16              SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
    1.17              EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
    1.18 -            dnl FIXME do dynamic loading code here.
    1.19 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
    1.20 +            AC_ARG_ENABLE(wayland-shared,
    1.21 +AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
    1.22 +                          , enable_wayland_shared=maybe)
    1.23 +
    1.24 +            dnl FIXME: Do BSD and OS X need special cases?
    1.25 +            case "$host" in
    1.26 +                *)
    1.27 +                    wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.28 +                    wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.29 +                    if test x$wayland_egl_lib = x; then
    1.30 +                        dnl This works in Ubuntu 13.10, maybe others
    1.31 +                        wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.32 +                    fi
    1.33 +                    wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.34 +                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.35 +                    ;;
    1.36 +            esac
    1.37 +
    1.38 +            if test x$enable_wayland_shared = xmaybe; then
    1.39 +                enable_wayland_shared=yes
    1.40 +            fi
    1.41 +            if test x$have_loadso != xyes && \
    1.42 +               test x$enable_wayland_shared = xyes; then
    1.43 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic WAYLAND loading])
    1.44 +                enable_wayland_shared=no
    1.45 +            fi
    1.46 +            if test x$have_loadso = xyes && \
    1.47 +               test x$enable_wayland_shared = xyes && \
    1.48 +               test x$wayland_client_lib != x && \
    1.49 +               test x$wayland_egl_lib != x && \
    1.50 +               test x$wayland_cursor_lib != x && \
    1.51 +               test x$xkbcommon_lib != x; then
    1.52 +                echo "-- dynamic libwayland-client -> $wayland_client_lib"
    1.53 +                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
    1.54 +                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
    1.55 +                echo "-- dynamic xkbcommon -> $xkbcommon_lib"
    1.56 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
    1.57 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
    1.58 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
    1.59 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
    1.60 +            else
    1.61 +                enable_wayland_shared=no
    1.62 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
    1.63 +            fi
    1.64              have_video=yes
    1.65          fi
    1.66      fi