Subject: bug#12765: "configure --disable-threads" doesn't work with coreutils-8.20

From: John David Anglin <[email-masked]>
Date: Sat, 3 Nov 2012 22:35:51 -0400

On 29-Oct-12, at 5:10 PM, Paul Eggert wrote:

> On 10/29/2012 12:39 PM, John David Anglin wrote:
>> hppa1.1-hp-hpux10.20 has DCE threads which predates the posix  
>> thread interface.
>
> On such a platform, coreutils should run single-threaded
> and shouldn't be mucking with DCE threads at all.
> Can you investigate what went wrong?  Perhaps you can
> send us the output of 'configure', and what's in config.h,
> and the output of 'diff -u lib/pthread.in.h lib/pthread.h'.
>

The attached change results in a successful build of sort.   It's not
optimal but I tried to avoid messing with the automake files.  I also
note that sort only seems to support pthreads.

Sorry, it appears the configure output, etc, only went to Paul.

Dave
--
John David Anglin	[email-masked]

--- pthread.in.h.orig	Tue Oct 23 10:19:34 2012
+++ pthread.in.h	Sat Nov  3 18:37:43 2012
@@ -26,7 +26,9 @@
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_PTHREAD_H@
-# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
+# ifdef USE_POSIX_THREADS
+#  @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
+# endif
 #endif
 
 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
@@ -38,7 +40,7 @@
 #include <sys/types.h>
 #include <time.h>
 
-#if ! @HAVE_PTHREAD_T@
+#if ! @HAVE_PTHREAD_T@ || ! defined(USE_POSIX_THREADS)
 # if !GNULIB_defined_pthread_types
  typedef int pthread_t;
  typedef int pthread_attr_t;
@@ -97,7 +99,7 @@
 #define PTHREAD_SCOPE_PROCESS 1
 #endif
 
-#if ! @HAVE_PTHREAD_T@
+#if ! @HAVE_PTHREAD_T@ || ! defined(USE_POSIX_THREADS)
 
 # if !GNULIB_defined_pthread_functions
 
@@ -226,7 +228,7 @@
 
 #endif
 
-#if ! @HAVE_PTHREAD_SPINLOCK_T@
+#if ! @HAVE_PTHREAD_SPINLOCK_T@ || ! defined(USE_POSIX_THREADS)
 
 # if !GNULIB_defined_pthread_spinlock_t