From: Kalle Sommer Nielsen Date: Tue, 8 Sep 2009 01:50:40 +0000 (+0000) Subject: Experimental build support for VC10 X-Git-Tag: php-5.4.0alpha1~191^2~2681 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e834d1a1f41c1ac13595e101dbe0ddaeab408401;p=php Experimental build support for VC10 - Contains newly introduced compiler warning fixes - configure now picks up VC10 --- diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 337571181a..ed2a6d0984 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -41,8 +41,12 @@ # include "php_sockets.h" # include "win32/sockets.h" # define IS_INVALID_SOCKET(a) (a->bsd_socket == INVALID_SOCKET) -# define EPROTONOSUPPORT WSAEPROTONOSUPPORT -# define ECONNRESET WSAECONNRESET +# ifndef EPROTONOSUPPORT +# define EPROTONOSUPPORT WSAEPROTONOSUPPORT +# endif +# ifndef ECONNRESET +# define ECONNRESET WSAECONNRESET +# endif # ifdef errno # undef errno # endif diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h index 1ffda52e9b..da96e1d7b8 100644 --- a/ext/standard/flock_compat.h +++ b/ext/standard/flock_compat.h @@ -42,9 +42,11 @@ PHPAPI int flock(int fd, int operation); #define PHP_LOCK_NB 4 #ifdef PHP_WIN32 -#define EWOULDBLOCK WSAEWOULDBLOCK -# define fsync _commit -# define ftruncate(a, b) chsize(a, b) +# ifndef EWOULDBLOCK +# define EWOULDBLOCK WSAEWOULDBLOCK +# endif +# define fsync _commit +# define ftruncate(a, b) chsize(a, b) #endif /* defined(PHP_WIN32) */ #if !HAVE_INET_ATON diff --git a/main/php_network.h b/main/php_network.h index aafd0a2a67..d8e34c4027 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -34,10 +34,14 @@ #endif #ifdef PHP_WIN32 -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEWOULDBLOCK -# define fsync _commit -# define ftruncate(a, b) chsize(a, b) +# ifndef EWOULDBLOCK +# define EWOULDBLOCK WSAEWOULDBLOCK +# endif +# ifndef EINPROGRESS +# define EINPROGRESS WSAEWOULDBLOCK +#endif +# define fsync _commit +# define ftruncate(a, b) chsize(a, b) #endif /* defined(PHP_WIN32) */ #ifndef EWOULDBLOCK diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h index 59e2036f0c..c182e8278c 100644 --- a/main/streams/php_streams_int.h +++ b/main/streams/php_streams_int.h @@ -48,7 +48,7 @@ #define CHUNK_SIZE 8192 -#ifdef PHP_WIN32 +#if defined(PHP_WIN32) && !defined(EWOULDBLOCK) #define EWOULDBLOCK WSAEWOULDBLOCK #endif diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 1f8bc3ce3a..8dab2bf9c4 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -15,8 +15,10 @@ if (!CL) { // 1310 is vs.net 2003 // 1400 is vs.net 2005 // 1500 is vs.net 2008 +// 1600 is vs.net 2010 // Which version of the compiler do we have? VCVERS = probe_binary(CL).substr(0, 5).replace('.', ''); +STDOUT.WriteLine(VCVERS); STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]); AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version"); DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]); @@ -147,7 +149,7 @@ if (VCVERS >= 1400) { } } -ARG_WITH('mp', 'Tell VC9 use up to [n,auto,disable] processes for compilation', 'auto'); +ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto'); if (VCVERS >= 1500 && PHP_MP != 'disable') { if(PHP_MP == 'auto' || PHP_MP == 'no') { ADD_FLAG('CFLAGS', ' /MP '); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 44c040bee9..82886d725f 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -41,6 +41,7 @@ VC_VERSIONS[1300] = 'MSVC7 (Visual C++ 2002)'; VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)'; VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)'; VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)'; +VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)'; var VC_VERSIONS_SHORT = new Array(); VC_VERSIONS_SHORT[1200] = 'VC6'; @@ -48,6 +49,7 @@ VC_VERSIONS_SHORT[1300] = 'VC7'; VC_VERSIONS_SHORT[1310] = 'VC7.1'; VC_VERSIONS_SHORT[1400] = 'VC8'; VC_VERSIONS_SHORT[1500] = 'VC9'; +VC_VERSIONS_SHORT[1600] = 'VC10'; if (PROGRAM_FILES == null) { PROGRAM_FILES = "C:\\Program Files"; diff --git a/win32/php_stdint.h b/win32/php_stdint.h index d3adcc2923..7c69d8ed0c 100644 --- a/win32/php_stdint.h +++ b/win32/php_stdint.h @@ -264,7 +264,13 @@ typedef uint64_t uintmax_t; #define INTMAX_C INT64_C #define UINTMAX_C UINT64_C -static __inline int64_t llabs( int64_t i ) { return i >= 0? i: -i; } +// In VC10+, llabs is an intrinsic function, so don't define it +#if _MSC_VER < 1600 +static __inline int64_t llabs( int64_t i ) +{ + return i >= 0 ? i : -i; +} +#endif #endif // __STDC_CONSTANT_MACROS ]