From: Stanislav Malyshev Date: Mon, 25 Mar 2013 03:11:28 +0000 (-0700) Subject: add code to check if we know flock definition on this system X-Git-Tag: php-5.5.0beta2~13^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=385d0e52cc527393269a48f2fdd01aa1541b4e1f;p=php add code to check if we know flock definition on this system In order to configure detect it and not fail the compile. Not an ideal solution, suggestions are welcome on how to improve it. --- diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index cbf7d5a19c..70cd4e9ecc 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -325,6 +325,39 @@ int main() { AC_DEFINE(HAVE_SHM_MMAP_FILE, 1, [Define if you have mmap() SHM support]) msg=yes,msg=no,msg=no) AC_MSG_RESULT([$msg]) + + AC_MSG_CHECKING(for known struct flock definition) + dnl Copied from ZendAccelerator.h + AC_TRY_RUN([ +#include +#include + +#ifndef ZEND_WIN32 +extern int lock_file; + +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {start, len, -1, type, whence} +# elif defined(__svr4__) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {type, whence, start, len} +# elif defined(__linux__) || defined(__hpux) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {type, whence, start, len, 0} +# elif defined(_AIX) +# if defined(_LARGE_FILES) || defined(__64BIT__) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {type, whence, 0, 0, 0, start, len } +# else +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {type, whence, start, len} +# endif +# else +# error "Don't know how to define struct flock" +# endif +#endif +void main() {} +], [], [AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], []) PHP_NEW_EXTENSION(opcache, ZendAccelerator.c \