]> Savannah Git Hosting - gnulib.git/commitdiff
pthread: define thread-safe macros on some platforms
authorPádraig Brady <P@draigBrady.com>
Fri, 13 Jun 2014 18:56:20 +0000 (19:56 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 14 Jun 2014 15:13:10 +0000 (16:13 +0100)
* m4/pthread.m4 (gl_PTHREAD_CHECK): Define macros needed
for thread-safe operation on some platforms.

ChangeLog
m4/pthread.m4

index cd1989714f53396d31562da13df6e04e8cf8f17c..05501530d21e5990975217769b6700e6e6514222 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-14  Pádraig Brady  <P@draigBrady.com>
+
+       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  <eggert@cs.ucla.edu>
 
        regex: don't be multithreaded if USE_UNLOCKED_IO.
index 1ed0dd335ed8091f39b412771b7b2bcbbe6c4381..44538bd941664e5aff1f6fea555808b2076cd483 100644 (file)
@@ -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 <errno.h>.
+   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])
 ])