Move the test for __sync_bool_compare_and_swap almost to the bottom,

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
This commit is contained in:
Julian Seward 2009-01-22 22:44:30 +00:00
parent ed322feb84
commit da8e9c1236

View 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.
#----------------------------------------------------------------------------