Mercurial > sdl-ios-xcode
diff configure.in @ 381:bc1401311390
Wilbern Cobb submitted a fix for building BSD joystick support that should work on all BSD flavors.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 28 May 2002 20:01:29 +0000 |
parents | 6089cd59e3ca |
children | 74bdcae44bf5 |
line wrap: on
line diff
--- a/configure.in Tue May 28 19:31:32 2002 +0000 +++ b/configure.in Tue May 28 20:01:29 2002 +0000 @@ -1445,6 +1445,86 @@ fi } +dnl Check for the usbhid(3) library on *BSD +CheckUSBHID() +{ + if test x$enable_joystick = xyes; then + have_libusbhid=no + have_libusb=no + AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) + AC_CHECK_LIB(usb, hid_init, have_libusb=yes) + if test x$have_libusbhid = xyes; then + SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid" + fi + if test x$have_libusb = xyes; then + SYSTEM_LIBS="$SYSTEM_LIBS -lusb" + fi + + AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes) + AC_CHECK_HEADER(libusb.h, have_libusb_h=yes) + AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes) + if test x$have_usbhid_h = xyes; then + CFLAGS="$CFLAGS -DHAVE_USBHID_H" + fi + if test x$have_libusb_h = xyes; then + CFLAGS="$CFLAGS -DHAVE_LIBUSB_H" + fi + if test x$have_libusbhid_h = xyes; then + CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H" + fi + + AC_MSG_CHECKING(for usbhid) + have_usbhid=no + AC_TRY_COMPILE([ + #include <dev/usb/usb.h> + #include <dev/usb/usbhid.h> + #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 + ],[ + struct report_desc *repdesc; + struct usb_ctl_report *repbuf; + enum hid_kind hidkind; + ],[ + have_usbhid=yes + ]) + AC_MSG_RESULT($have_usbhid) + + if test x$have_usbhid = xyes; then + AC_MSG_CHECKING(for ucr_data member of usb_ctl_report) + have_usbhid_ucr_data=no + AC_TRY_COMPILE([ + #include <dev/usb/usb.h> + #include <dev/usb/usbhid.h> + #include <stdio.h> + #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 + ],[ + struct usb_ctl_report buf; + if (buf.ucr_data) { } + ],[ + have_usbhid_ucr_data=yes + ]) + if test x$have_usbhid_ucr_data = xyes; then + CFLAGS="$CFLAGS -DUSBHID_UCR_DATA" + fi + AC_MSG_RESULT($have_usbhid_ucr_data) + + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la" + fi + fi +} + case "$target" in *-*-linux*) ARCH=linux @@ -1598,6 +1678,7 @@ CheckAAlib CheckOpenGL CheckPTHREAD + CheckUSBHID # Set up files for the main() stub COPY_ARCH_SRC(src/main, linux, SDL_main.c) # Set up files for the audio library @@ -1607,12 +1688,6 @@ # AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" # AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" #fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd" - JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la" - SYSTEM_LIBS="$SYSTEM_LIBS -lusb" - fi # Set up files for the cdrom library if test x$enable_cdrom = xyes; then CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd" @@ -1652,6 +1727,7 @@ CheckAAlib CheckOpenGL CheckPTHREAD + CheckUSBHID # Set up files for the main() stub COPY_ARCH_SRC(src/main, linux, SDL_main.c) # Set up files for the audio library @@ -1660,12 +1736,6 @@ AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd" - JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la" - SYSTEM_LIBS="$SYSTEM_LIBS -lusb" - fi # Set up files for the cdrom library if test x$enable_cdrom = xyes; then CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd" @@ -1707,6 +1777,7 @@ CheckAAlib CheckOpenGL CheckPTHREAD + CheckUSBHID # Set up files for the main() stub COPY_ARCH_SRC(src/main, linux, SDL_main.c) # Set up files for the audio library @@ -1719,12 +1790,6 @@ if test x$have_oss = xyes; then SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio" fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd" - JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la" - SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid" - fi # Set up files for the cdrom library if test x$enable_cdrom = xyes; then CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"