Blame SOURCES/libsodium-1.0.18/m4/ax_tls.m4

ca16be
# ===========================================================================
ca16be
#          https://www.gnu.org/software/autoconf-archive/ax_tls.html
ca16be
# ===========================================================================
ca16be
#
ca16be
# SYNOPSIS
ca16be
#
ca16be
#   AX_TLS([action-if-found], [action-if-not-found])
ca16be
#
ca16be
# DESCRIPTION
ca16be
#
ca16be
#   Provides a test for the compiler support of thread local storage (TLS)
ca16be
#   extensions. Defines TLS if it is found. Currently knows about C++11,
ca16be
#   GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland
ca16be
#   apparently supports either.
ca16be
#
ca16be
# LICENSE
ca16be
#
ca16be
#   Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk>
ca16be
#   Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
ca16be
#
ca16be
#   This program is free software: you can redistribute it and/or modify it
ca16be
#   under the terms of the GNU General Public License as published by the
ca16be
#   Free Software Foundation, either version 3 of the License, or (at your
ca16be
#   option) any later version.
ca16be
#
ca16be
#   This program is distributed in the hope that it will be useful, but
ca16be
#   WITHOUT ANY WARRANTY; without even the implied warranty of
ca16be
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
ca16be
#   Public License for more details.
ca16be
#
ca16be
#   You should have received a copy of the GNU General Public License along
ca16be
#   with this program. If not, see <https://www.gnu.org/licenses/>.
ca16be
#
ca16be
#   As a special exception, the respective Autoconf Macro's copyright owner
ca16be
#   gives unlimited permission to copy, distribute and modify the configure
ca16be
#   scripts that are the output of Autoconf when processing the Macro. You
ca16be
#   need not follow the terms of the GNU General Public License when using
ca16be
#   or distributing such scripts, even though portions of the text of the
ca16be
#   Macro appear in them. The GNU General Public License (GPL) does govern
ca16be
#   all other use of the material that constitutes the Autoconf Macro.
ca16be
#
ca16be
#   This special exception to the GPL applies to versions of the Autoconf
ca16be
#   Macro released by the Autoconf Archive. When you make and distribute a
ca16be
#   modified version of the Autoconf Macro, you may extend this special
ca16be
#   exception to the GPL to apply to your modified version as well.
ca16be
ca16be
#serial 14
ca16be
ca16be
AC_DEFUN([AX_TLS], [
ca16be
  AC_MSG_CHECKING([for thread local storage (TLS) class])
ca16be
  AC_CACHE_VAL([ac_cv_tls],
ca16be
   [for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do
ca16be
       AS_CASE([$ax_tls_keyword],
ca16be
          [none], [ac_cv_tls=none ; break],
ca16be
          [AC_TRY_COMPILE(
ca16be
              [#include <stdlib.h>
ca16be
               static void
ca16be
               foo(void) {
ca16be
               static ] $ax_tls_keyword [ int bar;
ca16be
               exit(1);
ca16be
               }],
ca16be
               [],
ca16be
               [ac_cv_tls=$ax_tls_keyword ; break],
ca16be
               ac_cv_tls=none
ca16be
           )])
ca16be
    done
ca16be
  ])
ca16be
  AC_MSG_RESULT([$ac_cv_tls])
ca16be
ca16be
  AS_IF([test "$ac_cv_tls" != "none"],
ca16be
    [AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class define it to that here])
ca16be
     m4_ifnblank([$1],[$1])],
ca16be
    [m4_ifnblank([$2],[$2])])
ca16be
])