Detect Xrandr >= 1.2 at build time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
diff --git a/configure b/configure
index 07bc156..f9b61e1 100755
--- a/configure
+++ b/configure
@@ -20077,17 +20077,33 @@ else
fi
if test x$enable_video_x11_xrandr = xyes; then
- definitely_enable_video_x11_xrandr=no
- ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include <X11/Xlib.h>
+ definitely_enable_video_x11_xrandr=no
+ have_xrandr_h_hdr=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-"
-if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :
- have_xrandr_h_hdr=yes
-else
- have_xrandr_h_hdr=no
-fi
+ #include <X11/Xlib.h>
+ #include <X11/extensions/Xrandr.h>
+
+int
+main ()
+{
+
+ XRRScreenResources *res = NULL;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ have_xrandr_h_hdr=yes
+ $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
+
+ SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$have_xrandr_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
echo "-- dynamic libXrandr -> $xrandr_lib"
diff --git a/configure.in b/configure.in
index a38abd4..9eb0805 100644
--- a/configure.in
+++ b/configure.in
@@ -1508,12 +1508,19 @@ XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
, enable_video_x11_xrandr=yes)
if test x$enable_video_x11_xrandr = xyes; then
+ dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
definitely_enable_video_x11_xrandr=no
- AC_CHECK_HEADER(X11/extensions/Xrandr.h,
- have_xrandr_h_hdr=yes,
- have_xrandr_h_hdr=no,
- [#include <X11/Xlib.h>
- ])
+ have_xrandr_h_hdr=no
+ AC_TRY_COMPILE([
+ #include <X11/Xlib.h>
+ #include <X11/extensions/Xrandr.h>
+ ],[
+ XRRScreenResources *res = NULL;
+ ],[
+ have_xrandr_h_hdr=yes
+ AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
+ SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
+ ])
if test x$have_xrandr_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
echo "-- dynamic libXrandr -> $xrandr_lib"