SDL: x11: Don't include X11/extensions/extutil.h

From 478f9eed288a9063ac55508401844835244da6b2 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 20 Sep 2021 10:20:04 -0400
Subject: [PATCH] x11: Don't include X11/extensions/extutil.h

We don't use it, it was a leftover from 1.2, I think, and it doesn't exist
on Solaris, so this should hopefully fix the build there.

This also means we don't need the configure/cmake checks for
SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY, so that was removed also.

Fixes #1666.
---
 cmake/sdlchecks.cmake       | 10 ----------
 configure                   | 32 --------------------------------
 configure.ac                | 14 --------------
 include/SDL_config.h.cmake  |  1 -
 include/SDL_config.h.in     |  1 -
 include/SDL_config_macosx.h |  1 -
 src/video/x11/SDL_x11dyn.h  |  1 -
 src/video/x11/SDL_x11sym.h  |  9 ---------
 8 files changed, 69 deletions(-)

diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 36e8b38682..3401769f45 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -462,16 +462,6 @@ macro(CheckX11)
       endif()
 
       set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB})
-      check_c_source_compiles("
-          #include <X11/Xlib.h>
-          #include <X11/Xproto.h>
-          #include <X11/extensions/Xext.h>
-          #include <X11/extensions/extutil.h>
-          extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
-          int main(int argc, char **argv) {}" HAVE_CONST_XEXT_ADDDISPLAY)
-      if(HAVE_CONST_XEXT_ADDDISPLAY)
-        set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1)
-      endif()
 
       check_c_source_compiles("
           #include <X11/Xlib.h>
diff --git a/configure b/configure
index 0ec7123829..7bbcbd5f97 100755
--- a/configure
+++ b/configure
@@ -21087,38 +21087,6 @@ _ACEOF
             fi
             have_video=yes
 
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for const parameter to XextAddDisplay" >&5
-$as_echo_n "checking for const parameter to XextAddDisplay... " >&6; }
-            have_const_param_XextAddDisplay=no
-            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-              #include <X11/Xlib.h>
-              #include <X11/Xproto.h>
-              #include <X11/extensions/Xext.h>
-              #include <X11/extensions/extutil.h>
-              extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-            have_const_param_XextAddDisplay=yes
-
-$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_const_param_XextAddDisplay" >&5
-$as_echo "$have_const_param_XextAddDisplay" >&6; }
-
                         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5
 $as_echo_n "checking for XGenericEvent... " >&6; }
             have_XGenericEvent=no
diff --git a/configure.ac b/configure.ac
index 3d9b0e9e14..5a00b1462f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1824,20 +1824,6 @@ CheckX11()
             fi
             have_video=yes
 
-            AC_MSG_CHECKING(for const parameter to XextAddDisplay)
-            have_const_param_XextAddDisplay=no
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-              #include <X11/Xlib.h>
-              #include <X11/Xproto.h>
-              #include <X11/extensions/Xext.h>
-              #include <X11/extensions/extutil.h>
-              extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
-            ]],[])], [
-            have_const_param_XextAddDisplay=yes
-            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
-            ],[])
-            AC_MSG_RESULT($have_const_param_XextAddDisplay)
-
             dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
             AC_MSG_CHECKING([for XGenericEvent])
             have_XGenericEvent=no
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index f4bcd2be0a..273555d8a8 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -422,7 +422,6 @@
 #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
 #cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
 #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
-#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
 #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
 #cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@
 
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 2459985379..09fb4e6fce 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -395,7 +395,6 @@
 #undef SDL_VIDEO_DRIVER_X11_XSHAPE
 #undef SDL_VIDEO_DRIVER_X11_XVIDMODE
 #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
-#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
 #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
 #undef SDL_VIDEO_DRIVER_NACL
 #undef SDL_VIDEO_DRIVER_VIVANTE
diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
index 99441e049d..40c72063b9 100644
--- a/include/SDL_config_macosx.h
+++ b/include/SDL_config_macosx.h
@@ -202,7 +202,6 @@
  */
 #define SDL_VIDEO_DRIVER_X11_XINPUT2 1
 #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
-#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
 #endif
 
 #ifndef SDL_VIDEO_RENDER_OGL
diff --git a/src/video/x11/SDL_x11dyn.h b/src/video/x11/SDL_x11dyn.h
index 3427a22ce1..7faa19526c 100644
--- a/src/video/x11/SDL_x11dyn.h
+++ b/src/video/x11/SDL_x11dyn.h
@@ -39,7 +39,6 @@
 
 #include <X11/Xproto.h>
 #include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
 
 #ifndef NO_SHARED_MEMORY
 #include <sys/ipc.h>
diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h
index 9a46802cd6..c4cb03fefd 100644
--- a/src/video/x11/SDL_x11sym.h
+++ b/src/video/x11/SDL_x11sym.h
@@ -140,15 +140,6 @@ SDL_X11_SYM(int,XWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),re
 SDL_X11_SYM(Status,XWithdrawWindow,(Display* a,Window b,int c),(a,b,c),return)
 SDL_X11_SYM(VisualID,XVisualIDFromVisual,(Visual* a),(a),return)
 SDL_X11_SYM(char*,XGetDefault,(Display* a,char* b, char* c),(a,b,c),return)
-#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
-SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
-#else
-SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
-#endif
-SDL_X11_SYM(XExtensionInfo*,XextCreateExtension,(void),(),return)
-SDL_X11_SYM(void,XextDestroyExtension,(XExtensionInfo* a),(a),)
-SDL_X11_SYM(XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
-SDL_X11_SYM(int,XextRemoveDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
 SDL_X11_SYM(Bool,XQueryExtension,(Display* a,_Xconst char* b,int* c,int* d,int* e),(a,b,c,d,e),return)
 SDL_X11_SYM(char *,XDisplayString,(Display* a),(a),return)
 SDL_X11_SYM(int,XGetErrorText,(Display* a,int b,char* c,int d),(a,b,c,d),return)