Fixed building on Mac OS X without libusb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
diff --git a/configure b/configure
index b0657da..8e0cefb 100755
--- a/configure
+++ b/configure
@@ -1675,7 +1675,7 @@ Optional Features:
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
--enable-hidapi use HIDAPI for low level joystick drivers
- [[default=maybe]]
+ [[default=yes]]
--enable-clock_gettime use clock_gettime() instead of gettimeofday() on
UNIX [[default=yes]]
--enable-rpath use an rpath when linking SDL [[default=yes]]
@@ -24105,20 +24105,16 @@ CheckHIDAPI()
{
# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
# so we'll just use libusb when it's available.
- #
- # libusb does not support iOS, so we default to yes on iOS.
- # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
- skiplibusb=no
case "$host" in
- *-*-cygwin* | *-*-mingw32* | arm*-apple-darwin* | *-ios-* )
+ # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
+ *-*-cygwin* | *-*-mingw32* )
skiplibusb=yes
;;
- esac
-
- # On the other hand, *BSD specifically uses libusb only, so we make a
- # special case just for them.
- onlylibusb=no
- case "$host" in
+ # libusb does not support iOS
+ arm*-apple-darwin* | *-ios-* )
+ skiplibusb=yes
+ ;;
+ # On the other hand, *BSD specifically uses libusb only
*-*-*bsd* )
onlylibusb=yes
;;
@@ -24128,15 +24124,9 @@ CheckHIDAPI()
if test "${enable_hidapi+set}" = set; then :
enableval=$enable_hidapi;
else
- enable_hidapi=maybe
+ enable_hidapi=yes
fi
- hidapi_support=no
-
- if test x$enable_hidapi = xmaybe; then
- enable_hidapi=$skiplibusb
- fi
-
if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
if test x$skiplibusb = xyes; then
hidapi_support=yes
@@ -24221,12 +24211,10 @@ fi
CFLAGS="$save_CFLAGS"
if test x$have_libusb_h = xyes; then
hidapi_support=yes
- elif test x$onlylibusb = xno; then
- case "$host" in
- *-*-darwin* )
- hidapi_support=yes
- ;;
- esac
+ elif test x$onlylibusb = xyes; then
+ hidapi_support=no
+ else
+ hidapi_support=yes
fi
fi
@@ -24237,17 +24225,11 @@ $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
- if test x$skiplibusb = xno; then
+ if test x$have_libusb_h = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
if test x$onlylibusb = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
- elif test x$have_libusb_h != xyes ; then
- case "$host" in
- *-*-darwin* )
- SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
- ;;
- esac
else
if test x$have_loadso != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5
@@ -24273,6 +24255,15 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
fi
+ else
+ case "$host" in
+ *-*-cygwin* | *-*-mingw32* )
+ SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
+ ;;
+ *-*-darwin* )
+ SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
+ ;;
+ esac
fi
fi
@@ -24778,10 +24769,6 @@ $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
have_joystick=yes
- # TODO: Remove this block once SDL_hidapi.c supports Windows!
- if test x$hidapi_support = xyes; then
- SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
- fi
fi
if test x$enable_haptic = xyes; then
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
diff --git a/configure.ac b/configure.ac
index 0d13684..c6fd37f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3197,34 +3197,24 @@ CheckHIDAPI()
{
# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
# so we'll just use libusb when it's available.
- #
- # libusb does not support iOS, so we default to yes on iOS.
- # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
- skiplibusb=no
case "$host" in
- *-*-cygwin* | *-*-mingw32* | arm*-apple-darwin* | *-ios-* )
+ # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
+ *-*-cygwin* | *-*-mingw32* )
skiplibusb=yes
;;
- esac
-
- # On the other hand, *BSD specifically uses libusb only, so we make a
- # special case just for them.
- onlylibusb=no
- case "$host" in
+ # libusb does not support iOS
+ arm*-apple-darwin* | *-ios-* )
+ skiplibusb=yes
+ ;;
+ # On the other hand, *BSD specifically uses libusb only
*-*-*bsd* )
onlylibusb=yes
;;
esac
AC_ARG_ENABLE(hidapi,
-AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]),
- , enable_hidapi=maybe)
- hidapi_support=no
-
- if test x$enable_hidapi = xmaybe; then
- enable_hidapi=$skiplibusb
- fi
-
+AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=yes]]]),
+ , enable_hidapi=yes)
if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
if test x$skiplibusb = xyes; then
hidapi_support=yes
@@ -3236,12 +3226,10 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
CFLAGS="$save_CFLAGS"
if test x$have_libusb_h = xyes; then
hidapi_support=yes
- elif test x$onlylibusb = xno; then
- case "$host" in
- *-*-darwin* )
- hidapi_support=yes
- ;;
- esac
+ elif test x$onlylibusb = xyes; then
+ hidapi_support=no
+ else
+ hidapi_support=yes
fi
fi
@@ -3250,17 +3238,11 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
- if test x$skiplibusb = xno; then
+ if test x$have_libusb_h = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
if test x$onlylibusb = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
- elif test x$have_libusb_h != xyes ; then
- case "$host" in
- *-*-darwin* )
- SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
- ;;
- esac
else
if test x$have_loadso != xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
@@ -3281,6 +3263,15 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
fi
AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
fi
+ else
+ case "$host" in
+ *-*-cygwin* | *-*-mingw32* )
+ SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
+ ;;
+ *-*-darwin* )
+ SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
+ ;;
+ esac
fi
fi
@@ -3640,10 +3631,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
fi
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
have_joystick=yes
- # TODO: Remove this block once SDL_hidapi.c supports Windows!
- if test x$hidapi_support = xyes; then
- SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
- fi
fi
if test x$enable_haptic = xyes; then
if test x$have_dinput = xyes -o x$have_xinput = xyes; then