From 3817d97ab70edd2bcc105b08e3b533945f19a451 Mon Sep 17 00:00:00 2001 From: spanne Date: Mon, 3 Jan 2005 11:22:59 +0000 Subject: [PATCH] autoconf'd and handling, removing MIN/MAX macros on the way. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@552 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/configure.ac | 2 +- freeglut/freeglut/src/freeglut_joystick.c | 7 +++---- freeglut/freeglut/src/freeglut_main.c | 18 +++++++++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/freeglut/freeglut/configure.ac b/freeglut/freeglut/configure.ac index a1f37be..63c2cb8 100644 --- a/freeglut/freeglut/configure.ac +++ b/freeglut/freeglut/configure.ac @@ -23,7 +23,7 @@ AC_SUBST([LIBXXF86VM]) # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([GL/gl.h GL/glu.h GL/glx.h fcntl.h sys/ioctl.h sys/time.h]) +AC_CHECK_HEADERS([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 save_CFLAGS="$CFLAGS" diff --git a/freeglut/freeglut/src/freeglut_joystick.c b/freeglut/freeglut/src/freeglut_joystick.c index 061a038..781d0dd 100644 --- a/freeglut/freeglut/src/freeglut_joystick.c +++ b/freeglut/freeglut/src/freeglut_joystick.c @@ -31,12 +31,11 @@ * Many thanks for Steve Baker for permission to pull from that library. */ -#if defined( __FreeBSD__ ) || defined( __NetBSD__ ) -# include -#endif - #include #include "freeglut_internal.h" +#if HAVE_SYS_PARAM_H +# include +#endif /* * Initial defines from "js.h" starting around line 33 with the existing "freeglut_joystick.c" diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 7c214dd..6f4bcec 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -28,7 +28,6 @@ #include #include "freeglut_internal.h" -#include #if TARGET_HOST_UNIX_X11 #include #include @@ -49,8 +48,15 @@ struct GXKeyList gxKeyList; #endif -#ifndef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) +/* + * Try to get the maximum value allowed for ints, falling back to the minimum + * guaranteed by ISO C99 if there is no suitable header. + */ +#if HAVE_LIMITS_H +# include +#endif +#ifndef INT_MAX +# define INT_MAX 32767 #endif #ifndef MIN @@ -445,8 +451,10 @@ static void fghSleepForEvents( void ) return; msec = fghNextTimer( ); - if( fghHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */ - msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */ + /* XXX Use GLUT timers for joysticks... */ + /* XXX Dumb; forces granularity to .01sec */ + if( fghHaveJoystick( ) && ( msec < 10 ) ) + msec = 10; #if TARGET_HOST_UNIX_X11 /*