]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move the test for __sync_bool_compare_and_swap almost to the bottom,
authorJulian Seward <jseward@acm.org>
Thu, 22 Jan 2009 22:44:30 +0000 (22:44 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 22 Jan 2009 22:44:30 +0000 (22:44 +0000)
so it can use $mflag_primary.  This makes the word size for which the
test is done (-m32 or -m64) be the same as for which it is actually
needed, and in some situations unbreaks building of the regtests in
32-bit mode on a 64-bit machine.

For the same reason, apply $mflag_primary to the test for OpenMP.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9034

configure.in

index 3ca0ef0ce177b11fd5c3ce2c15ec8f376cfada1d..b6e6b2798bc18c503604487c8a69650ddb66a2e6 100644 (file)
@@ -1215,24 +1215,6 @@ if test x$ac_have_builtin_expect = xyes ; then
 fi
 
 
-# does this compiler have built-in functions for atomic memory access ?
-AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
-
-AC_TRY_LINK(,
-[
-  int variable = 1;
-  return (__sync_bool_compare_and_swap(&variable, 1, 2)
-         && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
-],
-[
-  AC_MSG_RESULT([yes])
-  AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
-],
-[
-  AC_MSG_RESULT([no])
-])
-
-
 # does the ppc assembler support "mtocrf" et al?
 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
 
@@ -1647,7 +1629,7 @@ AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
 AC_MSG_CHECKING([for OpenMP])
 
 safe_CFLAGS=$CFLAGS
-CFLAGS="-fopenmp"
+CFLAGS="-fopenmp $mflag_primary"
 
 AC_LINK_IFELSE(
 [
@@ -1670,6 +1652,29 @@ CFLAGS=$safe_CFLAGS
 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
 
 
+# does this compiler have built-in functions for atomic memory access ?
+AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="$mflag_primary"
+
+AC_TRY_LINK(,
+[
+  int variable = 1;
+  return (__sync_bool_compare_and_swap(&variable, 1, 2)
+          && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
+],
+[
+  AC_MSG_RESULT([yes])
+  AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
+],
+[
+  AC_MSG_RESULT([no])
+])
+
+CFLAGS=$safe_CFLAGS
+
+
 #----------------------------------------------------------------------------
 # Ok.  We're done checking.
 #----------------------------------------------------------------------------