From e5eb0d16eefdede24baf2ebd76090d85e594f774 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sun, 26 Oct 2014 22:05:31 +0100
Subject: Fix build on Haiku.


diff --git a/src/frontend/Makefile.am b/src/frontend/Makefile.am
index a0345ae..f401017 100644
--- a/src/frontend/Makefile.am
+++ b/src/frontend/Makefile.am
@@ -1,7 +1,7 @@
 AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(OPENSSL_CFLAGS)
 AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)
 AM_LDFLAGS  = $(HARDEN_LDFLAGS)
-LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(OPENSSL_LIBS)
+LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS) $(OPENSSL_LIBS)
 
 mosh_server_LDADD = $(LDADD) $(LIBUTIL)
 
diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc
index ae2505f..f809cc0 100644
--- a/src/frontend/mosh-server.cc
+++ b/src/frontend/mosh-server.cc
@@ -41,6 +41,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <strings.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <pwd.h>
diff --git a/src/util/pty_compat.cc b/src/util/pty_compat.cc
index 98fa22a..3bb1c52 100644
--- a/src/util/pty_compat.cc
+++ b/src/util/pty_compat.cc
@@ -39,7 +39,9 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#ifndef __HAIKU__
 #include <sys/stropts.h>
+#endif
 #include <termios.h>
 
 #include "pty_compat.h"
@@ -92,7 +94,7 @@ pid_t my_forkpty( int *amaster, char *name,
     return -1;
   }
 
-#ifndef _AIX
+#if !defined(_AIX) && !defined(__HAIKU__)
   if ( ioctl(slave, I_PUSH, "ptem") < 0 ||
        ioctl(slave, I_PUSH, "ldterm") < 0 ) {
     perror( "ioctl(I_PUSH)" );
-- 
1.8.3.4

