Fixed bug 2149 - Don't search for libusbhid except on BSD

Joseph Carter

There's a whole set of configure tests for BSD's libusbhid, and they only matter on BSD.  However, if you have the library on Linux, it gets pulled in as library bloat.  And it's bloat of the highest order since not a single function call to the library is ever made unless you're on a *BSD.
This commit is contained in:
Sam Lantinga 2013-10-13 19:49:45 -07:00
parent a7b2db05cd
commit 2337a684b3
3 changed files with 251 additions and 242 deletions

228
configure vendored
View File

@ -21634,8 +21634,10 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h
CheckUSBHID() CheckUSBHID()
{ {
if test x$enable_joystick = xyes; then case "$host" in
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 *-*-*bsd*)
if test x$enable_joystick = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
$as_echo_n "checking for hid_init in -lusbhid... " >&6; } $as_echo_n "checking for hid_init in -lusbhid... " >&6; }
if ${ac_cv_lib_usbhid_hid_init+:} false; then : if ${ac_cv_lib_usbhid_hid_init+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
@ -21675,34 +21677,34 @@ if test "x$ac_cv_lib_usbhid_hid_init" = xyes; then :
have_libusbhid=yes have_libusbhid=yes
fi fi
if test x$have_libusbhid = xyes; then if test x$have_libusbhid = xyes; then
ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default"
if test "x$ac_cv_header_usbhid_h" = xyes; then : if test "x$ac_cv_header_usbhid_h" = xyes; then :
USB_CFLAGS="-DHAVE_USBHID_H" USB_CFLAGS="-DHAVE_USBHID_H"
fi fi
ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default"
if test "x$ac_cv_header_libusbhid_h" = xyes; then : if test "x$ac_cv_header_libusbhid_h" = xyes; then :
USB_CFLAGS="-DHAVE_LIBUSBHID_H" USB_CFLAGS="-DHAVE_LIBUSBHID_H"
fi fi
USB_LIBS="$USB_LIBS -lusbhid" USB_LIBS="$USB_LIBS -lusbhid"
else else
ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
if test "x$ac_cv_header_usb_h" = xyes; then : if test "x$ac_cv_header_usb_h" = xyes; then :
USB_CFLAGS="-DHAVE_USB_H" USB_CFLAGS="-DHAVE_USB_H"
fi fi
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"
if test "x$ac_cv_header_libusb_h" = xyes; then : if test "x$ac_cv_header_libusb_h" = xyes; then :
USB_CFLAGS="-DHAVE_LIBUSB_H" USB_CFLAGS="-DHAVE_LIBUSB_H"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5
$as_echo_n "checking for hid_init in -lusb... " >&6; } $as_echo_n "checking for hid_init in -lusb... " >&6; }
if ${ac_cv_lib_usb_hid_init+:} false; then : if ${ac_cv_lib_usb_hid_init+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
@ -21742,43 +21744,43 @@ if test "x$ac_cv_lib_usb_hid_init" = xyes; then :
USB_LIBS="$USB_LIBS -lusb" USB_LIBS="$USB_LIBS -lusb"
fi fi
fi fi
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $USB_CFLAGS" CFLAGS="$CFLAGS $USB_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5
$as_echo_n "checking for usbhid... " >&6; } $as_echo_n "checking for usbhid... " >&6; }
have_usbhid=no have_usbhid=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_USB_H) #if defined(HAVE_USB_H)
#include <usb.h> #include <usb.h>
#endif #endif
#ifdef __DragonFly__ #ifdef __DragonFly__
# include <bus/usb/usb.h> # include <bus/usb/usb.h>
# include <bus/usb/usbhid.h> # include <bus/usb/usbhid.h>
#else #else
# include <dev/usb/usb.h> # include <dev/usb/usb.h>
# include <dev/usb/usbhid.h> # include <dev/usb/usbhid.h>
#endif #endif
#if defined(HAVE_USBHID_H) #if defined(HAVE_USBHID_H)
#include <usbhid.h> #include <usbhid.h>
#elif defined(HAVE_LIBUSB_H) #elif defined(HAVE_LIBUSB_H)
#include <libusb.h> #include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H) #elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
int int
main () main ()
{ {
struct report_desc *repdesc; struct report_desc *repdesc;
struct usb_ctl_report *repbuf; struct usb_ctl_report *repbuf;
hid_kind_t hidkind; hid_kind_t hidkind;
; ;
return 0; return 0;
@ -21786,45 +21788,45 @@ main ()
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
have_usbhid=yes have_usbhid=yes
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5
$as_echo "$have_usbhid" >&6; } $as_echo "$have_usbhid" >&6; }
if test x$have_usbhid = xyes; then if test x$have_usbhid = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5
$as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; } $as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; }
have_usbhid_ucr_data=no have_usbhid_ucr_data=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_USB_H) #if defined(HAVE_USB_H)
#include <usb.h> #include <usb.h>
#endif #endif
#ifdef __DragonFly__ #ifdef __DragonFly__
# include <bus/usb/usb.h> # include <bus/usb/usb.h>
# include <bus/usb/usbhid.h> # include <bus/usb/usbhid.h>
#else #else
# include <dev/usb/usb.h> # include <dev/usb/usb.h>
# include <dev/usb/usbhid.h> # include <dev/usb/usbhid.h>
#endif #endif
#if defined(HAVE_USBHID_H) #if defined(HAVE_USBHID_H)
#include <usbhid.h> #include <usbhid.h>
#elif defined(HAVE_LIBUSB_H) #elif defined(HAVE_LIBUSB_H)
#include <libusb.h> #include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H) #elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
int int
main () main ()
{ {
struct usb_ctl_report buf; struct usb_ctl_report buf;
if (buf.ucr_data) { } if (buf.ucr_data) { }
; ;
return 0; return 0;
@ -21832,47 +21834,47 @@ main ()
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
have_usbhid_ucr_data=yes have_usbhid_ucr_data=yes
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$have_usbhid_ucr_data = xyes; then if test x$have_usbhid_ucr_data = xyes; then
USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5
$as_echo "$have_usbhid_ucr_data" >&6; } $as_echo "$have_usbhid_ucr_data" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5
$as_echo_n "checking for new usbhid API... " >&6; } $as_echo_n "checking for new usbhid API... " >&6; }
have_usbhid_new=no have_usbhid_new=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_USB_H) #if defined(HAVE_USB_H)
#include <usb.h> #include <usb.h>
#endif #endif
#ifdef __DragonFly__ #ifdef __DragonFly__
#include <bus/usb/usb.h> #include <bus/usb/usb.h>
#include <bus/usb/usbhid.h> #include <bus/usb/usbhid.h>
#else #else
#include <dev/usb/usb.h> #include <dev/usb/usb.h>
#include <dev/usb/usbhid.h> #include <dev/usb/usbhid.h>
#endif #endif
#if defined(HAVE_USBHID_H) #if defined(HAVE_USBHID_H)
#include <usbhid.h> #include <usbhid.h>
#elif defined(HAVE_LIBUSB_H) #elif defined(HAVE_LIBUSB_H)
#include <libusb.h> #include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H) #elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
int int
main () main ()
{ {
report_desc_t d; report_desc_t d;
hid_start_parse(d, 1, 1); hid_start_parse(d, 1, 1);
; ;
return 0; return 0;
@ -21880,29 +21882,29 @@ main ()
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
have_usbhid_new=yes have_usbhid_new=yes
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$have_usbhid_new = xyes; then if test x$have_usbhid_new = xyes; then
USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5
$as_echo "$have_usbhid_new" >&6; } $as_echo "$have_usbhid_new" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5
$as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; } $as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; }
have_machine_joystick=no have_machine_joystick=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <machine/joystick.h> #include <machine/joystick.h>
int int
main () main ()
{ {
struct joystick t; struct joystick t;
; ;
return 0; return 0;
@ -21910,28 +21912,30 @@ main ()
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
have_machine_joystick=yes have_machine_joystick=yes
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$have_machine_joystick = xyes; then if test x$have_machine_joystick = xyes; then
$as_echo "#define SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 1" >>confdefs.h
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5
$as_echo "$have_machine_joystick" >&6; } $as_echo "$have_machine_joystick" >&6; }
$as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
have_joystick=yes have_joystick=yes
fi fi
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
fi fi
;;
esac
} }
CheckClockGettime() CheckClockGettime()

