Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haiku support #2697

Closed
wants to merge 27 commits into from
Closed
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -416,6 +416,7 @@ dnl are usually in libnsl
dnl Also, uClibc will bark at linking with glibc's libnsl.

PHP_CHECK_FUNC(socket, socket)
AC_CHECK_LIB(network, socket)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could amend the preceding PHP_CHECK_FUNC() instead.

PHP_CHECK_FUNC(socket, socket, network)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll fix this.

PHP_CHECK_FUNC(socketpair, socket)
PHP_CHECK_FUNC(htonl, socket)
PHP_CHECK_FUNC(gethostname, nsl)
@@ -429,8 +430,8 @@ fi
AC_CHECK_LIB(m, sin)

dnl Check for inet_aton
dnl in -lc, -lbind and -lresolv
PHP_CHECK_FUNC(inet_aton, resolv, bind)
dnl in -lc, -lbind, -lresolv and -lnetwork
PHP_CHECK_FUNC(inet_aton, resolv, bind, network)

dnl Then headers.
dnl -------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion ext/bz2/config.m4
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ PHP_ARG_WITH(bz2, for BZip2 support,
[ --with-bz2[=DIR] Include BZip2 support])

if test "$PHP_BZ2" != "no"; then
if test -r $PHP_BZ2/include/bzlib.h; then
if test -r "$PHP_BZ2/include/bzlib.h" || test -r "$PHP_BZ2/develop/headers/bzlib.h"; then
BZIP_DIR=$PHP_BZ2
else
AC_MSG_CHECKING(for BZip2 in default path)
7 changes: 5 additions & 2 deletions ext/curl/config.m4
Original file line number Diff line number Diff line change
@@ -23,6 +23,9 @@ if test "$PHP_CURL" != "no"; then
elif test -r $PHP_CURL/lib/pkgconfig/libcurl.pc; then
PKNAME=$PHP_CURL/lib/pkgconfig/libcurl.pc
AC_MSG_RESULT(using $PKNAME)
elif test -r $PHP_CURL/develop/lib/pkgconfig/libcurl.pc; then
PKNAME=$PHP_CURL/develop/lib/pkgconfig/libcurl.pc
AC_MSG_RESULT(using $PKNAME)
else
AC_MSG_RESULT(not found)
AC_MSG_WARN(Could not find libcurl.pc. Try without $PHP_CURL or set PKG_CONFIG_PATH)
@@ -45,11 +48,11 @@ if test "$PHP_CURL" != "no"; then
dnl fallback to old vay, using curl-config
AC_MSG_WARN(Fallback: search for curl headers and curl-config)

