Make better use of GNU Pth -- patch by Andy Dustman.
I can't test this, so I'm just checking it in with blind faith in Andy.
I've tested that it doesn't broeak a non-Pth build on Linux.

Changes include:

- There's a --with-pth configure option.

- Instead of _GNU_PTH, we test for HAVE_PTH.

- Better signal handling.

- (The config.h.in file is regenerated in a slightly different order.)
diff --git a/configure.in b/configure.in
index d36f312..4dd8e72 100644
--- a/configure.in
+++ b/configure.in
@@ -745,6 +745,15 @@
     AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
     AC_DEFINE(C_THREADS)
     LIBOBJS="$LIBOBJS thread.o"],[
+    AC_MSG_CHECKING(for --with-pth)
+    AC_ARG_WITH(pth,
+    [  --with-pth                      use GNU pth threading libraries], [
+    AC_MSG_RESULT($withval)
+    AC_DEFINE(WITH_THREAD)
+    AC_DEFINE(HAVE_PTH)
+    LIBS="-lpth $LIBS"
+    LIBOBJS="$LIBOBJS thread.o"],[
+    AC_MSG_RESULT(no)
     AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
     AC_DEFINE(_POSIX_THREADS)
     LIBS="-lpthread $LIBS"
@@ -767,10 +776,6 @@
     AC_DEFINE(_POSIX_THREADS)
     LIBS="$LIBS -lthread"
     LIBOBJS="$LIBOBJS thread.o"], [
-    AC_CHECK_LIB(pth, pth_init, [AC_DEFINE(WITH_THREAD)
-    AC_DEFINE(_GNU_PTH)
-    LIBS="-lpth $LIBS"
-    LIBOBJS="$LIBOBJS thread.o"],[
     AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
     AC_DEFINE(_POSIX_THREADS)
     LIBS="$LIBS -lcma"