Hi Paul, Thanks for looking at this.
On 20 Sep 2010, at 13:21, Paul Eggert wrote: > On 09/19/2010 07:43 PM, Gary V. Vaughan wrote: >> my system headers have no pthread_spinlock_t definition, but >> gnulib sees /usr/include/pthread.h and uses that instead of generating it's >> own, >> ... >> I don't know enough about pthreads to tell whether gnulib should paper over >> the lack of spinlocks on Mac OS, or whether coreutils should be more careful >> about using spinlocks without having tested for them first... > > If MacOS doesn't have spinlocks, then from coreutils' point of view MacOS > doesn't have proper thread support. The simplest fix is for coreutils > to use the substitute pthread.h on MacOS. Does the following patch > work for you? It fixes the original spinlocks error I reported, but then the build falls over on lib/glthread/lock.c: In file included from ../../lib/glthread/lock.h:93, from ../../lib/glthread/lock.c:26: ./pthread.h:184: error: expected ')' before '*' token ./pthread.h:191: error: expected ')' before '*' token ./pthread.h:198: error: expected ')' before '*' token ./pthread.h:206: error: expected ')' before '*' token ../../lib/glthread/lock.c: In function 'glthread_recursive_lock_init_multithreaded': ../../lib/glthread/lock.c:321: warning: implicit declaration of function 'pthread_mutexattr_init' ../../lib/glthread/lock.c:324: warning: implicit declaration of function 'pthread_mutexattr_settype' ../../lib/glthread/lock.c:327: warning: implicit declaration of function 'pthread_mutexattr_destroy' where lines 184, 191, 198 and 206 of lib/pthread.h each contain a use of pthread_spinlock_t. lib/pthread.h does have a typedef for pthread_spinlock_t, but it is predicated on not having HAVE_PTHREAD_T defined (which I do): ; sed -n /HAVE_PTHREAD_T/,/endif/p lib/pthread.h #ifndef HAVE_PTHREAD_T typedef int pthread_t; typedef int pthread_attr_t; typedef int pthread_barrier_t; typedef int pthread_barrierattr_t; typedef int pthread_cond_t; typedef int pthread_condattr_t; typedef int pthread_key_t; typedef int pthread_mutex_t; typedef int pthread_mutexattr_t; typedef int pthread_once_t; typedef int pthread_rwlock_t; typedef int pthread_rwlockattr_t; typedef int pthread_spinlock_t; #endif ; grep HAVE_PTHREAD_T lib/config.h #define HAVE_PTHREAD_T 1 > diff --git a/m4/pthread.m4 b/m4/pthread.m4 > index 69866cb..121d84d 100644 > --- a/m4/pthread.m4 > +++ b/m4/pthread.m4 > @@ -6,19 +6,22 @@ dnl with or without modifications, as long as this notice > is preserved. > > AC_DEFUN([gl_PTHREAD_CHECK], > [AC_CHECK_HEADERS_ONCE([pthread.h]) > + AC_CHECK_TYPES([pthread_t]) > > LIB_PTHREAD= > - PTHREAD_H= > - if test "$ac_cv_header_pthread_h" = yes; then > - gl_saved_libs=$LIBS > - AC_SEARCH_LIBS([pthread_create], [pthread], > - [if test "$ac_cv_search_pthread_create" != "none required"; then > - LIB_PTHREAD="$ac_cv_search_pthread_create" > - fi]) > - LIBS="$gl_saved_libs" > - else > - AC_CHECK_TYPES([pthread_t]) > - PTHREAD_H='pthread.h' > + PTHREAD_H='pthread.h' > + if test "$ac_cv_header_pthread_h" = yes && > + test "$ac_cv_type_pthread_t" = yes; then > + AC_CHECK_TYPE([pthread_spinlock_t]) > + if test "$ac_cv_type_pthread_spinlock_t" = yes; then > + PTHREAD_H= > + gl_saved_libs=$LIBS > + AC_SEARCH_LIBS([pthread_create], [pthread], > + [if test "$ac_cv_search_pthread_create" != "none required"; then > + LIB_PTHREAD="$ac_cv_search_pthread_create" > + fi]) > + LIBS="$gl_saved_libs" > + fi > fi > > AC_SUBST([LIB_PTHREAD]) Cheers, -- Gary V. Vaughan (g...@gnu.org)
PGP.sig
Description: This is a digitally signed message part