summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-06-13 19:56:20 +0100
committerPádraig Brady <P@draigBrady.com>2014-06-14 16:13:10 +0100
commitbadf0c4f5f40080abd32b8b9e2cb5a37e345b7a2 (patch)
tree8221272a819f40bdddfbe53302d4d644fef4b6bd /m4
parenta8ba7140ace794a511f97ab7de1addc6a3cf4fca (diff)
downloadgnulib-badf0c4f5f40080abd32b8b9e2cb5a37e345b7a2.tar.gz
pthread: define thread-safe macros on some platforms
* m4/pthread.m4 (gl_PTHREAD_CHECK): Define macros needed for thread-safe operation on some platforms.
Diffstat (limited to 'm4')
-rw-r--r--m4/pthread.m414
1 files changed, 14 insertions, 0 deletions
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 <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])
])