From: Julian Seward Date: Thu, 22 Jan 2009 22:44:30 +0000 (+0000) Subject: Move the test for __sync_bool_compare_and_swap almost to the bottom, X-Git-Tag: svn/VALGRIND_3_5_0~1053 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da8e9c1236b7a9d98ecfd37999bb0d266f0c3249;p=thirdparty%2Fvalgrind.git 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 --- diff --git a/configure.in b/configure.in index 3ca0ef0ce1..b6e6b2798b 100644 --- a/configure.in +++ b/configure.in @@ -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. #----------------------------------------------------------------------------