From 32cd611201e666894e4bbbde6ba046a9667a9782 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Sun, 13 Dec 2009 05:06:44 +0000 Subject: [PATCH] Checking in the 'build patch' from Jeremy Huddleston vintage 11/19/09 -- everything except the 'configure.ac' changes which break my Cygwin build git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@861 7f0cb862-5218-0410-a997-914c9d46530a --- src/Makefile.am | 4 ++-- src/freeglut_input_devices.c | 6 +----- src/freeglut_internal.h | 44 ++++++++++++++++++++++-------------------- src/freeglut_joystick.c | 21 ++++++++++---------- src/freeglut_main.c | 10 +++++----- 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 683f33f..5b0b00f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,9 +43,9 @@ lib@LIBRARY@_la_SOURCES = freeglut_callbacks.c \ # # Additional linker flags # -lib@LIBRARY@_la_LIBADD = $(LIBM) $(X_LIBS) $(GL_LIBS) $(LIBXXF86VM) $(LIBXI) +lib@LIBRARY@_la_LIBADD = $(GL_LIBS) $(X_LIBS) $(LIBM) lib@LIBRARY@_la_LDFLAGS = $(VERSION_INFO) -no-undefined -lib@LIBRARY@_la_CFLAGS = $(X_CFLAGS) $(EXPORT_FLAGS) +lib@LIBRARY@_la_CFLAGS = $(GL_FLAGS) $(X_CFLAGS) $(EXPORT_FLAGS) lib@LIBRARY@_la_CPPFLAGS= -I$(top_srcdir)/include # diff --git a/src/freeglut_input_devices.c b/src/freeglut_input_devices.c index 0dcb97f..04f5fd5 100755 --- a/src/freeglut_input_devices.c +++ b/src/freeglut_input_devices.c @@ -36,19 +36,15 @@ #include "freeglut_internal.h" #if TARGET_HOST_POSIX_X11 -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif #include -#include -#include #include #include -#include #include #include #include -#include typedef struct { int fd; diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 0ec9cc2..d8ae89f 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -28,7 +28,7 @@ #ifndef FREEGLUT_INTERNAL_H #define FREEGLUT_INTERNAL_H -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -41,6 +41,7 @@ /* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined? * XXX: If so, remove the first set of defined()'s below. */ +#if !defined(TARGET_HOST_POSIX_X11) && !defined(TARGET_HOST_MS_WINDOWS) && !defined(TARGET_HOST_MAC_OSX) #if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__) \ || defined(_WIN32) || defined(_WIN32_WCE) \ || ( defined(__CYGWIN__) && defined(X_DISPLAY_MISSING) ) @@ -58,6 +59,7 @@ # error "Unrecognized target host!" */ #endif +#endif /* Detect both SunPro and gcc compilers on Sun Solaris */ #if defined (__SVR4) && defined (__sun) @@ -109,7 +111,7 @@ # include # include # include -# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H +# ifdef HAVE_XXF86VM # include # endif /* If GLX is too old, we will fail during runtime when multisampling @@ -130,16 +132,16 @@ #include /* These are included based on autoconf directives. */ -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include # include -#elif HAVE_SYS_TIME_H +#elif defined(HAVE_SYS_TIME_H) # include #else # include @@ -159,15 +161,6 @@ # endif #endif -#if TARGET_HOST_MS_WINDOWS -# define HAVE_VPRINTF 1 -#endif - -#if !defined(HAVE_VPRINTF) && !defined(HAVE_DOPRNT) -/* XXX warning directive here? */ -# define HAVE_VPRINTF 1 -#endif - /* MinGW may lack a prototype for ChangeDisplaySettingsEx() (depending on the version?) */ #if TARGET_HOST_MS_WINDOWS && !defined(ChangeDisplaySettingsEx) LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID); @@ -189,12 +182,21 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); # define M_PI 3.14159265358979323846 #endif -#ifndef TRUE -# define TRUE 1 -#endif - -#ifndef FALSE -# define FALSE 0 +#ifdef HAVE_STDBOOL_H +# include +# ifndef TRUE +# define TRUE true +# endif +# ifndef FALSE +# define FALSE false +# endif +#else +# ifndef TRUE +# define TRUE 1 +# endif +# ifndef FALSE +# define FALSE 0 +# endif #endif /* General defines */ diff --git a/src/freeglut_joystick.c b/src/freeglut_joystick.c index 2a57e29..91fe226 100644 --- a/src/freeglut_joystick.c +++ b/src/freeglut_joystick.c @@ -33,7 +33,7 @@ #include #include "freeglut_internal.h" -#if HAVE_SYS_PARAM_H +#ifdef HAVE_SYS_PARAM_H # include #endif @@ -69,14 +69,15 @@ #if TARGET_HOST_POSIX_X11 # define _JS_MAX_AXES 16 -# if HAVE_SYS_IOCTL_H +# ifdef HAVE_SYS_IOCTL_H # include # endif -# if HAVE_FCNTL_H +# ifdef HAVE_FCNTL_H # include # endif -# if HAVE_ERRNO_H +# ifdef HAVE_ERRNO_H # include +# include # endif # if defined(__FreeBSD__) || defined(__NetBSD__) /* XXX The below hack is done until freeglut's autoconf is updated. */ @@ -240,7 +241,7 @@ static int fghJoystickFindUSBdev(char *name, char *out, int outlen) if (cp) return 1; } -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H else if (errno == EACCES) { if (!protection_warned) { fgWarning ( "Can't open %s for read!", buf ); @@ -265,7 +266,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os, if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 ) { -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H fgWarning ( "error: %s: %s", os->fname, strerror( errno ) ); #else fgWarning ( "error: %s", os->fname ); @@ -279,7 +280,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os, if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0) { /*** XXX {report_id} may not be the right variable? ***/ -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) ); #else fgWarning ( "error: %s%d", UHIDDEV, report_id ); @@ -676,7 +677,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) } } } -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H if ( len < 0 && errno != EAGAIN ) #else if ( len < 0 ) @@ -699,7 +700,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) if ( status != sizeof( struct js_event ) ) { -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H if ( errno == EAGAIN ) { /* Use the old values */ @@ -1317,7 +1318,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) joy->os->fd = open( joy->os->fname, O_RDONLY | O_NONBLOCK); -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H if( joy->os->fd < 0 && errno == EACCES ) fgWarning ( "%s exists but is not readable by you", joy->os->fname ); #endif diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 1c308df..19f584e 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -27,13 +27,13 @@ #include #include "freeglut_internal.h" -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H # include #endif #include -#if HAVE_VPRINTF +#ifdef HAVE_VFPRINTF # define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) -#elif HAVE_DOPRNT +#elif defined(HAVE__DOPRNT) # define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) #else # define VFPRINTF(s,f,a) @@ -59,7 +59,7 @@ struct GXKeyList gxKeyList; * 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 +#ifdef HAVE_LIMITS_H # include #endif #ifndef INT_MAX @@ -473,7 +473,7 @@ static void fghSleepForEvents( void ) wait.tv_usec = (msec % 1000) * 1000; err = select( socket+1, &fdset, NULL, NULL, &wait ); -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H if( ( -1 == err ) && ( errno != EINTR ) ) fgWarning ( "freeglut select() error: %d", errno ); #endif -- 1.7.10.4