Detect Xrandr >= 1.2 at build time
authorGabriel Jacobo <gabomdq@gmail.com>
Thu, 30 Jan 2014 20:27:13 -0300
changeset 8146bfff4df36f0b
parent 8145 663d7d9de9bf
child 8147 9802c269104f
Detect Xrandr >= 1.2 at build time
configure
configure.in
     1.1 --- a/configure	Wed Jan 29 18:38:13 2014 -0800
     1.2 +++ b/configure	Thu Jan 30 20:27:13 2014 -0300
     1.3 @@ -20077,17 +20077,33 @@
     1.4  fi
     1.5  
     1.6              if test x$enable_video_x11_xrandr = xyes; then
     1.7 -                definitely_enable_video_x11_xrandr=no
     1.8 -                ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include <X11/Xlib.h>
     1.9 -
    1.10 -"
    1.11 -if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :
    1.12 -  have_xrandr_h_hdr=yes
    1.13 -else
    1.14 -  have_xrandr_h_hdr=no
    1.15 -fi
    1.16 -
    1.17 -
    1.18 +                                definitely_enable_video_x11_xrandr=no
    1.19 +                have_xrandr_h_hdr=no
    1.20 +                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.21 +/* end confdefs.h.  */
    1.22 +
    1.23 +                #include <X11/Xlib.h>
    1.24 +                #include <X11/extensions/Xrandr.h>
    1.25 +
    1.26 +int
    1.27 +main ()
    1.28 +{
    1.29 +
    1.30 +                XRRScreenResources *res = NULL;
    1.31 +
    1.32 +  ;
    1.33 +  return 0;
    1.34 +}
    1.35 +_ACEOF
    1.36 +if ac_fn_c_try_compile "$LINENO"; then :
    1.37 +
    1.38 +                have_xrandr_h_hdr=yes
    1.39 +                $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
    1.40 +
    1.41 +                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.42 +
    1.43 +fi
    1.44 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.45                  if test x$have_xrandr_h_hdr = xyes; then
    1.46                      if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
    1.47                          echo "-- dynamic libXrandr -> $xrandr_lib"
     2.1 --- a/configure.in	Wed Jan 29 18:38:13 2014 -0800
     2.2 +++ b/configure.in	Thu Jan 30 20:27:13 2014 -0300
     2.3 @@ -1508,12 +1508,19 @@
     2.4  AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
     2.5                              , enable_video_x11_xrandr=yes)
     2.6              if test x$enable_video_x11_xrandr = xyes; then
     2.7 +                dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
     2.8                  definitely_enable_video_x11_xrandr=no
     2.9 -                AC_CHECK_HEADER(X11/extensions/Xrandr.h,
    2.10 -                                have_xrandr_h_hdr=yes,
    2.11 -                                have_xrandr_h_hdr=no,
    2.12 -                                [#include <X11/Xlib.h>
    2.13 -                                ])
    2.14 +                have_xrandr_h_hdr=no
    2.15 +                AC_TRY_COMPILE([
    2.16 +                #include <X11/Xlib.h>
    2.17 +                #include <X11/extensions/Xrandr.h>
    2.18 +                ],[
    2.19 +                XRRScreenResources *res = NULL;
    2.20 +                ],[
    2.21 +                have_xrandr_h_hdr=yes
    2.22 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
    2.23 +                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    2.24 +                ])
    2.25                  if test x$have_xrandr_h_hdr = xyes; then
    2.26                      if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
    2.27                          echo "-- dynamic libXrandr -> $xrandr_lib"