Permalink
Browse files

Fix cmpxchg16b configure test

  • Loading branch information...
1 parent a9b6516 commit a51a4395dc3ed642750ccb316ce312ee12af95eb @jpeach jpeach committed Mar 17, 2013
Showing with 7 additions and 13 deletions.
  1. +4 −8 build/common.m4
  2. +3 −5 configure.ac
View
@@ -171,21 +171,17 @@ dnl is false if the code doesn't compile cleanly. For compilers
dnl where it is not known how to activate a "fail-on-error" mode,
dnl it is undefined which of the sets of actions will be run.
dnl
+dnl We actually always try to link the resulting program, since gcc has
+dnl a nasty habit of compiling code that cannot subsequently be linked.
+dnl
AC_DEFUN([TS_TRY_COMPILE_NO_WARNING],
[ats_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFLAGS_WARN"
if test "$ac_cv_prog_gcc" = "yes"; then
CFLAGS="$CFLAGS -Werror"
fi
CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /')
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- [#include "confdefs.h"
- ]
- [[$1]]
- [int main(int argc, const char *const *argv) {]
- [[$2]]
- [ return 0; }]])],
- [$3], [$4])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([$1], [$2])], [$3], [$4])
CFLAGS=$ats_save_CFLAGS
])
View
@@ -1108,20 +1108,18 @@ AC_SUBST(need_union_semun)
AC_MSG_CHECKING(for 128bit CAS support)
AC_LANG_PUSH([C++])
-TS_TRY_COMPILE_NO_WARNING(
- [],[
+TS_TRY_COMPILE_NO_WARNING([],[
__int128_t x = 0;
__sync_bool_compare_and_swap(&x,0,10);
], [
AC_MSG_RESULT(yes)
has_128bit_cas=1
], [
dnl If 128bit CAS fails, try again with the -mcx16 option. GCC needs this;
- dnl clang doesn't; icc isunknown but presumed sane.
+ dnl clang doesn't; icc is unknown but presumed sane.
__saved_CXXFLAGS="${CXXFLAGS}"
TS_ADDTO(CXXFLAGS, [-mcx16])
- TS_TRY_COMPILE_NO_WARNING(
- [],[
+ TS_TRY_COMPILE_NO_WARNING([],[
__int128_t x = 0;
__sync_bool_compare_and_swap(&x,0,10);
], [

0 comments on commit a51a439

Please sign in to comment.