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: https://svn.code.sf.net/p/freeglut/code/trunk@861 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2009-12-13 05:06:44 +00:00
parent ab90771c87
commit e2a89d2678
5 changed files with 42 additions and 43 deletions

View File

@ -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
#

View File

@ -36,19 +36,15 @@
#include "freeglut_internal.h"
#if TARGET_HOST_POSIX_X11
#if HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <sys/ioctl.h>
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/types.h>
typedef struct {
int fd;

View File

@ -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 <X11/Xatom.h>
# include <X11/keysym.h>
# include <X11/extensions/XInput.h>
# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
# ifdef HAVE_XXF86VM
# include <X11/extensions/xf86vmode.h>
# endif
/* If GLX is too old, we will fail during runtime when multisampling
@ -130,16 +132,16 @@
#include <stdlib.h>
/* These are included based on autoconf directives. */
#if HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if TIME_WITH_SYS_TIME
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#elif HAVE_SYS_TIME_H
#elif defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#else
# include <time.h>
@ -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
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
# ifndef TRUE
# define TRUE true
# endif
# ifndef FALSE
# define FALSE false
# endif
#else
# ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# endif
# ifndef FALSE
# define FALSE 0
# endif
#endif
/* General defines */

View File

@ -33,7 +33,7 @@
#include <GL/freeglut.h>
#include "freeglut_internal.h"
#if HAVE_SYS_PARAM_H
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#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 <sys/ioctl.h>
# endif
# if HAVE_FCNTL_H
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# if HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
# include <errno.h>
# include <string.h>
# 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

View File

@ -27,13 +27,13 @@
#include <GL/freeglut.h>
#include "freeglut_internal.h"
#if HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#include <stdarg.h>
#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 <limits.h>
#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