diff -urN php-5.2.9/acinclude.m4 php-5.2.9-haiku/acinclude.m4
--- php-5.2.9/acinclude.m4	2009-03-01 12:13:19.000000000 +0000
+++ php-5.2.9-haiku/acinclude.m4	2009-03-01 12:56:26.000000000 +0000
@@ -2332,7 +2332,7 @@
   if test "$found_openssl" = "no"; then
   
     if test "$PHP_OPENSSL_DIR" = "yes"; then
-      PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
+      PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl /boot/common/ssl"
     fi
 
     for i in $PHP_OPENSSL_DIR; do
@@ -2444,7 +2444,7 @@
   dnl
   if test "$found_iconv" = "no"; then
 
-    for i in $PHP_ICONV /usr/local /usr; do
+    for i in $PHP_ICONV /usr/local /usr /boot/common; do
       if test -r $i/include/giconv.h; then
         AC_DEFINE(HAVE_GICONV_H, 1, [ ])
         ICONV_DIR=$i
@@ -2500,7 +2500,7 @@
 AC_DEFUN([PHP_SETUP_LIBXML], [
 AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
 [
-  for i in $PHP_LIBXML_DIR /usr/local /usr; do
+  for i in $PHP_LIBXML_DIR /usr/local /boot/common /usr; do
     if test -x "$i/bin/xml2-config"; then
       ac_cv_php_xml2_config_path="$i/bin/xml2-config"
       break
diff -urN php-5.2.9/aclocal.m4 php-5.2.9-haiku/aclocal.m4
--- php-5.2.9/aclocal.m4	2009-03-01 12:12:52.000000000 +0000
+++ php-5.2.9-haiku/aclocal.m4	2009-03-01 14:55:37.000000000 +0000
@@ -4142,6 +4142,15 @@
   shlibpath_var=LIBRARY_PATH
   ;;
 
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes;;
+
 bsdi[[45]]*)
   version_type=linux
   need_version=no
diff -urN php-5.2.9/configure.in php-5.2.9-haiku/configure.in
--- php-5.2.9/configure.in	2009-03-01 12:13:18.000000000 +0000
+++ php-5.2.9-haiku/configure.in	2009-03-01 14:55:53.000000000 +0000
@@ -345,6 +345,11 @@
 PHP_CHECK_FUNC(gethostbyaddr, nsl)
 PHP_CHECK_FUNC(yp_get_default_domain, nsl)
 
+PHP_CHECK_FUNC(socket, network)
+PHP_CHECK_FUNC(socketpair, network)
+PHP_CHECK_FUNC(gethostname, network)
+PHP_CHECK_FUNC(gethostbyaddr, network)
+
 PHP_CHECK_FUNC(dlopen, dl)
 if test "$ac_cv_func_dlopen" = "yes"; then
   AC_DEFINE(HAVE_LIBDL, 1, [ ])
diff -urN php-5.2.9/ext/spl/spl_directory.c php-5.2.9-haiku/ext/spl/spl_directory.c
--- php-5.2.9/ext/spl/spl_directory.c	2009-03-01 12:07:38.000000000 +0000
+++ php-5.2.9-haiku/ext/spl/spl_directory.c	2009-03-01 14:56:24.000000000 +0000
@@ -849,7 +849,7 @@
 }
 /* }}} */
 
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 /* {{{ proto string SplFileInfo::getRealPath()
    Return the resolved path */
 SPL_METHOD(SplFileInfo, getRealPath)
@@ -1433,7 +1433,7 @@
 	SPL_ME(SplFileInfo,       isDir,         NULL, ZEND_ACC_PUBLIC)
 	SPL_ME(SplFileInfo,       isLink,        NULL, ZEND_ACC_PUBLIC)
 	SPL_ME(SplFileInfo,       getLinkTarget, NULL, ZEND_ACC_PUBLIC)
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 	SPL_ME(SplFileInfo,       getRealPath,   NULL, ZEND_ACC_PUBLIC)
 #endif
 	SPL_ME(SplFileInfo,       getFileInfo,   arginfo_info_optinalFileClass, ZEND_ACC_PUBLIC)
diff -urN php-5.2.9/ext/standard/basic_functions.c php-5.2.9-haiku/ext/standard/basic_functions.c
--- php-5.2.9/ext/standard/basic_functions.c	2009-03-01 12:12:25.000000000 +0000
+++ php-5.2.9-haiku/ext/standard/basic_functions.c	2009-03-01 14:57:12.000000000 +0000
@@ -1395,7 +1395,7 @@
 	ZEND_ARG_INFO(0, enclosure)
 ZEND_END_ARG_INFO()
 
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 static
 ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0)
 	ZEND_ARG_INFO(0, path)
