--- src/numbers.c.orig	Sun Sep 27 20:03:39 2009
+++ src/numbers.c	Sun Sep 27 20:03:49 2009
@@ -70,7 +70,7 @@ DEFSTRING(domain_error, "Domain error");
 #  define LONG_LONG_MIN LONGLONG_MIN
 #  define LONG_LONG_MAX LONGLONG_MAX
 # elif defined (LLONG_MIN)
-   /* Solaris uses LLONG_ */
+   /* Solaris and OpenBSD uses LLONG_ */
 #  define LONG_LONG_MIN LLONG_MIN
 #  define LONG_LONG_MAX LLONG_MAX
 # endif

--- src/repint.h.orig	Sun Sep 27 20:04:02 2009
+++ src/repint.h	Sun Sep 27 20:04:49 2009
@@ -26,8 +26,16 @@
 #endif
 
 /* Maximum/minimum macros. Don't use when X or Y have side-effects! */
-#define MAX(x,y) (((x) > (y)) ? (x) : (y))
-#define MIN(x,y) (((x) < (y)) ? (x) : (y))
+#ifdef __OpenBSD__
+    /* MAX and MIN these are defined in <sys/param.h> on OpenBSD
+     * We include that here as sometimes it's included in other
+     * places and sometimes not - this ensures we don't redefine
+     * these two macros */
+# include <sys/param.h>
+#else
+# define MAX(x,y) (((x) > (y)) ? (x) : (y))
+# define MIN(x,y) (((x) < (y)) ? (x) : (y))
+#endif
 #define POS(x)   MAX(x, 0)
 #define ABS(x)   MAX(x, -(x))
 
