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

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