]> granicus.if.org Git - php/commitdiff
- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they were...
authorJérôme Loyet <fat@php.net>
Wed, 1 Sep 2010 08:17:18 +0000 (08:17 +0000)
committerJérôme Loyet <fat@php.net>
Wed, 1 Sep 2010 08:17:18 +0000 (08:17 +0000)
sapi/fpm/config.m4
sapi/fpm/fpm/fpm_atomic.h

index f32db6a36809677a61622731cc73b8a31a4b62f6..0fd566962600b5e9b434c791478286a665de72a9 100644 (file)
@@ -499,6 +499,24 @@ AC_DEFUN([AC_FPM_TRACE],
   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 @@ if test "$PHP_FPM" != "no"; then
   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)
index e2e64d8a5df1b5f2301cc9ed10ad6c8c468e1f23..5c93bfcb780ccf345476494f86f1469ab7de17bf 100644 (file)
@@ -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: