Check for Xrandr extension.

diff --git a/configure b/configure
index 13198bc..0e68d5a 100755
--- a/configure
+++ b/configure
@@ -7550,6 +7550,127 @@
 
 
 
+for ac_header in X11/extensions/Xrandr.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+                  echo "$as_me:$LINENO: checking for XRRSetScreenConfigAndRate in -lXrandr" >&5
+echo $ECHO_N "checking for XRRSetScreenConfigAndRate in -lXrandr... $ECHO_C" >&6
+if test "${ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrandr $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
+                 $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XRRSetScreenConfigAndRate ();
+int
+main ()
+{
+XRRSetScreenConfigAndRate ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate" >&5
+echo "${ECHO_T}$ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate" >&6
+if test $ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBXRANDR 1
+_ACEOF
+
+                     X_PRE_LIBS="$X_PRE_LIBS -lXrandr"
+
+fi
+
+
+else
+  { echo "$as_me:$LINENO: WARNING: Xrandr extension not found, Wine will be built without it" >&5
+echo "$as_me: WARNING: Xrandr extension not found, Wine will be built without it" >&2;}
+fi
+
+done
+
+
+
 for ac_header in X11/extensions/Xvlib.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/configure.ac b/configure.ac
index 850eb78..c879249 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,19 @@
             AC_MSG_WARN([[XFree86 VMODE extension not found, Wine will be built without it]]),
             [#include <X11/Xlib.h>])
 
+        dnl *** Check for X RandR extension
+        AC_CHECK_HEADERS(X11/extensions/Xrandr.h,
+            [ dnl *** If X11/extensions/Xrandr.h exists...
+                AC_CHECK_LIB(Xrandr, XRRSetScreenConfigAndRate,
+                  [ AC_DEFINE(HAVE_LIBXRANDR, 1, [Define if you have the Xrandr library])
+                     X_PRE_LIBS="$X_PRE_LIBS -lXrandr"
+                  ],,
+                  $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
+                )
+            ],
+            AC_MSG_WARN([[Xrandr extension not found, Wine will be built without it]]),
+            [#include <X11/Xlib.h>])
+
         dnl *** Check for XVideo extension supporting XvImages
         AC_CHECK_HEADERS(X11/extensions/Xvlib.h,
             [ dnl *** If X11/extensions/Xvlib.h exists...
diff --git a/include/config.h.in b/include/config.h.in
index 62f75c1..b5322e8 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -251,6 +251,9 @@
 /* Define to 1 if you have the `xpg4' library (-lxpg4). */
 #undef HAVE_LIBXPG4
 
+/* Define if you have the Xrandr library */
+#undef HAVE_LIBXRANDR
+
 /* Define if you have the X Shape extension */
 #undef HAVE_LIBXSHAPE
 
@@ -695,6 +698,9 @@
 /* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */
 #undef HAVE_X11_EXTENSIONS_XF86VMODE_H
 
+/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */
+#undef HAVE_X11_EXTENSIONS_XRANDR_H
+
 /* Define to 1 if you have the <X11/extensions/Xrender.h> header file. */
 #undef HAVE_X11_EXTENSIONS_XRENDER_H