Fix compilation with libX11 >= 1.5.99.902.
authorAzamat H. Hackimov <azamat.hackimov@gmail.com>
Sun, 02 Jun 2013 20:20:18 +0600
changeset 72666caad66a4966
parent 7265 3bb309bb6bfe
child 7267 7970a2839280
Fix compilation with libX11 >= 1.5.99.902.

These changes fixes bug #1769 for SDL2
(http://bugzilla.libsdl.org/show_bug.cgi?id=1769).
cmake/sdlchecks.cmake
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
src/video/x11/SDL_x11sym.h
     1.1 --- a/cmake/sdlchecks.cmake	Sun Jun 02 08:48:52 2013 -0700
     1.2 +++ b/cmake/sdlchecks.cmake	Sun Jun 02 20:20:18 2013 +0600
     1.3 @@ -356,6 +356,14 @@
     1.4          set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
     1.5        endif(HAVE_XGENERICEVENT)
     1.6  
     1.7 +      check_c_source_compiles("
     1.8 +          #include <X11/Xlibint.h>
     1.9 +          extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
    1.10 +          int main(int argc, char **argv) {}" HAVE_CONST_XDATA32)
    1.11 +      if(HAVE_CONST_XDATA32)
    1.12 +        set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1)
    1.13 +      endif(HAVE_CONST_XDATA32)
    1.14 +
    1.15        check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
    1.16  
    1.17        if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
     2.1 --- a/configure	Sun Jun 02 08:48:52 2013 -0700
     2.2 +++ b/configure	Sun Jun 02 20:20:18 2013 +0600
     2.3 @@ -19492,6 +19492,35 @@
     2.4              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_const_param_XextAddDisplay" >&5
     2.5  $as_echo "$have_const_param_XextAddDisplay" >&6; }
     2.6  
     2.7 +            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for const parameter to _XData32" >&5
     2.8 +$as_echo_n "checking for const parameter to _XData32... " >&6; }
     2.9 +	    have_const_param_xdata32=no
    2.10 +	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2.11 +/* end confdefs.h.  */
    2.12 +
    2.13 +	      #include <X11/Xlibint.h>
    2.14 +	      extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
    2.15 +
    2.16 +int
    2.17 +main ()
    2.18 +{
    2.19 +
    2.20 +
    2.21 +  ;
    2.22 +  return 0;
    2.23 +}
    2.24 +_ACEOF
    2.25 +if ac_fn_c_try_compile "$LINENO"; then :
    2.26 +
    2.27 +	    have_const_param_xdata32=yes
    2.28 +	    $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1" >>confdefs.h
    2.29 +
    2.30 +
    2.31 +fi
    2.32 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2.33 +	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_const_param_xdata32" >&5
    2.34 +$as_echo "$have_const_param_xdata32" >&6; }
    2.35 +
    2.36                          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5
    2.37  $as_echo_n "checking for XGenericEvent... " >&6; }
    2.38              have_XGenericEvent=no
     3.1 --- a/configure.in	Sun Jun 02 08:48:52 2013 -0700
     3.2 +++ b/configure.in	Sun Jun 02 20:20:18 2013 +0600
     3.3 @@ -1144,6 +1144,18 @@
     3.4              ])
     3.5              AC_MSG_RESULT($have_const_param_XextAddDisplay)
     3.6  
     3.7 +            AC_MSG_CHECKING(for const parameter to _XData32)
     3.8 +	    have_const_param_xdata32=no
     3.9 +	    AC_TRY_COMPILE([
    3.10 +	      #include <X11/Xlibint.h>
    3.11 +	      extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
    3.12 +	    ],[
    3.13 +	    ],[
    3.14 +	    have_const_param_xdata32=yes
    3.15 +	    AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
    3.16 +	    ])
    3.17 +	    AC_MSG_RESULT($have_const_param_xdata32)
    3.18 +
    3.19              dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
    3.20              AC_MSG_CHECKING([for XGenericEvent])
    3.21              have_XGenericEvent=no
     4.1 --- a/include/SDL_config.h.cmake	Sun Jun 02 08:48:52 2013 -0700
     4.2 +++ b/include/SDL_config.h.cmake	Sun Jun 02 20:20:18 2013 +0600
     4.3 @@ -266,6 +266,7 @@
     4.4  #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
     4.5  #cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
     4.6  #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
     4.7 +#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32@
     4.8  #cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
     4.9  #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
    4.10  
     5.1 --- a/include/SDL_config.h.in	Sun Jun 02 08:48:52 2013 -0700
     5.2 +++ b/include/SDL_config.h.in	Sun Jun 02 20:20:18 2013 +0600
     5.3 @@ -268,6 +268,7 @@
     5.4  #undef SDL_VIDEO_DRIVER_X11_XSHAPE
     5.5  #undef SDL_VIDEO_DRIVER_X11_XVIDMODE
     5.6  #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
     5.7 +#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32
     5.8  #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
     5.9  #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
    5.10  
     6.1 --- a/src/video/x11/SDL_x11sym.h	Sun Jun 02 08:48:52 2013 -0700
     6.2 +++ b/src/video/x11/SDL_x11sym.h	Sun Jun 02 20:20:18 2013 +0600
     6.3 @@ -203,7 +203,11 @@
     6.4   */
     6.5  #ifdef LONG64
     6.6  SDL_X11_MODULE(IO_32BIT)
     6.7 +#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32
     6.8 +SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
     6.9 +#else
    6.10  SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
    6.11 +#endif
    6.12  SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
    6.13  #endif
    6.14