From: Pádraig Brady Date: Fri, 13 Jun 2014 18:56:20 +0000 (+0100) Subject: pthread: define thread-safe macros on some platforms X-Git-Tag: v1.0~7353 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=badf0c4f5f40080abd32b8b9e2cb5a37e345b7a2;p=gnulib.git pthread: define thread-safe macros on some platforms * m4/pthread.m4 (gl_PTHREAD_CHECK): Define macros needed for thread-safe operation on some platforms. --- diff --git a/ChangeLog b/ChangeLog index cd1989714f..05501530d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-06-14 Pádraig Brady + + pthread: define thread-safe macros on some platforms + * m4/pthread.m4 (gl_PTHREAD_CHECK): Define macros needed + for thread-safe operation on some platforms. + 2014-06-13 Paul Eggert regex: don't be multithreaded if USE_UNLOCKED_IO. diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 1ed0dd335e..44538bd941 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -88,6 +88,20 @@ AC_DEFUN([gl_PTHREAD_CHECK], fi AC_SUBST([LIB_PTHREAD]) + dnl Some systems optimize for single-threaded programs by default, and + dnl need special flags to disable these optimizations. For example, the + dnl definition of 'errno' in . + case "$host_os" in + aix* | freebsd*) + AC_DEFINE([_THREAD_SAFE], 1, + [Define on some systems, to enable only thread-safe operations.]) + ;; + osf* | solaris*) + AC_DEFINE([_REENTRANT], 1, + [Define on some systems, to enable only thread-safe operations.]) + ;; + esac + AC_REQUIRE([AC_C_RESTRICT]) ])