diff -urN php-5.3.5/configure.in php-5.3.5-haiku/configure.in
--- php-5.3.5/configure.in	2011-01-05 16:35:33.016515072 +0000
+++ php-5.3.5-haiku/configure.in	2011-02-04 13:58:33.000000000 +0000
@@ -1,7 +1,7 @@
 ## $Id: configure.in 307133 2011-01-05 16:35:33Z johannes $ -*- autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
-divert(1)
+divert(1001)
 
 dnl ## Diversion 1 is the autoconf + automake setup phase. We also
 dnl ## set the PHP version, deal with platform-specific compile
@@ -290,7 +290,7 @@
 sinclude(TSRM/tsrm.m4)
 
 
-divert(2)
+divert(1002)
 
 dnl ## Diversion 2 is where we set PHP-specific options and come up
 dnl ## with reasonable default values for them. We check for pthreads here
@@ -329,7 +329,7 @@
   PTHREADS_FLAGS
 fi
 
-divert(3)
+divert(1003)
 
 dnl ## In diversion 3 we check for compile-time options to the PHP
 dnl ## core and how to deal with different system dependencies. 
@@ -675,7 +675,7 @@
   PHP_CRYPT_R_STYLE
 fi
 
-divert(4)
+divert(1004)
 
 dnl ## In diversion 4 we check user-configurable general settings.
 
@@ -916,7 +916,7 @@
   AC_MSG_RESULT([using system default])
 fi
 
-divert(5)
+divert(1005)
 
 dnl ## In diversion 5 we check which extensions should be compiled.
 dnl ## All of these are normally in the extension directories.
diff -urN php-5.3.5/ext/date/php_date.c php-5.3.5-haiku/ext/date/php_date.c
--- php-5.3.5/ext/date/php_date.c	2010-11-18 11:33:42.044302336 +0000
+++ php-5.3.5-haiku/ext/date/php_date.c	2011-02-04 14:09:21.000000000 +0000
@@ -33,7 +33,7 @@
 
 #ifdef PHP_WIN32
 static __inline __int64 php_date_llabs( __int64 i ) { return i >= 0? i: -i; }
-#elif defined(__GNUC__) && __GNUC__ < 3
+#elif (defined(__GNUC__) && __GNUC__ < 3) && (!defined __HAIKU__)
 static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i; }
 #else
 static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; }
diff -urN php-5.3.5/ext/standard/config.m4 php-5.3.5-haiku/ext/standard/config.m4
--- php-5.3.5/ext/standard/config.m4	2010-06-17 10:22:03.023592960 +0000
+++ php-5.3.5-haiku/ext/standard/config.m4	2011-02-04 13:58:33.000000000 +0000
@@ -1,6 +1,6 @@
 dnl $Id: config.m4 300511 2010-06-17 10:22:03Z pajoye $ -*- autoconf -*-
 
-divert(3)dnl
+divert(1003)dnl
 
 dnl
 dnl Check if flush should be called explicitly after buffered io
@@ -342,7 +342,7 @@
 AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
 AC_FUNC_FNMATCH	
 
-divert(5)dnl
+divert(1005)dnl
 
 dnl
 dnl Check if there is a support means of creating a new process
diff -urN php-5.3.5/ext/standard/microtime.c php-5.3.5-haiku/ext/standard/microtime.c
--- php-5.3.5/ext/standard/microtime.c	2010-01-03 09:23:27.029097984 +0000
+++ php-5.3.5-haiku/ext/standard/microtime.c	2011-02-04 14:18:46.000000000 +0000
@@ -131,7 +131,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.3.5/scripts/phpize.m4 php-5.3.5-haiku/scripts/phpize.m4
--- php-5.3.5/scripts/phpize.m4	2010-11-02 09:58:08.015204352 +0000
+++ php-5.3.5-haiku/scripts/phpize.m4	2011-02-04 13:58:33.000000000 +0000
@@ -1,6 +1,6 @@
 dnl This file becomes configure.in for self-contained extensions.
 
-divert(1)
+divert(1001)
 
 AC_PREREQ(2.13)
 AC_INIT(config.m4)
