First BeOS patch
| From: | Jonathan Perret | Date: | Wed, 22 Mar 2000 21:37:18 +0000 |
| Subject: | First BeOS patch | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12504@lists.php.net to get a copy of this message | ||
Hello all,
Below is my first patch for BeOS. Freshly diff'd from the latest CVS.
This first patch handles a few minor glitches wrt headers and libs :
- add '-lbe' to the link (cause syslog() is in it)
- check for <arpa/inet.h>,<arpa/nameser.h> and <resolv.h> before
(not) including them (BeOS does not have them)
- check for getservbyport,getprotobyname,getprotobynumber
(BeOS does not have them)
- check for LOG_NOWAIT (BeOS doesn't have it)
- #undef AF_UNIX (BeOS does not have UNIX sockets)
- skip some <netinet/> headers - I couldn't see where
HAVE_BROKEN_NETINET_INCLUDES was supposed to get defined ???
This is not enough to build PHP4 under BeOS but it's a good start.
The rest is coming up.
Cheers,
--Jonathan
---8<---snip
Index: configure.in
===================================================================
RCS file: /repository/php4/configure.in,v
retrieving revision 1.104
diff -u -r1.104 configure.in
--- configure.in 2000/03/18 17:58:09 1.104
+++ configure.in 2000/03/22 19:53:25
@@ -168,6 +168,10 @@
AC_ADD_LIBRARY(nsl)
AC_DEFINE(HAVE_LIBNSL) ], [])
+AC_CHECK_LIB(be, syslog, [
+ AC_ADD_LIBRARY(be)
+ ], [])
+
AC_CHECK_LIB(socket, socket, [
AC_ADD_LIBRARY(socket)
AC_DEFINE(HAVE_LIBSOCKET) ], [
@@ -223,6 +227,7 @@
dnl QNX requires unix.h to allow functions in libunix to work properly
AC_CHECK_HEADERS(
arpa/inet.h \
+arpa/nameser.h \
crypt.h \
dlfcn.h \
fcntl.h \
@@ -232,6 +237,7 @@
memory.h \
netinet/in.h \
pwd.h \
+resolv.h \
signal.h \
stdarg.h \
stdlib.h \
@@ -292,6 +298,9 @@
getlogin \
gethostbyaddr \
getrusage \
+getservbyport \
+getprotobyname \
+getprotobynumber \
gettimeofday \
gmtime_r \
inet_aton \
Index: fopen-wrappers.c
===================================================================
RCS file: /repository/php4/fopen-wrappers.c,v
retrieving revision 1.46
diff -u -r1.46 fopen-wrappers.c
--- fopen-wrappers.c 2000/03/15 19:12:41 1.46
+++ fopen-wrappers.c 2000/03/22 19:53:25
@@ -66,7 +66,9 @@
#else
#include <netinet/in.h>
#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#endif
#ifdef PHP_WIN32
Index: ext/mysql/libmysql/my_net.c
===================================================================
RCS file: /repository/php4/ext/mysql/libmysql/my_net.c,v
retrieving revision 1.1
diff -u -r1.1 my_net.c
--- ext/mysql/libmysql/my_net.c 2000/02/19 10:10:46 1.1
+++ ext/mysql/libmysql/my_net.c 2000/03/22 19:53:28
@@ -9,9 +9,15 @@
/* for thread safe my_inet_ntoa */
#if !defined(MSDOS) && !defined(__WIN32__)
#include <netdb.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#endif
#ifndef THREAD
Index: ext/mysql/libmysql/my_net.h
===================================================================
RCS file: /repository/php4/ext/mysql/libmysql/my_net.h,v
retrieving revision 1.1
diff -u -r1.1 my_net.h
--- ext/mysql/libmysql/my_net.h 2000/02/19 10:10:46 1.1
+++ ext/mysql/libmysql/my_net.h 2000/03/22 19:53:28
@@ -1,10 +1,16 @@
/* thread safe version of some common functions */
/* for thread safe my_inet_ntoa */
-#if !defined(MSDOS) && !defined(__WIN32__)
+#if !defined(MSDOS) && !defined(__WIN32__) && !defined(__BEOS__)
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#endif
void my_inet_ntoa(struct in_addr in, char *buf);
Index: ext/mysql/libmysql/net.c
===================================================================
RCS file: /repository/php4/ext/mysql/libmysql/net.c,v
retrieving revision 1.1
diff -u -r1.1 net.c
--- ext/mysql/libmysql/net.c 2000/02/19 21:35:02 1.1
+++ ext/mysql/libmysql/net.c 2000/03/22 19:53:28
@@ -24,7 +24,7 @@
#if !defined(__WIN32__) && !defined(MSDOS)
#include <sys/socket.h>
#endif
-#if !defined(MSDOS) && !defined(__WIN32__) &&
!defined(HAVE_BROKEN_NETINET_INCLUDES)
+#if !defined(MSDOS) && !defined(__WIN32__) &&
!defined(HAVE_BROKEN_NETINET_INCLUDES)
&& !defined(__BEOS__)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
Index: ext/snmp/snmp.c
===================================================================
RCS file: /repository/php4/ext/snmp/snmp.c,v
retrieving revision 1.22
diff -u -r1.22 snmp.c
--- ext/snmp/snmp.c 2000/03/19 12:38:53 1.22
+++ ext/snmp/snmp.c 2000/03/22 19:53:29
@@ -33,7 +33,9 @@
#else
#include <sys/socket.h>
#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#ifndef _OSD_POSIX
#include <sys/errno.h>
#else
Index: ext/standard/basic_functions.c
===================================================================
RCS file: /repository/php4/ext/standard/basic_functions.c,v
retrieving revision 1.175
diff -u -r1.175 basic_functions.c
--- ext/standard/basic_functions.c 2000/03/16 16:02:23 1.175
+++ ext/standard/basic_functions.c 2000/03/22 19:53:29
@@ -30,7 +30,9 @@
#include <time.h>
#include <stdio.h>
#include <netdb.h>
+#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
Index: ext/standard/dns.c
===================================================================
RCS file: /repository/php4/ext/standard/dns.c,v
retrieving revision 1.16
diff -u -r1.16 dns.c
--- ext/standard/dns.c 2000/03/11 20:48:49 1.16
+++ ext/standard/dns.c 2000/03/22 19:53:30
@@ -36,15 +36,21 @@
#include <winsock.h>
#else
#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#include <netdb.h>
#ifdef _OSD_POSIX
#undef STATUS
#undef T_UNSPEC
#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
+#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif
+#endif
#include "dns.h"
Index: ext/standard/file.c
===================================================================
RCS file: /repository/php4/ext/standard/file.c,v
retrieving revision 1.72
diff -u -r1.72 file.c
--- ext/standard/file.c 2000/03/17 00:44:55 1.72
+++ ext/standard/file.c 2000/03/22 19:53:30
@@ -63,7 +63,9 @@
#else
#include <netinet/in.h>
#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#endif
#include "fsock.h"
#include "fopen-wrappers.h"
Index: ext/standard/fsock.c
===================================================================
RCS file: /repository/php4/ext/standard/fsock.c,v
retrieving revision 1.48
diff -u -r1.48 fsock.c
--- ext/standard/fsock.c 2000/03/06 20:37:11 1.48
+++ ext/standard/fsock.c 2000/03/22 19:53:31
@@ -48,9 +48,11 @@
#else
#include <netinet/in.h>
#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
-#ifdef PHP_WIN32
+#endif
+#if defined(PHP_WIN32)||defined(__BEOS__)
#undef AF_UNIX
#endif
#if defined(AF_UNIX)
Index: ext/standard/syslog.c
===================================================================
RCS file: /repository/php4/ext/standard/syslog.c,v
retrieving revision 1.17
diff -u -r1.17 syslog.c
--- ext/standard/syslog.c 2000/03/06 20:37:11 1.17
+++ ext/standard/syslog.c 2000/03/22 19:53:31
@@ -92,7 +92,9 @@
REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
+#ifdef LOG_NOWAIT
REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
+#endif
#ifdef LOG_PERROR
/* AIX doesn't have LOG_PERROR */
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT);
/*log to stderr*/
@@ -175,7 +177,9 @@
SET_VAR_LONG("LOG_CONS", LOG_CONS);
SET_VAR_LONG("LOG_ODELAY", LOG_ODELAY);
SET_VAR_LONG("LOG_NDELAY", LOG_NDELAY);
+#ifdef LOG_NOWAIT
SET_VAR_LONG("LOG_NOWAIT", LOG_NOWAIT);
+#endif
#ifdef LOG_PERROR
/* AIX doesn't have LOG_PERROR */
SET_VAR_LONG("LOG_PERROR", LOG_PERROR); /*log to stderr*/