Re: porting to OS/2

From: Date: Mon, 10 May 1999 14:10:11 +0000
Subject: Re: porting to OS/2
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-5477@lists.php.net to get a copy of this message
On Sat, 1 May 1999 02:46:29 -0400, Jim Winstead wrote: >Sorry, I must have missed your message the first time around. >This is fixed in the CVS tree now. (And in taking a look at pageinfo.c >to see who would make such a silly mistake in the first place, it >turns out it was me. :) No problem. Anyway, here's the port to OS/2 as a patch against the current tree. It compiles and runs but hasn't been extensively tested. It _should_ be harmless for other platforms (it's pretty straightforward) but I can't really check. Index: Makefile.in =================================================================== RCS file: /repository/php3/Makefile.in,v retrieving revision 1.306 diff -u -r1.306 Makefile.in --- Makefile.in 1999/05/09 16:54:33 1.306 +++ Makefile.in 1999/05/10 12:43:10 @@ -33,6 +33,7 @@ VPATH = @srcdir@ bindir = @bindir@ +SHELL = @SH@ CC = @CC@ AR = ar rc BINNAME = @BINNAME@ Index: apMakefile.tmpl =================================================================== RCS file: /repository/php3/apMakefile.tmpl,v retrieving revision 1.6 diff -u -r1.6 apMakefile.tmpl --- apMakefile.tmpl 1998/05/25 12:08:33 1.6 +++ apMakefile.tmpl 1999/05/10 12:43:11 @@ -36,6 +36,12 @@ rm -f $@ $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) +# Build OS/2 dll +libphp3.dll: $(OBJS) mod_php3.def + $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $* $(OBJS) libmodphp3.a $(LIBS_SHLIB) $(EXTRA_LIBS) $(SRCDIR)/$(REGLIB) + emxbind -b -q -s -h0 -dmod_php3.def $* && \ + rm $* + # 1. extension .o for shared objects cannot be used here because # first these files aren't still shared objects and second we # have to use a different name to trigger the different @@ -43,7 +49,7 @@ # 2. extension -so.o (as used elsewhere) cannot be used because # the suffix feature of Make really wants just .x, so we use # extension .so-o -.SUFFIXES: .o .so-o +.SUFFIXES: .o .so-o .dll .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $< .c.so-o: Index: configure.in =================================================================== RCS file: /repository/php3/configure.in,v retrieving revision 1.352 diff -u -r1.352 configure.in --- configure.in 1999/05/09 18:09:50 1.352 +++ configure.in 1999/05/10 12:43:21 @@ -29,6 +29,7 @@ AC_PROG_RANLIB AC_PROG_CC_C_O AC_PATH_PROG(PERL_PATH, perl) +AC_CHECK_PROGS(SH, /bin/sh sh) dnl Ugly hack to get around a problem with gcc on AIX. if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ @@ -186,7 +187,9 @@ dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument if test "uname -s 2>/dev/null" != "QNX"; then - AC_STRUCT_ST_BLOCKS + if test "uname -s 2>/dev/null" != "OS/2"; then + AC_STRUCT_ST_BLOCKS + fi else AC_MSG_WARN(warnings level for cc set to 0) WARNING_LEVEL=0 Index: main.c =================================================================== RCS file: /repository/php3/main.c,v retrieving revision 1.496 diff -u -r1.496 main.c --- main.c 1999/03/07 15:49:15 1.496 +++ main.c 1999/05/10 12:43:26 @@ -80,7 +80,7 @@ #include <io.h> #include <fcntl.h> #include "win32/syslog.h" -#else +#elif HAVE_SYSLOG_H #include <syslog.h> #endif Index: php.h =================================================================== RCS file: /repository/php3/php.h,v retrieving revision 1.51 diff -u -r1.51 php.h --- php.h 1999/04/21 19:42:08 1.51 +++ php.h 1999/05/10 12:43:28 @@ -68,6 +68,16 @@ # define THREAD_LS #endif +#ifdef __EMX__ +#define OS2 1 +#define TCPIPV4 +#define MAXSOCKETS 4096 +#if !APACHE +#define strcasecmp(s1, s2) stricmp(s1, s2) +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) +#endif +#endif + #if HAVE_UNIX_H #include <unix.h> #endif Index: php_compat.h =================================================================== RCS file: /repository/php3/php_compat.h,v retrieving revision 1.1 diff -u -r1.1 php_compat.h --- php_compat.h 1999/02/28 23:10:56 1.1 +++ php_compat.h 1999/05/10 12:43:28 @@ -13,6 +13,10 @@ #include "resolv.h" #endif +#ifdef OS2 +#include <netinet/in.h> +#endif + #if !HAVE_FLOCK #define LOCK_SH 1 Index: functions/basic_functions.c =================================================================== RCS file: /repository/php3/functions/basic_functions.c,v retrieving revision 1.261 diff -u -r1.261 basic_functions.c --- basic_functions.c 1999/04/17 04:21:29 1.261 +++ basic_functions.c 1999/05/10 12:43:36 @@ -218,7 +218,7 @@ {"gethostbyaddr", php3_gethostbyaddr, NULL}, {"gethostbyname", php3_gethostbyname, NULL}, {"gethostbynamel", php3_gethostbynamel, NULL}, -#if !(WIN32|WINNT)||HAVE_BINDLIB +#if !(WIN32|WINNT|OS2)||HAVE_BINDLIB {"checkdnsrr", php3_checkdnsrr, NULL}, {"getmxrr", php3_getmxrr, second_and_third_args_force_ref}, #endif Index: functions/datetime.c =================================================================== RCS file: /repository/php3/functions/datetime.c,v retrieving revision 1.51 diff -u -r1.51 datetime.c --- datetime.c 1999/04/03 00:55:40 1.51 +++ datetime.c 1999/05/10 12:43:50 @@ -64,10 +64,8 @@ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -#ifndef HAVE_TM_ZONE -#ifndef _TIMEZONE +#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(OS2) extern time_t timezone; -#endif #endif static int phpday_tab[2][12] = Index: functions/dns.c =================================================================== RCS file: /repository/php3/functions/dns.c,v retrieving revision 1.53 diff -u -r1.53 dns.c --- dns.c 1999/02/27 17:03:50 1.53 +++ dns.c 1999/05/10 12:43:50 @@ -178,7 +178,7 @@ return estrdup(inet_ntoa(in)); } -#if !(WIN32|WINNT)||HAVE_BINDLIB +#if !(WIN32|WINNT|OS2)||HAVE_BINDLIB /* {{{ proto int checkdnsrr(string host [, string type]) Check DNS records corresponding to a given Internet host name or IP address */ Index: functions/filestat.c =================================================================== RCS file: /repository/php3/functions/filestat.c,v retrieving revision 1.87 diff -u -r1.87 filestat.c --- filestat.c 1999/03/01 18:33:53 1.87 +++ filestat.c 1999/05/10 12:43:50 @@ -43,6 +43,11 @@ #include <ctype.h> #include <time.h> +#ifdef OS2 +# define INCL_DOS +# include <os2.h> +#endif + #if HAVE_UNISTD_H # include <unistd.h> #endif @@ -161,6 +166,14 @@ bytesfree = FreeBytesAvailableToCaller.HighPart * (double) (((unsigned long)1) << 31) * 2.0 + FreeBytesAvailableToCaller.LowPart; +#elif defined(OS2) + { + FSALLOCATE fsinfo; + char drive = path->value.str.val[0] & 95; + + if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) + bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail; + } #else /* WINDOWS */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) if (statvfs(path->value.str.val,&buf)) RETURN_FALSE; @@ -187,7 +200,7 @@ int ret; TLS_VARS; ret = 0; -#ifndef WINDOWS +#if !defined(WINDOWS) && !defined(OS2) if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&group)==FAILURE) { WRONG_PARAM_COUNT; @@ -229,7 +242,7 @@ Change file owner */ void php3_chown(INTERNAL_FUNCTION_PARAMETERS) { -#ifndef WINDOWS +#if !defined(WINDOWS) && !defined(OS2) pval *filename, *user; int ret; uid_t uid; @@ -451,7 +464,9 @@ case S_IFIFO: RETURN_STRING("fifo",1); case S_IFCHR: RETURN_STRING("char",1); case S_IFDIR: RETURN_STRING("dir",1); +#ifdef S_IFBLK case S_IFBLK: RETURN_STRING("block",1); +#endif case S_IFREG: RETURN_STRING("file",1); } php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT); Index: functions/syslog.c =================================================================== RCS file: /repository/php3/functions/syslog.c,v retrieving revision 1.44 diff -u -r1.44 syslog.c --- syslog.c 1999/04/22 13:19:51 1.44 +++ syslog.c 1999/05/10 12:43:55 @@ -40,7 +40,7 @@ #endif #if MSVC5 #include "win32/syslog.h" -#else +#elif HAVE_SYSLOG_H #include <syslog.h> #endif @@ -50,6 +50,8 @@ #include <stdio.h> #include "functions/php3_syslog.h" +#if HAVE_SYSLOG_H + static int syslog_started; static char *syslog_device; static void start_syslog(void); @@ -286,6 +288,7 @@ DLEXPORT php3_module_entry *get_module(void) { return &syslog_module_entry; } #endif +#endif /* HAVE_SYSLOG_H */ /* * Local variables: -- ______________________________________________________________________________ | Brian Havard | "He is not the messiah! | | brianh@kheldar.apana.org.au | He's a very naughty boy!" - Life of Brian | ------------------------------------------------------------------------------ -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5477) next »