From aacc2ed7b074730d2ff7f03c6d162a578e73e059 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 10 Apr 2014 16:03:33 +0000
Subject: initial Haiku patch


diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index d768dc5..21e3fd5 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -43,6 +43,27 @@ INSTALL_SCHEMES = {
         'data'   : '$base',
         },
     'nt': WINDOWS_SCHEME,
+    'haiku': {
+        'purelib': '$base/non-packaged/lib/python$py_version_short/site-packages',
+        'platlib': '$platbase/non-packaged/lib/python$py_version_short/site-packages',
+        'headers': '$base/non-packaged/develop/headers/python$py_version_short/$dist_name',
+        'scripts': '$base/non-packaged/bin',
+        'data'   : '$base/non-packaged',
+        },
+    'haiku_vendor': {
+        'purelib': '$base/lib/python$py_version_short/vendor-packages',
+        'platlib': '$platbase/lib/python$py_version_short/vendor-packages',
+        'headers': '$base/develop/headers/python$py_version_short/$dist_name',
+        'scripts': '$base/bin',
+        'data'   : '$base',
+        },
+    'haiku_home': {
+        'purelib': '$base/lib/python',
+        'platlib': '$base/lib/python',
+        'headers': '$base/develop/headers/python/$dist_name',
+        'scripts': '$base/bin',
+        'data'   : '$base',
+        },
     }
 
 # user site schemes
@@ -64,6 +85,14 @@ if HAS_USER_SITE:
         'data'   : '$userbase',
         }
 
+    INSTALL_SCHEMES['haiku_user'] = {
+        'purelib': '$usersite',
+        'platlib': '$usersite',
+        'headers': '$userbase/develop/headers/python$py_version_short/$dist_name',
+        'scripts': '$userbase/bin',
+        'data'   : '$userbase',
+        }
+
 # The keys to an installation scheme; if any new types of files are to be
 # installed, be sure to add an entry to every installation scheme above,
 # and to SCHEME_KEYS here.
@@ -406,10 +435,16 @@ class install(Command):
                 raise DistutilsPlatformError(
                     "User base directory is not specified")
             self.install_base = self.install_platbase = self.install_userbase
-            self.select_scheme("unix_user")
+            if sys.platform.startswith('haiku'):
+                self.select_scheme("haiku_user")
+            else:
+                self.select_scheme("unix_user")
         elif self.home is not None:
             self.install_base = self.install_platbase = self.home
-            self.select_scheme("unix_home")
+            if sys.platform.startswith('haiku'):
+                self.select_scheme("haiku_home")
+            else:
+                self.select_scheme("unix_home")
         else:
             if self.prefix is None:
                 if self.exec_prefix is not None:
@@ -425,7 +460,13 @@ class install(Command):
 
             self.install_base = self.prefix
             self.install_platbase = self.exec_prefix
-            self.select_scheme("unix_prefix")
+            if sys.platform.startswith('haiku'):
+                if os.environ.get('HAIKU_USE_VENDOR_DIRECTORIES') == '1':
+                    self.select_scheme("haiku_vendor")
+                else:
+                    self.select_scheme("haiku")
+            else:
+                self.select_scheme("unix_prefix")
 
     def finalize_other(self):
         """Finalizes options for non-posix platforms"""
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index a1452fe..07e2225 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -111,7 +111,8 @@ def get_python_inc(plat_specific=0, prefix=None):
                 incdir = os.path.join(get_config_var('srcdir'), 'Include')
             return os.path.normpath(incdir)
         python_dir = 'python' + get_python_version() + build_flags
-        return os.path.join(prefix, "include", python_dir)
+        inc_dir = "include" if sys.platform != "haiku1" else "develop/headers"
+        return os.path.join(prefix, inc_dir, python_dir)
     elif os.name == "nt":
         return os.path.join(prefix, "include")
     else:
@@ -141,12 +142,20 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
             prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
