Permalink
Browse files

improve __sync_sub_and_fetch detection #4231

  • Loading branch information...
1 parent 760b60e commit cd05f738a64e40543703b10906cf6e1b45e46a81 @unicolet unicolet committed Dec 12, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 configure
  2. +1 −1 configure.in
View
@@ -17836,7 +17836,7 @@ else
int
main ()
{
-long x;long y=__sync_fetch_and_add(&x,1);
+long x=0,y=0;for(x=0;x<5;x++){if(y>1) break; y=__sync_fetch_and_add(&x,1);}
;
return 0;
}
View
@@ -851,7 +851,7 @@ dnl ---------------------------------------------------------------------
dnl Check for the __sync_fetch_and_add builtin
dnl ---------------------------------------------------------------------
AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
-[AC_TRY_LINK([],[long x;long y=__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
+[AC_TRY_LINK([],[long x=0,y=0;for(x=0;x<5;x++){if(y>1) break; y=__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
ALL_ENABLED="-DHAVE_SYNC_FETCH_AND_ADD $ALL_ENABLED"
AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])

0 comments on commit cd05f73

Please sign in to comment.