diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2013-01-18 13:02:37 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2013-01-18 13:02:37 +0000 |
commit | d86497bc393606519eff0900020dec8bf3a6055f (patch) | |
tree | a5da17b6f29cbc1c47e6473c343842f3056d9f88 | |
parent | fa62cd3946761609f296acfa6d7b44cbf76bbe3d (diff) |
use the AX_TLS macro to find correct thread-local storage class compiler directive
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1921 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | m4/ax_tls.m4 | 76 | ||||
-rw-r--r-- | nslcd/log.c | 6 | ||||
-rw-r--r-- | nss/aliases.c | 4 | ||||
-rw-r--r-- | nss/ethers.c | 4 | ||||
-rw-r--r-- | nss/group.c | 4 | ||||
-rw-r--r-- | nss/hosts.c | 4 | ||||
-rw-r--r-- | nss/netgroup.c | 4 | ||||
-rw-r--r-- | nss/networks.c | 4 | ||||
-rw-r--r-- | nss/passwd.c | 4 | ||||
-rw-r--r-- | nss/protocols.c | 4 | ||||
-rw-r--r-- | nss/rpc.c | 4 | ||||
-rw-r--r-- | nss/services.c | 4 | ||||
-rw-r--r-- | nss/shadow.c | 4 |
14 files changed, 102 insertions, 36 deletions
diff --git a/configure.ac b/configure.ac index d1440f4..a25e9a4 100644 --- a/configure.ac +++ b/configure.ac @@ -300,17 +300,7 @@ AC_CHECK_SIZEOF(unsigned long int) AC_CHECK_SIZEOF(unsigned long long int) AC_CHECK_SIZEOF(uid_t) AC_CHECK_SIZEOF(gid_t) - -# check for support for the __thread keyword -AC_CACHE_CHECK([whether $CC supports '__thread'], [mn_cv_c___thread_supported], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[static __thread i;]], [])], - [mn_cv_c___thread_supported=yes], - [mn_cv_c___thread_supported=no])]) -if test $mn_cv_c___thread_supported != yes -then - AC_MSG_WARN([$CC does not support '__thread' keyword]) - AC_DEFINE(__thread,, [Define to empty if compiler does not support `__thread' keyword.]) -fi +AX_TLS() # check for support for the struct ether_addr structure AC_CHECK_TYPES(struct ether_addr,,, [ diff --git a/m4/ax_tls.m4 b/m4/ax_tls.m4 new file mode 100644 index 0000000..033e3b1 --- /dev/null +++ b/m4/ax_tls.m4 @@ -0,0 +1,76 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_tls.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TLS([action-if-found], [action-if-not-found]) +# +# 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. +# +# LICENSE +# +# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk> +# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com> +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# 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/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AC_DEFUN([AX_TLS], [ + 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 + AS_CASE([$ax_tls_keyword], + [none], [ac_cv_tls=none ; break], + [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 + )]) + done + ]) + 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_ifnblank([$1], [$1]), + m4_ifnblank([$2], [$2]) + ) +]) diff --git a/nslcd/log.c b/nslcd/log.c index 3e70462..6613a4c 100644 --- a/nslcd/log.c +++ b/nslcd/log.c @@ -1,7 +1,7 @@ /* log.c - logging funtions - Copyright (C) 2002, 2003, 2008, 2010, 2011, 2012 Arthur de Jong + Copyright (C) 2002, 2003, 2008, 2010, 2011, 2012, 2013 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -44,10 +44,10 @@ static int prelogging_loglevel = LOG_INFO; static int loglevel = LOG_INFO; /* the session id that is set for this thread */ -static __thread char *sessionid = NULL; +static TLS char *sessionid = NULL; /* the request identifier that is set for this thread */ -static __thread char *requestid = NULL; +static TLS char *requestid = NULL; #define MAX_REQUESTID_LENGTH 40 /* set loglevel when no logging is configured */ diff --git a/nss/aliases.c b/nss/aliases.c index 54e0049..261c92d 100644 --- a/nss/aliases.c +++ b/nss/aliases.c @@ -2,7 +2,7 @@ aliases.c - NSS lookup functions for aliases database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -59,7 +59,7 @@ nss_status_t _nss_ldap_getaliasbyname_r(const char *name, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *aliasentfp; +static TLS TFILE *aliasentfp; /* start a request to read all aliases */ nss_status_t _nss_ldap_setaliasent(void) diff --git a/nss/ethers.c b/nss/ethers.c index c374975..9273fc4 100644 --- a/nss/ethers.c +++ b/nss/ethers.c @@ -2,7 +2,7 @@ ethers.c - NSS lookup functions for ethers database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -65,7 +65,7 @@ nss_status_t _nss_ldap_getntohost_r(const struct ether_addr *addr, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *etherentfp; +static TLS TFILE *etherentfp; /* open a connection to read all ether entries */ nss_status_t _nss_ldap_setetherent(int UNUSED(stayopen)) diff --git a/nss/group.c b/nss/group.c index 69d0f02..c00b086 100644 --- a/nss/group.c +++ b/nss/group.c @@ -2,7 +2,7 @@ group.c - NSS lookup functions for group database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -133,7 +133,7 @@ nss_status_t _nss_ldap_getgrgid_r(gid_t gid, struct group *result, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *grentfp; +static TLS TFILE *grentfp; /* start a request to read all groups */ nss_status_t _nss_ldap_setgrent(int UNUSED(stayopen)) diff --git a/nss/hosts.c b/nss/hosts.c index 55205ae..7773895 100644 --- a/nss/hosts.c +++ b/nss/hosts.c @@ -2,7 +2,7 @@ hosts.c - NSS lookup functions for hosts database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -193,7 +193,7 @@ nss_status_t _nss_ldap_gethostbyaddr_r(const void *addr, socklen_t len, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *hostentfp; +static TLS TFILE *hostentfp; nss_status_t _nss_ldap_sethostent(int UNUSED(stayopen)) { diff --git a/nss/netgroup.c b/nss/netgroup.c index a85e6d5..3777c4c 100644 --- a/nss/netgroup.c +++ b/nss/netgroup.c @@ -2,7 +2,7 @@ netgroup.c - NSS lookup functions for netgroup entries Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -92,7 +92,7 @@ static nss_status_t read_netgrent_line(TFILE *fp, struct __netgrent *result, #ifdef NSS_FLAVOUR_GLIBC /* thread-local file pointer to an ongoing request */ -static __thread TFILE *netgrentfp; +static TLS TFILE *netgrentfp; /* start a request to get a netgroup by name */ nss_status_t _nss_ldap_setnetgrent(const char *group, diff --git a/nss/networks.c b/nss/networks.c index 586b91d..4130205 100644 --- a/nss/networks.c +++ b/nss/networks.c @@ -2,7 +2,7 @@ networks.c - NSS lookup functions for networks database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -136,7 +136,7 @@ nss_status_t _nss_ldap_getnetbyaddr_r(uint32_t addr, int UNUSED(af), } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *netentfp; +static TLS TFILE *netentfp; /* start a request to read all networks */ nss_status_t _nss_ldap_setnetent(int UNUSED(stayopen)) diff --git a/nss/passwd.c b/nss/passwd.c index db286a8..8e69692 100644 --- a/nss/passwd.c +++ b/nss/passwd.c @@ -2,7 +2,7 @@ passwd.c - NSS lookup functions for passwd database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -72,7 +72,7 @@ nss_status_t _nss_ldap_getpwuid_r(uid_t uid, struct passwd *result, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *pwentfp; +static TLS TFILE *pwentfp; /* open a connection to read all passwd entries */ nss_status_t _nss_ldap_setpwent(int UNUSED(stayopen)) diff --git a/nss/protocols.c b/nss/protocols.c index cc1e60f..7787161 100644 --- a/nss/protocols.c +++ b/nss/protocols.c @@ -2,7 +2,7 @@ protocols.c - NSS lookup functions for protocol database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -67,7 +67,7 @@ nss_status_t _nss_ldap_getprotobynumber_r(int number, struct protoent *result, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *protoentfp; +static TLS TFILE *protoentfp; /* start a request to read all protocol entries */ nss_status_t _nss_ldap_setprotoent(int UNUSED(stayopen)) @@ -2,7 +2,7 @@ rpc.c - NSS lookup functions for rpc database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -66,7 +66,7 @@ nss_status_t _nss_ldap_getrpcbynumber_r(int number, struct rpcent *result, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *rpcentfp; +static TLS TFILE *rpcentfp; /* request a stream to list all rpc entries */ nss_status_t _nss_ldap_setrpcent(int UNUSED(stayopen)) diff --git a/nss/services.c b/nss/services.c index 494a9aa..a83a6ec 100644 --- a/nss/services.c +++ b/nss/services.c @@ -2,7 +2,7 @@ service.c - NSS lookup functions for services database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -74,7 +74,7 @@ nss_status_t _nss_ldap_getservbyport_r(int port, const char *protocol, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *serventfp; +static TLS TFILE *serventfp; /* open request to get all services */ nss_status_t _nss_ldap_setservent(int UNUSED(stayopen)) diff --git a/nss/shadow.c b/nss/shadow.c index 53a2ad4..8fe2437 100644 --- a/nss/shadow.c +++ b/nss/shadow.c @@ -2,7 +2,7 @@ shadow.c - NSS lookup functions for shadow database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -61,7 +61,7 @@ nss_status_t _nss_ldap_getspnam_r(const char *name, struct spwd *result, } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *spentfp; +static TLS TFILE *spentfp; /* start listing all shadow users */ nss_status_t _nss_ldap_setspent(int UNUSED(stayopen)) |