From 81f8c03712b6215e006577b5bb0e5749400cdd32 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 11 Mar 2009 16:49:55 +0100 Subject: [PATCH] configure: Check for IOHIDManagerCreate function that's missing on Tiger. --- configure | 107 +++++++++++++++++++++++++++++++++++++ configure.ac | 7 +++ dlls/dinput/joystick_osx.c | 6 +-- include/config.h.in | 3 ++ 4 files changed, 120 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 8bf88e1981d..5fe40d42b63 100755 --- a/configure +++ b/configure @@ -7557,6 +7557,113 @@ fi COREAUDIO="-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI" fi + if test "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" + then + ac_save_LIBS="$LIBS" + LIBS="$LIBS $IOKITLIB" + +for ac_func in IOHIDManagerCreate +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS="$ac_save_LIBS" + fi case $host_cpu in *powerpc*) LDDLLFLAGS="$LDDLLFLAGS -read_only_relocs warning" ;; diff --git a/configure.ac b/configure.ac index 0930f5c75c1..1246a11a7ef 100644 --- a/configure.ac +++ b/configure.ac @@ -578,6 +578,13 @@ case $host_os in dnl CoreServices needed by AudioUnit AC_SUBST(COREAUDIO,"-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI") fi + if test "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" + then + ac_save_LIBS="$LIBS" + LIBS="$LIBS $IOKITLIB" + AC_CHECK_FUNCS(IOHIDManagerCreate) + LIBS="$ac_save_LIBS" + fi case $host_cpu in *powerpc*) LDDLLFLAGS="$LDDLLFLAGS -read_only_relocs warning" dnl FIXME diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index ea5ad63e9be..c8a333fa70f 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -116,7 +116,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); -#ifdef HAVE_IOKIT_HID_IOHIDLIB_H +#ifdef HAVE_IOHIDMANAGERCREATE static IOHIDManagerRef gIOHIDManagerRef = NULL; static CFArrayRef gDevices = NULL; @@ -893,7 +893,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt = }; #undef XCAST -#else /* HAVE_IOKIT_HID_IOHIDLIB_H */ +#else /* HAVE_IOHIDMANAGERCREATE */ const struct dinput_device joystick_osx_device = { "Wine OS X joystick driver", @@ -903,4 +903,4 @@ const struct dinput_device joystick_osx_device = { NULL }; -#endif /* HAVE_IOKIT_HID_IOHIDLIB_H */ +#endif /* HAVE_IOHIDMANAGERCREATE */ diff --git a/include/config.h.in b/include/config.h.in index 3dec61e9150..9f3da47bd22 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -255,6 +255,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `IOHIDManagerCreate' function. */ +#undef HAVE_IOHIDMANAGERCREATE + /* Define to 1 if you have the header file. */ #undef HAVE_IOKIT_HID_IOHIDLIB_H