AC_SUBST([VERSION_INFO])
AC_SUBST([EXPORT_FLAGS])
+AC_CHECK_LIB([usbhid], [hid_init],
+ [LIBUSBHID=-lusbhid], [LIBUSBHID=])
+AC_SUBST(LIBUSBHID)
+
# Checks for header files.
AC_HEADER_STDC
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-AC_CHECK_HEADERS([usbhid.h errno.h GL/gl.h GL/glu.h GL/glx.h fcntl.h limits.h sys/ioctl.h sys/param.h sys/time.h])
+AC_CHECK_HEADERS([usbhid.h libusbhid.h errno.h GL/gl.h GL/glu.h GL/glx.h fcntl.h limits.h sys/ioctl.h sys/param.h sys/time.h])
AC_HEADER_TIME
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h], [], [], [#include <X11/Xlib.h>])
AC_CHECK_HEADERS([X11/extensions/Xrandr.h])
# include <errno.h>
# include <string.h>
# endif
-# if defined(__FreeBSD__) || defined(__NetBSD__)
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USB_JS 1
-# if defined(__FreeBSD__)
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/joystick.h>
# else
/*
/* BSD defines from "jsBSD.cxx" around lines 42-270 */
-#if defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# ifdef HAVE_USB_JS
# if defined(__NetBSD__)
# else
# include <usb.h>
# endif
-# elif defined(__FreeBSD__)
-# if __FreeBSD_version < 500000
-# include <libusbhid.h>
-# else
-/* XXX The below hack is done until freeglut's autoconf is updated. */
-# define HAVE_USBHID_H 1
+# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# ifdef HAVE_USBHID_H
# include <usbhid.h>
+# else
+# include <libusbhid.h>
# endif
# endif
-# include <dev/usb/usb.h>
+# include <legacy/dev/usb/usb.h>
# include <dev/usb/usbhid.h>
/* Compatibility with older usb.h revisions */
#if TARGET_HOST_POSIX_X11
-# if defined(__FreeBSD__) || defined(__NetBSD__)
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
struct os_specific_s *os;
# endif
int status;
#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
int len;
#endif
#endif
#if TARGET_HOST_POSIX_X11
-# if defined(__FreeBSD__) || defined(__NetBSD__)
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
if ( joy->os->is_analog )
{
int status = read ( joy->os->fd, &joy->os->ajs, sizeof(joy->os->ajs) );
}
if ( buttons )
-# if defined( __FreeBSD__ ) || defined( __NetBSD__ )
+# if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
*buttons = ( joy->js.b1 ? 1 : 0 ) | ( joy->js.b2 ? 2 : 0 ); /* XXX Should not be here -- BSD is handled earlier */
# else
*buttons = joy->js.buttons;
CFTypeRef topLevelElement;
#endif
#if TARGET_HOST_POSIX_X11
-# if defined( __FreeBSD__ ) || defined( __NetBSD__ )
+# if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
char *cp;
# endif
# ifdef JS_NEW
#endif
#if TARGET_HOST_POSIX_X11
-#if defined( __FreeBSD__ ) || defined( __NetBSD__ )
+#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
for( i = 0; i < _JS_MAX_AXES; i++ )
joy->os->cache_axes[ i ] = 0.0f;
#endif
#if TARGET_HOST_POSIX_X11
-# if defined( __FreeBSD__ ) || defined( __NetBSD__ )
+# if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
fgJoystick[ ident ]->id = ident;
fgJoystick[ ident ]->error = GL_FALSE;
#endif
#if TARGET_HOST_POSIX_X11
-#if defined( __FreeBSD__ ) || defined( __NetBSD__ )
+#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
if( fgJoystick[ident]->os )
{
if( ! fgJoystick[ ident ]->error )