php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #55874
Patch check-if-__sync_fetch_and_add-is-provided revision 2011-10-08 15:51 UTC by klightspeed at netspace dot net dot au

Patch check-if-__sync_fetch_and_add-is-provided for Compile Failure Bug #55874

Patch version 2011-10-08 15:51 UTC

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

Developer: klightspeed@netspace.net.au

Index: ext/standard/php_crypt_r.c
===================================================================
--- ext/standard/php_crypt_r.c	(revision 317888)
+++ ext/standard/php_crypt_r.c	(working copy)
@@ -94,8 +94,7 @@
 	if (!initialized) {
 #ifdef PHP_WIN32
 		InterlockedIncrement(&initialized);
-#elif (defined(__GNUC__) && !defined(__hpux) && !defined(__hppa__) && (__GNUC__ > 4 || \
-    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1)))))
+#elif defined(HAVE_SYNC_FETCH_AND_ADD)
 		__sync_fetch_and_add(&initialized, 1);
 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
 		membar_producer();
Index: configure.in
===================================================================
--- configure.in	(revision 317888)
+++ configure.in	(working copy)
@@ -736,6 +736,13 @@
   AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
 fi
 
+dnl Check for the __sync_fetch_and_add builtin
+AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
+[AC_TRY_LINK([],[int x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
+if test "$ac_cv_func_sync_fetch_and_add" = yes; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
+fi
+
 AC_REPLACE_FUNCS(strlcat strlcpy getopt)
 AC_FUNC_UTIME_NULL
 AC_FUNC_ALLOCA
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC