This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: compiling php for cygwin


Hi,

I'm the apache and php port maintaner for the Cygwin platform.

> both php-4.0.4pl1 and php-4.0.5 get the following compile errors
>
> datetime.c: In function `php_mktime':
> datetime.c:186: wrong type argument to unary minus
> datetime.c: In function `php_date':
> datetime.c:436: invalid operands to binary /
> datetime.c:436: invalid operands to binary %
> datetime.c:444: wrong type argument to unary minus
> datetime.c:444: wrong type argument to unary minus
> datetime.c:497: invalid operands to binary /
> datetime.c:498: invalid operands to binary %
> make[3]: *** [datetime.lo] Error 1

for php-4.0.4pl1 and php-4.0.5 you have to ensure that you pass -UWINNT for every gcc
call made by make, because the sources support the native Win32 compile too.

Use the attached patch to see what needs to be done. - I'm currently working on
php-4.0.5 and will post an announcement of the diffs and source, binary packages as
they are available.

> Any help would be appreciated...  btw I'm trying to compile as an executable not an
> apache DSO module

why not -- it works fine with advanced patches I made recently :)) -- to be announced.

Stipe

tolj@wapme-systems.de
-------------------------------------------------------------------
Wapme Systems AG

Münsterstr. 248
40470 Düsseldorf

Tel: +49-211-74845-0
Fax: +49-211-74845-299

E-Mail: info@wapme-systems.de
Internet: http://www.wapme-systems.de
-------------------------------------------------------------------
wapme.net - wherever you are

diff -ur php-4.0.0/configure php-4.0.0-cygwin/configure
--- php-4.0.0/configure	Mon May 22 18:03:35 2000
+++ php-4.0.0-cygwin/configure	Sun Oct 29 19:13:04 2000
@@ -1470,7 +1470,16 @@
 fi
   MAINT=$MAINTAINER_MODE_TRUE
   
-
+# Cygwin's gcc defines WINNT which is used _very_ frequently in
+# the php3 sources, so we have to ensure to undef this.
+# --
+# Stipe Tolj <tolj@wapme-systems.de>
+# Cygwin Porting Project -- http://www.student.uni-koeln.de/cygwin/      
+if test "$OSTYPE" = "cygwin32"; then
+  CFLAGS="$CFLAGS -UWINNT"
+  echo " + Cygwin OS detected ... undef WINNT"
+  echo " + setting CFLAGS=\"$CFLAGS\""
+fi
 
 # Make sure we can run config.sub.
 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
diff -ur php-4.0.0/ext/dav/dav.c php-4.0.0-cygwin/ext/dav/dav.c
--- php-4.0.0/ext/dav/dav.c	Thu May 18 15:34:23 2000
+++ php-4.0.0-cygwin/ext/dav/dav.c	Sun Oct 29 19:13:06 2000
@@ -157,7 +157,8 @@
 }
 
 
