From 70d7d86505545e8a228897d6220c6f5b1cb3f76f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Loyet?= Date: Wed, 1 Sep 2010 08:17:18 +0000 Subject: [PATCH] - Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they were not available). --- sapi/fpm/config.m4 | 19 +++++++++++++++++++ sapi/fpm/fpm/fpm_atomic.h | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index f32db6a368..0fd5669626 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -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) diff --git a/sapi/fpm/fpm/fpm_atomic.h b/sapi/fpm/fpm/fpm_atomic.h index e2e64d8a5d..5c93bfcb78 100644 --- a/sapi/fpm/fpm/fpm_atomic.h +++ b/sapi/fpm/fpm/fpm_atomic.h @@ -12,7 +12,7 @@ #endif #include -#if (__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1) +#ifdef HAVE_BUILTIN_ATOMIC /** * all the cases below (as provided by upstream) define: -- 2.40.0