      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 12:02:35.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_RUSAGE_PARA(ru_oublock);
 	PHP_RUSAGE_PARA(ru_inblock);
 	PHP_RUSAGE_PARA(ru_msgsnd);

 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
