--- ./src/m/sparc.h.orig	Sat May 16 15:44:50 1998
+++ ./src/m/sparc.h	Sat May 16 15:47:05 1998
@@ -50,7 +50,7 @@
 
 #define SEGMENT_MASK (SEGSIZ - 1)
 
-#if ! defined (__NetBSD__) && ! defined (__linux__)
+#if ! defined (__NetBSD__) && ! defined (__linux__) && !defined (__OpenBSD__)
 /* This really belongs in s/sun.h.  */
 
 /* Data type of load average, as read out of kmem.  */
@@ -71,4 +71,4 @@
 
 #define A_TEXT_SEEK(HDR) (N_TXTOFF (hdr) + sizeof (hdr))
 
-#endif /* not Linux or NetBSD */
+#endif /* not Linux or NetBSD or OpenBSD */
--- ./src/s/openbsd.h.orig	Sat May 16 15:51:40 1998
+++ ./src/s/openbsd.h	Sat May 16 15:54:49 1998
@@ -0,0 +1,12 @@
+/* s/ file for openbsd systems. */
+
+/* Get most of the stuff from bsd4.3 */
+#include "bsd4-3.h"
+
+/* OpenBSD alpha has no shared libs yet. */
+#if defined (__alpha__) && !defined (__ELF__)
+#define NO_SHARED_LIBS
+#endif
+
+/* Get the rest of the stuff from NetBSD */
+#include "netbsd.h"
--- ./src/getloadavg.c.orig	Sat May 16 15:39:01 1998
+++ ./src/getloadavg.c	Sat May 16 15:44:16 1998
@@ -58,6 +58,7 @@
    __linux__			Linux: assumes /proc filesystem mounted.
    				Support from Michael K. Johnson.
    __NetBSD__			NetBSD: assumes /kern filesystem mounted.
+   __OpenBSD__			OpenBSD: dito.
 
    In addition, to avoid nesting many #ifdefs, we internally set
    LDAV_DONE to indicate that the load average has been computed.
@@ -621,7 +622,7 @@
     loadavg[elem] = load_ave[elem];
 #endif /* __linux__ */
 
-#if !defined (LDAV_DONE) && defined (__NetBSD__)
+#if !defined (LDAV_DONE) && defined (__NetBSD__) || defined (__OpenBSD__))
 #define LDAV_DONE
 #undef LOAD_AVE_TYPE
 
@@ -645,7 +646,7 @@
 
   for (elem = 0; elem < nelem; elem++)
     loadavg[elem] = (double) load_ave[elem] / (double) scale;
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ or __OpenBSD__ */
 
 #if !defined (LDAV_DONE) && defined (NeXT)
 #define LDAV_DONE
--- ./src/malloc.c.orig	Sat May 16 15:47:33 1998
+++ ./src/malloc.c	Sat May 16 15:49:06 1998
@@ -186,11 +186,11 @@
 #ifndef HPUX
 /* not sure where this for NetBSD should really go
    and it probably applies to other systems */
-#if !defined(__NetBSD__) && !defined(__bsdi__)
+#if !defined(__NetBSD__) && !defined(__bsdi__) && !defined(__OpenBSD__)
 extern void *sbrk (ptrdiff_t);
 #else
 extern char *sbrk ();
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ or __OpenBSD__ */
 #endif /* HPUX */
 #else
 extern void *sbrk ();
--- ./src/mem-limits.h.orig	Sat May 16 15:49:36 1998
+++ ./src/mem-limits.h	Sat May 16 15:51:02 1998
@@ -61,7 +61,7 @@
 #include <sys/resource.h>
 #endif
 
-#if defined(__bsdi__) || defined(__NetBSD__) || defined(__linux__)
+#if defined(__bsdi__) || defined(__NetBSD__) || defined(__linux__) || defined(__OpenBSD__)
 #if defined(__linux__) && defined (powerpc)	/*Added by Fukui*/
 #else					/*Added by Fukui*/
 #define BSD4_2
--- ./src/unexec.c.orig	Sat May 16 15:55:16 1998
+++ ./src/unexec.c	Sat May 16 15:56:29 1998
@@ -294,11 +294,11 @@
 #ifndef HPUX
 /* not sure where this for NetBSD should really go
    and it probably applies to other systems */
-#if !defined(__NetBSD__) && !defined(__bsdi__)
+#if !defined(__NetBSD__) && !defined(__bsdi__) && !defined(__OpenBSD__)
 extern void *sbrk (ptrdiff_t);
 #else
 extern char *sbrk ();
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ or __OpenBSD__ */
 #endif /* HPUX */
 #else
 extern void *sbrk ();
--- ./config.sub.orig	Sat May 16 15:27:48 1998
+++ ./config.sub	Sat May 16 15:30:06 1998
@@ -678,7 +678,7 @@
 	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -cygwin32* | -pe* | -psos* | -moss* )
+	      | -cygwin32* | -pe* | -psos* | -moss* | -openbsd* )
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-sunos5*)
--- ./configure.in.orig	Sat May 16 15:30:30 1998
+++ ./configure.in	Sat May 16 15:36:14 1998
@@ -1038,6 +1038,7 @@
 case "$canonical" in
   *-*-linux*    ) opsys=linux ;;
   *-*-netbsd*   ) opsys=netbsd ;;
+  *-*-openbsd*	) opsys=openbsd ;;
   *-*-nextstep* ) opsys=nextstep ;;
   *-*-vms       ) opsys=vms ;;
 
@@ -1097,6 +1098,19 @@
       pmax-*-netbsd*  | mips-*-netbsd*  )  machine=pmax ;;
     esac
   ;;
+
+  dnl OpenBSD ports
+  *-*-openbsd* )
+    case "${canonical}" in
+      alpha*-*-openbsd*)	machine=alpha ;;
+      i386-*-openbsd*)		machine=intel386 ;;
+      m68k-*-openbsd*)		machine=hp9000s300 ;;
+      mipsel-*-openbsd*)	machine=pmax ;;
+      ns32k-*-openbsd*)		machine=ns32000 ;;
+      sparc-*-openbsd*)		machine=sparc ;;
+      vax-*-openbsd*)		machine=vax ;;
+     esac
+   ;;
 
   dnl Acorn RISCiX:
   arm-acorn-riscix1.1* ) machine=acorn opsys=riscix1-1 ;;
