From: <fa...@us...> - 2011-09-28 01:37:36
|
Revision: 942 http://freeglut.svn.sourceforge.net/freeglut/?rev=942&view=rev Author: fayjf Date: 2011-09-28 01:37:26 +0000 (Wed, 28 Sep 2011) Log Message: ----------- FreeBSD patch per e-mail from John Tsiombikas vintage 9/27/11, 10:37 AM Modified Paths: -------------- trunk/freeglut/freeglut/configure.ac trunk/freeglut/freeglut/src/Makefile.am trunk/freeglut/freeglut/src/freeglut_joystick.c Modified: trunk/freeglut/freeglut/configure.ac =================================================================== --- trunk/freeglut/freeglut/configure.ac 2011-09-28 01:24:32 UTC (rev 941) +++ trunk/freeglut/freeglut/configure.ac 2011-09-28 01:37:26 UTC (rev 942) @@ -42,11 +42,15 @@ 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]) Modified: trunk/freeglut/freeglut/src/Makefile.am =================================================================== --- trunk/freeglut/freeglut/src/Makefile.am 2011-09-28 01:24:32 UTC (rev 941) +++ trunk/freeglut/freeglut/src/Makefile.am 2011-09-28 01:37:26 UTC (rev 942) @@ -44,7 +44,7 @@ # # Additional linker flags # -lib@LIBRARY@_la_LIBADD = $(GL_LIBS) $(X_LIBS) $(LIBM) +lib@LIBRARY@_la_LIBADD = $(GL_LIBS) $(X_LIBS) $(LIBM) $(LIBUSBHID) lib@LIBRARY@_la_LDFLAGS = $(VERSION_INFO) -no-undefined lib@LIBRARY@_la_CFLAGS = $(GL_FLAGS) $(X_CFLAGS) $(EXPORT_FLAGS) lib@LIBRARY@_la_CPPFLAGS= -I$(top_srcdir)/include Modified: trunk/freeglut/freeglut/src/freeglut_joystick.c =================================================================== --- trunk/freeglut/freeglut/src/freeglut_joystick.c 2011-09-28 01:24:32 UTC (rev 941) +++ trunk/freeglut/freeglut/src/freeglut_joystick.c 2011-09-28 01:37:26 UTC (rev 942) @@ -79,11 +79,11 @@ # 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 /* @@ -134,7 +134,7 @@ /* 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__) @@ -145,16 +145,14 @@ # 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 */ @@ -407,7 +405,7 @@ #if TARGET_HOST_POSIX_X11 -# if defined(__FreeBSD__) || defined(__NetBSD__) +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) struct os_specific_s *os; # endif @@ -475,7 +473,7 @@ int status; #endif -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) int len; #endif @@ -612,7 +610,7 @@ #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) ); @@ -764,7 +762,7 @@ } 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; @@ -1074,7 +1072,7 @@ 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 @@ -1310,7 +1308,7 @@ #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; @@ -1576,7 +1574,7 @@ #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; @@ -1645,7 +1643,7 @@ #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 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |