You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/03/13 17:14:05 UTC

git commit: TS-1742: Fix the cmpxchg16 autoconf test

Updated Branches:
  refs/heads/master ae21316cb -> d19dabf79


TS-1742: Fix the cmpxchg16 autoconf test

Make sure we don't add a gcc-specific option unless we really need
it. Switch from a run time check to a compile time check.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d19dabf7
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d19dabf7
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d19dabf7

Branch: refs/heads/master
Commit: d19dabf7910cb9efaa026532086c9511308804de
Parents: ae21316
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 13 08:50:06 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Mar 13 08:57:05 2013 -0700

----------------------------------------------------------------------
 configure.ac |   54 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d19dabf7/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 86476e3..2db8c46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1105,31 +1105,39 @@ AC_MSG_RESULT([$msg])
 
 AC_SUBST(need_union_semun)
 
-
-
-has_128bit_cas=0
-__saved_CFLAGS="${CFLAGS}"
-CFLAGS=-mcx16
 AC_MSG_CHECKING(for 128bit CAS support)
-AC_LANG_PUSH([C])
-AC_RUN_IFELSE(
-  [
-    int main() { 
-      __int128_t x = 0;
-      __sync_bool_compare_and_swap(&x,0,10); 
-      return 0;
-    }
-  ],
-  [ has_128bit_cas="1" ]
+AC_LANG_PUSH([C++])
+
+TS_TRY_COMPILE_NO_WARNING(
+  [],[
+    __int128_t x = 0;
+    __sync_bool_compare_and_swap(&x,0,10);
+  ], [
     AC_MSG_RESULT(yes)
-    CXXFLAGS+=" -mcx16"
-  ,
-  [ has_128bit_cas="0" ]
-    AC_MSG_RESULT(no)
-  )
+    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.
+    __saved_CXXFLAGS="${CXXFLAGS}"
+    TS_ADDTO(CXXFLAGS, [-mcx16])
+    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 Keep CFLAGS and CXXFLAGS in sync.
+        TS_ADDTO(CFLAGS, [-mcx16])
+      ], [
+        AC_MSG_RESULT(no)
+        has_128bit_cas=0
+        CXXFLAGS="${__saved_CXXFLAGS}"
+    ])
+])
+
 AC_LANG_POP
-CFLAGS="${__saved_CFLAGS}"
-AC_SUBST([has_128bit_cas])
+AC_SUBST(has_128bit_cas)
 
 # Check for POSIX capabilities library.
 # If we don't find it, disable checking for header.
@@ -1143,7 +1151,7 @@ AS_IF([test "x$enable_posix_cap" != "xno"],
       AC_MSG_FAILURE([POSIX capabilities enabled but system library not found.])
      ],[
       [enable_posix_cap=no]
-    ])
+    ]    )
    ]
   )
 )