Home | History | Annotate | Line # | Download | only in bfd
      1  1.1  christos # ===========================================================================
      2  1.1  christos #          https://www.gnu.org/software/autoconf-archive/ax_tls.html
      3  1.1  christos # ===========================================================================
      4  1.1  christos #
      5  1.1  christos # SYNOPSIS
      6  1.1  christos #
      7  1.1  christos #   AX_TLS([action-if-found], [action-if-not-found])
      8  1.1  christos #
      9  1.1  christos # DESCRIPTION
     10  1.1  christos #
     11  1.1  christos #   Provides a test for the compiler support of thread local storage (TLS)
     12  1.1  christos #   extensions. Defines TLS if it is found. Currently knows about C++11,
     13  1.1  christos #   GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland
     14  1.1  christos #   apparently supports either.
     15  1.1  christos #
     16  1.1  christos # LICENSE
     17  1.1  christos #
     18  1.1  christos #   Copyright (c) 2008 Alan Woodland <ajw05 (a] aber.ac.uk>
     19  1.1  christos #   Copyright (c) 2010 Diego Elio Petteno` <flameeyes (a] gmail.com>
     20  1.1  christos #
     21  1.1  christos #   This program is free software: you can redistribute it and/or modify it
     22  1.1  christos #   under the terms of the GNU General Public License as published by the
     23  1.1  christos #   Free Software Foundation, either version 3 of the License, or (at your
     24  1.1  christos #   option) any later version.
     25  1.1  christos #
     26  1.1  christos #   This program is distributed in the hope that it will be useful, but
     27  1.1  christos #   WITHOUT ANY WARRANTY; without even the implied warranty of
     28  1.1  christos #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
     29  1.1  christos #   Public License for more details.
     30  1.1  christos #
     31  1.1  christos #   You should have received a copy of the GNU General Public License along
     32  1.1  christos #   with this program. If not, see <https://www.gnu.org/licenses/>.
     33  1.1  christos #
     34  1.1  christos #   As a special exception, the respective Autoconf Macro's copyright owner
     35  1.1  christos #   gives unlimited permission to copy, distribute and modify the configure
     36  1.1  christos #   scripts that are the output of Autoconf when processing the Macro. You
     37  1.1  christos #   need not follow the terms of the GNU General Public License when using
     38  1.1  christos #   or distributing such scripts, even though portions of the text of the
     39  1.1  christos #   Macro appear in them. The GNU General Public License (GPL) does govern
     40  1.1  christos #   all other use of the material that constitutes the Autoconf Macro.
     41  1.1  christos #
     42  1.1  christos #   This special exception to the GPL applies to versions of the Autoconf
     43  1.1  christos #   Macro released by the Autoconf Archive. When you make and distribute a
     44  1.1  christos #   modified version of the Autoconf Macro, you may extend this special
     45  1.1  christos #   exception to the GPL to apply to your modified version as well.
     46  1.1  christos 
     47  1.1  christos #serial 15
     48  1.1  christos 
     49  1.1  christos AC_DEFUN([AX_TLS], [
     50  1.1  christos   AC_MSG_CHECKING([for thread local storage (TLS) class])
     51  1.1  christos   AC_CACHE_VAL([ac_cv_tls],
     52  1.1  christos    [for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do
     53  1.1  christos        AS_CASE([$ax_tls_keyword],
     54  1.1  christos           [none], [ac_cv_tls=none ; break],
     55  1.1  christos           [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
     56  1.1  christos               [#include <stdlib.h>],
     57  1.1  christos               [static  $ax_tls_keyword  int bar;]
     58  1.1  christos             )],
     59  1.1  christos             [ac_cv_tls=$ax_tls_keyword ; break],
     60  1.1  christos             [ac_cv_tls=none]
     61  1.1  christos           )]
     62  1.1  christos         )
     63  1.1  christos     done ]
     64  1.1  christos   )
     65  1.1  christos   AC_MSG_RESULT([$ac_cv_tls])
     66  1.1  christos 
     67  1.1  christos   AS_IF([test "$ac_cv_tls" != "none"],
     68  1.1  christos     [AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class, define it to that here])
     69  1.1  christos      m4_ifnblank([$1],[$1],[[:]])],
     70  1.1  christos     [m4_ifnblank([$2],[$2],[[:]])])
     71  1.1  christos ])
     72