[PATCH] Change AC_COMPILE_IFELSE into AC_LINK_IFELSE for the __sync_{add, sub}_and_fetch() test

Mike Hommey mh+jemalloc at glandium.org
Tue Mar 27 06:03:07 PDT 2012


From: Mike Hommey <mh at glandium.org>

With the Android NDK, __sync_{add,sub}_and_fetch() compile fine for uint64_t,
but the corresponding libgcc function aren't there.
---
 configure.ac |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2616b0a..c1b46dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -898,20 +898,20 @@ dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
 AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
   AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
                [je_cv_sync_compare_and_swap_$2],
-               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
-                                                    #include <stdint.h>
-                                                   ],
-                                                   [
-                                                    #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
-                                                    {
-                                                       uint$1_t x$1 = 0;
-                                                       __sync_add_and_fetch(&x$1, 42);
-                                                       __sync_sub_and_fetch(&x$1, 1);
-                                                    }
-                                                    #else
-                                                    #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
-                                                    #endif
-                                                   ])],
+               [AC_LINK_IFELSE([AC_LANG_PROGRAM([
+                                                 #include <stdint.h>
+                                                ],
+                                                [
+                                                 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
+                                                 {
+                                                    uint$1_t x$1 = 0;
+                                                    __sync_add_and_fetch(&x$1, 42);
+                                                    __sync_sub_and_fetch(&x$1, 1);
+                                                 }
+                                                 #else
+                                                 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
+                                                 #endif
+                                                ])],
                                [je_cv_sync_compare_and_swap_$2=yes],
                                [je_cv_sync_compare_and_swap_$2=no])])
 
-- 
1.7.9.1




More information about the jemalloc-discuss mailing list