php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch fpm_builtin_atomic.patch for FPM related Bug #52725

Patch version 2010-08-30 13:45 UTC

Return to Bug #52725 | Download this patch
Patch Revisions:

Developer: fat@php.net

Index: sapi/fpm/fpm/fpm_atomic.h
===================================================================
--- sapi/fpm/fpm/fpm_atomic.h	(révision 302885)
+++ sapi/fpm/fpm/fpm_atomic.h	(copie de travail)
@@ -12,7 +12,7 @@
 #endif
 #include <sched.h>
 
-#if (__GNUC__) && (__GNUC__ >= 4 &&  __GNUC_MINOR__ >= 1)
+#ifdef HAVE_BUILTIN_ATOMIC
 
 /**
  * all the cases below (as provided by upstream) define:
Index: sapi/fpm/config.m4
===================================================================
--- sapi/fpm/config.m4	(révision 302885)
+++ sapi/fpm/config.m4	(copie de travail)
@@ -499,6 +499,24 @@
   fi
   
 ])
+
+AC_DEFUN([AC_FPM_BUILTIN_ATOMIC],
+[
+  AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
+  AC_TRY_LINK(,
+  [
+    int variable = 1;
+    return (__sync_bool_compare_and_swap(&variable, 1, 2)
+           && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
+  ],
+  [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
+  ],
+  [
+    AC_MSG_RESULT([no])
+  ])
+])
 dnl }}}
 
 AC_MSG_CHECKING(for FPM build)
@@ -518,6 +536,7 @@
   AC_FPM_PRCTL
   AC_FPM_CLOCK
   AC_FPM_TRACE
+  AC_FPM_BUILTIN_ATOMIC
 
   PHP_ARG_WITH(fpm-user,,
   [  --with-fpm-user[=USER]  Set the user for php-fpm to run as. (default: nobody)], nobody, no)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 19:01:53 2014 UTC