Bug 652827 - glib-2.29.8 no longer builds with mingw.org's toolchain
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 9 Aug 2011 17:43:34 +0000 (19:43 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 11 Aug 2011 06:40:43 +0000 (08:40 +0200)
Check for Win32 atomic intrinsics.

configure.ac
glib/gatomic.c

index 8fbc4f5..8168988 100644 (file)
@@ -2596,10 +2596,20 @@ if test x"$GCC" = xyes; then
 
   AC_MSG_RESULT($glib_cv_gcc_has_builtin_atomic_operations)
 fi
-
 AM_CONDITIONAL(HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS,
               [test $glib_cv_gcc_has_builtin_atomic_operations = yes])
 
+AC_MSG_CHECKING([for Win32 atomic intrinsics])
+glib_cv_has_win32_atomic_operations=no
+AC_TRY_LINK([],
+       [int i; _InterlockedExchangeAdd (&i, 0);],
+       [glib_cv_has_win32_atomic_operations=yes],
+       [glib_cv_has_win32_atomic_operations=no])
+AC_MSG_RESULT($glib_cv_has_win32_atomic_operations)
+if test "x$glib_cv_has_win32_atomic_operations" = xyes; then
+       AC_DEFINE(HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS,1,[Have Win32 atomic intrinsics])
+fi
+
 dnl ************************
 dnl ** Check for futex(2) **
 dnl ************************
index 328ad4f..1e83f19 100644 (file)
@@ -455,7 +455,7 @@ gsize
   return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
 }
 
-#elif defined (G_PLATFORM_WIN32)
+#elif defined (G_PLATFORM_WIN32) && defined(HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS)
 
 #include <windows.h>
 #if !defined(_M_AMD64) && !defined (_M_IA64) && !defined(_M_X64)