summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAntoine Jacoutot <antoine@mtier.org>2013-08-28 09:35:27 +0200
committerAntoine Jacoutot <antoine@mtier.org>2013-08-28 12:01:44 +0200
commit996edb0c46356d8a326f886b91a77a6af9a2de3e (patch)
treee52730f00113c9e9fa698c33aeec0085c58adedf /configure.ac
parent34e1a537956e85d9d2db2127cd723a6c7456f793 (diff)
fix atomic ops detection
AC_TRY_LINK should be used instead of AC_TRY_COMPILE because the code will compile everywhere, either producing ``atomic'' code, or an external reference to __sync_bool_compare_and_swap. https://bugzilla.gnome.org/show_bug.cgi?id=706958
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac6
1 files changed, 3 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 826204eaf..3c2e142b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2454,7 +2454,7 @@ AC_CACHE_CHECK([for lock-free atomic intrinsics], glib_cv_g_atomic_lock_free, [
glib_cv_g_atomic_lock_free=yes
;;
*)
- AC_TRY_COMPILE([],
+ AC_TRY_LINK([],
[volatile int atomic = 2;\
__sync_bool_compare_and_swap (&atomic, 2, 3);],
[glib_cv_g_atomic_lock_free=yes],
@@ -2462,7 +2462,7 @@ AC_CACHE_CHECK([for lock-free atomic intrinsics], glib_cv_g_atomic_lock_free, [
if test "$glib_cv_g_atomic_lock_free" = "no"; then
SAVE_CFLAGS="${CFLAGS}"
CFLAGS="-march=i486"
- AC_TRY_COMPILE([],
+ AC_TRY_LINK([],
[volatile int atomic = 2;\
__sync_bool_compare_and_swap (&atomic, 2, 3);],
[AC_MSG_ERROR([GLib must be build with -march=i486 or later.])],
@@ -2480,7 +2480,7 @@ case $host in
# Some compilers support atomic operations but do not define
# __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, like clang
if test x"$glib_cv_g_atomic_lock_free" = xyes; then
- AC_TRY_COMPILE([],
+ AC_TRY_LINK([],
[__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
[],
[AC_DEFINE(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, 1, [ compiler supports atomic operations])])