PATCH: check for Xrandr extension

Alex Pasadyn ajp at mail.utexas.edu
Fri Oct 10 13:15:36 CDT 2003


Hi,
I've been tinkering around with using the Xrandr extension as an 
alternative to XVidMode.  It seems "better" in all ways.  This just adds 
the configure check for the library.  Note that this looks for a 
function that is only present with the version included with XFree86 4.3 
and newer.  This is because the Xrandr headers and library broke 
compatibility with the earlier versions, though the docs claim it will 
be compatible from now on...

-ajp

ChangeLog:
- Check for Xrandr extension
-------------- next part --------------
Index: configure
===================================================================
RCS file: /home/wine/wine/configure,v
retrieving revision 1.464
diff -u -r1.464 configure
--- configure	9 Oct 2003 04:33:20 -0000	1.464
+++ configure	10 Oct 2003 17:16:44 -0000
@@ -7550,6 +7551,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 -lXrender $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 -lXrender"
+
+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`
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.186
diff -u -r1.186 configure.ac
--- configure.ac	9 Oct 2003 04:33:20 -0000	1.186
+++ configure.ac	10 Oct 2003 17:16:45 -0000
@@ -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 -lXrender"
+                  ],,
+                  $X_LIBS -lXext -lX11 -lXrender $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...
Index: include/config.h.in
===================================================================
RCS file: /home/wine/wine/include/config.h.in,v
retrieving revision 1.164
diff -u -r1.164 config.h.in
--- include/config.h.in	7 Oct 2003 22:49:22 -0000	1.164
+++ include/config.h.in	10 Oct 2003 17:16:46 -0000
@@ -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
 
@@ -688,6 +691,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


More information about the wine-patches mailing list