From 392fc2240718d68c1e0ce62cc11c1e894ba2cd95 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Wed, 30 Oct 2013 21:35:40 -0600
Subject: import old patch


diff --git a/configure b/configure
index e08bbce..a39e9e4 100755
--- a/configure
+++ b/configure
@@ -285,6 +285,10 @@ case "$bytecc,$host" in
     bytecccompopts="-fno-defer-pop $gcc_warnings"
     # No -lm library
     mathlib="";;
+  *,*-*-haiku*)
+    bytecccompopts="-fno-defer-pop $gcc_warnings"
+    # No -lm library
+    mathlib="";;
   gcc,alpha*-*-osf*)
     bytecccompopts="-fno-defer-pop $gcc_warnings"
     if cc="$bytecc" sh ./hasgot -mieee; then
@@ -614,6 +618,9 @@ if test $withsharedlibs = "yes"; then
       byteccrpath="-Wl,-rpath,"
       mksharedlibrpath="-Wl,-rpath,"
       shared_libraries_supported=true;;
+    *-*haiku*)
+      mksharedlib="$bytecc -shared"
+      shared_libraries_supported=true;;  
   esac
 fi
 
@@ -679,6 +686,7 @@ case "$host" in
                                   arch=i386; system=solaris
                                 fi;;
   i[3456]86-*-beos*)            arch=i386; system=beos;;
+  i[3456]86-*-haiku*)            arch=i386; system=beos;;
   i[3456]86-*-cygwin*)          arch=i386; system=cygwin;;
   i[3456]86-*-darwin*)          if $arch64; then
                                   arch=amd64; system=macosx
@@ -901,6 +909,11 @@ elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; th
   cclibs="$cclibs -lnsl -lsocket"
   echo "#define HAS_SOCKETS" >> s.h
   has_sockets=yes
+elif sh ./hasgot -lnetwork socket socketpair bind listen accept connect; then
+  echo "You have BSD sockets (with libraries '-lnetwork')"
+  cclibs="$cclibs -lnetwork"
+  echo "#define HAS_SOCKETS" >> s.h
+  has_sockets=yes
 fi
 
 if sh ./hasgot -i sys/socket.h -t socklen_t; then
diff --git a/otherlibs/unix/nice.c b/otherlibs/unix/nice.c
index 400543c..94aa025 100644
--- a/otherlibs/unix/nice.c
+++ b/otherlibs/unix/nice.c
@@ -24,7 +24,11 @@ CAMLprim value unix_nice(value incr)
 {
   int ret;
   errno = 0;
+#ifdef __HAIKU__
+  ret = 0;
+#else
   ret = nice(Int_val(incr));
+#endif
   if (ret == -1 && errno != 0) uerror("nice", Nothing);
   return Val_int(ret);
 }
-- 
1.8.3.4