-        libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
-        if standard_lib:
-            return libpython
+        if sys.platform.startswith('haiku'):
+            if standard_lib:
+                return os.path.join(prefix,
+                                    "lib", "python" + get_python_version())
+            return os.path.join(prefix, "non-packaged",
+                                "lib", "python" + get_python_version(),
+                                "site-packages")
         else:
-            return os.path.join(libpython, "site-packages")
+	        libpython = os.path.join(prefix,
+	                                 "lib", "python" + get_python_version())
+	        if standard_lib:
+	            return libpython
+	        else:
+	            return os.path.join(libpython, "site-packages")
     elif os.name == "nt":
         if standard_lib:
             return os.path.join(prefix, "Lib")
diff --git a/Lib/plat-haiku1/regen b/Lib/plat-haiku1/regen
new file mode 100644
index 0000000..4372ee2
--- /dev/null
+++ b/Lib/plat-haiku1/regen
@@ -0,0 +1,4 @@
+#! /bin/sh
+HEADERS=/boot/develop/headers
+set -v
+eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" $HEADERS/posix/netinet/in.h
diff --git a/Lib/site.py b/Lib/site.py
index ad5d136..c00666c 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -303,7 +303,14 @@ def getsitepackages(prefixes=None):
             continue
         seen.add(prefix)
 
-        if os.sep == '/':
+        if sys.platform.startswith('haiku'):
+           sitepackages.append(os.path.join(prefix, "non-packaged", "lib",
+                                       "python" + sys.version[:3],
+                                       "site-packages"))
+           sitepackages.append(os.path.join(prefix, "lib",
+                                       "python" + sys.version[:3],
+                                       "vendor-packages"))
+        elif os.sep == '/':
             sitepackages.append(os.path.join(prefix, "lib",
                                         "python" + sys.version[:3],
                                         "site-packages"))
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index c37482e..96277a8 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -295,6 +295,7 @@ class OtherFileTests(unittest.TestCase):
                     self.assertEqual(f.writable(), True)
                     if sys.platform != "darwin" and \
                        'bsd' not in sys.platform and \
+                       'haiku' not in sys.platform and \
                        not sys.platform.startswith('sunos'):
                         # Somehow /dev/tty appears seekable on some BSDs
                         self.assertEqual(f.seekable(), False)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 76aef28..4b06354 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -119,7 +119,7 @@ BINDIR=		@bindir@
 LIBDIR=		@libdir@
 MANDIR=		@mandir@
 INCLUDEDIR=	@includedir@
-CONFINCLUDEDIR=	$(exec_prefix)/include
+CONFINCLUDEDIR=	$(INCLUDEDIR)
 SCRIPTDIR=	$(prefix)/lib
 ABIFLAGS=	@ABIFLAGS@
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 628dec2..5e6bb3f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -12023,7 +12023,7 @@ all_ins(PyObject *m)
     if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
     if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
 #ifdef SCHED_SPORADIC
-    if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1;
+    if (PyModule_AddIntMacro(m, SCHED_SPORADIC)) return -1;
 #endif
 #ifdef SCHED_BATCH
     if (PyModule_AddIntMacro(m, SCHED_BATCH)) return -1;
diff --git a/Modules/resource.c b/Modules/resource.c
index 3a1cf09..bb56e30 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -83,6 +83,7 @@ resource_getrusage(PyObject *self, PyObject *args)
                     PyFloat_FromDouble(doubletime(ru.ru_utime)));
     PyStructSequence_SET_ITEM(result, 1,
                     PyFloat_FromDouble(doubletime(ru.ru_stime)));
+#ifndef __HAIKU__
     PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss));
     PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss));
     PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss));
@@ -97,7 +98,22 @@ resource_getrusage(PyObject *self, PyObject *args)
     PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals));
     PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw));
     PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw));
-
+#else
+    PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 5, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 7, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 8, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 9, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 10, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 11, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 12, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(0));
+    PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(0));
+#endif
     if (PyErr_Occurred()) {
         Py_DECREF(result);
         return NULL;
@@ -334,19 +350,19 @@ PyInit_resource(void)
                        (PyObject*) &StructRUsageType);
 
     /* insert constants */
