configure.ac
changeset 12984 774ceeac9335
parent 12978 d2e027c5a389
child 12998 b87ba0fad17e
     1.1 --- a/configure.ac	Fri Aug 02 17:20:00 2019 -0700
     1.2 +++ b/configure.ac	Fri Aug 02 18:14:31 2019 -0700
     1.3 @@ -3197,34 +3197,24 @@
     1.4  {
     1.5      # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
     1.6      # so we'll just use libusb when it's available.
     1.7 -    #
     1.8 -    # libusb does not support iOS, so we default to yes on iOS.
     1.9 -    # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
    1.10 -    skiplibusb=no
    1.11      case "$host" in
    1.12 -        *-*-cygwin* | *-*-mingw32* | arm*-apple-darwin* | *-ios-* )
    1.13 +        # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
    1.14 +        *-*-cygwin* | *-*-mingw32* )
    1.15              skiplibusb=yes
    1.16              ;;
    1.17 -    esac
    1.18 -
    1.19 -    # On the other hand, *BSD specifically uses libusb only, so we make a
    1.20 -    # special case just for them.
    1.21 -    onlylibusb=no
    1.22 -    case "$host" in
    1.23 +        # libusb does not support iOS
    1.24 +        arm*-apple-darwin* | *-ios-* )
    1.25 +            skiplibusb=yes
    1.26 +            ;;
    1.27 +        # On the other hand, *BSD specifically uses libusb only
    1.28          *-*-*bsd* )
    1.29              onlylibusb=yes
    1.30              ;;
    1.31      esac
    1.32  
    1.33      AC_ARG_ENABLE(hidapi,
    1.34 -AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]),
    1.35 -                  , enable_hidapi=maybe)
    1.36 -    hidapi_support=no
    1.37 -
    1.38 -    if test x$enable_hidapi = xmaybe; then
    1.39 -      enable_hidapi=$skiplibusb
    1.40 -    fi
    1.41 -
    1.42 +AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=yes]]]),
    1.43 +                  , enable_hidapi=yes)
    1.44      if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
    1.45          if test x$skiplibusb = xyes; then
    1.46              hidapi_support=yes
    1.47 @@ -3236,12 +3226,10 @@
    1.48              CFLAGS="$save_CFLAGS"
    1.49              if test x$have_libusb_h = xyes; then
    1.50                  hidapi_support=yes
    1.51 -            elif test x$onlylibusb = xno; then
    1.52 -                case "$host" in
    1.53 -                *-*-darwin* )
    1.54 -                    hidapi_support=yes
    1.55 -                    ;;
    1.56 -                esac
    1.57 +            elif test x$onlylibusb = xyes; then
    1.58 +                hidapi_support=no
    1.59 +            else
    1.60 +                hidapi_support=yes
    1.61              fi
    1.62          fi
    1.63  
    1.64 @@ -3250,17 +3238,11 @@
    1.65              EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    1.66              SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    1.67  
    1.68 -            if test x$skiplibusb = xno; then
    1.69 +            if test x$have_libusb_h = xyes; then
    1.70                  EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
    1.71                  if test x$onlylibusb = xyes; then
    1.72                      SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
    1.73                      EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
    1.74 -                elif test x$have_libusb_h != xyes ; then
    1.75 -                    case "$host" in
    1.76 -                    *-*-darwin* )
    1.77 -                        SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
    1.78 -                        ;;
    1.79 -                    esac
    1.80                  else
    1.81                      if test x$have_loadso != xyes; then
    1.82                          AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
    1.83 @@ -3281,6 +3263,15 @@
    1.84                      fi
    1.85                      AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
    1.86                  fi
    1.87 +            else
    1.88 +                case "$host" in
    1.89 +                *-*-cygwin* | *-*-mingw32* )
    1.90 +                    SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
    1.91 +                    ;;
    1.92 +                *-*-darwin* )
    1.93 +                    SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
    1.94 +                    ;;
    1.95 +                esac
    1.96              fi
    1.97          fi
    1.98  
    1.99 @@ -3640,10 +3631,6 @@
   1.100              fi
   1.101              SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
   1.102              have_joystick=yes
   1.103 -            # TODO: Remove this block once SDL_hidapi.c supports Windows!
   1.104 -            if test x$hidapi_support = xyes; then
   1.105 -                SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
   1.106 -            fi
   1.107          fi
   1.108          if test x$enable_haptic = xyes; then
   1.109              if test x$have_dinput = xyes -o x$have_xinput = xyes; then