Skip to contentSkip to conversation

Check for TLS support after CC detection

PATCH New Michael Jeanson 2 participants 2 messages Apr 16, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/2 Check for TLS support after CC detection

---
 configure.ac | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
configure.ac +5 -5
index 3879f8f..475dcf5 100644
@@ -45,6 +45,11 @@ AC_ARG_ENABLE([compiler-tls],
 	[def_compiler_tls=$enableval],
 	[def_compiler_tls="yes"])
 
+# Checks for C compiler
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_CC
+AC_PROG_CC_STDC
+
 # If not overridden, use ax_tls.m4 to check if TLS is available.
 AS_IF([test "x$def_compiler_tls" = "xyes"],
 	[AX_TLS([def_tls_detect=$ac_cv_tls], [:])],
@@ -54,11 +59,6 @@ AS_IF([test "x$def_tls_detect" = "x"],
 	[:],
 	[AC_DEFINE_UNQUOTED([CONFIG_RCU_TLS], $def_tls_detect)])
 
-# Checks for C compiler
-AC_USE_SYSTEM_EXTENSIONS
-AC_PROG_CC
-AC_PROG_CC_STDC
-
 # Checks for programs.
 AC_PROG_AWK
 AC_PROG_MAKE_SET
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH urcu 1/2] Update macros from the autotools archive

In reply to a message not in the archive

Both patches merged into liburcu master branch, thanks!

Mathieu

Quoted 176 lines · ----- On Apr 16, 2019, at 1:47 PM, Michael Jeanson [email protected] wrote:

---

m4/ax_c___attribute__.m4 |  6 ++---
m4/ax_pthread.m4         |  9 ++++---
m4/ax_tls.m4             | 57 ++++++++++++++++------------------------
3 files changed, 30 insertions(+), 42 deletions(-)
m4/ax_c___attribute__.m4 +3 -3
index cf3d62b..6a1ede1 100644
@@ -1,5 +1,5 @@
 # ===========================================================================
-#    http://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html
+#    https://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -28,7 +28,7 @@
 #   Public License for more details.
 #
 #   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
 #
 #   As a special exception, the respective Autoconf Macro's copyright owner
 #   gives unlimited permission to copy, distribute and modify the configure
@@ -43,7 +43,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 8
+#serial 9
 

AC_DEFUN([AX_C___ATTRIBUTE__], [
AC_CACHE_CHECK([for __attribute__], [ax_cv___attribute__],

m4/ax_pthread.m4 +3 -3
index 4c4051e..4920e07 100644
@@ -1,5 +1,5 @@
 # ===========================================================================
-#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+#        https://www.gnu.org/software/autoconf-archive/ax_pthread.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -67,7 +67,7 @@
 #   Public License for more details.
 #
 #   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
 #
 #   As a special exception, the respective Autoconf Macro's copyright owner
 #   gives unlimited permission to copy, distribute and modify the configure
@@ -82,7 +82,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 23
+#serial 25
 
 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])

AC_DEFUN([AX_PTHREAD], [

m4/ax_pthread.m4 +2 -1
@@ -438,7 +438,8 @@ if test "x$ax_pthread_ok" = "xyes"; then
        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
            [ax_cv_PTHREAD_PRIO_INHERIT],
            [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
-                                             [[int i =
 PTHREAD_PRIO_INHERIT;]])],
+                                             [[int i = PTHREAD_PRIO_INHERIT;
+                                               return i;]])],
                            [ax_cv_PTHREAD_PRIO_INHERIT=yes],
                            [ax_cv_PTHREAD_PRIO_INHERIT=no])
            ])
m4/ax_tls.m4 +6 -22
index 7c86daf..51edee8 100644
@@ -1,5 +1,5 @@
 # ===========================================================================
-#          http://www.gnu.org/software/autoconf-archive/ax_tls.html
+#          https://www.gnu.org/software/autoconf-archive/ax_tls.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -9,9 +9,9 @@
 # DESCRIPTION
 #
 #   Provides a test for the compiler support of thread local storage (TLS)
-#   extensions. Defines TLS if it is found. Currently knows about GCC/ICC
-#   and MSVC. I think SunPro uses the same as GCC, and Borland apparently
-#   supports either.
+#   extensions. Defines TLS if it is found. Currently knows about C++11,
+#   GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland
+#   apparently supports either.
 #
 # LICENSE
 #
@@ -29,7 +29,7 @@
 #   Public License for more details.
 #
 #   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
 #
 #   As a special exception, the respective Autoconf Macro's copyright owner
 #   gives unlimited permission to copy, distribute and modify the configure
@@ -44,44 +44,31 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 11
-
-#   Define m4_ifblank and m4_ifnblank macros from introduced in
-#   autotools 2.64 m4sugar.m4 if using an earlier autotools.
-
-ifdef([m4_ifblank], [], [
-m4_define([m4_ifblank],
-[m4_if(m4_translit([[$1]],  [ ][	][
-]), [], [$2], [$3])])
-])
-
-
-ifdef([m4_ifnblank], [], [
-m4_define([m4_ifnblank],
-[m4_if(m4_translit([[$1]],  [ ][	][
-]), [], [$3], [$2])])
-])
+#serial 14
 

AC_DEFUN([AX_TLS], [

m4/ax_tls.m4 +3 -4
-  AC_MSG_CHECKING(for thread local storage (TLS) class)
-  AC_CACHE_VAL(ac_cv_tls, [
-    ax_tls_keywords="__thread __declspec(thread) none"
-    for ax_tls_keyword in $ax_tls_keywords; do
+  AC_MSG_CHECKING([for thread local storage (TLS) class])
+  AC_CACHE_VAL([ac_cv_tls],
+   [for ax_tls_keyword in thread_local _Thread_local __thread

'__declspec(thread)' none; do

       AS_CASE([$ax_tls_keyword],
          [none], [ac_cv_tls=none ; break],
m4/ax_tls.m4 +10 -6
-          [AC_TRY_LINK(
-               [$ax_tls_keyword int foo;],
-               [++foo;],
+          [AC_TRY_COMPILE(
+              [#include <stdlib.h>
+               static void
+               foo(void) {
+               static ] $ax_tls_keyword [ int bar;
+               exit(1);
+               }],
+               [],
               [ac_cv_tls=$ax_tls_keyword ; break],
-               [ac_cv_tls=none]
+               ac_cv_tls=none
           )])
    done
  ])
-  AC_MSG_RESULT($ac_cv_tls)
+  AC_MSG_RESULT([$ac_cv_tls])
 
  AS_IF([test "$ac_cv_tls" != "none"],
-    AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS

storage class define it to that here])

m4/ax_tls.m4 +1 -3
-      m4_ifnblank([$1], [$1]),
-    m4_ifnblank([$2], [$2])
-  )
+    [AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS

storage class define it to that here])

m4/ax_tls.m4 +2 -0
+     m4_ifnblank([$1],[$1])],
+    [m4_ifnblank([$2],[$2])])

])
--
2.17.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com