mirror of https://github.com/encounter/SDL.git
configure: Windows and macOS now respect --enable-hidapi.
(and it defaults to "yes" on those platforms. Other places, which use libusb, still default to no because they probably need root permissions to work.)
This commit is contained in:
parent
7e09718dfe
commit
4df22d812c
|
@ -1675,7 +1675,7 @@ Optional Features:
|
||||||
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
|
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
|
||||||
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
|
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
|
||||||
--enable-hidapi use HIDAPI for low level joystick drivers
|
--enable-hidapi use HIDAPI for low level joystick drivers
|
||||||
[[default=no]]
|
[[default=maybe]]
|
||||||
--enable-clock_gettime use clock_gettime() instead of gettimeofday() on
|
--enable-clock_gettime use clock_gettime() instead of gettimeofday() on
|
||||||
UNIX [[default=yes]]
|
UNIX [[default=yes]]
|
||||||
--enable-rpath use an rpath when linking SDL [[default=yes]]
|
--enable-rpath use an rpath when linking SDL [[default=yes]]
|
||||||
|
@ -24107,14 +24107,32 @@ CheckHIDAPI()
|
||||||
# so we'll just use libusb when it's available.
|
# so we'll just use libusb when it's available.
|
||||||
#
|
#
|
||||||
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
|
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
|
||||||
|
#
|
||||||
|
# On macOS and Windows, where you don't need libusb or root, we default to yes.
|
||||||
|
skiplibusb=no
|
||||||
|
case "$host" in
|
||||||
|
*-*-cygwin* | *-*-mingw32* | *-*-darwin* )
|
||||||
|
skiplibusb=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Check whether --enable-hidapi was given.
|
# Check whether --enable-hidapi was given.
|
||||||
if test "${enable_hidapi+set}" = set; then :
|
if test "${enable_hidapi+set}" = set; then :
|
||||||
enableval=$enable_hidapi;
|
enableval=$enable_hidapi;
|
||||||
else
|
else
|
||||||
enable_hidapi=no
|
enable_hidapi=maybe
|
||||||
fi
|
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$enable_joystick = xyes -a x$enable_hidapi = xyes; then
|
||||||
|
if test x$skiplibusb = xyes; then
|
||||||
|
hidapi_support=yes
|
||||||
|
else
|
||||||
|
|
||||||
pkg_failed=no
|
pkg_failed=no
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5
|
||||||
|
@ -24184,7 +24202,6 @@ else
|
||||||
$as_echo "yes" >&6; }
|
$as_echo "yes" >&6; }
|
||||||
have_libusb=yes
|
have_libusb=yes
|
||||||
fi
|
fi
|
||||||
hidapi_support=no
|
|
||||||
save_CFLAGS="$CFLAGS"
|
save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
|
CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
|
||||||
|
@ -24194,18 +24211,25 @@ fi
|
||||||
|
|
||||||
|
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
if test x$have_libusb_h = xyes; then
|
if test x$have_libusb_h = xyes; then
|
||||||
hidapi_support=yes
|
hidapi_support=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
|
|
||||||
$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
|
$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
|
||||||
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
||||||
|
|
||||||
|
if test x$skiplibusb = xno; then
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
|
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi support" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi support" >&5
|
||||||
$as_echo_n "checking for hidapi support... " >&6; }
|
$as_echo_n "checking for hidapi support... " >&6; }
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5
|
||||||
|
@ -24632,6 +24656,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||||
CheckWINDOWSGLES
|
CheckWINDOWSGLES
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckDIRECTX
|
CheckDIRECTX
|
||||||
|
CheckHIDAPI
|
||||||
|
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
@ -24705,14 +24730,11 @@ $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h
|
||||||
$as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
|
$as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
|
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
|
||||||
have_joystick=yes
|
have_joystick=yes
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if test x$enable_haptic = xyes; then
|
if test x$enable_haptic = xyes; then
|
||||||
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
|
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
|
||||||
|
@ -25036,6 +25058,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
|
||||||
CheckOpenGLX11
|
CheckOpenGLX11
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
CheckHIDAPI
|
||||||
|
|
||||||
# Set up files for the audio library
|
# Set up files for the audio library
|
||||||
if test x$enable_audio = xyes; then
|
if test x$enable_audio = xyes; then
|
||||||
|
@ -25052,14 +25075,11 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h
|
||||||
|
|
||||||
$as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
|
$as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
|
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
|
||||||
have_joystick=yes
|
have_joystick=yes
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# Set up files for the haptic library
|
# Set up files for the haptic library
|
||||||
if test x$enable_haptic = xyes; then
|
if test x$enable_haptic = xyes; then
|
||||||
|
|
50
configure.ac
50
configure.ac
|
@ -3199,26 +3199,50 @@ CheckHIDAPI()
|
||||||
# so we'll just use libusb when it's available.
|
# so we'll just use libusb when it's available.
|
||||||
#
|
#
|
||||||
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
|
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
|
||||||
|
#
|
||||||
|
# On macOS and Windows, where you don't need libusb or root, we default to yes.
|
||||||
|
skiplibusb=no
|
||||||
|
case "$host" in
|
||||||
|
*-*-cygwin* | *-*-mingw32* | *-*-darwin* )
|
||||||
|
skiplibusb=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AC_ARG_ENABLE(hidapi,
|
AC_ARG_ENABLE(hidapi,
|
||||||
AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
|
AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]),
|
||||||
, enable_hidapi=no)
|
, enable_hidapi=maybe)
|
||||||
if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
|
|
||||||
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
|
|
||||||
hidapi_support=no
|
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
|
||||||
|
else
|
||||||
|
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
|
||||||
save_CFLAGS="$CFLAGS"
|
save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
|
CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
|
||||||
AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
|
AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
if test x$have_libusb_h = xyes; then
|
if test x$have_libusb_h = xyes; then
|
||||||
hidapi_support=yes
|
hidapi_support=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
||||||
|
|
||||||
|
if test x$skiplibusb = xno; then
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
|
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(for hidapi support)
|
AC_MSG_CHECKING(for hidapi support)
|
||||||
AC_MSG_RESULT($hidapi_support)
|
AC_MSG_RESULT($hidapi_support)
|
||||||
fi
|
fi
|
||||||
|
@ -3521,6 +3545,7 @@ case "$host" in
|
||||||
CheckWINDOWSGLES
|
CheckWINDOWSGLES
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckDIRECTX
|
CheckDIRECTX
|
||||||
|
CheckHIDAPI
|
||||||
|
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
@ -3572,12 +3597,11 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
else
|
else
|
||||||
AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
|
AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
|
||||||
fi
|
fi
|
||||||
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
|
||||||
have_joystick=yes
|
have_joystick=yes
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if test x$enable_haptic = xyes; then
|
if test x$enable_haptic = xyes; then
|
||||||
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
|
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
|
||||||
|
@ -3803,6 +3827,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
CheckOpenGLX11
|
CheckOpenGLX11
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
CheckHIDAPI
|
||||||
|
|
||||||
# Set up files for the audio library
|
# Set up files for the audio library
|
||||||
if test x$enable_audio = xyes; then
|
if test x$enable_audio = xyes; then
|
||||||
|
@ -3815,12 +3840,11 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
# Set up files for the joystick library
|
# Set up files for the joystick library
|
||||||
if test x$enable_joystick = xyes; then
|
if test x$enable_joystick = xyes; then
|
||||||
AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
|
AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
|
||||||
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
|
||||||
have_joystick=yes
|
have_joystick=yes
|
||||||
|
if test x$hidapi_support = xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# Set up files for the haptic library
|
# Set up files for the haptic library
|
||||||
if test x$enable_haptic = xyes; then
|
if test x$enable_haptic = xyes; then
|
||||||
|
|
Loading…
Reference in New Issue