Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hooked up dynamic loading for Mir.
  • Loading branch information
icculus committed Feb 3, 2014
1 parent 8f055d1 commit 89fd0fa
Show file tree
Hide file tree
Showing 14 changed files with 554 additions and 182 deletions.
2 changes: 2 additions & 0 deletions cmake/sdlchecks.cmake
Expand Up @@ -506,6 +506,7 @@ macro(CheckX11)
endmacro(CheckX11)

macro(CheckMir)
# !!! FIXME: hook up dynamic loading here.
if(VIDEO_MIR)
find_library(MIR_LIB mirclient mircommon egl)
pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
Expand All @@ -529,6 +530,7 @@ endmacro(CheckMir)
# Requires:
# - EGL
macro(CheckWayland)
# !!! FIXME: hook up dynamic loading here.
if(VIDEO_WAYLAND)
pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
if(WAYLAND_FOUND)
Expand Down
234 changes: 130 additions & 104 deletions configure
Expand Up @@ -817,10 +817,11 @@ enable_sndio
enable_sndio_shared
enable_diskaudio
enable_dummyaudio
enable_video_mir
enable_video_wayland
enable_video_wayland_qt_touch
enable_wayland_shared
enable_video_mir
enable_mir_shared
enable_video_x11
with_x
enable_x11_shared
Expand Down Expand Up @@ -1535,12 +1536,13 @@ Optional Features:
--enable-sndio-shared dynamically load sndio audio support [[default=yes]]
--enable-diskaudio support the disk writer audio driver [[default=yes]]
--enable-dummyaudio support the dummy audio driver [[default=yes]]
--enable-video-mir use Mir video driver [[default=yes]]
--enable-video-wayland use Wayland video driver [[default=yes]]
--enable-video-wayland-qt-touch
QtWayland server support for Wayland video driver
[[default=yes]]
--enable-wayland-shared dynamically load Wayland support [[default=maybe]]
--enable-video-mir use Mir video driver [[default=yes]]
--enable-mir-shared dynamically load Mir support [[default=maybe]]
--enable-video-x11 use X11 video driver [[default=yes]]
--enable-x11-shared dynamically load X11 support [[default=maybe]]
--enable-video-x11-xcursor
Expand Down Expand Up @@ -18629,105 +18631,6 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; }
fi
}

CheckMir()
{
# Check whether --enable-video-mir was given.
if test "${enable_video_mir+set}" = set; then :
enableval=$enable_video_mir;
else
enable_video_mir=yes
fi


if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



if test x$PKG_CONFIG != xno; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
$as_echo_n "checking for Mir support... " >&6; }
video_mir=no
tmp_CFLAGS="$CFLAGS"
CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <EGL/egl.h>
#include <xkbcommon/xkbcommon.h>
#include <mir_toolkit/mir_client_library.h>

int
main ()
{


;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

video_mir=yes

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$tmp_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
$as_echo "$video_mir" >&6; }

if test x$video_mir = xyes; then
$as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
have_video=yes
SUMMARY_video="${SUMMARY_video} mir"
fi
fi
fi
}

CheckWarnAll()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5
Expand Down Expand Up @@ -18888,8 +18791,8 @@ fi
fi
if test x$have_loadso != xyes && \
test x$enable_wayland_shared = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;}
enable_wayland_shared=no
fi
if test x$have_loadso = xyes && \
Expand All @@ -18901,7 +18804,7 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WA
echo "-- dynamic libwayland-client -> $wayland_client_lib"
echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
echo "-- dynamic xkbcommon -> $xkbcommon_lib"
echo "-- dynamic libxkbcommon -> $xkbcommon_lib"

cat >>confdefs.h <<_ACEOF
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
Expand Down Expand Up @@ -18933,6 +18836,129 @@ _ACEOF
fi
}

CheckMir()
{
# Check whether --enable-video-mir was given.
if test "${enable_video_mir+set}" = set; then :
enableval=$enable_video_mir;
else
enable_video_mir=yes
fi


if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
$as_echo_n "checking for Mir support... " >&6; }
video_mir=no
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
video_mir=yes
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
$as_echo "$video_mir" >&6; }

if test x$video_mir = xyes; then

$as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
# Check whether --enable-mir-shared was given.
if test "${enable_mir_shared+set}" = set; then :
enableval=$enable_mir_shared;
else
enable_mir_shared=maybe
fi


case "$host" in
*)
mirclient_lib=`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
;;
esac

if test x$enable_mir_shared = xmaybe; then
enable_mir_shared=yes
fi
if test x$have_loadso != xyes && \
test x$enable_mir_shared = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&2;}
enable_mir_shared=no
fi
if test x$have_loadso = xyes && \
test x$enable_mir_shared = xyes && \
test x$mirclient_lib != x && \
test x$xkbcommon_lib != x; then
echo "-- dynamic libmirclient -> $mirclient_lib"
echo "-- dynamic libxkbcommon -> $xkbcommon_lib"

cat >>confdefs.h <<_ACEOF
#define SDL_VIDEO_DRIVER_MIR_DYNAMIC "$mirclient_lib"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
_ACEOF

SUMMARY_video="${SUMMARY_video} mir(dynamic)"
else
enable_mir_shared=no
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
SUMMARY_video="${SUMMARY_video} mir"
fi
have_video=yes
fi
fi
}


CheckX11()
{

Expand Down

0 comments on commit 89fd0fa

Please sign in to comment.