configure.ac
changeset 12931 881705583f45
parent 12899 11cb5d784a3a
child 12974 0fef4b21fa1d
equal deleted inserted replaced
12930:92e72926b7f5 12931:881705583f45
  3197 {
  3197 {
  3198     # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
  3198     # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
  3199     # so we'll just use libusb when it's available.
  3199     # so we'll just use libusb when it's available.
  3200     #
  3200     #
  3201     # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
  3201     # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
       
  3202     #
       
  3203     #  On macOS and Windows, where you don't need libusb or root, we default to yes.
       
  3204     skiplibusb=no
       
  3205     case "$host" in
       
  3206         *-*-cygwin* | *-*-mingw32* | *-*-darwin* )
       
  3207             skiplibusb=yes
       
  3208             ;;
       
  3209     esac
       
  3210 
  3202     AC_ARG_ENABLE(hidapi,
  3211     AC_ARG_ENABLE(hidapi,
  3203 AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
  3212 AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]),
  3204                   , enable_hidapi=no)
  3213                   , enable_hidapi=maybe)
       
  3214     hidapi_support=no
       
  3215 
       
  3216     if test x$enable_hidapi = xmaybe; then
       
  3217       enable_hidapi=$skiplibusb
       
  3218     fi
       
  3219 
  3205     if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
  3220     if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
  3206         PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
  3221         if test x$skiplibusb = xyes; then
  3207         hidapi_support=no
       
  3208         save_CFLAGS="$CFLAGS"
       
  3209         CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
       
  3210         AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
       
  3211         CFLAGS="$save_CFLAGS"
       
  3212 
       
  3213         if test x$have_libusb_h = xyes; then
       
  3214             hidapi_support=yes
  3222             hidapi_support=yes
       
  3223         else
       
  3224             PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
       
  3225             save_CFLAGS="$CFLAGS"
       
  3226             CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
       
  3227             AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
       
  3228             CFLAGS="$save_CFLAGS"
       
  3229             if test x$have_libusb_h = xyes; then
       
  3230                 hidapi_support=yes
       
  3231             fi
       
  3232         fi
       
  3233 
       
  3234         if test x$hidapi_support = xyes; then
  3215             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3235             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3216             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  3236             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  3217             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3237             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3218             SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
  3238 
  3219             EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
  3239             if test x$skiplibusb = xno; then
  3220             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
  3240                 SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
  3221         fi
  3241                 EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
       
  3242                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
       
  3243             fi
       
  3244         fi
       
  3245 
  3222         AC_MSG_CHECKING(for hidapi support)
  3246         AC_MSG_CHECKING(for hidapi support)
  3223         AC_MSG_RESULT($hidapi_support)
  3247         AC_MSG_RESULT($hidapi_support)
  3224     fi
  3248     fi
  3225 }
  3249 }
  3226 
  3250 
  3519         CheckWINDOWS
  3543         CheckWINDOWS
  3520         CheckWINDOWSGL
  3544         CheckWINDOWSGL
  3521         CheckWINDOWSGLES
  3545         CheckWINDOWSGLES
  3522         CheckVulkan
  3546         CheckVulkan
  3523         CheckDIRECTX
  3547         CheckDIRECTX
       
  3548         CheckHIDAPI
  3524 
  3549 
  3525         # Set up the core platform files
  3550         # Set up the core platform files
  3526         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  3551         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  3527 
  3552 
  3528         # Set up files for the video library
  3553         # Set up files for the video library
  3570                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  3595                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  3571                 fi
  3596                 fi
  3572             else
  3597             else
  3573                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  3598                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  3574             fi
  3599             fi
  3575             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
       
  3576             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
  3600             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
  3577             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
       
  3578             SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
       
  3579             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
       
  3580             have_joystick=yes
  3601             have_joystick=yes
       
  3602             if test x$hidapi_support = xyes; then
       
  3603                 SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
       
  3604             fi
  3581         fi
  3605         fi
  3582         if test x$enable_haptic = xyes; then
  3606         if test x$enable_haptic = xyes; then
  3583             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  3607             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  3584                 if test x$have_xinput = xyes; then
  3608                 if test x$have_xinput = xyes; then
  3585                     AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
  3609                     AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
  3801         CheckMacGL
  3825         CheckMacGL
  3802         CheckMacGLES
  3826         CheckMacGLES
  3803         CheckOpenGLX11
  3827         CheckOpenGLX11
  3804         CheckVulkan
  3828         CheckVulkan
  3805         CheckPTHREAD
  3829         CheckPTHREAD
       
  3830         CheckHIDAPI
  3806 
  3831 
  3807         # Set up files for the audio library
  3832         # Set up files for the audio library
  3808         if test x$enable_audio = xyes; then
  3833         if test x$enable_audio = xyes; then
  3809             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  3834             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  3810             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  3835             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  3813             have_audio=yes
  3838             have_audio=yes
  3814         fi
  3839         fi
  3815         # Set up files for the joystick library
  3840         # Set up files for the joystick library
  3816         if test x$enable_joystick = xyes; then
  3841         if test x$enable_joystick = xyes; then
  3817             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  3842             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  3818             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
       
  3819             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  3843             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  3820             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
       
  3821             SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
       
  3822             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
       
  3823             have_joystick=yes
  3844             have_joystick=yes
       
  3845             if test x$hidapi_support = xyes; then
       
  3846                 SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
       
  3847             fi
  3824         fi
  3848         fi
  3825         # Set up files for the haptic library
  3849         # Set up files for the haptic library
  3826         if test x$enable_haptic = xyes; then
  3850         if test x$enable_haptic = xyes; then
  3827             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  3851             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  3828             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  3852             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"