Revision
58
Author
robert@fledge.watson.org
Date
2009-10-27 16:24:40 -0700 (Tue, 27 Oct 2009)

Log Message

Move atomic builtin detections to separate autoconf macro.

Submitted by:	Paolo Bonzini <bonzini@gnu.org>

Modified Paths

Added Paths

Diff

Modified: trunk/configure.ac (57 => 58)


--- trunk/configure.ac	2009-10-27 23:11:08 UTC (rev 57)
+++ trunk/configure.ac	2009-10-27 23:24:40 UTC (rev 58)
@@ -109,24 +109,7 @@
 
 AM_INIT_AUTOMAKE([foreign])
 
-#
-# This is a bit subtle: on i386 systems without at least -march=i486 defined,
-# certain built-in atomics fall back to depending on undefined symbols if
-# their return values are used.
-#
-AC_CACHE_CHECK([for gcc atomic builtins],[dispatch_cv_atomic],
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
-int i, x =0;
-i = __sync_add_and_fetch(&x,1);
-return x;]])],[dispatch_cv_atomic=yes],
-  [saveCFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -march=i486"
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
-  int i, x =0;
-  i = __sync_add_and_fetch(&x,1);
-  return x;]])],[CFLAGS="$saveCFLAGS"
-dispatch_cv_atomic="-march=i486"
-])])])
+DISPATCH_C_ATOMIC_BUILTINS
 
 case $dispatch_cv_atomic in
   yes) ;;

Added: trunk/m4/atomic.m4 (0 => 58)


--- trunk/m4/atomic.m4	                        (rev 0)
+++ trunk/m4/atomic.m4	2009-10-27 23:24:40 UTC (rev 58)
@@ -0,0 +1,21 @@
+AC_DEFUN([DISPATCH_C_ATOMIC_BUILTINS], [
+#
+# This is a bit subtle: on i386 systems without at least -march=i486 defined,
+# certain built-in atomics fall back to depending on undefined symbols if
+# their return values are used.
+#
+AC_CACHE_CHECK([for gcc atomic builtins],[dispatch_cv_atomic],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
+int i, x =0;
+i = __sync_add_and_fetch(&x,1);
+return x;]])],[dispatch_cv_atomic=yes],
+  [saveCFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -march=i486"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
+  int i, x =0;
+  i = __sync_add_and_fetch(&x,1);
+  return x;]])],[CFLAGS="$saveCFLAGS"
+dispatch_cv_atomic="-march=i486"
+])])])
+
+])