autotools, cmake: tighten Xfixes check && explicitly test BarrierEventID Apparently the older versions of libXi doesn't have it. Fixes the build break issue reported at: https://github.com/libsdl-org/SDL/commit/4b42c05ba1eaaaa9a4ef803acea8f13402271039#commitcomment-61427659
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 32be19c..6d20d46 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -418,7 +418,7 @@ macro(CheckX11)
check_include_file(X11/extensions/Xinerama.h HAVE_XINERAMA_H)
check_include_file(X11/extensions/XInput2.h HAVE_XINPUT2_H)
check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H)
- check_include_file(X11/extensions/Xfixes.h HAVE_XFIXES_H)
+ check_include_file(X11/extensions/Xfixes.h HAVE_XFIXES_H_)
check_include_file(X11/extensions/Xrender.h HAVE_XRENDER_H)
check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H)
check_include_file(X11/extensions/shape.h HAVE_XSHAPE_H)
@@ -538,6 +538,15 @@ macro(CheckX11)
endif()
# check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer
+ if(SDL_X11_XFIXES AND HAVE_XFIXES_H_ AND HAVE_XINPUT2_H)
+ check_c_source_compiles("
+ #include <X11/Xlib.h>
+ #include <X11/Xproto.h>
+ #include <X11/extensions/XInput2.h>
+ #include <X11/extensions/Xfixes.h>
+ BarrierEventID b;
+ int main(void) { }" HAVE_XFIXES_H)
+ endif()
if(SDL_X11_XFIXES AND HAVE_XFIXES_H AND HAVE_XINPUT2_H)
if(HAVE_X11_SHARED AND XFIXES_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES "\"${XFIXES_LIB_SONAME}\"")
diff --git a/configure b/configure
index 7069aef..b059a49 100755
--- a/configure
+++ b/configure
@@ -22123,17 +22123,31 @@ fi
if test x$enable_video_x11_xfixes = xyes; then
definitely_enable_video_x11_xfixes=no
# check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer
- ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xfixes.h" "ac_cv_header_X11_extensions_Xfixes_h" "#include <X11/Xlib.h>
- #include <X11/Xproto.h>
- #include <X11/extensions/XInput2.h>
-"
-if test "x$ac_cv_header_X11_extensions_Xfixes_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11/extensions/Xfixes.h" >&5
+$as_echo_n "checking for X11/extensions/Xfixes.h... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <X11/Xlib.h>
+ #include <X11/Xproto.h>
+ #include <X11/extensions/XInput2.h>
+ #include <X11/extensions/Xfixes.h>
+int
+main ()
+{
+BarrierEventID b;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
have_xfixes_h_hdr=yes
else
have_xfixes_h_hdr=no
fi
-
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xfixes_h_hdr" >&5
+$as_echo "$have_xfixes_h_hdr" >&6; }
if test x$have_xfixes_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xfixes_lib != x ; then
echo "-- dynamic libXfixes -> $xfixes_lib"
diff --git a/configure.ac b/configure.ac
index 551a5de..623d5f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1973,12 +1973,16 @@ XITouchClassInfo *t;
if test x$enable_video_x11_xfixes = xyes; then
definitely_enable_video_x11_xfixes=no
# check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer
- AC_CHECK_HEADER(X11/extensions/Xfixes.h,
- have_xfixes_h_hdr=yes,
- have_xfixes_h_hdr=no,
- [#include <X11/Xlib.h>
- #include <X11/Xproto.h>
- #include <X11/extensions/XInput2.h>])
+ AC_MSG_CHECKING(for X11/extensions/Xfixes.h)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <X11/Xlib.h>
+ #include <X11/Xproto.h>
+ #include <X11/extensions/XInput2.h>
+ #include <X11/extensions/Xfixes.h>]],
+ [BarrierEventID b;])],
+ [have_xfixes_h_hdr=yes],
+ [have_xfixes_h_hdr=no])
+ AC_MSG_RESULT($have_xfixes_h_hdr)
if test x$have_xfixes_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xfixes_lib != x ; then
echo "-- dynamic libXfixes -> $xfixes_lib"
diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h
index 673b7f1..7951511 100644
--- a/src/video/x11/SDL_x11sym.h
+++ b/src/video/x11/SDL_x11sym.h
@@ -163,7 +163,7 @@ SDL_X11_SYM(Status,XmbTextListToTextProperty,(Display* a,char** b,int c,XICCEnco
SDL_X11_MODULE(XFIXES)
SDL_X11_SYM(PointerBarrier, XFixesCreatePointerBarrier, (Display* a, Window b, int c, int d, int e, int f, int g, int h, int *i),(a,b,c,d,e,f,g,h,i),return)
SDL_X11_SYM(void, XFixesDestroyPointerBarrier, (Display* a, PointerBarrier b), (a,b),)
-SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, BarrierEventID d), (a,b,c,d), return)
+SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, BarrierEventID d), (a,b,c,d), return) /* this is actually Xinput2 */
SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), return)
#endif