if test -r $PHP_CURL/include/curl/easy.h; then
if test -r $PHP_CURL/include/curl/easy.h || test -r $PHP_CURL/develop/headers/curl/easy.h; then
CURL_DIR=$PHP_CURL
else
AC_MSG_CHECKING(for cURL in default path)
for i in /usr/local /usr; do
for i in /usr/local /usr /system; do
if test -r $i/include/curl/easy.h; then
CURL_DIR=$i
AC_MSG_RESULT(found in $i)
24 changes: 19 additions & 5 deletions ext/gd/config.m4
Original file line number Diff line number Diff line change
@@ -50,17 +50,23 @@ AC_DEFUN([PHP_GD_ZLIB],[
elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
elif test -f "$PHP_ZLIB_DIR/develop/headers/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/develop/headers"
else
AC_MSG_ERROR([Can't find zlib headers under "$PHP_ZLIB_DIR"])
fi
else
for i in /usr/local /usr; do
for i in /usr/local /usr /system; do
if test -f "$i/include/zlib/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include/zlib"
elif test -f "$i/include/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include"
elif test -f "$i/develop/headers/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/develop/headers"
fi
done
fi
@@ -71,6 +77,7 @@ AC_DEFUN([PHP_GD_WEBP],[

for i in $PHP_WEBP_DIR /usr/local /usr; do
test -f $i/include/webp/decode.h && GD_WEBP_DIR=$i && break
test -f $i/develop/headers/webp/decode.h && GD_WEBP_DIR=$i && break
done

if test -z "$GD_WEBP_DIR"; then
@@ -79,6 +86,7 @@ AC_DEFUN([PHP_GD_WEBP],[

for i in $PHP_WEBP_DIR /usr/local /usr; do
test -f $i/include/webp/encode.h && GD_WEBP_DIR=$i && break
test -f $i/develop/headers/webp/encode.h && GD_WEBP_DIR=$i && break
done

if test -z "$GD_WEBP_DIR"; then
@@ -103,8 +111,9 @@ AC_DEFUN([PHP_GD_WEBP],[
AC_DEFUN([PHP_GD_JPEG],[
if test "$PHP_JPEG_DIR" != "no"; then

for i in $PHP_JPEG_DIR /usr/local /usr; do
for i in $PHP_JPEG_DIR /usr/local /usr /system; do
test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break
test -f $i/develop/headers/jpeglib.h && GD_JPEG_DIR=$i && break
done

if test -z "$GD_JPEG_DIR"; then
@@ -130,6 +139,7 @@ AC_DEFUN([PHP_GD_PNG],[

for i in $PHP_PNG_DIR /usr/local /usr; do
test -f $i/include/png.h && GD_PNG_DIR=$i && break
test -f $i/develop/headers/png.h && GD_PNG_DIR=$i && break
done

if test -z "$GD_PNG_DIR"; then
@@ -162,6 +172,8 @@ AC_DEFUN([PHP_GD_XPM],[
for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
test -f $i/include/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i && break
test -f $i/include/X11/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i/X11 && break
test -f $i/develop/headers/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i && break
test -f $i/develop/headers/X11/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i/X11 && break
done

if test -z "$GD_XPM_DIR"; then
@@ -186,7 +198,7 @@ AC_DEFUN([PHP_GD_XPM],[
AC_DEFUN([PHP_GD_FREETYPE2],[
if test "$PHP_FREETYPE_DIR" != "no"; then

for i in $PHP_FREETYPE_DIR /usr/local /usr; do
for i in $PHP_FREETYPE_DIR /usr/local /usr /system; do
if test -f "$i/bin/freetype-config"; then
FREETYPE2_DIR=$i
FREETYPE2_CONFIG="$i/bin/freetype-config"
@@ -220,7 +232,9 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
if test -n "$GD_XPM_DIR"; then
PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
fi
PHP_CHECK_LIBRARY(gd, gdImageCreateFromBmp, [AC_DEFINE(HAVE_GD_BMP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdVersionString, [AC_DEFINE(HAVE_GD_LIBVERSION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
@@ -317,7 +331,7 @@ dnl Various checks for GD features
PHP_GD_FREETYPE2

dnl Header path
for i in include/gd include/gd2 include gd ""; do
for i in include/gd include/gd2 include gd develop/headers ""; do
test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
done

6 changes: 3 additions & 3 deletions ext/gettext/config.m4
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@ PHP_ARG_WITH(gettext,for GNU gettext support,
[ --with-gettext[=DIR] Include GNU gettext support])

if test "$PHP_GETTEXT" != "no"; then
for i in $PHP_GETTEXT /usr/local /usr; do
test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
for i in $PHP_GETTEXT /usr/local /usr /system; do
test -r $i/include/libintl.h && GETTEXT_DIR=$i && GETTEXT_INCDIR=$GETTEXT_DIR/include && break
test -r $i/develop/headers/libintl.h && GETTEXT_DIR=$i && GETTEXT_INCDIR=$GETTEXT_DIR/develop/headers && break
done

if test -z "$GETTEXT_DIR"; then
AC_MSG_ERROR(Cannot locate header file libintl.h)
fi

GETTEXT_LIBDIR=$GETTEXT_DIR/$PHP_LIBDIR
GETTEXT_INCDIR=$GETTEXT_DIR/include

O_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
1 change: 1 addition & 0 deletions ext/gmp/config.m4
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ if test "$PHP_GMP" != "no"; then
for i in $PHP_GMP /usr/local /usr; do
test -f $i/include/gmp.h && GMP_DIR=$i && break
test -f $i/include/$MACHINE_INCLUDES/gmp.h && GMP_DIR=$i && break
test -f $i/develop/headers/gmp.h && GMP_DIR=$i && break
done

if test -z "$GMP_DIR"; then
4 changes: 3 additions & 1 deletion ext/pcntl/pcntl.c
Original file line number Diff line number Diff line change
@@ -301,7 +301,9 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
#ifdef SIGPOLL
REGISTER_LONG_CONSTANT("SIGPOLL", (zend_long) SIGPOLL, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGIO
REGISTER_LONG_CONSTANT("SIGIO", (zend_long) SIGIO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGPWR
REGISTER_LONG_CONSTANT("SIGPWR", (zend_long) SIGPWR, CONST_CS | CONST_PERSISTENT);
#endif
@@ -622,7 +624,7 @@ PHP_FUNCTION(pcntl_alarm)

#define PHP_RUSAGE_PARA(from, to, field) \
add_assoc_long(to, #field, from.field)
#ifndef _OSD_POSIX
#if !defined(_OSD_POSIX) && !defined(__HAIKU__)
#define PHP_RUSAGE_SPECIAL(from, to) \
PHP_RUSAGE_PARA(from, to, ru_oublock); \
PHP_RUSAGE_PARA(from, to, ru_inblock); \
5 changes: 4 additions & 1 deletion ext/pdo_sqlite/config.m4
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ if test "$PHP_PDO_SQLITE" != "no"; then
php_pdo_sqlite_sources_core="pdo_sqlite.c sqlite_driver.c sqlite_statement.c"

if test "$PHP_PDO_SQLITE" != "yes"; then
SEARCH_PATH="$PHP_PDO_SQLITE /usr/local /usr" # you might want to change this
SEARCH_PATH="$PHP_PDO_SQLITE /usr/local /usr /system" # you might want to change this
SEARCH_FOR="/include/sqlite3.h" # you most likely want to change this
if test -r $PHP_PDO_SQLITE/$SEARCH_FOR; then # path given as parameter
PDO_SQLITE_DIR=$PHP_PDO_SQLITE
@@ -43,6 +43,9 @@ if test "$PHP_PDO_SQLITE" != "no"; then
if test -r $i/$SEARCH_FOR; then
PDO_SQLITE_DIR=$i
AC_MSG_RESULT(found in $i)
elif test -r $i/develop/headers/sqlite3.h; then
PDO_SQLITE_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
3 changes: 2 additions & 1 deletion ext/readline/config.m4
Original file line number Diff line number Diff line change
@@ -14,8 +14,9 @@ else
fi

if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
for i in $PHP_READLINE /usr/local /usr; do
for i in $PHP_READLINE /usr/local /usr /system; do
test -f $i/include/readline/readline.h && READLINE_DIR=$i && break
test -f $i/develop/headers/readline/readline.h && READLINE_DIR=$i && break
done

if test -z "$READLINE_DIR"; then
4 changes: 4 additions & 0 deletions ext/sqlite3/config0.m4
Original file line number Diff line number Diff line change
@@ -27,6 +27,10 @@ if test $PHP_SQLITE3 != "no"; then
SQLITE3_DIR=$i
AC_MSG_RESULT(found in $i)
break
elif test -r $i/develop/headers/sqlite3.h; then
SQLITE3_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done

2 changes: 1 addition & 1 deletion ext/standard/microtime.c
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ PHP_FUNCTION(getrusage)
#ifdef PHP_WIN32 /* Windows only implements a limited amount of fields from the rusage struct */
PHP_RUSAGE_PARA(ru_majflt);
PHP_RUSAGE_PARA(ru_maxrss);
#elif !defined(_OSD_POSIX)
#elif !defined(_OSD_POSIX) && !defined(__HAIKU__)
PHP_RUSAGE_PARA(ru_oublock);
PHP_RUSAGE_PARA(ru_inblock);
PHP_RUSAGE_PARA(ru_msgsnd);
16 changes: 14 additions & 2 deletions ext/zip/config.m4
Original file line number Diff line number Diff line change
@@ -26,17 +26,23 @@ if test "$PHP_ZIP" != "no"; then
elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
elif test -f "$PHP_ZLIB_DIR/develop/headers/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/develop/headers"
else
AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
fi
else
for i in /usr/local /usr; do
for i in /usr/local /usr /system; do
if test -f "$i/include/zlib/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include/zlib"
elif test -f "$i/include/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include"
elif test -f "$i/develop/headers/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/develop/headers"
fi
done
fi
@@ -73,13 +79,19 @@ if test "$PHP_ZIP" != "no"; then
fi

else
for i in /usr/local /usr; do
for i in /usr/local /usr /system; do
if test -r $i/include/zip.h; then
LIBZIP_CFLAGS="-I$i/include"
LIBZIP_LIBDIR="$i/$PHP_LIBDIR"
AC_MSG_RESULT(in default path: found in $i)
break
fi
if test -r $i/develop/headers/zip.h; then
LIBZIP_CFLAGS="-I$i/develop/headers"
LIBZIP_LIBDIR="$i/$PHP_LIBDIR"
AC_MSG_RESULT(in default path: found in $i)
break
fi
done
fi

10 changes: 8 additions & 2 deletions ext/zlib/config0.m4
Original file line number Diff line number Diff line change
@@ -19,15 +19,21 @@ if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
elif test -f $PHP_ZLIB/include/zlib.h; then
ZLIB_DIR=$PHP_ZLIB
ZLIB_INCDIR=$ZLIB_DIR/include
elif test -f $PHP_ZLIB/develop/headers/zlib.h; then
ZLIB_DIR=$PHP_ZLIB
ZLIB_INCDIR=$ZLIB_DIR/develop/headers
fi
else
for i in /usr/local /usr $PHP_ZLIB_DIR; do
for i in /usr/local /usr /system $PHP_ZLIB_DIR; do
if test -f $i/include/zlib/zlib.h; then
ZLIB_DIR=$i
ZLIB_INCDIR=$i/include/zlib
elif test -f $i/include/zlib.h; then
ZLIB_DIR=$i
ZLIB_INCDIR=$i/include
elif test -f $i/develop/headers/zlib.h; then
ZLIB_DIR=$i
ZLIB_INCDIR=$i/develop/headers
fi
done
fi
@@ -42,7 +48,7 @@ if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
esac

AC_MSG_CHECKING([for zlib version >= 1.2.0.4])
ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_DIR/include/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_INCDIR/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
AC_MSG_RESULT([$ZLIB_VERSION])
if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100 + $4}'` -lt 1020004; then
AC_MSG_ERROR([libz version greater or equal to 1.2.0.4 required])
8 changes: 6 additions & 2 deletions sapi/fpm/fpm/fpm_children.c
Original file line number Diff line number Diff line change
@@ -204,13 +204,17 @@ void fpm_children_bury() /* {{{ */

} else if (WIFSIGNALED(status)) {
const char *signame = fpm_signal_names[WTERMSIG(status)];
const char *have_core = WCOREDUMP(status) ? " - core dumped" : "";
#ifdef WCOREDUMP
const char *have_core = WCOREDUMP(status) ? " - core dumped" : "";
#endif

if (signame == NULL) {
signame = "";
}

snprintf(buf, sizeof(buf), "on signal %d (%s%s)", WTERMSIG(status), signame, have_core);
#ifndef __HAIKU__
snprintf(buf, sizeof(buf), "on signal %d (%s%s)", WTERMSIG(status), signame, have_core);
#endif

/* if it's been killed because of dynamic process management
* don't restart it automaticaly
21 changes: 15 additions & 6 deletions sapi/fpm/fpm/fpm_unix.c
Original file line number Diff line number Diff line change
@@ -373,10 +373,15 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (is_root) {

if (wp->config->process_priority != 64) {
if (setpriority(PRIO_PROCESS, 0, wp->config->process_priority) < 0) {
zlog(ZLOG_SYSERROR, "[pool %s] Unable to set priority for this new process", wp->config->name);
#ifndef __HAIKU__
if (setpriority(PRIO_PROCESS, 0, wp->config->process_priority) < 0) {
zlog(ZLOG_SYSERROR, "[pool %s] Unable to set priority for this new process", wp->config->name);
return -1;
}
#else
return -1;
}
#endif

}

if (wp->set_gid) {
@@ -560,10 +565,14 @@ int fpm_unix_init_main() /* {{{ */

if (fpm_global_config.process_priority != 64) {
if (is_root) {
if (setpriority(PRIO_PROCESS, 0, fpm_global_config.process_priority) < 0) {
zlog(ZLOG_SYSERROR, "Unable to set priority for the master process");
#ifndef __HAIKU__
if (setpriority(PRIO_PROCESS, 0, fpm_global_config.process_priority) < 0) {
zlog(ZLOG_SYSERROR, "Unable to set priority for the master process");
return -1;
}
#else
return -1;
}
#endif
} else {
zlog(ZLOG_NOTICE, "'process.priority' directive is ignored when FPM is not running as root");
}
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg.c
Original file line number Diff line number Diff line change
@@ -1736,7 +1736,7 @@ int main(int argc, char **argv) /* {{{ */
exit(0);
}

#ifndef _WIN32
#if !defined(_WIN32) && !defined(__HAIKU__)
zend_sigaction(SIGIO, &sigio_struct, NULL);
#endif