diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-18 07:31:25 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-18 07:38:59 +0100 |
commit | 4ae346e7647fd2c01324f1a6d3b37674e858486d (patch) | |
tree | 5ae6c7d16ada8c9f08f8f2b24a04389fa95662d0 | |
parent | fac6845820e49dbbea2a625b7bb745d8f9159b56 (diff) |
configure: Double check xinerama's headers
Having the pkgconfig present doesn't always necessarily imply the
headers are installed correctly - just fail over gracefully for xinerama
and intel-virtual-output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | tools/virtual.c | 22 |
2 files changed, 35 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index eec9f896..953f09ce 100644 --- a/configure.ac +++ b/configure.ac @@ -262,13 +262,20 @@ if test "x$shm" != "xyes"; then tools="no" fi if test "x$tools" != "xno"; then - ivo_requires="xinerama xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1" + ivo_requires="xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1" + extra_cflags="" + + ignore="xinerama" + PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], + [AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [ivo_requires="$ignore $ivo_requires"], [], + [#include <X11/Xlibint.h> + #include <X11/Xproto.h> + ])], [ignore=""]) + + ignore="xcb-dri3 xcb-sync x11-xcb xshmfence x11" + PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], [ivo_requires="$ivo_requires $ignore"; extra_cflags="-DDRI3"], [ignore=""]) + PKG_CHECK_MODULES(IVO, [$ivo_requires], [ivo="yes"], [ivo="no"]) - PKG_CHECK_MODULES(IVO_DRI3, [xcb-dri3 xcb-sync x11-xcb xshmfence x11], [ivo_dri3="yes"], [ivo_dri3="no"]) - if test "x$ivo_dri3" = "xyes"; then - IVO_CFLAGS="$IVO_CFLAGS $IVO_DRI3_CFLAGS -DDRI3" - IVO_LIBS="$IVO_LIBS $IVO_DRI3_LIBS" - fi AC_CHECK_HEADER([sys/timerfd.h], [], [ivo="no"]) if test "x$ivo" = "xno"; then if test "x$tools" = "xyes"; then @@ -276,6 +283,8 @@ if test "x$tools" != "xno"; then fi tools="no" fi + + IVO_CFLAGS="$IVO_CFLAGS $extra_cflags" fi if test "x$tools" != "xno"; then tools_msg="$tools_msg intel-virtual-output" diff --git a/tools/virtual.c b/tools/virtual.c index 9ed1d03c..83b934aa 100644 --- a/tools/virtual.c +++ b/tools/virtual.c @@ -40,7 +40,10 @@ #error Failed to find the right header for X11 MIT-SHM protocol definitions #endif #include <X11/extensions/Xdamage.h> +#if HAVE_X11_EXTENSIONS_XINERAMA_H #include <X11/extensions/Xinerama.h> +#define USE_XINERAMA +#endif #include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrender.h> #include <X11/Xcursor/Xcursor.h> @@ -2263,6 +2266,18 @@ static int clone_init_depth(struct clone *clone) return 0; } +#if defined(USE_XINERAMA) +static int xinerama_active(struct display *display) +{ + int active = 0; + if (XineramaQueryExtension(display->dpy, &display->xinerama_event, &display->xinerama_error)) + active = XineramaIsActive(display->dpy); + return active; +} +#else +#define xinerama_active(d) 0 +#endif + static int add_display(struct context *ctx, Display *dpy) { struct display *display; @@ -2315,8 +2330,7 @@ static int add_display(struct context *ctx, Display *dpy) display->rr_event, display->rr_error)); - if (XineramaQueryExtension(dpy, &display->xinerama_event, &display->xinerama_error)) - display->xinerama_active = XineramaIsActive(dpy); + display->xinerama_active = xinerama_active(display); DBG(X11, ("%s: xinerama_active?=%d, event=%d, error=%d\n", DisplayString(dpy), display->xinerama_active, @@ -2598,6 +2612,7 @@ static int last_display_add_clones__randr(struct context *ctx) return 0; } +#if defined(USE_XINERAMA) static int last_display_add_clones__xinerama(struct context *ctx) { struct display *display = last_display(ctx); @@ -2672,6 +2687,9 @@ static int last_display_add_clones__xinerama(struct context *ctx) reverse_clone_list(display); return 0; } +#else +#define last_display_add_clones__xinerama(ctx) -1 +#endif static int last_display_add_clones__display(struct context *ctx) { |