Skip to content

Commit 3de48f0

Browse files
committed
Just use the latest AX_TLS
1 parent b22f536 commit 3de48f0

1 file changed

Lines changed: 29 additions & 32 deletions

File tree

m4/ax_tls.m4

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# ===========================================================================
2-
# http://www.nongnu.org/autoconf-archive/ax_tls.html
2+
# https://www.gnu.org/software/autoconf-archive/ax_tls.html
33
# ===========================================================================
44
#
55
# SYNOPSIS
66
#
7-
# AX_TLS
7+
# AX_TLS([action-if-found], [action-if-not-found])
88
#
99
# DESCRIPTION
1010
#
1111
# Provides a test for the compiler support of thread local storage (TLS)
12-
# extensions. Defines TLS if it is found. Currently only knows about GCC
13-
# and MSVC. I think SunPro uses the same as GCC, and Borland apparently
14-
# supports either.
12+
# extensions. Defines TLS if it is found. Currently knows about C++11,
13+
# GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland
14+
# apparently supports either.
1515
#
1616
# LICENSE
1717
#
1818
# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk>
19+
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
1920
#
2021
# This program is free software: you can redistribute it and/or modify it
2122
# under the terms of the GNU General Public License as published by the
@@ -28,7 +29,7 @@
2829
# Public License for more details.
2930
#
3031
# You should have received a copy of the GNU General Public License along
31-
# with this program. If not, see <http://www.gnu.org/licenses/>.
32+
# with this program. If not, see <https://www.gnu.org/licenses/>.
3233
#
3334
# As a special exception, the respective Autoconf Macro's copyright owner
3435
# gives unlimited permission to copy, distribute and modify the configure
@@ -43,32 +44,28 @@
4344
# modified version of the Autoconf Macro, you may extend this special
4445
# exception to the GPL to apply to your modified version as well.
4546

47+
#serial 15
48+
4649
AC_DEFUN([AX_TLS], [
47-
AC_MSG_CHECKING(for thread local storage (TLS) class)
48-
AC_CACHE_VAL(ac_cv_tls, [
49-
ax_tls_keywords="__thread __declspec(thread) none"
50-
for ax_tls_keyword in $ax_tls_keywords; do
51-
case $ax_tls_keyword in
52-
none) ac_cv_tls=none ; break ;;
53-
*)
54-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
55-
[@%:@include <stdlib.h>
56-
static void
57-
foo(void) {
58-
static ] $ax_tls_keyword [ int bar;
59-
exit(1);
60-
}],
61-
[])],
62-
[ac_cv_tls=$ax_tls_keyword ; break],
63-
ac_cv_tls=none
64-
)
65-
esac
66-
done
67-
])
50+
AC_MSG_CHECKING([for thread local storage (TLS) class])
51+
AC_CACHE_VAL([ac_cv_tls],
52+
[for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do
53+
AS_CASE([$ax_tls_keyword],
54+
[none], [ac_cv_tls=none ; break],
55+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
56+
[#include <stdlib.h>],
57+
[static $ax_tls_keyword int bar;]
58+
)],
59+
[ac_cv_tls=$ax_tls_keyword ; break],
60+
[ac_cv_tls=none]
61+
)]
62+
)
63+
done ]
64+
)
65+
AC_MSG_RESULT([$ac_cv_tls])
6866
69-
if test "$ac_cv_tls" != "none"; then
70-
dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
71-
AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
72-
fi
73-
AC_MSG_RESULT($ac_cv_tls)
67+
AS_IF([test "$ac_cv_tls" != "none"],
68+
[AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class, define it to that here])
69+
m4_ifnblank([$1],[$1],[[:]])],
70+
[m4_ifnblank([$2],[$2],[[:]])])
7471
])

0 commit comments

Comments
 (0)