-#ifdef RLIMIT_CPU
+#if !defined(__HAIKU__) && defined(RLIMIT_CPU)
     PyModule_AddIntMacro(m, RLIMIT_CPU);
 #endif
 
-#ifdef RLIMIT_FSIZE
+#if !defined(__HAIKU__) && defined(RLIMIT_FSIZE)
     PyModule_AddIntMacro(m, RLIMIT_FSIZE);
 #endif
 
-#ifdef RLIMIT_DATA
+#if !defined(__HAIKU__) && defined(RLIMIT_DATA)
     PyModule_AddIntMacro(m, RLIMIT_DATA);
 #endif
 
-#ifdef RLIMIT_STACK
+#if !defined(__HAIKU__) && defined(RLIMIT_STACK)
     PyModule_AddIntMacro(m, RLIMIT_STACK);
 #endif
 
@@ -358,31 +374,31 @@ PyInit_resource(void)
     PyModule_AddIntMacro(m, RLIMIT_NOFILE);
 #endif
 
-#ifdef RLIMIT_OFILE
+#if !defined(__HAIKU__) && defined(RLIMIT_OFILE)
     PyModule_AddIntMacro(m, RLIMIT_OFILE);
 #endif
 
-#ifdef RLIMIT_VMEM
+#if !defined(__HAIKU__) && defined(RLIMIT_VMEM)
     PyModule_AddIntMacro(m, RLIMIT_VMEM);
 #endif
 
-#ifdef RLIMIT_AS
+#if !defined(__HAIKU__) && defined(RLIMIT_AS)
     PyModule_AddIntMacro(m, RLIMIT_AS);
 #endif
 
-#ifdef RLIMIT_RSS
+#if !defined(__HAIKU__) && defined(RLIMIT_RSS)
     PyModule_AddIntMacro(m, RLIMIT_RSS);
 #endif
 
-#ifdef RLIMIT_NPROC
+#if !defined(__HAIKU__) && defined(RLIMIT_NPROC)
     PyModule_AddIntMacro(m, RLIMIT_NPROC);
 #endif
 
-#ifdef RLIMIT_MEMLOCK
+#if !defined(__HAIKU__) && defined(RLIMIT_MEMLOCK)
     PyModule_AddIntMacro(m, RLIMIT_MEMLOCK);
 #endif
 
-#ifdef RLIMIT_SBSIZE
+#if !defined(__HAIKU__) && defined(RLIMIT_SBSIZE)
     PyModule_AddIntMacro(m, RLIMIT_SBSIZE);
 #endif
 
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index cb44d05..4023304 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -6094,7 +6094,9 @@ PyInit__socket(void)
     PyModule_AddIntMacro(m, SOCK_DGRAM);
 /* We have incomplete socket support. */
     PyModule_AddIntMacro(m, SOCK_RAW);
+#ifndef __HAIKU__
     PyModule_AddIntMacro(m, SOCK_SEQPACKET);
+#endif
 #if defined(SOCK_RDM)
     PyModule_AddIntMacro(m, SOCK_RDM);
 #endif
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index b83f9af..47e4064 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -47,6 +47,10 @@ typedef int socklen_t;
 #  undef AF_NETLINK
 #endif
 
+#if defined(__HAIKU__)
+#undef HAVE_BLUETOOTH_BLUETOOTH_H
+#endif
+
 #ifdef HAVE_BLUETOOTH_BLUETOOTH_H
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/rfcomm.h>
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index 68ea1b5..1f5c3d0 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -81,7 +81,9 @@ static PyObject *mkspent(struct spwd *p)
 
     SETS(setIndex++, p->sp_namp);
     SETS(setIndex++, p->sp_pwdp);
+#ifndef __HAIKU__
     SETI(setIndex++, p->sp_lstchg);
