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:
parent
394abb4298
commit
2ba754fbe6
3 changed files with 251 additions and 242 deletions
228
configure
vendored
228
configure
vendored
|
@ -21634,8 +21634,10 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h
|
|||
|
||||
CheckUSBHID()
|
||||
{
|
||||
if test x$enable_joystick = xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
|
||||
case "$host" in
|
||||
*-*-*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; }
|
||||
if ${ac_cv_lib_usbhid_hid_init+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
|
@ -21675,34 +21677,34 @@ if test "x$ac_cv_lib_usbhid_hid_init" = xyes; then :
|
|||
have_libusbhid=yes
|
||||
fi
|
||||
|
||||
if test x$have_libusbhid = xyes; then
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default"
|
||||
if test x$have_libusbhid = xyes; then
|
||||
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 :
|
||||
USB_CFLAGS="-DHAVE_USBHID_H"
|
||||
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 :
|
||||
USB_CFLAGS="-DHAVE_LIBUSBHID_H"
|
||||
fi
|
||||
|
||||
|
||||
USB_LIBS="$USB_LIBS -lusbhid"
|
||||
else
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
|
||||
USB_LIBS="$USB_LIBS -lusbhid"
|
||||
else
|
||||
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 :
|
||||
USB_CFLAGS="-DHAVE_USB_H"
|
||||
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 :
|
||||
USB_CFLAGS="-DHAVE_LIBUSB_H"
|
||||
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; }
|
||||
if ${ac_cv_lib_usb_hid_init+:} false; then :
|
||||
$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"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $USB_CFLAGS"
|
||||
save_CFLAGS="$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; }
|
||||
have_usbhid=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
have_usbhid=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
struct report_desc *repdesc;
|
||||
struct usb_ctl_report *repbuf;
|
||||
hid_kind_t hidkind;
|
||||
struct report_desc *repdesc;
|
||||
struct usb_ctl_report *repbuf;
|
||||
hid_kind_t hidkind;
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -21786,45 +21788,45 @@ main ()
|
|||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_usbhid=yes
|
||||
have_usbhid=yes
|
||||
|
||||
fi
|
||||
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; }
|
||||
|
||||
if test x$have_usbhid = xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5
|
||||
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_n "checking for ucr_data member of usb_ctl_report... " >&6; }
|
||||
have_usbhid_ucr_data=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
have_usbhid_ucr_data=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
struct usb_ctl_report buf;
|
||||
if (buf.ucr_data) { }
|
||||
struct usb_ctl_report buf;
|
||||
if (buf.ucr_data) { }
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -21832,47 +21834,47 @@ main ()
|
|||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_usbhid_ucr_data=yes
|
||||
have_usbhid_ucr_data=yes
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
if test x$have_usbhid_ucr_data = xyes; then
|
||||
USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5
|
||||
if test x$have_usbhid_ucr_data = xyes; then
|
||||
USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5
|
||||
$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; }
|
||||
have_usbhid_new=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
have_usbhid_new=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
report_desc_t d;
|
||||
hid_start_parse(d, 1, 1);
|
||||
report_desc_t d;
|
||||
hid_start_parse(d, 1, 1);
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -21880,29 +21882,29 @@ main ()
|
|||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_usbhid_new=yes
|
||||
have_usbhid_new=yes
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
if test x$have_usbhid_new = xyes; then
|
||||
USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5
|
||||
if test x$have_usbhid_new = xyes; then
|
||||
USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5
|
||||
$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; }
|
||||
have_machine_joystick=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
have_machine_joystick=no
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <machine/joystick.h>
|
||||
#include <machine/joystick.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
struct joystick t;
|
||||
struct joystick t;
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -21910,28 +21912,30 @@ main ()
|
|||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_machine_joystick=yes
|
||||
have_machine_joystick=yes
|
||||
|
||||
fi
|
||||
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
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5
|
||||
$as_echo "$have_machine_joystick" >&6; }
|
||||
|
||||
|
||||
$as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h
|
||||
|
||||
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
|
||||
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
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
CheckClockGettime()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue