>From 2e32ff90a6af9695d812700e9347f15b50d829e5 Mon Sep 17 00:00:00 2001 From: Paul Eggert
Date: Thu, 19 Mar 2015 14:14:07 -0700 Subject: [PATCH] Better port of pthread usage to FreeBSD * configure.ac (ac_func_list): Omit pthread_sigmask, since we check for that ourselves rather than relying on gnulib. (HAVE_PTHREAD, LIB_PTHREAD, _THREAD_SAFE): Port better to FreeBSD, by also checking for pthread_create, pthread_self, pthread_sigmask. Tighten the test for pthread_atfork while we're at it. Fixes: bug#20136 --- ChangeLog | 8 ++++++ configure.ac | 87 ++++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 66 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d7ba93..d268ba0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2015-03-19 Paul Eggert + Better port of pthread usage to FreeBSD + * configure.ac (ac_func_list): Omit pthread_sigmask, since + we check for that ourselves rather than relying on gnulib. + (HAVE_PTHREAD, LIB_PTHREAD, _THREAD_SAFE): Port better to FreeBSD, + by also checking for pthread_create, pthread_self, pthread_sigmask. + Tighten the test for pthread_atfork while we're at it. + Fixes: bug#20136 + Merge from gnulib This incorporates: 2015-03-19 fdopendir: port better to MinGW diff --git a/configure.ac b/configure.ac index d65494a..520816b1 100644 --- a/configure.ac +++ b/configure.ac @@ -780,6 +780,12 @@ AC_DEFUN([gl_CRYPTO_CHECK]) # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, # as we don't use them. AC_DEFUN([gl_FCNTL_O_FLAGS]) +# Avoid gnulib's test for pthread_sigmask. +funcs= +for func in $ac_func_list; do + test $func = pthread_sigmask || AS_VAR_APPEND([funcs], [" $func"]) +done +ac_func_list=$funcs # Use the system putenv even if it lacks GNU features, as we don't need them, # and the gnulib replacement runs afoul of a FreeBSD 10.1 bug; see Bug#19874. AC_CHECK_FUNCS_ONCE([putenv]) @@ -2179,39 +2185,62 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd") dnl Check for the POSIX thread library. LIB_PTHREAD= -if test "$opsys" != "mingw32"; then AC_CHECK_HEADERS_ONCE(pthread.h) -if test "$ac_cv_header_pthread_h"; then - dnl gmalloc.c uses pthread_atfork, which is not available on older-style - dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely - dnl testing for pthread_kill if Emacs uses gmalloc.c. - if test "$GMALLOC_OBJ" = gmalloc.o; then - emacs_pthread_function=pthread_atfork - else - emacs_pthread_function=pthread_kill - fi - OLD_LIBS=$LIBS - AC_SEARCH_LIBS([$emacs_pthread_function], [pthread], - [AC_DEFINE([HAVE_PTHREAD], [1], - [Define to 1 if you have pthread (-lpthread).]) - # Some systems optimize for single-threaded programs by default, and - # need special flags to disable these optimizations. For example, the - # definition of 'errno' in