Fixed compile error with both new and old Xext headers (bug 1498)
authorSam Lantinga <slouken@libsdl.org>
Wed, 30 May 2012 11:44:57 -0400
changeset 6313d86efd889847
parent 6312 b3ae153ff088
child 6314 7905438c9c3a
Fixed compile error with both new and old Xext headers (bug 1498)
configure
configure.in
include/SDL_config.h.in
src/video/x11/SDL_x11sym.h
     1.1 --- a/configure	Wed May 30 11:43:33 2012 -0400
     1.2 +++ b/configure	Wed May 30 11:44:57 2012 -0400
     1.3 @@ -22166,6 +22166,140 @@
     1.4              fi
     1.5              have_video=yes
     1.6  
     1.7 +            { echo "$as_me:$LINENO: checking for const parameter to XextAddDisplay" >&5
     1.8 +echo $ECHO_N "checking for const parameter to XextAddDisplay... $ECHO_C" >&6; }
     1.9 +            have_const_param_XextAddDisplay=no
    1.10 +            cat >conftest.$ac_ext <<_ACEOF
    1.11 +/* confdefs.h.  */
    1.12 +_ACEOF
    1.13 +cat confdefs.h >>conftest.$ac_ext
    1.14 +cat >>conftest.$ac_ext <<_ACEOF
    1.15 +/* end confdefs.h.  */
    1.16 +
    1.17 +              #include <X11/Xlib.h>
    1.18 +              #include <X11/Xproto.h>
    1.19 +              #include <X11/extensions/Xext.h>
    1.20 +              #include <X11/extensions/extutil.h>
    1.21 +
    1.22 +int
    1.23 +main ()
    1.24 +{
    1.25 +
    1.26 +XExtDisplayInfo*
    1.27 +XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f)
    1.28 +{
    1.29 +    return (XExtDisplayInfo*)0;
    1.30 +}
    1.31 +
    1.32 +  ;
    1.33 +  return 0;
    1.34 +}
    1.35 +_ACEOF
    1.36 +rm -f conftest.$ac_objext
    1.37 +if { (ac_try="$ac_compile"
    1.38 +case "(($ac_try" in
    1.39 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    1.40 +  *) ac_try_echo=$ac_try;;
    1.41 +esac
    1.42 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
    1.43 +  (eval "$ac_compile") 2>conftest.er1
    1.44 +  ac_status=$?
    1.45 +  grep -v '^ *+' conftest.er1 >conftest.err
    1.46 +  rm -f conftest.er1
    1.47 +  cat conftest.err >&5
    1.48 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
    1.49 +  (exit $ac_status); } && {
    1.50 +	 test -z "$ac_c_werror_flag" ||
    1.51 +	 test ! -s conftest.err
    1.52 +       } && test -s conftest.$ac_objext; then
    1.53 +
    1.54 +            have_const_param_XextAddDisplay=yes
    1.55 +            cat >>confdefs.h <<\_ACEOF
    1.56 +#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
    1.57 +_ACEOF
    1.58 +
    1.59 +
    1.60 +else
    1.61 +  echo "$as_me: failed program was:" >&5
    1.62 +sed 's/^/| /' conftest.$ac_ext >&5
    1.63 +
    1.64 +
    1.65 +fi
    1.66 +
    1.67 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.68 +            { echo "$as_me:$LINENO: result: $have_const_param_XextAddDisplay" >&5
    1.69 +echo "${ECHO_T}$have_const_param_XextAddDisplay" >&6; }
    1.70 +
    1.71 +            { echo "$as_me:$LINENO: checking for XGetEventData in -lX11" >&5
    1.72 +echo $ECHO_N "checking for XGetEventData in -lX11... $ECHO_C" >&6; }
    1.73 +if test "${ac_cv_lib_X11_XGetEventData+set}" = set; then
    1.74 +  echo $ECHO_N "(cached) $ECHO_C" >&6
    1.75 +else
    1.76 +  ac_check_lib_save_LIBS=$LIBS
    1.77 +LIBS="-lX11  $LIBS"
    1.78 +cat >conftest.$ac_ext <<_ACEOF
    1.79 +/* confdefs.h.  */
    1.80 +_ACEOF
    1.81 +cat confdefs.h >>conftest.$ac_ext
    1.82 +cat >>conftest.$ac_ext <<_ACEOF
    1.83 +/* end confdefs.h.  */
    1.84 +
    1.85 +/* Override any GCC internal prototype to avoid an error.
    1.86 +   Use char because int might match the return type of a GCC
    1.87 +   builtin and then its argument prototype would still apply.  */
    1.88 +#ifdef __cplusplus
    1.89 +extern "C"
    1.90 +#endif
    1.91 +char XGetEventData ();
    1.92 +int
    1.93 +main ()
    1.94 +{
    1.95 +return XGetEventData ();
    1.96 +  ;
    1.97 +  return 0;
    1.98 +}
    1.99 +_ACEOF
   1.100 +rm -f conftest.$ac_objext conftest$ac_exeext
   1.101 +if { (ac_try="$ac_link"
   1.102 +case "(($ac_try" in
   1.103 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.104 +  *) ac_try_echo=$ac_try;;
   1.105 +esac
   1.106 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.107 +  (eval "$ac_link") 2>conftest.er1
   1.108 +  ac_status=$?
   1.109 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.110 +  rm -f conftest.er1
   1.111 +  cat conftest.err >&5
   1.112 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.113 +  (exit $ac_status); } && {
   1.114 +	 test -z "$ac_c_werror_flag" ||
   1.115 +	 test ! -s conftest.err
   1.116 +       } && test -s conftest$ac_exeext &&
   1.117 +       $as_test_x conftest$ac_exeext; then
   1.118 +  ac_cv_lib_X11_XGetEventData=yes
   1.119 +else
   1.120 +  echo "$as_me: failed program was:" >&5
   1.121 +sed 's/^/| /' conftest.$ac_ext >&5
   1.122 +
   1.123 +	ac_cv_lib_X11_XGetEventData=no
   1.124 +fi
   1.125 +
   1.126 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
   1.127 +      conftest$ac_exeext conftest.$ac_ext
   1.128 +LIBS=$ac_check_lib_save_LIBS
   1.129 +fi
   1.130 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XGetEventData" >&5
   1.131 +echo "${ECHO_T}$ac_cv_lib_X11_XGetEventData" >&6; }
   1.132 +if test $ac_cv_lib_X11_XGetEventData = yes; then
   1.133 +
   1.134 +cat >>confdefs.h <<\_ACEOF
   1.135 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
   1.136 +_ACEOF
   1.137 +
   1.138 +fi
   1.139 +
   1.140 +
   1.141              # Check whether --enable-video-x11-xcursor was given.
   1.142  if test "${enable_video_x11_xcursor+set}" = set; then
   1.143    enableval=$enable_video_x11_xcursor;
   1.144 @@ -22475,9 +22609,9 @@
   1.145  
   1.146              if test x$enable_video_x11_xinput = xyes; then
   1.147                  definitely_enable_video_x11_xinput=no
   1.148 -                { echo "$as_me:$LINENO: checking for X11/extensions/XInput.h" >&5
   1.149 -echo $ECHO_N "checking for X11/extensions/XInput.h... $ECHO_C" >&6; }
   1.150 -if test "${ac_cv_header_X11_extensions_XInput_h+set}" = set; then
   1.151 +                { echo "$as_me:$LINENO: checking for X11/extensions/XInput2.h" >&5
   1.152 +echo $ECHO_N "checking for X11/extensions/XInput2.h... $ECHO_C" >&6; }
   1.153 +if test "${ac_cv_header_X11_extensions_XInput2_h+set}" = set; then
   1.154    echo $ECHO_N "(cached) $ECHO_C" >&6
   1.155  else
   1.156    cat >conftest.$ac_ext <<_ACEOF
   1.157 @@ -22489,38 +22623,38 @@
   1.158  #include <X11/Xlib.h>
   1.159  
   1.160  
   1.161 -#include <X11/extensions/XInput.h>
   1.162 -_ACEOF
   1.163 -rm -f conftest.$ac_objext
   1.164 -if { (ac_try="$ac_compile"
   1.165 -case "(($ac_try" in
   1.166 -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.167 -  *) ac_try_echo=$ac_try;;
   1.168 -esac
   1.169 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.170 -  (eval "$ac_compile") 2>conftest.er1
   1.171 -  ac_status=$?
   1.172 -  grep -v '^ *+' conftest.er1 >conftest.err
   1.173 -  rm -f conftest.er1
   1.174 -  cat conftest.err >&5
   1.175 -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.176 -  (exit $ac_status); } && {
   1.177 -	 test -z "$ac_c_werror_flag" ||
   1.178 -	 test ! -s conftest.err
   1.179 -       } && test -s conftest.$ac_objext; then
   1.180 -  ac_cv_header_X11_extensions_XInput_h=yes
   1.181 -else
   1.182 -  echo "$as_me: failed program was:" >&5
   1.183 -sed 's/^/| /' conftest.$ac_ext >&5
   1.184 -
   1.185 -	ac_cv_header_X11_extensions_XInput_h=no
   1.186 -fi
   1.187 -
   1.188 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.189 -fi
   1.190 -{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_XInput_h" >&5
   1.191 -echo "${ECHO_T}$ac_cv_header_X11_extensions_XInput_h" >&6; }
   1.192 -if test $ac_cv_header_X11_extensions_XInput_h = yes; then
   1.193 +#include <X11/extensions/XInput2.h>
   1.194 +_ACEOF
   1.195 +rm -f conftest.$ac_objext
   1.196 +if { (ac_try="$ac_compile"
   1.197 +case "(($ac_try" in
   1.198 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.199 +  *) ac_try_echo=$ac_try;;
   1.200 +esac
   1.201 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.202 +  (eval "$ac_compile") 2>conftest.er1
   1.203 +  ac_status=$?
   1.204 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.205 +  rm -f conftest.er1
   1.206 +  cat conftest.err >&5
   1.207 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.208 +  (exit $ac_status); } && {
   1.209 +	 test -z "$ac_c_werror_flag" ||
   1.210 +	 test ! -s conftest.err
   1.211 +       } && test -s conftest.$ac_objext; then
   1.212 +  ac_cv_header_X11_extensions_XInput2_h=yes
   1.213 +else
   1.214 +  echo "$as_me: failed program was:" >&5
   1.215 +sed 's/^/| /' conftest.$ac_ext >&5
   1.216 +
   1.217 +	ac_cv_header_X11_extensions_XInput2_h=no
   1.218 +fi
   1.219 +
   1.220 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.221 +fi
   1.222 +{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_XInput2_h" >&5
   1.223 +echo "${ECHO_T}$ac_cv_header_X11_extensions_XInput2_h" >&6; }
   1.224 +if test $ac_cv_header_X11_extensions_XInput2_h = yes; then
   1.225    have_xinput_h_hdr=yes
   1.226  else
   1.227    have_xinput_h_hdr=no
   1.228 @@ -22532,7 +22666,7 @@
   1.229                          echo "-- dynamic libXi -> $xinput_lib"
   1.230  
   1.231  cat >>confdefs.h <<_ACEOF
   1.232 -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT "$xinput_lib"
   1.233 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "$xinput_lib"
   1.234  _ACEOF
   1.235  
   1.236                          definitely_enable_video_x11_xinput=yes
   1.237 @@ -22612,7 +22746,7 @@
   1.238              if test x$definitely_enable_video_x11_xinput = xyes; then
   1.239  
   1.240  cat >>confdefs.h <<\_ACEOF
   1.241 -#define SDL_VIDEO_DRIVER_X11_XINPUT 1
   1.242 +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
   1.243  _ACEOF
   1.244  
   1.245              fi
     2.1 --- a/configure.in	Wed May 30 11:43:33 2012 -0400
     2.2 +++ b/configure.in	Wed May 30 11:44:57 2012 -0400
     2.3 @@ -1091,6 +1091,25 @@
     2.4              fi
     2.5              have_video=yes
     2.6  
     2.7 +            AC_MSG_CHECKING(for const parameter to XextAddDisplay)
     2.8 +            have_const_param_XextAddDisplay=no
     2.9 +            AC_TRY_COMPILE([
    2.10 +              #include <X11/Xlib.h>
    2.11 +              #include <X11/Xproto.h>
    2.12 +              #include <X11/extensions/Xext.h>
    2.13 +              #include <X11/extensions/extutil.h>
    2.14 +            ],[
    2.15 +XExtDisplayInfo*
    2.16 +XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f)
    2.17 +{
    2.18 +    return (XExtDisplayInfo*)0;
    2.19 +}
    2.20 +            ],[
    2.21 +            have_const_param_XextAddDisplay=yes
    2.22 +            AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
    2.23 +            ])
    2.24 +            AC_MSG_RESULT($have_const_param_XextAddDisplay)
    2.25 +
    2.26              AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
    2.27  
    2.28              AC_ARG_ENABLE(video-x11-xcursor,
     3.1 --- a/include/SDL_config.h.in	Wed May 30 11:43:33 2012 -0400
     3.2 +++ b/include/SDL_config.h.in	Wed May 30 11:44:57 2012 -0400
     3.3 @@ -269,6 +269,7 @@
     3.4  #undef SDL_VIDEO_DRIVER_X11_XSHAPE
     3.5  #undef SDL_VIDEO_DRIVER_X11_XVIDMODE
     3.6  #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
     3.7 +#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
     3.8  
     3.9  #undef SDL_VIDEO_RENDER_D3D
    3.10  #undef SDL_VIDEO_RENDER_OGL
     4.1 --- a/src/video/x11/SDL_x11sym.h	Wed May 30 11:43:33 2012 -0400
     4.2 +++ b/src/video/x11/SDL_x11sym.h	Wed May 30 11:44:57 2012 -0400
     4.3 @@ -103,7 +103,11 @@
     4.4  SDL_X11_SYM(int,XUnmapWindow,(Display* a,Window b),(a,b),return)
     4.5  SDL_X11_SYM(int,XWarpPointer,(Display* a,Window b,Window c,int d,int e,unsigned int f,unsigned int g,int h,int i),(a,b,c,d,e,f,g,h,i),return)
     4.6  SDL_X11_SYM(VisualID,XVisualIDFromVisual,(Visual* a),(a),return)
     4.7 +#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
     4.8  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)
     4.9 +#else
    4.10 +SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
    4.11 +#endif
    4.12  SDL_X11_SYM(XExtensionInfo*,XextCreateExtension,(void),(),return)
    4.13  SDL_X11_SYM(void,XextDestroyExtension,(XExtensionInfo* a),(a),)
    4.14  SDL_X11_SYM(XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo* a,Display* b),(a,b),return)