From: Jérôme Loyet Date: Wed, 1 Sep 2010 08:17:18 +0000 (+0000) Subject: - Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they were... X-Git-Tag: php-5.3.4RC1~285 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b2b7046edf708ddd15511efd8d3f5c518f7808c;p=php - Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they were not available). --- diff --git a/NEWS b/NEWS index c98e917435..60fd6130b7 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ - Fixed possible crash in mssql_fetch_batch(). (Kalle) - Fixed inconsistent backlog default value (-1) in FPM on many systems. (fat) +- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they + were not available). (fat) - Fixed bug #52745 (Binding params doesn't work when selecting a date inside a CASE-WHEN). (Andrey) - Fixed bug #52699 (PDO bindValue writes long int 32bit enum). 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: