Patched to compile on Cygwin.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 29 Jun 2002 10:23:17 +0000
changeset 310 f8bca4a93fd5
parent 309 a8615a87be0a
child 311 8a4ee9ab0fc3
Patched to compile on Cygwin.
configure.in
platform/posix.c
platform/unix.c
platform/win32.c
--- a/configure.in	Sat Jun 29 04:10:11 2002 +0000
+++ b/configure.in	Sat Jun 29 10:23:17 2002 +0000
@@ -205,6 +205,16 @@
 
 AC_MSG_RESULT([$this_is_beos])
 
+AC_MSG_CHECKING([if this is Cygwin])
+if test x$build_os = xcygwin; then
+  this_is_cygwin=yes
+  CFLAGS="$CFLAGS -DWIN32"
+else
+  this_is_cygwin=no
+fi
+
+AC_MSG_RESULT([$this_is_cygwin])
+
 this_is_macosx=no
 if test x$we_have_sed = xyes; then
   AC_MSG_CHECKING([if this is MacOS X])
@@ -237,6 +247,7 @@
 AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
 AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
 AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes)
+AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes)
 
 LDFLAGS="$LDFLAGS -no-undefined"
 
--- a/platform/posix.c	Sat Jun 29 04:10:11 2002 +0000
+++ b/platform/posix.c	Sat Jun 29 10:23:17 2002 +0000
@@ -10,6 +10,8 @@
 #  include <config.h>
 #endif
 
+#if (!defined WIN32)
+
 #if (defined __STRICT_ANSI__)
 #define __PHYSFS_DOING_STRICT_ANSI__
 #endif
@@ -512,5 +514,7 @@
     return statbuf.st_mtime;
 } /* __PHYSFS_platformGetLastModTime */
 
+#endif /* !defined WIN32 */
+
 /* end of posix.c ... */
 
--- a/platform/unix.c	Sat Jun 29 04:10:11 2002 +0000
+++ b/platform/unix.c	Sat Jun 29 10:23:17 2002 +0000
@@ -12,6 +12,10 @@
 
 #if (!defined __BEOS__) /* BeOS uses beos.cpp and posix.c ... */
 
+#if (defined WIN32) /* cygwin/mingw32? */
+#include "win32.c"  /* !!! FIXME: holy friggin' hack. */
+#else
+
 #if ((defined __APPLE__) && (defined __MACH__))
 #  if (!defined __DARWIN__)
 #    define __DARWIN__
@@ -302,6 +306,8 @@
     pthread_mutex_unlock((pthread_mutex_t *) mutex);
 } /* __PHYSFS_platformReleaseMutex */
 
+#endif /* win32 check. */
+
 #endif /* !defined __BEOS__ */
 
 /* end of unix.c ... */
--- a/platform/win32.c	Sat Jun 29 04:10:11 2002 +0000
+++ b/platform/win32.c	Sat Jun 29 10:23:17 2002 +0000
@@ -20,6 +20,10 @@
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
 
+#ifndef _MSC_VER /* for Cygwin, etc. */
+#define _alloca alloca
+#endif
+
 #define LOWORDER_UINT64(pos)       (PHYSFS_uint32)(pos & 0x00000000FFFFFFFF)
 #define HIGHORDER_UINT64(pos)      (PHYSFS_uint32)(pos & 0xFFFFFFFF00000000)
 
@@ -701,7 +705,7 @@
     return retval;
 }
 
-PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, void *buffer,
+PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
                                      PHYSFS_uint32 size, PHYSFS_uint32 count)
 {
     HANDLE FileHandle;