+#endif
     SETI(setIndex++, p->sp_min);
     SETI(setIndex++, p->sp_max);
     SETI(setIndex++, p->sp_warn);
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4b4f979..48a2897 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -24,7 +24,7 @@
 #ifdef HAVE_MBCS
 const char *Py_FileSystemDefaultEncoding = "mbcs";
 int Py_HasFileSystemDefaultEncoding = 1;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__HAIKU__)
 const char *Py_FileSystemDefaultEncoding = "utf-8";
 int Py_HasFileSystemDefaultEncoding = 1;
 #else
diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
index 4f871d9..343e5ba 100755
--- a/Tools/scripts/h2py.py
+++ b/Tools/scripts/h2py.py
@@ -49,12 +49,15 @@ except KeyError:
     try:
         searchdirs=os.environ['INCLUDE'].split(';')
     except KeyError:
-        searchdirs=['/usr/include']
-        try:
-            searchdirs.insert(0, os.path.join('/usr/include',
+        if sys.platform.find("beos") == 0 or sys.platform.find("haiku1") == 0:
+            searchdirs=os.environ['BEINCLUDES'].split(';')
+        else:
+            searchdirs=['/usr/include']
+            try:
+                searchdirs.insert(0, os.path.join('/usr/include',
                                               os.environ['MULTIARCH']))
-        except KeyError:
-            pass
+            except KeyError:
+                pass
 
 def main():
     global filedict
diff --git a/configure.ac b/configure.ac
index a0d0afa..aad64a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -956,7 +956,7 @@ if test $enable_shared = "yes"; then
 	      PY3LIBRARY=libpython3.so
 	  fi
           ;;
-    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Haiku*)
 	  LDLIBRARY='libpython$(LDVERSION).so'
 	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -964,6 +964,9 @@ if test $enable_shared = "yes"; then
 	      FreeBSD*)
 		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
 		;;
+	      Haiku*)
+		RUNSHARED=LIBRARY_PATH=`pwd`:${LIBRARY_PATH}
+		;;
 	  esac
 	  INSTSONAME="$LDLIBRARY".$SOVERSION
 	  if test "$with_pydebug" != yes
@@ -1055,6 +1058,7 @@ AC_PROG_MKDIR_P
 AC_SUBST(LN)
 if test -z "$LN" ; then
 	case $ac_sys_system in
+		Haiku*) LN="ln -s";;
 		CYGWIN*) LN="ln -s";;
 		*) LN=ln;;
 	esac
@@ -2055,7 +2059,7 @@ then
 			BLDSHARED="$LDSHARED"
 		fi
 		;;
-	Linux*|GNU*|QNX*)
+	Linux*|GNU*|QNX*|Haiku*)
 		LDSHARED='$(CC) -shared'
 		LDCXXSHARED='$(CXX) -shared';;
 	BSD/OS*/4*)
@@ -2124,7 +2128,7 @@ then
 		 then CCSHARED="-fPIC";
 		 else CCSHARED="+z";
 		 fi;;
-	Linux*|GNU*) CCSHARED="-fPIC";;
+	Linux*|GNU*|Haiku*) CCSHARED="-fPIC";;
 	BSD/OS*/4*) CCSHARED="-fpic";;
 	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
 	OpenUNIX*|UnixWare*)
@@ -2155,7 +2159,7 @@ then
 	    LINKFORSHARED="-Wl,-E -Wl,+s";;
 #	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
 	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