@@ -3574,7 +3574,7 @@
 
 	PHP_FALIAS(socket_get_status, stream_get_meta_data,						arginfo_stream_get_meta_data)
 
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 	PHP_FE(realpath,														arginfo_realpath)
 #endif
 
diff -urN php-5.2.9/ext/standard/file.c php-5.2.9-haiku/ext/standard/file.c
--- php-5.2.9/ext/standard/file.c	2009-03-01 12:12:25.000000000 +0000
+++ php-5.2.9-haiku/ext/standard/file.c	2009-03-01 14:57:31.000000000 +0000
@@ -2384,7 +2384,7 @@
 }
 /* }}} */
 
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 /* {{{ proto string realpath(string path)
    Return the resolved path */
 PHP_FUNCTION(realpath)
diff -urN php-5.2.9/ext/standard/file.h php-5.2.9-haiku/ext/standard/file.h
--- php-5.2.9/ext/standard/file.h	2009-03-01 14:57:50.000000000 +0000
+++ php-5.2.9-haiku/ext/standard/file.h	2009-03-01 12:12:25.000000000 +0000
@@ -60,7 +60,7 @@
 PHP_FUNCTION(flock);
 PHP_FUNCTION(fd_set);
 PHP_FUNCTION(fd_isset);
-#if ((defined(__HAIKU__) || !defined(__BEOS__)) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
 PHP_FUNCTION(realpath);
 #endif
 #ifdef HAVE_FNMATCH
diff -urN php-5.2.9/ext/standard/filestat.c php-5.2.9-haiku/ext/standard/filestat.c
--- php-5.2.9/ext/standard/filestat.c	2009-03-01 12:12:26.000000000 +0000
+++ php-5.2.9-haiku/ext/standard/filestat.c	2009-03-01 14:58:07.000000000 +0000
@@ -898,7 +898,7 @@
 		case S_IFDIR: RETURN_STRING("dir", 1);
 		case S_IFBLK: RETURN_STRING("block", 1);
 		case S_IFREG: RETURN_STRING("file", 1);
-#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__)
+#if defined(S_IFSOCK) && !defined(ZEND_WIN32) && (defined(__HAIKU__) || !defined(__BEOS__))
 		case S_IFSOCK: RETURN_STRING("socket", 1);
 #endif
 		}
diff -urN php-5.2.9/ext/standard/microtime.c php-5.2.9-haiku/ext/standard/microtime.c
--- php-5.2.9/ext/standard/microtime.c	2009-03-01 12:12:26.000000000 +0000
+++ php-5.2.9-haiku/ext/standard/microtime.c	2009-03-01 12:06:02.000000000 +0000
@@ -132,7 +132,7 @@
 	array_init(return_value);
 #define PHP_RUSAGE_PARA(a) \
 		add_assoc_long(return_value, #a, usg.a)
-#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */
+#if !defined( _OSD_POSIX) && !defined(__BEOS__) && !defined(__HAIKU__)/* BS2000 has only a few fields in the rusage struct */
 	PHP_RUSAGE_PARA(ru_oublock);
 	PHP_RUSAGE_PARA(ru_inblock);
 	PHP_RUSAGE_PARA(ru_msgsnd);
diff -urN php-5.2.9/main/network.c php-5.2.9-haiku/main/network.c
--- php-5.2.9/main/network.c	2009-03-01 12:12:46.000000000 +0000
+++ php-5.2.9-haiku/main/network.c	2009-03-01 14:58:23.000000000 +0000
@@ -268,7 +268,7 @@
 #define O_NONBLOCK O_NDELAY
 #endif
 
-#if !defined(__BEOS__)
+#if !defined(__BEOS__) || defined(__HAIKU__)
 # define HAVE_NON_BLOCKING_CONNECT 1
 # ifdef PHP_WIN32
 typedef u_long php_non_blocking_flags_t;