View File

@ -2189,138 +2189,142 @@ AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[de
dnl Check for the usbhid(3) library on *BSD dnl Check for the usbhid(3) library on *BSD
CheckUSBHID() CheckUSBHID()
{ {
if test x$enable_joystick = xyes; then case "$host" in
AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) *-*-*bsd*)
if test x$have_libusbhid = xyes; then if test x$enable_joystick = xyes; then
AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"]) AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"]) if test x$have_libusbhid = xyes; then
USB_LIBS="$USB_LIBS -lusbhid" AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
else AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"]) USB_LIBS="$USB_LIBS -lusbhid"
AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"]) else
AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"]) AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
fi AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
save_CFLAGS="$CFLAGS" fi
CFLAGS="$CFLAGS $USB_CFLAGS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $USB_CFLAGS"
AC_MSG_CHECKING(for usbhid) AC_MSG_CHECKING(for usbhid)
have_usbhid=no have_usbhid=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_USB_H) #if defined(HAVE_USB_H)
#include <usb.h> #include <usb.h>
#endif #endif
#ifdef __DragonFly__ #ifdef __DragonFly__
# include <bus/usb/usb.h> # include <bus/usb/usb.h>
# include <bus/usb/usbhid.h> # include <bus/usb/usbhid.h>
#else #else
# include <dev/usb/usb.h> # include <dev/usb/usb.h>
# include <dev/usb/usbhid.h> # include <dev/usb/usbhid.h>
#endif #endif
#if defined(HAVE_USBHID_H) #if defined(HAVE_USBHID_H)
#include <usbhid.h> #include <usbhid.h>
#elif defined(HAVE_LIBUSB_H) #elif defined(HAVE_LIBUSB_H)
#include <libusb.h> #include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H) #elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
],[ ],[
struct report_desc *repdesc; struct report_desc *repdesc;
struct usb_ctl_report *repbuf; struct usb_ctl_report *repbuf;
hid_kind_t hidkind; hid_kind_t hidkind;
],[ ],[
have_usbhid=yes have_usbhid=yes
]) ])
AC_MSG_RESULT($have_usbhid) AC_MSG_RESULT($have_usbhid)
if test x$have_usbhid = xyes; then if test x$have_usbhid = xyes; then
AC_MSG_CHECKING(for ucr_data member of usb_ctl_report) AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
have_usbhid_ucr_data=no have_usbhid_ucr_data=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_USB_H) #if defined(HAVE_USB_H)
#include <usb.h> #include <usb.h>
#endif #endif
#ifdef __DragonFly__ #ifdef __DragonFly__
# include <bus/usb/usb.h> # include <bus/usb/usb.h>
# include <bus/usb/usbhid.h> # include <bus/usb/usbhid.h>
#else #else
# include <dev/usb/usb.h> # include <dev/usb/usb.h>
# include <dev/usb/usbhid.h> # include <dev/usb/usbhid.h>
#endif #endif
#if defined(HAVE_USBHID_H) #if defined(HAVE_USBHID_H)
#include <usbhid.h> #include <usbhid.h>
#elif defined(HAVE_LIBUSB_H) #elif defined(HAVE_LIBUSB_H)
#include <libusb.h> #include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H) #elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
],[ ],[
struct usb_ctl_report buf; struct usb_ctl_report buf;
if (buf.ucr_data) { } if (buf.ucr_data) { }
],[ ],[
have_usbhid_ucr_data=yes have_usbhid_ucr_data=yes
]) ])
if test x$have_usbhid_ucr_data = xyes; then if test x$have_usbhid_ucr_data = xyes; then
USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
fi
AC_MSG_RESULT($have_usbhid_ucr_data)
AC_MSG_CHECKING(for new usbhid API)
have_usbhid_new=no
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
#ifdef __DragonFly__
#include <bus/usb/usb.h>
#include <bus/usb/usbhid.h>
#else
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#endif
#if defined(HAVE_USBHID_H)
#include <usbhid.h>
#elif defined(HAVE_LIBUSB_H)
#include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h>
#endif
],[
report_desc_t d;
hid_start_parse(d, 1, 1);
],[
have_usbhid_new=yes
])
if test x$have_usbhid_new = xyes; then
USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
fi
AC_MSG_RESULT($have_usbhid_new)
AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
have_machine_joystick=no
AC_TRY_COMPILE([
#include <machine/joystick.h>
],[
struct joystick t;
],[
have_machine_joystick=yes
])
if test x$have_machine_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
fi
AC_MSG_RESULT($have_machine_joystick)
AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
have_joystick=yes
fi
CFLAGS="$save_CFLAGS"
fi fi
AC_MSG_RESULT($have_usbhid_ucr_data) ;;
esac
AC_MSG_CHECKING(for new usbhid API)
have_usbhid_new=no
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
#ifdef __DragonFly__
#include <bus/usb/usb.h>
#include <bus/usb/usbhid.h>
#else
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#endif
#if defined(HAVE_USBHID_H)
#include <usbhid.h>
#elif defined(HAVE_LIBUSB_H)
#include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h>
#endif
],[
report_desc_t d;
hid_start_parse(d, 1, 1);
],[
have_usbhid_new=yes
])
if test x$have_usbhid_new = xyes; then
USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
fi
AC_MSG_RESULT($have_usbhid_new)
AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
have_machine_joystick=no
AC_TRY_COMPILE([
#include <machine/joystick.h>
],[
struct joystick t;
],[
have_machine_joystick=yes
])
if test x$have_machine_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
fi
AC_MSG_RESULT($have_machine_joystick)
AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
have_joystick=yes
fi
CFLAGS="$save_CFLAGS"
fi
} }
dnl Check for clock_gettime() dnl Check for clock_gettime()

3
test/configure vendored
View File

@ -586,8 +586,8 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
SDL_TTF_LIB SDL_TTF_LIB
XLIB XLIB
GLLIB
GLESLIB GLESLIB
GLLIB
CPP CPP
XMKMF XMKMF
SDL_CONFIG SDL_CONFIG
@ -3874,6 +3874,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5
$as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; } $as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; }
if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then : if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then :