Updated the generic event check to try to compile instead of just look for library runtime function (fixes compiling on older Mac OS X SDKs)
authorSam Lantinga <slouken@libsdl.org>
Wed, 18 Jul 2012 10:47:41 -0700
changeset 6362562a9fe60603
parent 6360 efd48af40ec3
child 6363 8506dd64e859
Updated the generic event check to try to compile instead of just look for library runtime function (fixes compiling on older Mac OS X SDKs)
configure
configure.in
     1.1 --- a/configure	Wed Jul 11 22:20:02 2012 -0400
     1.2 +++ b/configure	Wed Jul 18 10:47:41 2012 -0700
     1.3 @@ -22226,74 +22226,67 @@
     1.4              { echo "$as_me:$LINENO: result: $have_const_param_XextAddDisplay" >&5
     1.5  echo "${ECHO_T}$have_const_param_XextAddDisplay" >&6; }
     1.6  
     1.7 -            { echo "$as_me:$LINENO: checking for XGetEventData in -lX11" >&5
     1.8 -echo $ECHO_N "checking for XGetEventData in -lX11... $ECHO_C" >&6; }
     1.9 -if test "${ac_cv_lib_X11_XGetEventData+set}" = set; then
    1.10 -  echo $ECHO_N "(cached) $ECHO_C" >&6
    1.11 -else
    1.12 -  ac_check_lib_save_LIBS=$LIBS
    1.13 -LIBS="-lX11  $LIBS"
    1.14 -cat >conftest.$ac_ext <<_ACEOF
    1.15 -/* confdefs.h.  */
    1.16 -_ACEOF
    1.17 -cat confdefs.h >>conftest.$ac_ext
    1.18 -cat >>conftest.$ac_ext <<_ACEOF
    1.19 -/* end confdefs.h.  */
    1.20 -
    1.21 -/* Override any GCC internal prototype to avoid an error.
    1.22 -   Use char because int might match the return type of a GCC
    1.23 -   builtin and then its argument prototype would still apply.  */
    1.24 -#ifdef __cplusplus
    1.25 -extern "C"
    1.26 -#endif
    1.27 -char XGetEventData ();
    1.28 -int
    1.29 -main ()
    1.30 -{
    1.31 -return XGetEventData ();
    1.32 -  ;
    1.33 -  return 0;
    1.34 -}
    1.35 -_ACEOF
    1.36 -rm -f conftest.$ac_objext conftest$ac_exeext
    1.37 -if { (ac_try="$ac_link"
    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_link") 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_exeext &&
    1.53 -       $as_test_x conftest$ac_exeext; then
    1.54 -  ac_cv_lib_X11_XGetEventData=yes
    1.55 -else
    1.56 -  echo "$as_me: failed program was:" >&5
    1.57 -sed 's/^/| /' conftest.$ac_ext >&5
    1.58 -
    1.59 -	ac_cv_lib_X11_XGetEventData=no
    1.60 -fi
    1.61 -
    1.62 -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
    1.63 -      conftest$ac_exeext conftest.$ac_ext
    1.64 -LIBS=$ac_check_lib_save_LIBS
    1.65 -fi
    1.66 -{ echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XGetEventData" >&5
    1.67 -echo "${ECHO_T}$ac_cv_lib_X11_XGetEventData" >&6; }
    1.68 -if test $ac_cv_lib_X11_XGetEventData = yes; then
    1.69 -
    1.70 -cat >>confdefs.h <<\_ACEOF
    1.71 +                        { echo "$as_me:$LINENO: checking for XGenericEvent" >&5
    1.72 +echo $ECHO_N "checking for XGenericEvent... $ECHO_C" >&6; }
    1.73 +            have_XGenericEvent=no
    1.74 +            cat >conftest.$ac_ext <<_ACEOF
    1.75 +/* confdefs.h.  */
    1.76 +_ACEOF
    1.77 +cat confdefs.h >>conftest.$ac_ext
    1.78 +cat >>conftest.$ac_ext <<_ACEOF
    1.79 +/* end confdefs.h.  */
    1.80 +
    1.81 +              	#include <X11/Xlib.h>
    1.82 +
    1.83 +int
    1.84 +main ()
    1.85 +{
    1.86 +
    1.87 +Display *display;
    1.88 +XEvent event;
    1.89 +XGenericEventCookie *cookie = &event.xcookie;
    1.90 +XNextEvent(display, &event);
    1.91 +XGetEventData(display, cookie);
    1.92 +XFreeEventData(display, cookie);
    1.93 +
    1.94 +  ;
    1.95 +  return 0;
    1.96 +}
    1.97 +_ACEOF
    1.98 +rm -f conftest.$ac_objext
    1.99 +if { (ac_try="$ac_compile"
   1.100 +case "(($ac_try" in
   1.101 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.102 +  *) ac_try_echo=$ac_try;;
   1.103 +esac
   1.104 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.105 +  (eval "$ac_compile") 2>conftest.er1
   1.106 +  ac_status=$?
   1.107 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.108 +  rm -f conftest.er1
   1.109 +  cat conftest.err >&5
   1.110 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.111 +  (exit $ac_status); } && {
   1.112 +	 test -z "$ac_c_werror_flag" ||
   1.113 +	 test ! -s conftest.err
   1.114 +       } && test -s conftest.$ac_objext; then
   1.115 +
   1.116 +                have_XGenericEvent=yes
   1.117 +                cat >>confdefs.h <<\_ACEOF
   1.118  #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
   1.119  _ACEOF
   1.120  
   1.121 -fi
   1.122 +
   1.123 +else
   1.124 +  echo "$as_me: failed program was:" >&5
   1.125 +sed 's/^/| /' conftest.$ac_ext >&5
   1.126 +
   1.127 +
   1.128 +fi
   1.129 +
   1.130 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.131 +            { echo "$as_me:$LINENO: result: $have_XGenericEvent" >&5
   1.132 +echo "${ECHO_T}$have_XGenericEvent" >&6; }
   1.133  
   1.134              { echo "$as_me:$LINENO: checking for XkbKeycodeToKeysym in -lX11" >&5
   1.135  echo $ECHO_N "checking for XkbKeycodeToKeysym in -lX11... $ECHO_C" >&6; }
   1.136 @@ -22831,6 +22824,7 @@
   1.137  int
   1.138  main ()
   1.139  {
   1.140 +
   1.141  int event_type = XI_TouchBegin;
   1.142  XITouchClassInfo *t;
   1.143  Status
   1.144 @@ -29773,7 +29767,7 @@
   1.145      cat >>$CONFIG_STATUS <<_ACEOF
   1.146      # First, check the format of the line:
   1.147      cat >"\$tmp/defines.sed" <<\\CEOF
   1.148 -/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*/b def
   1.149 +/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
   1.150  /^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
   1.151  b
   1.152  :def
     2.1 --- a/configure.in	Wed Jul 11 22:20:02 2012 -0400
     2.2 +++ b/configure.in	Wed Jul 18 10:47:41 2012 -0700
     2.3 @@ -1106,7 +1106,24 @@
     2.4              ])
     2.5              AC_MSG_RESULT($have_const_param_XextAddDisplay)
     2.6  
     2.7 -            AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
     2.8 +            dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
     2.9 +            AC_MSG_CHECKING([for XGenericEvent])
    2.10 +            have_XGenericEvent=no
    2.11 +            AC_TRY_COMPILE([
    2.12 +              	#include <X11/Xlib.h>
    2.13 +            ],[
    2.14 +Display *display;
    2.15 +XEvent event;
    2.16 +XGenericEventCookie *cookie = &event.xcookie;
    2.17 +XNextEvent(display, &event);
    2.18 +XGetEventData(display, cookie);
    2.19 +XFreeEventData(display, cookie);
    2.20 +            ],[
    2.21 +                have_XGenericEvent=yes
    2.22 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
    2.23 +            ])
    2.24 +            AC_MSG_RESULT($have_XGenericEvent)
    2.25 +
    2.26              AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
    2.27  
    2.28              AC_ARG_ENABLE(video-x11-xcursor,