Index: /trunk/configure
===================================================================
--- /trunk/configure	(revision 27448)
+++ /trunk/configure	(revision 27449)
@@ -119,4 +119,5 @@
 LIBXCURSOR="-lXcursor"
 LIBXMU="-lXmu"
+LIBXINERAMA="-lXinerama"
 MESA="-lGL"
 INCZ=""
@@ -1224,4 +1225,5 @@
                            0, 16, InputOutput, CopyFromParent, 0, NULL);
   XDestroyWindow(dpy, win);
+  XCloseDisplay(dpy);
 }
 EOF
@@ -1256,4 +1258,33 @@
   fi
 }
+
+
+#
+# Check for the Xinerama library, needed by the Qt GUI
+#
+check_xinerama()
+{
+  test_header Xinerama
+  cat > $ODIR.tmp_src.cc << EOF
+#include <X11/Xlib.h>
+#include <X11/extensions/Xinerama.h>
+extern "C" int main(void)
+{
+  Display *dpy;
+  Bool flag;
+  dpy = XOpenDisplay(NULL);
+  if (dpy)
+  {
+    flag = XineramaIsActive(dpy);
+    XCloseDisplay(dpy);
+  }
+}
+EOF
+  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
+  if test_compile "$LIBX11 $LIBXINERAMA $I_INCX11" Xinerama Xinerama; then
+    log_success "found"
+  fi
+}
+
 
 #
@@ -1300,4 +1331,5 @@
                     24, XA_RGB_DEFAULT_MAP, False, True);
     printf("Status = %x\n", status);
+    XCloseDisplay(dpy);
   }
   return 0;
@@ -1335,4 +1367,5 @@
       return 0;
     }
+    XCloseDisplay(dpy);
   }
   printf("found (inactive), OK.\n");
@@ -2356,4 +2389,5 @@
 # TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
 [ $WITH_X11    -eq 1 ] && check_xcursor
+[ $WITH_X11    -eq 1 ] && check_xinerama
 [ $WITH_OPENGL -eq 1 ] && check_opengl
 [ $WITH_QT4    -eq 1 ] && check_qt4
