From ee45c548e61fa0ce1f8adbcf29d7678769f2c0ed Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Sat, 4 Jun 2005 17:45:24 +0000 Subject: [PATCH] Detect Apple bug that prevents the joystick code compiling for OS X 10.1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 102 ++++++++++++++++++++++++++++++++++++++++----------- configure.in | 51 +++++++++++++++----------- 2 files changed, 111 insertions(+), 42 deletions(-) diff --git a/configure b/configure index 46f6ecb568..ec2bc1903e 100755 --- a/configure +++ b/configure @@ -38694,10 +38694,80 @@ _ACEOF fi -if test "$wxUSE_GUI" = "yes"; then - if test "$wxUSE_JOYSTICK" = "yes"; then +if test "$wxUSE_GUI" = "yes" -a "$wxUSE_JOYSTICK" = "yes"; then + wxUSE_JOYSTICK=no + + if test "$TOOLKIT" = "MSW"; then + wxUSE_JOYSTICK=yes + + elif test "$TOOLKIT" = "MAC" -o "$TOOLKIT" = "COCOA"; then + if test "$USE_DARWIN" = 1; then + echo "$as_me:$LINENO: checking headers have declarations needed for joystick support" >&5 +echo $ECHO_N "checking headers have declarations needed for joystick support... $ECHO_C" >&6 + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include +int +main () +{ + IOHIDQueueInterface *qi = NULL; + IOHIDCallbackFunction cb = NULL; + qi->setEventCallout(NULL, cb, NULL, NULL); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + wxUSE_JOYSTICK=yes - if test "$TOOLKIT" != "MAC" -a "$TOOLKIT" != "COCOA" -a "$TOOLKIT" != "MSW"; then +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + echo "$as_me:$LINENO: result: $wxUSE_JOYSTICK" >&5 +echo "${ECHO_T}$wxUSE_JOYSTICK" >&6 + fi + + else for ac_header in linux/joystick.h do @@ -38843,32 +38913,22 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - + wxUSE_JOYSTICK=yes fi done - if test "$ac_cv_header_linux_joystick_h" != "yes"; then - wxUSE_JOYSTICK=no - { echo "$as_me:$LINENO: WARNING: Joystick not supported by this system... disabled" >&5 -echo "$as_me: WARNING: Joystick not supported by this system... disabled" >&2;} - fi - else - if test "$USE_DARWIN" != 1 -a "$TOOLKIT" != "MSW"; then - wxUSE_JOYSTICK=no - { echo "$as_me:$LINENO: WARNING: Joystick not supported by this system... disabled" >&5 -echo "$as_me: WARNING: Joystick not supported by this system... disabled" >&2;} - fi - fi - + fi - if test "$wxUSE_JOYSTICK" = "yes"; then - cat >>confdefs.h <<\_ACEOF + if test "$wxUSE_JOYSTICK" = "yes"; then + cat >>confdefs.h <<\_ACEOF #define wxUSE_JOYSTICK 1 _ACEOF - SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest" - fi + SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest" + else + { echo "$as_me:$LINENO: WARNING: Joystick not supported by this system... disabled" >&5 +echo "$as_me: WARNING: Joystick not supported by this system... disabled" >&2;} fi fi diff --git a/configure.in b/configure.in index 92094c5db2..d1279b3e49 100644 --- a/configure.in +++ b/configure.in @@ -5462,30 +5462,39 @@ dnl --------------------------------------------------------------------------- dnl Joystick support dnl --------------------------------------------------------------------------- -if test "$wxUSE_GUI" = "yes"; then - dnl under MSW we always have joystick support - if test "$wxUSE_JOYSTICK" = "yes"; then - - dnl joystick support is only for Linux 2.1.x or greater - if test "$TOOLKIT" != "MAC" -a "$TOOLKIT" != "COCOA" -a "$TOOLKIT" != "MSW"; then - AC_CHECK_HEADERS(linux/joystick.h) - if test "$ac_cv_header_linux_joystick_h" != "yes"; then - wxUSE_JOYSTICK=no - AC_MSG_WARN(Joystick not supported by this system... disabled) - fi - else - dnl mac only available on darwin - if test "$USE_DARWIN" != 1 -a "$TOOLKIT" != "MSW"; then - wxUSE_JOYSTICK=no - AC_MSG_WARN(Joystick not supported by this system... disabled) - fi - fi +if test "$wxUSE_GUI" = "yes" -a "$wxUSE_JOYSTICK" = "yes"; then + wxUSE_JOYSTICK=no + dnl under MSW we always have joystick support + if test "$TOOLKIT" = "MSW"; then + wxUSE_JOYSTICK=yes - if test "$wxUSE_JOYSTICK" = "yes"; then - AC_DEFINE(wxUSE_JOYSTICK) - SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest" + dnl mac only available on darwin + elif test "$TOOLKIT" = "MAC" -o "$TOOLKIT" = "COCOA"; then + if test "$USE_DARWIN" = 1; then + dnl check for a bug in the headers, some have bad setEventCallout + AC_MSG_CHECKING([headers have declarations needed for joystick support]) + AC_LANG_PUSH(C++) + AC_TRY_COMPILE( [ #include ], + [ IOHIDQueueInterface *qi = NULL; + IOHIDCallbackFunction cb = NULL; + qi->setEventCallout(NULL, cb, NULL, NULL); ], + [ wxUSE_JOYSTICK=yes ] + ) + AC_LANG_POP + AC_MSG_RESULT($wxUSE_JOYSTICK) fi + + dnl joystick support is only for Linux 2.1.x or greater + else + AC_CHECK_HEADERS(linux/joystick.h, wxUSE_JOYSTICK=yes) + fi + + if test "$wxUSE_JOYSTICK" = "yes"; then + AC_DEFINE(wxUSE_JOYSTICK) + SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest" + else + AC_MSG_WARN(Joystick not supported by this system... disabled) fi fi -- 2.45.2