FreeBSD patch per e-mail from John Tsiombikas vintage 9/27/11, 10:37 AM

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@942 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2011-09-28 01:37:26 +00:00
parent 9b112ded4d
commit 747517066a
3 changed files with 22 additions and 20 deletions

View File

@ -42,11 +42,15 @@ AC_SUBST([LIBXI])
AC_SUBST([VERSION_INFO]) AC_SUBST([VERSION_INFO])
AC_SUBST([EXPORT_FLAGS]) AC_SUBST([EXPORT_FLAGS])
AC_CHECK_LIB([usbhid], [hid_init],
[LIBUSBHID=-lusbhid], [LIBUSBHID=])
AC_SUBST(LIBUSBHID)
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
save_CPPFLAGS="$CPPFLAGS" save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS" 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_HEADER_TIME
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h], [], [], [#include <X11/Xlib.h>]) AC_CHECK_HEADERS([X11/extensions/xf86vmode.h], [], [], [#include <X11/Xlib.h>])
AC_CHECK_HEADERS([X11/extensions/Xrandr.h]) AC_CHECK_HEADERS([X11/extensions/Xrandr.h])

View File

@ -44,7 +44,7 @@ lib@LIBRARY@_la_SOURCES = freeglut_callbacks.c \
# #
# Additional linker flags # 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_LDFLAGS = $(VERSION_INFO) -no-undefined
lib@LIBRARY@_la_CFLAGS = $(GL_FLAGS) $(X_CFLAGS) $(EXPORT_FLAGS) lib@LIBRARY@_la_CFLAGS = $(GL_FLAGS) $(X_CFLAGS) $(EXPORT_FLAGS)
lib@LIBRARY@_la_CPPFLAGS= -I$(top_srcdir)/include lib@LIBRARY@_la_CPPFLAGS= -I$(top_srcdir)/include

View File

@ -79,11 +79,11 @@
# include <errno.h> # include <errno.h>
# include <string.h> # include <string.h>
# endif # 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. */ /* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USB_JS 1 # define HAVE_USB_JS 1
# if defined(__FreeBSD__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/joystick.h> # include <sys/joystick.h>
# else # else
/* /*
@ -134,7 +134,7 @@
/* BSD defines from "jsBSD.cxx" around lines 42-270 */ /* 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 # ifdef HAVE_USB_JS
# if defined(__NetBSD__) # if defined(__NetBSD__)
@ -145,16 +145,14 @@
# else # else
# include <usb.h> # include <usb.h>
# endif # endif
# elif defined(__FreeBSD__) # elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# if __FreeBSD_version < 500000 # ifdef HAVE_USBHID_H
# include <libusbhid.h>
# else
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USBHID_H 1
# include <usbhid.h> # include <usbhid.h>
# else
# include <libusbhid.h>
# endif # endif
# endif # endif
# include <dev/usb/usb.h> # include <legacy/dev/usb/usb.h>
# include <dev/usb/usbhid.h> # include <dev/usb/usbhid.h>
/* Compatibility with older usb.h revisions */ /* Compatibility with older usb.h revisions */
@ -407,7 +405,7 @@ struct tagSFG_Joystick
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
# if defined(__FreeBSD__) || defined(__NetBSD__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
struct os_specific_s *os; struct os_specific_s *os;
# endif # endif
@ -475,7 +473,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
int status; int status;
#endif #endif
#if defined(__FreeBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
int len; int len;
#endif #endif
@ -612,7 +610,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
#endif #endif
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
# if defined(__FreeBSD__) || defined(__NetBSD__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
if ( joy->os->is_analog ) if ( joy->os->is_analog )
{ {
int status = read ( joy->os->fd, &joy->os->ajs, sizeof(joy->os->ajs) ); int status = read ( joy->os->fd, &joy->os->ajs, sizeof(joy->os->ajs) );
@ -764,7 +762,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
} }
if ( buttons ) 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 */ *buttons = ( joy->js.b1 ? 1 : 0 ) | ( joy->js.b2 ? 2 : 0 ); /* XXX Should not be here -- BSD is handled earlier */
# else # else
*buttons = joy->js.buttons; *buttons = joy->js.buttons;
@ -1074,7 +1072,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
CFTypeRef topLevelElement; CFTypeRef topLevelElement;
#endif #endif
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
# if defined( __FreeBSD__ ) || defined( __NetBSD__ ) # if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
char *cp; char *cp;
# endif # endif
# ifdef JS_NEW # ifdef JS_NEW
@ -1310,7 +1308,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
#endif #endif
#if TARGET_HOST_POSIX_X11 #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++ ) for( i = 0; i < _JS_MAX_AXES; i++ )
joy->os->cache_axes[ i ] = 0.0f; joy->os->cache_axes[ i ] = 0.0f;
@ -1576,7 +1574,7 @@ static void fghJoystickInit( int ident )
#endif #endif
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
# if defined( __FreeBSD__ ) || defined( __NetBSD__ ) # if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
fgJoystick[ ident ]->id = ident; fgJoystick[ ident ]->id = ident;
fgJoystick[ ident ]->error = GL_FALSE; fgJoystick[ ident ]->error = GL_FALSE;
@ -1645,7 +1643,7 @@ void fgJoystickClose( void )
#endif #endif
#if TARGET_HOST_POSIX_X11 #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]->os )
{ {
if( ! fgJoystick[ ident ]->error ) if( ! fgJoystick[ ident ]->error )