--- src/runtime/arch.h	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/arch.h	2016-12-23 22:05:10.590132243 +1100
@@ -12,6 +12,9 @@
 #ifndef __ARCH_H__
 #define __ARCH_H__
 
+#ifndef __GLIBC__
+#include <signal.h>
+#endif
 #include "os.h"
 #include "signal.h"
 #include "thread.h"
--- src/runtime/interrupt.h	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/interrupt.h	2016-12-23 22:01:01.750119405 +1100
@@ -14,6 +14,9 @@
 
 #include "runtime.h"
 #include <string.h>
+#ifndef __GLIBC__
+#include <signal.h>
+#endif
 
 extern void get_current_sigmask(sigset_t *sigset);
 
--- src/runtime/linux-os.h	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/linux-os.h	2016-12-23 22:01:51.218121957 +1100
@@ -24,7 +24,11 @@
 #include <linux/version.h>
 
 // Needs to be defined before including target-arch.h
+#ifdef __GLIBC__
 typedef caddr_t os_vm_address_t;
+#else
+typedef void *os_vm_address_t;
+#endif
 typedef size_t os_vm_size_t;
 typedef off_t os_vm_offset_t;
 typedef int os_vm_prot_t;
--- src/runtime/os.h	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/os.h	2016-12-23 22:05:29.678133228 +1100
@@ -17,6 +17,9 @@
 
 #define _OS_H_INCLUDED_
 
+#ifndef __GLIBC__
+#include <signal.h>
+#endif
 #include "sbcl.h"
 #include "runtime.h"
 
--- src/runtime/runtime.h	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/runtime.h	2016-12-23 22:05:59.766134780 +1100
@@ -165,7 +165,9 @@
 void dyndebug_init(void);
 
 #if QSHOW_SIGNAL_SAFE == 1 && !defined(LISP_FEATURE_WIN32)
-
+#ifndef __GLIBC__
+typedef struct __sigset_t sigset_t;
+#endif
 extern sigset_t blockable_sigset;
 
 #define QSHOW_BLOCK                                             \
--- src/runtime/wrap.c	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/wrap.c	2016-12-23 22:02:15.792123225 +1100
@@ -35,7 +35,10 @@
 #include <errno.h>
 #include <limits.h>
 #include <fcntl.h>
 #include <math.h>
+#ifndef __GLIBC__
+#include <time.h>
+#endif
 
 #ifndef LISP_FEATURE_WIN32
 #include <pwd.h>
--- src/runtime/GNUmakefile	2016-11-30 08:07:36.000000000 +1100
+++ src/runtime/GNUmakefile	2016-12-17 16:41:46.823387383 +1100
@@ -24,7 +24,7 @@
 
 include ../../output/prefix.def
 
-CFLAGS = -g -Wall -Wsign-compare -O3
+CFLAGS = -g -Wall -Wsign-compare -O3 -D_GNU_SOURCE=1
 ASFLAGS = $(CFLAGS)
 CPPFLAGS = -I. -DSBCL_PREFIX=\"$(SBCL_PREFIX)\"
 
--- contrib/sb-bsd-sockets/constants.lisp.orig
+++ contrib/sb-bsd-sockets/constants.lisp
@@ -93,8 +93,8 @@
  (:integer EAFNOSUPPORT "EAFNOSUPPORT")
  (:integer EINPROGRESS "EINPROGRESS")
 
- (:integer NETDB-INTERNAL #+hpux "h_NETDB_INTERNAL" #-hpux "NETDB_INTERNAL" "See errno.")
- (:integer NETDB-SUCCESS #+hpux "h_NETDB_SUCCESS" #-hpux "NETDB_SUCCESS" "No problem.")
+ (:integer NETDB-INTERNAL #+hpux "h_NETDB_INTERNAL" #-hpux "EAI_BADFLAGS" "See errno.")
+ (:integer NETDB-SUCCESS #+hpux "h_NETDB_SUCCESS" #-hpux "F_OK" "No problem.")
  (:integer HOST-NOT-FOUND "HOST_NOT_FOUND" "Authoritative Answer Host not found.")
  (:integer TRY-AGAIN "TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
  (:integer NO-RECOVERY "NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
--- src/runtime/linux-os.c.orig
+++ src/runtime/linux-os.c
@@ -181,6 +181,9 @@
 int
 isnptl (void)
 {
+#ifndef __GLIBC__
+  return 1;
+#endif
   size_t n = confstr (_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
   if (n > 0) {
       char *buf = alloca (n);