-PHP_MINFO_FUNCTION(phpdav);
+//PHP_MINFO_FUNCTION(phpdav);
+PHP_MINFO_FUNCTION(phpdav)
 {
 	php_info_print_table_start();
 	php_info_print_table_row(2, "DAV Support", "enabled");
diff -ur php-4.0.0/ext/dav/php_dav.h php-4.0.0-cygwin/ext/dav/php_dav.h
--- php-4.0.0/ext/dav/php_dav.h	Fri Dec 17 20:54:48 1999
+++ php-4.0.0-cygwin/ext/dav/php_dav.h	Sun Oct 29 19:13:06 2000
@@ -43,7 +43,7 @@
 extern zend_module_entry phpdav_module_entry;
 #  define phpdav_module_ptr &phpdav_module_entry
 
-int phpdav_mkcol_test_handler(request_rec *);
+//int phpdav_mkcol_test_handler(request_rec *);
 
 PHP_FUNCTION(dav_set_mkcol_handlers);
 
diff -ur php-4.0.0/ext/mysql/libmysql/global.h php-4.0.0-cygwin/ext/mysql/libmysql/global.h
--- php-4.0.0/ext/mysql/libmysql/global.h	Sun Mar 26 14:27:10 2000
+++ php-4.0.0-cygwin/ext/mysql/libmysql/global.h	Sun Oct 29 19:13:26 2000
@@ -7,7 +7,7 @@
 #ifndef _global_h
 #define _global_h
 
-#if defined(__WIN32__) || defined(WIN32)
+#if (defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
 #include <config-win32.h>
 #else
 #include <my_config.h>
@@ -504,7 +504,7 @@
 error "Neither int or long is of 4 bytes width"
 #endif
 
-#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC)
+#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC) && !defined(__CYGWIN__)
 typedef unsigned long	ulong;	/* Short for unsigned long */
 #endif
 #ifndef longlong_defined
diff -ur php-4.0.0/ext/mysql/libmysql/my_sys.h php-4.0.0-cygwin/ext/mysql/libmysql/my_sys.h
--- php-4.0.0/ext/mysql/libmysql/my_sys.h	Sat Feb 19 10:10:46 2000
+++ php-4.0.0-cygwin/ext/mysql/libmysql/my_sys.h	Sun Oct 29 19:13:33 2000
@@ -7,6 +7,10 @@
 extern "C" {
 #endif
 
+#if defined(__CYGWIN__)
+#include <errno.h>
+#endif
+
 #ifdef HAVE_AIOWAIT
 #include <sys/asynch.h>			/* Used by record-cache */
 typedef struct my_aio_result {
diff -ur php-4.0.0/ext/mysql/libmysql/mysql.h php-4.0.0-cygwin/ext/mysql/libmysql/mysql.h
--- php-4.0.0/ext/mysql/libmysql/mysql.h	Sat Feb 19 10:10:46 2000
+++ php-4.0.0-cygwin/ext/mysql/libmysql/mysql.h	Sun Oct 29 19:13:31 2000
@@ -13,7 +13,7 @@
 #ifndef _global_h				/* If not standard header */
 #include <sys/types.h>
 typedef char my_bool;
-#if !defined(WIN32)
+#if !defined(WIN32) && !defined(__CYGWIN__)
 #define STDCALL
 #else
 #define STDCALL __stdcall
diff -ur php-4.0.0/ext/mysql/libmysql/net.c php-4.0.0-cygwin/ext/mysql/libmysql/net.c
--- php-4.0.0/ext/mysql/libmysql/net.c	Sat Feb 19 21:35:02 2000
+++ php-4.0.0-cygwin/ext/mysql/libmysql/net.c	Sun Oct 29 19:13:33 2000
@@ -8,7 +8,7 @@
 ** 3 byte length & 1 byte package-number.
 */
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <winsock.h>
 #endif
 #include <global.h>
@@ -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(__CYGWIN__)
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
diff -ur php-4.0.0/ext/standard/basic_functions.c php-4.0.0-cygwin/ext/standard/basic_functions.c
--- php-4.0.0/ext/standard/basic_functions.c	Sun May 21 21:13:32 2000
+++ php-4.0.0-cygwin/ext/standard/basic_functions.c	Sun Oct 29 19:13:49 2000
@@ -201,7 +201,7 @@
 	PHP_FE(gethostbyaddr,							NULL)
 	PHP_FE(gethostbyname,							NULL)
 	PHP_FE(gethostbynamel,							NULL)
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
+#if (!defined(PHP_WIN32)||HAVE_BINDLIB) && !defined(__CYGWIN__)
 	PHP_FE(checkdnsrr,								NULL)
 	PHP_FE(getmxrr,									second_and_third_args_force_ref)
 #endif
diff -ur php-4.0.0/ext/standard/datetime.c php-4.0.0-cygwin/ext/standard/datetime.c
--- php-4.0.0/ext/standard/datetime.c	Thu May 18 15:34:35 2000
+++ php-4.0.0-cygwin/ext/standard/datetime.c	Sun Oct 29 19:13:50 2000
@@ -52,7 +52,7 @@
 	"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
 };
 
-#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
+#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE) && !defined(__CYGWIN__)
 extern time_t timezone;
 #endif
 
@@ -417,6 +417,8 @@
 			case 'T':		/* timezone name */
 #if HAVE_TM_ZONE
 				strcat(return_value->value.str.val, ta->tm_zone);
+#elif defined(__CYGWIN__)
+				strcat(return_value->value.str.val, _tzname[0]);
 #else
 				strcat(return_value->value.str.val, tzname[0]);
 #endif
diff -ur php-4.0.0/ext/standard/dns.c php-4.0.0-cygwin/ext/standard/dns.c
--- php-4.0.0/ext/standard/dns.c	Thu May 18 15:34:35 2000
+++ php-4.0.0-cygwin/ext/standard/dns.c	Sun Oct 29 19:13:50 2000
@@ -42,8 +42,10 @@
 #undef STATUS
 #undef T_UNSPEC
 #endif
-#include <arpa/nameser.h>
-#include <resolv.h>
+#if !defined(__CYGWIN__)
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+#endif
 #endif
 
 #include "dns.h"
@@ -159,7 +161,8 @@
 	return estrdup(inet_ntoa(in));
 }
 
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
+#if (!defined(PHP_WIN32)||HAVE_BINDLIB) && !defined(__CYGWIN__)
+
 
 /* {{{ proto int checkdnsrr(string host [, string type])
    Check DNS records corresponding to a given Internet host name or IP address */
diff -ur php-4.0.0/ext/standard/parsedate.c php-4.0.0-cygwin/ext/standard/parsedate.c
--- php-4.0.0/ext/standard/parsedate.c	Mon May 22 18:03:47 2000
+++ php-4.0.0-cygwin/ext/standard/parsedate.c	Sun Oct 29 19:14:09 2000
@@ -64,7 +64,7 @@
 #include <alloca.h>
 #endif
 
-#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
+#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE) && !defined(__CYGWIN__)
 extern time_t timezone;
 #endif
 
@@ -314,7 +314,7 @@
 #define YYPURE 1
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/lib/bison.simple"
+#line 3 "/usr/share/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -507,7 +507,7 @@
 #endif
 #endif
 
-#line 196 "/usr/lib/bison.simple"
+#line 196 "/usr/share/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -1074,7 +1074,7 @@
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/lib/bison.simple"
+#line 498 "/usr/share/bison.simple"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -1772,6 +1772,8 @@
     yyDay = tm->tm_mday;
 #ifdef HAVE_TM_GMTOFF
     yyTimezone = tm->tm_gmtoff/60;
+#elif defined(__CYGWIN__)
+	yyTimezone = (int)timezone/60;
 #else
 	yyTimezone = timezone/60;
 #endif
diff -ur php-4.0.0/ext/standard/parsedate.y php-4.0.0-cygwin/ext/standard/parsedate.y
--- php-4.0.0/ext/standard/parsedate.y	Thu May  4 10:38:14 2000
+++ php-4.0.0-cygwin/ext/standard/parsedate.y	Sun Oct 29 19:14:12 2000
@@ -46,7 +46,7 @@
 #include <alloca.h>
 #endif
 
-#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
+#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE) && !defined(__CYGWIN__)
 extern time_t timezone;
 #endif
 
@@ -868,6 +868,8 @@
     yyDay = tm->tm_mday;
 #ifdef HAVE_TM_GMTOFF
     yyTimezone = tm->tm_gmtoff/60;
+#elif defined(__CYGWIN__)
+	yyTimezone = (int)timezone/60;
 #else
 	yyTimezone = timezone/60;
 #endif
diff -ur php-4.0.0/php.h php-4.0.0-cygwin/php.h
--- php-4.0.0/php.h	Fri May 19 08:28:53 2000
+++ php-4.0.0-cygwin/php.h	Sun Oct 29 19:14:58 2000
@@ -76,7 +76,6 @@
 #undef PHP_DEBUG
 #define PHP_DEBUG ZEND_DEBUG
 
-
 #if PHP_DEBUG || !(defined(__GNUC__)||defined(PHP_WIN32))
 #ifdef inline
 #undef inline

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]