-	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
+	Linux*|GNU*|Haiku*) LINKFORSHARED="-Xlinker -export-dynamic";;
 	# -u libsys_s pulls in all symbols in libsys
 	Darwin/*) 
 		LINKFORSHARED="$extra_undefs -framework CoreFoundation"
@@ -2329,6 +2333,12 @@ esac
 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
 
+# Haiku's sockets are stashed in libnetwork.
+case "$ac_sys_system" in
+	Haiku*)
+		AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS);;
+esac
+
 AC_MSG_CHECKING(for --with-libs)
 AC_ARG_WITH(libs,
             AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
@@ -3663,6 +3673,7 @@ fi],
 AC_SUBST(LIBM)
 case $ac_sys_system in
 Darwin) ;;
+Haiku) ;;
 *) LIBM=-lm
 esac
 AC_MSG_CHECKING(for --with-libm=STRING)
diff --git a/setup.py b/setup.py
index 2779658..b1ff43a 100644
--- a/setup.py
+++ b/setup.py
@@ -523,6 +523,12 @@ class PyBuildExt(build_ext):
             config_h_vars = sysconfig.parse_config_h(file)
 
         srcdir = sysconfig.get_config_var('srcdir')
+        
+        # Haiku-specific library locations
+        if host_platform == 'haiku1':
+            inc_dirs += ['/boot/develop/headers/posix',
+                         '/boot/system/develop/headers']
+            lib_dirs += ['/boot/system/develop/lib']
 
         # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
         if host_platform in ['osf1', 'unixware7', 'openunix8']:
@@ -550,9 +556,9 @@ class PyBuildExt(build_ext):
                 if item.startswith('-L'):
                     lib_dirs.append(item[2:])
 
-        # Check for MacOS X, which doesn't need libm.a at all
+        # Check for MacOS X and Haiku, which don't need libm.a at all
         math_libs = ['m']
-        if host_platform == 'darwin':
+        if host_platform in ['darwin','haiku1']:
             math_libs = []
 
         # XXX Omitted modules: gl, pure, dl, SGI-specific modules
@@ -762,15 +768,22 @@ class PyBuildExt(build_ext):
                               '/usr/local/ssl/include',
                               '/usr/contrib/ssl/include/'
                              ]
-        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+        ssl_incs = find_file('openssl/ssl.h', [],
+                             inc_dirs + search_for_ssl_incs_in
+                             )
+        ssl_incs_to_add = find_file('openssl/ssl.h', inc_dirs,
                              search_for_ssl_incs_in
                              )
         if ssl_incs is not None:
             krb5_h = find_file('krb5.h', inc_dirs,
                                ['/usr/kerberos/include'])
             if krb5_h:
-                ssl_incs += krb5_h
-        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+                ssl_incs_to_add += krb5_h
+        ssl_libs = find_library_file(self.compiler, 'ssl', [],
+                                     lib_dirs + ['/usr/local/ssl/lib',
+                                      '/usr/contrib/ssl/lib/'
+                                     ] )
+        ssl_libs_to_add = find_library_file(self.compiler, 'ssl', lib_dirs,
                                      ['/usr/local/ssl/lib',
                                       '/usr/contrib/ssl/lib/'
                                      ] )
@@ -778,8 +791,8 @@ class PyBuildExt(build_ext):
         if (ssl_incs is not None and
             ssl_libs is not None):
             exts.append( Extension('_ssl', ['_ssl.c'],
-                                   include_dirs = ssl_incs,
-                                   library_dirs = ssl_libs,
+                                   include_dirs = ssl_incs_to_add,
+                                   library_dirs = ssl_libs_to_add,
                                    libraries = ['ssl', 'crypto'],
                                    depends = ['socketmodule.h']), )
         else:
@@ -819,8 +832,8 @@ class PyBuildExt(build_ext):
                 # of hash functions from the OpenSSL library.
                 exts.append( Extension('_hashlib', ['_hashopenssl.c'],
                                        depends = ['hashlib.h'],
-                                       include_dirs = ssl_incs,
-                                       library_dirs = ssl_libs,
+                                       include_dirs = ssl_incs_to_add,
+                                       library_dirs = ssl_libs_to_add,
                                        libraries = ['ssl', 'crypto']) )
             else:
                 print("warning: openssl 0x%08x is too old for _hashlib" %
@@ -1254,7 +1267,7 @@ class PyBuildExt(build_ext):
             exts.append( Extension('resource', ['resource.c']) )
 
             # Sun yellow pages. Some systems have the functions in libc.
-            if (host_platform not in ['cygwin', 'qnx6'] and
+            if (host_platform not in ['cygwin', 'qnx6', 'haiku1'] and
                 find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
                 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
                     libs = ['nsl']
-- 
1.8.3.4

