diff -r b9846bae810e src/hostfs.c
--- a/src/hostfs.c	Wed Nov 06 22:11:19 2013 +0000
+++ b/src/hostfs.c	Thu Nov 07 23:40:23 2013 +0000
@@ -31,7 +31,7 @@
 #else
 #include <unistd.h>
 #endif
-#if defined __unix || defined __MACH__
+#if defined __unix || defined __MACH__ || defined __OpenBSD__
 #include <utime.h>
 #else
 #include <sys/utime.h>
diff -r b9846bae810e src/rpcemu.h
--- a/src/rpcemu.h	Wed Nov 06 22:11:19 2013 +0000
+++ b/src/rpcemu.h	Thu Nov 07 23:40:23 2013 +0000
@@ -32,15 +32,17 @@
 #endif
 
 
-#ifdef __MACH__
+#if defined __MACH__ || defined __OpenBSD__
 #define fseeko64(_a, _b, _c) fseeko(_a, _b, _c)
 #define ftello64(stream) ftello(stream)
 #define fopen64(_a, _b) fopen(_a, _b)
 #define off64_t off_t
 #endif
 
-#if defined _BIG_ENDIAN || defined __BIG_ENDIAN__
+#if defined __BIG_ENDIAN__ 
 	#define _RPCEMU_BIG_ENDIAN
+#elif defined _BIG_ENDIAN && _BYTE_ORDER == _BIG_ENDIAN
+	#define RPCEMU_BIG_ENDIAN
 #endif
 
 /*This determines whether RPCemu can use hardware to blit and scale the display.
Good evening,
I've attached below a tentative patch to get RPCEmu building/running on OpenBSD (tested on 5.4-release, using the allegro from packages).  All that needed changing was a little preprocessor stuff :-).
This fiddles with the following things:
1. Under OpenBSD, off_t is always 64-bit, so there's no separate fseeko64() etc.  There's already something for this for Mach in rpcemu.h, so I've added ' || defined __OpenBSD__' to switch this code in for OpenBSD too.
2. hostfs.c was looking for utime.h in the wrong place --- whether to look for sys/utime.h or just utime.h was defined by __MACH__ or __unix being defined.  OpenBSD doesn't define __unix under gcc.  So I've added ' || defined __OpenBSD__' to that line, too.
3. rpcemu.h was deciding that the machine I was on was big-endian.  This is because it was testing for _BIG_ENDIAN being /defined/ -- under OpenBSD both _BIG_ENDIAN and _LITTLE_ENDIAN are /always/ defined, and _BYTE_ORDER switches between them.  Likewise, so are BIG_ENDIAN and LITTLE_ENDIAN, with BYTE_ORDER switching between /those/.  So the patch checks whether _BIG_ENDIAN is defined and then checks whether _BYTE_ORDER is is _BIG_ENDIAN.  It doesn't remove the __BIG_ENDIAN__ check.
Now, I don't actually /have/ any non-x86 kit handy here, and certainly not any big-endian stuff.  So I hope I haven't broken anything critical.  This certainly builds/runs under Linux/x86 and OpenBSD/x86.
Any thoughts/comments? :)
Thanks
Rob Mitchelmore
 
No comments:
Post a Comment